Workspace files
When an agent has a bash sandbox, the text files it writes under /home/user are kept per conversation. Files meant for the user are written under /home/user/out/; the rest is the agent's working area. Files whose name starts with a dot are not listed. The content is always UTF-8 text. All routes require the conversation owner's credentials (x-api-key).
GET /conversations/:conversationId/workspace/files​
Lists the files (never their content), sorted by path: [{ path, size, mimeType, version, updatedAt }]. Headers X-Workspace-File-Count and X-Workspace-Total-Bytes give the current usage.
GET /conversations/:conversationId/workspace/files/content?path=/home/user/out/report.md​
Returns { path, content, mimeType, size, version, updatedAt } — the current state; there is no history.
PUT /conversations/:conversationId/workspace/files/content​
Body { "path": "/home/user/out/report.md", "content": "…", "expectedVersion": 3 }. Updates an existing file only if it is still at expectedVersion. Returns the file at its new version.
DELETE /conversations/:conversationId/workspace/files?path=…​
Deletes the path and everything below it. → 204.
| Status | Meaning |
|---|---|
| 400 | Missing or invalid path, content not UTF-8 text, invalid expectedVersion |
| 403 | You are not the owner of this conversation |
| 404 | Conversation or file not found (PUT never creates a file) |
| 409 | PUT: the file changed since you read it; the body carries currentVersion |
| 413 | PUT: content over the per-file limit, or workspace quota reached |
Answering a sandbox approval request​
When the sandbox needs permission, the reply stops and GET /conversations/:conversationId/messages/:messageId/status reports waiting_client. GET …/messages/:messageId/tool-calls?pending=true returns the pending call: bash_network_approval (arguments url, urlPrefix, origin, host, method) or bash_command_approval (argument command). Answer with POST …/messages/:messageId/tool-calls/:callId and body { "status": "completed" | "refused", "approvalScope": "once" | "agentUser", "approvalWidth": "prefix" | "origin" }:
approvalScope:once(default) = this reply only;agentUser= this agent, for this user, until revoked.approvalWidth: addresses only.
Only the user who was asked can answer (403 otherwise). The reply resumes once no call is pending on the message. Standing approvals are managed with /organizations/:organizationId/tool-approvals (GET, POST, PATCH /:approvalId, DELETE /:approvalId).