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

Reference

Errors and retries

Every error is JSON with a stable error code you can switch on, a message written for a person, and, under /v1/sandboxes, whether it is worth trying again.

{
  "error": "exec_timeout",
  "message": "the command ran longer than its timeout_s of 5 s and was stopped",
  "failure_class": "timeout",
  "retryable": false,
  "limit_s": 5
}

Statuses#

StatusMeansRetry?
400The request is wrong: invalid_*, bad_json. The message names the field.No: fix it
401No key, or a revoked or expired one (unauthorized)No
402A plan is needed (plan_required), a plan limit is reached (plan_limit), the plan lacks the feature (plan_feature), or payment is due (payment_required)Not until someone acts
403The key lacks the scope, or a token is held to other sandboxesNo
404not_found: no such thing in your organizationNo
409The state is wrong for this (not_running, starting, name_taken)Sometimes: see the code
413too_largeNo
423org_frozen: an owner froze the organization (the kill switch)Not until it is unfrozen
429rate_limited (slow down) or a running-sandbox limit (quota_exceeded)Rate limits: yes, after Retry-After
501not_available: this host or region does not have the featureNo
502, 503kosa8's side: host_failed, no_capacity, database_busyYes, with backoff
504exec_timeout: your command outran its timeout_sNo: it is your command's time

failure_class and retryable#

Answers under /v1/sandboxes carry failure_class, whose fault it was, and retryable:

okIt worked (an exec that exited 0)
exit_nonzeroYour command ran and exited non-zero. Still a 200.
timeoutIt ran past its limit
oomThe kernel killed it for memory. Use a bigger size.
infraA host failed, was busy or went away. Retryable, except 501.
quotaA plan, payment, running or spending-cap limit
clientThe request was wrong

An RL trainer running thousands of rollouts can drop infra failures instead of scoring them as reward 0. Retryable answers often carry retry_after_s and a Retry-After header.

Plan and payment refusals#

A 402 carries upgrade_url, where a person can fix it, and agent_message, one sentence for an AI agent to pass on word for word. An agent should relay it and stop; it should never buy anything itself.

{
  "error": "plan_limit",
  "message": "…",
  "upgrade_url": "https://app.kosa8.com/#billing",
  "agent_message": "kosa8 Cloud refused this: … Ask the person to …"
}

Safe retries with Idempotency-Key#

Send Idempotency-Key: <any unique string> on a create or fork. If the connection drops and you send it again with the same key within 24 hours, you get the first answer back instead of a second sandbox. If the first request is still running, the retry gets 409 idempotency_in_progress: wait two seconds and ask again.

curl -s https://api.kosa8.com/v1/sandboxes \
  -H "Authorization: Bearer $KOSA8_API_KEY" -H 'Content-Type: application/json' \
  -H "Idempotency-Key: rollout-1842" -d '{"template":"python"}'

In the SDKs#

The Python and Go SDKs retry retryable failures for you, with backoff and the same Idempotency-Key (Python: three tries by default). Every SDK raises a typed error carrying the code, status, request_id and retryable otherwise: Python, JavaScript, Go, Ruby, Java.

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