Executes a shell command in the isolated sandbox environment associated with a room. Unlike the message endpoint, this executes commands directly without AI interpretation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jaypopat/cf_ai_duet/llms.txt
Use this file to discover all available pages before exploring further.
Endpoint
Path Parameters
Unique identifier for the room. Each room has its own isolated sandbox instance named
sandbox-{roomID}.Request Body
The shell command to execute. Must be at least 1 character long.
Response
The execution result containing stdout and stderr streams.
The name of the sandbox instance that executed the command (format:
sandbox-{roomID}).Example Request
Example Response
Error Responses
400 Bad Request
Returned when request validation fails:404 Not Found
Returned when the room ID is missing or the endpoint path is incorrect.405 Method Not Allowed
Returned when using a method other than POST.500 Internal Server Error
Returned when sandbox execution fails:Use Cases
- Direct command execution for scripting and automation
- Testing and debugging sandbox environments
- File system operations in the isolated environment
- Running build commands or test suites
Implementation Reference
The handler uses Cloudflare’s sandbox API:Sandbox Lifecycle
Each room has a persistent sandbox instance that:- Is created on first use
- Maintains file system state between commands
- Is isolated from other rooms’ sandboxes
- Can be destroyed using the DELETE /api/rooms/ endpoint
Related Endpoints
- POST /api/rooms//message - Send messages to AI (which may execute commands)
- DELETE /api/rooms/ - Destroy the sandbox and clean up room state