Agent Calls the Sandbox
Suppose an agent gets a small task: write data into the sandbox, process it with a command and Python, then read the result back. The whole flow takes four calls on one filesystem.
Requirements
The capabilities object from GET /v2/sandbox should include files, exec, and code_interpreter.
GET /v1/capabilities should report files, exec, and code_interpreter.
With AIO_API_KEY set, send the key as a bearer token.
The loop
Each step is one call. The command and the code read the file written in step 1, because every plane shares the same filesystem:
Every call goes through the shared Aio helper (Conventions), which unwraps the envelope to data.
The 1.x SDK covers all four calls; the result sits under data, and under body.data in TypeScript.
Both forms print the same three lines and leave the same two files behind. wc -l pads its count, so strip() is what turns 4 /tmp/agent-data.txt into the line above.
Related
- MCP — the same four steps over one JSON-RPC endpoint
- Code Execution — sessions and kernels
- File Operations — the file API and error handling
- Interactive Terminal — a live shell instead of one-shot commands