API Overview
About 174 wordsLess than 1 minute
2025-02-04
This document introduces the API interfaces of AgentFlow Sandbox.
Client API
Sandbox Class
Sandbox is the main entry class for user interaction.
from sandbox import Sandbox
sandbox = Sandbox(
server_url="http://127.0.0.1:18890",
worker_id="my_worker",
auto_start_server=True
)Main Methods:
| Method | Description |
|---|---|
start() | Start connection |
close() | Close connection |
warmup(resources) | Warmup backends |
create_session(resource, config) | Create Session |
destroy_session(resource) | Destroy Session |
execute(action, params) | Execute tool |
list_sessions() | List Sessions |
get_status() | Get status |
Server API
HTTP Endpoints
| Endpoint | Method | Description |
|---|---|---|
/execute | POST | Execute tool |
/execute/batch | POST | Batch execute |
/session/create | POST | Create Session |
/session/destroy | POST | Destroy Session |
/session/list | POST | List Sessions |
/tools | GET | List tools |
/health | GET | Health check |
/warmup | POST | Warmup backends |
/shutdown | POST | Shutdown server |
Response Format
Standard response format:
{
"code": 0,
"message": "success",
"data": {...},
"meta": {
"execution_time_ms": 150,
"tool": "screenshot",
"resource_type": "vm",
"session_id": "xxx"
}
}Error Codes
| Code | Description |
|---|---|
| 0 | Success |
| 1001 | Tool not found |
| 1002 | Parameter error |
| 1003 | Session error |
| 2001 | Backend error |
| 2002 | Timeout |
| 5000 | Internal error |