kosa8 docs Dashboard
esc
↑ ↓ move↵ openRuns in your browser; nothing you type is sent anywhere.

Get started

Quickstart

Three steps, about a minute. Choose a language once: every tabbed example in these docs switches with it, and remembers.

1. Get an API key#

Sign in at app.kosa8.com, pick a plan on Billing (see pricing), then make a key under API keys. It is shown once and starts with k8c_live_. Every SDK and the CLI read it from KOSA8_API_KEY.

Optional. Fills k8c_live_… into the snippets on this page so you can paste them as they are. Kept in this browser tab only, never sent anywhere.
export KOSA8_API_KEY=k8c_live_…

Prefer not to handle keys? kosa8 login signs the CLI in through your browser instead.

2. Install#

curl -fsSL https://kosa8.com/install.sh | sh     # macOS and Linux
brew install kosa8                               # or with Homebrew
irm https://kosa8.com/install.ps1 | iex          # Windows PowerShell
# Nothing to install: curl and jq are all you need.
curl --version | head -1 && jq --version
pip install kosa8        # Python 3.9+, or: uv add kosa8
npm install @kosa8/sdk   # Node.js 18 or later
go get github.com/kosa8ai/kosa8-go@latest
gem install kosa8        # or in a Gemfile: gem "kosa8"
<!-- Maven (Java 17+); Gradle: implementation("com.kosa8:kosa8:0.5.3") -->
<dependency>
  <groupId>com.kosa8</groupId>
  <artifactId>kosa8</artifactId>
  <version>0.5.3</version>
</dependency>

3. Run code in a sandbox#

Create a sandbox from the python template, run a command, read its output, delete it:

kosa8 run --cloud python:3.12-slim python3 -c 'print(6 * 7)'
# Create a sandbox from the python template
SBX=$(curl -s https://api.kosa8.com/v1/sandboxes \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"template":"python","ttl_s":600}' | jq -r .sandbox.id)

# Run a command in it
curl -s https://api.kosa8.com/v1/sandboxes/$SBX/exec \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"cmd":["python3","-c","print(6 * 7)"]}'

# Delete it
curl -s -X DELETE https://api.kosa8.com/v1/sandboxes/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
from kosa8 import Kosa8Cloud

cloud = Kosa8Cloud()  # reads KOSA8_API_KEY

with cloud.sandboxes.create(template="python", ttl_s=600) as box:
    r = box.exec(["python3", "-c", "print(6 * 7)"])
    print(r.exit_code, r.stdout)  # 0 42
# the sandbox is deleted when the block ends
import { Kosa8Cloud } from '@kosa8/sdk';

const cloud = new Kosa8Cloud(); // reads KOSA8_API_KEY

const box = await cloud.sandboxes.create({ template: 'python', ttlS: 600 });
try {
  const r = await box.exec(['python3', '-c', 'print(6 * 7)']);
  console.log(r.exitCode, r.stdout); // 0 42
} finally {
  await box.delete();
}
package main

import (
	"context"
	"fmt"
	"log"

	kosa8 "github.com/kosa8ai/kosa8-go"
)

func main() {
	ctx := context.Background()
	cloud, err := kosa8.NewCloud(kosa8.CloudOptions{}) // reads KOSA8_API_KEY
	if err != nil {
		log.Fatal(err)
	}

	box, err := cloud.Sandboxes.Create(ctx, kosa8.CloudCreateOptions{Template: "python", TTLSeconds: 600})
	if err != nil {
		log.Fatal(err)
	}
	defer box.Delete(ctx)

	r, err := box.Exec(ctx, []string{"python3", "-c", "print(6 * 7)"}, nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Print(r.Stdout) // 42
}
require "kosa8"

cloud = Kosa8::Cloud.new # reads KOSA8_API_KEY

box = cloud.sandboxes.create(template: "python", ttl_s: 600)
begin
  r = box.exec(["python3", "-c", "print(6 * 7)"])
  puts r.exit_code, r.stdout # 0, 42
ensure
  box.delete
end
import com.kosa8.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Kosa8Cloud cloud = Kosa8Cloud.builder().build(); // reads KOSA8_API_KEY

        CloudSandbox box = cloud.sandboxes().create(
            new CloudOptions.Create().template("python").ttlSeconds(600));
        try {
            CloudExecResult r = box.exec("python3 -c 'print(6 * 7)'");
            System.out.println(r.exitCode() + " " + r.stdout()); // 0 42
        } finally {
            box.delete();
        }
    }
}

You should see 42. The sandbox was a microVM in us-ash1 (Ashburn, Virginia), and it is gone. The ttl_s of 600 is a safety net: even if your program crashed before the delete, kosa8 would delete the sandbox ten minutes later.

Even shorter: one call, no sandbox to manage#

POST /v1/run takes a warm sandbox, runs your code, returns the output and deletes the sandbox, all in one request:

kosa8 run -q "python3 -c 'print(6 * 7)'"
curl -s https://api.kosa8.com/v1/run \
  -H "Authorization: Bearer $KOSA8_API_KEY" -H 'Content-Type: application/json' \
  -d '{"code": "print(6 * 7)", "language": "python"}' | jq -r '.run.stdout'

It takes files, returns files and streams. See One-call run.

Where next#

Something wrong or missing? Edit this page, or write to contact@kosa8.com.

The kosa8 weekly

Agent security news, one industry deep-dive and a hands-on challenge, every Monday. Unsubscribe in one click.

© 2026 kosa8 · kosa8.com · AI Agent Sandbox: Secure and Sovereign for Enterprise · Local models served by llamay · Agent gateway: MAQPNA