Destroys the sandbox environment and resets conversation state for a specific room. Use this endpoint when a conversation session ends or to free up resources.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 to clean up.
Response
Success (200 OK)
Always
true when cleanup completes.The room ID that was cleaned up.
Partial Success (207 Multi-Status)
Returned when cleanup completes but some operations failed:Always
true even when errors occur.Array of error messages from failed cleanup operations (e.g., sandbox destruction failures).
Example Request
Example Response (Success)
Example Response (Partial Success)
Cleanup Operations
The endpoint performs the following cleanup tasks:- Reset Agent State - Clears the conversation history (sets
messagesarray to empty) - Destroy Sandbox - Terminates the
sandbox-{roomID}instance and removes its resources
Error Handling
The cleanup endpoint is designed to be resilient:- Best-effort cleanup: Even if sandbox destruction fails, the agent state is still reset
- Partial success reporting: Returns 207 status with error details rather than failing completely
- No rollback: Successful cleanup operations are not reversed if later operations fail
Error Responses
404 Not Found
Returned when the room ID is missing from the URL path.405 Method Not Allowed
Returned when using a method other than DELETE.Use Cases
- End of conversation session cleanup
- Resource management and memory optimization
- Resetting a room to initial state
- Automated cleanup in test environments
Client Implementation Example
From internal/ai/client.go:106-125:Related Endpoints
- POST /api/rooms//message - Send messages to the AI assistant
- POST /api/rooms//sandbox/exec - Execute sandbox commands