Environments
Built. An environment is the template for a session's sandbox. Each session gets its own sandbox from it; sandboxes are not shared between sessions.
Create
const environment = await client.beta.environments.create({
name: "research",
config: {
type: "cloud",
networking: { type: "limited", allowed_hosts: ["example.com", "api.example.com"] },
},
});
Networking
networking.type |
What the sandbox can reach |
|---|---|
limited |
Only the hosts in allowed_hosts. An empty list means no outbound access. |
unrestricted |
The internet. |
Use limited unless the task needs open access.
Where the sandbox runs
| Setting | Sandbox |
|---|---|
Local development (SANDBOX_PROVIDER=local) |
A local process, for testing only |
AWS (SANDBOX_PROVIDER=fargate) |
One Fargate task per session, in the deployment's region. Not deployed yet. |
With several agents in one session (a coordinator and its threads), they share that session's sandbox and files.
The egress proxy
MAA addition. Sandbox traffic goes through a proxy that enforces the host rules and swaps vault secrets in at the edge.
- The sandbox gets
HTTP_PROXY,HTTPS_PROXYandMAA_EGRESS_URL. - Plain HTTP requests are rewritten in flight.
- Inside an HTTPS tunnel nothing can be rewritten. For an HTTPS call that needs a secret, send it through the proxy's fetch endpoint:
curl -s "$MAA_EGRESS_URL/fetch" -d '{"url":"https://api.example.com/x","headers":{"Authorization":"Bearer '"$API_TOKEN"'"}}'
The proxy substitutes the secret only for that credential's allowed_hosts and masks it in the response. See Vaults.
Not in v1
- Self-hosted environments (
config.type: "self_hosted", where tools run on your own machines). Planned.
Endpoints
POST /v1/environments · GET /v1/environments · GET /v1/environments/{id} · POST /v1/environments/{id} · DELETE /v1/environments/{id} · POST /v1/environments/{id}/archive