kosa8 / Use cases

Use case · Secrets broker · Updated 2026-11-24

Give an agent API keys it can use but never read.

With kosa8, the sandbox an agent runs in holds only a placeholder for each API key; a broker on the host, outside the agent's microVM, swaps in the real key only on requests to that key's own upstream host, so the agent can use the key but cannot read it or send it anywhere else.

Try now Install

01Who it is for

  • Teams whose agents call paid or privileged APIs (OpenAI, Anthropic, GitHub, a package registry) and run code they did not write.
  • Anyone who has asked "what happens to our key if the agent is prompt-injected or a dependency is malicious?"

02How to do it

  1. Store the key once for your organization. The value is read from your shell, never typed on the command line, and never shown again.

    terminal
    kosa8 cloud secrets set openai --upstream https://api.openai.com --from-env OPENAI_API_KEY
  2. Create a sandbox with it. A secret needs a sized sandbox; add only the other hosts the job needs.

    terminal
    kosa8 cloud sandbox create --size 2x4 --secret openai --allow pypi.org --allow files.pythonhosted.org
  3. Code inside runs unchanged: it sees OPENAI_API_KEY (a placeholder) and OPENAI_BASE_URL (the broker).

    terminal
    kosa8 cloud sandbox exec sbx_abc -- python3 -c 'import os; print(os.environ["OPENAI_API_KEY"])'
  4. On your own Mac or Linux machine, the built-in agent kits do the same for the agent's own key.

    terminal
    kosa8 agent run codex

The same through the API:

terminal
curl -s -X PUT https://api.kosa8.com/v1/secrets/openai \
  -H "Authorization: Bearer $KOSA8_ADMIN_KEY" -H 'Content-Type: application/json' \
  -d '{"value":"'"$OPENAI_API_KEY"'","upstream":"https://api.openai.com"}'

03What this does not do

  • The placeholder is a capability: anything in the sandbox can spend the key on requests the secret allows. Scope the key at its provider, and narrow it with --method and --path.
  • Response bodies are not filtered. An upstream that echoes the key in a body leaks it.
  • A sandbox holding a secret cannot sleep, be checkpointed, rewound or forked, because the value lives only in the host's memory. It boots cold and needs a size.
  • No open internet beside the broker: --internet is refused for a sandbox with secrets.
  • Replacing a secret does not touch running sandboxes; they keep the value they started with until you delete them.

04What it costs

Secrets are on every plan and on the free Starter tier (no card). Sandbox time is the plan's included hours, then per second. Every plan, limit and rate: pricing.md (for agents) or the pricing page.

05Read more

06Try it now

Run code in a kosa8 sandbox in your browser, no account, or install kosa8 and start free with no card.

Try now Download kosa8

Updated 2026-11-24