Base URL
All endpoints are relative to the ORS server base URL:Common Headers
X-Session-ID
Most endpoints require theX-Session-ID header to identify the episode:
/create, /delete, /delete_session, /ping, /{env_name}/call, /{env_name}/prompt, /{env_name}/task_tools
Not required for: /create_session, discovery endpoints, /health
Discovery Endpoints
These endpoints provide information about available environments, tools, and tasks. They generally do not require session IDs, with one exception: listing tools may require an active session when the environment defines task-specific tools (see below).GET /health
Health check endpoint. Request:GET /list_environments
List all available environments on this server. Request:/{env_name}/* endpoints.
Use case: Discover what environments are available before creating a session.
GET /{env_name}/tools
List all tools available in the specified environment. Request:tools: Array of ToolSpec objectsname: Tool identifier (string)description: Human-readable description (string)input_schema: JSON Schema defining tool parameters (object, optional)
- 404 Not Found: Environment name not recognized
Some environments define task-specific tools (using
@tool(shared=False)) that are only available within an active session. Use the GET /{env_name}/task_tools endpoint (which requires an active session) to get the combined set of shared and task-specific tools. This sessionless /{env_name}/tools endpoint returns only shared tools.GET /{env_name}/splits
List all task splits available in the environment. Request:- Array of Split objects
name: Split identifier (string)type: Split category - “train”, “validation”, or “test” (string)
- 404 Not Found: Environment name not recognized
POST /{env_name}/tasks
List tasks for a specific split. Request:split: Split name to query (string, required)
tasks: Array of task objects (structure is environment-specific)env_name: Environment name (string)
- 400 Bad Request: Invalid split name
- 404 Not Found: Environment name not recognized
POST /{env_name}/num_tasks
Get the number of tasks for a specific split. Request:split: Split name to query (string, required)
- 400 Bad Request: Invalid split name
- 404 Not Found: Environment name not recognized
/{env_name}/task_range.
POST /{env_name}/task
Get a single task by split and index. Request:split: Split name (string, required)index: Zero-based task index (integer, required)
- 400 Bad Request: Invalid split name or invalid index (out of range)
- 404 Not Found: Environment name not recognized
POST /{env_name}/task_range
Get tasks for a range of indices. Request:split: Split name (string, required)start: Start index, inclusive (integer, optional, default: 0). Supports negative indices.stop: Stop index, exclusive (integer, optional, default: num_tasks). Supports negative indices.
- 400 Bad Request: Invalid split name or invalid index range
- 404 Not Found: Environment name not recognized
range()/slice conventions: start is inclusive, stop is exclusive. Negative indices are resolved relative to the total number of tasks.
Session Management
These endpoints manage episode lifecycle.POST /create_session
Generate a new session ID. Request:sid: Session identifier (string, UUID format)
/create.
POST /create
Create an episode instance for a specific task. Request:X-Session-ID: Session identifier from/create_session(required)
env_name: Environment to instantiate (string, optional). Defaults to the first registered environment if omitted. If the server hosts a single environment, requests to unrecognized paths are redirected to it automatically.task_spec: Task-specific data passed to the environment constructor (object). Provide eithertask_specor bothsplitandindex, not both.split: Split name to resolve the task from (string). Must be provided together withindex.index: Task index within the split (integer). Must be provided together withsplit.secrets: Secrets to pass to environment (object, optional, default: )
You must provide exactly one of:
task_spec (pass the full task object directly) or split + index (let the server resolve the task via its get_task() method). Providing both or neither will return a 400 error.- 400 Bad Request: Session already exists, or missing X-Session-ID header
- 404 Not Found: Environment name not recognized
setup() method.
Important: The environment initialization happens asynchronously. Subsequent requests wait for setup to complete.
POST /ping
Keep the session alive to prevent timeout. Request:X-Session-ID: Session identifier (required)
- 400 Bad Request: Missing X-Session-ID header
- 404 Not Found: Session not found
/ping periodically to keep the session alive. The reference SDK pings every 10 seconds; at minimum, ping well before the 15-minute timeout.
POST /delete
Delete an episode and clean up resources. Request:X-Session-ID: Session identifier (required)
- 400 Bad Request: Missing X-Session-ID header
- 404 Not Found: Session not found
teardown() method.
Important: Always call /delete when done with an episode to free server resources.
POST /delete_session
Optional cleanup endpoint for session ID. Request:X-Session-ID: Session identifier (required)
/delete. In practice, /delete is sufficient.
Episode Interaction
These endpoints interact with an active episode.GET /{env_name}/task_tools
List all tools (shared + task-specific) available in the current session. Request:X-Session-ID: Session identifier (required)
tools: Array of ToolSpec objects (shared tools + task-specific tools combined)
- 400 Bad Request: Missing X-Session-ID header
- 404 Not Found: Session not found
- 410 Gone: Session was deleted
/{env_name}/tools endpoint. Tools marked with @tool(shared=False) or returned by list_task_tools() only appear here.
GET /{env_name}/prompt
Get the initial prompt for the current task. Request:X-Session-ID: Session identifier (required)
- Array of Block objects
- TextBlock:
{"text": "...", "detail": null, "type": "text"} - ImageBlock:
{"data": "base64...", "mimeType": "image/png", "detail": null, "type": "image"}
- TextBlock:
- 400 Bad Request: Missing X-Session-ID header
- 404 Not Found: Session not found (no active environment for this session ID)
- 410 Gone: Session was deleted
/create and before calling tools.
Note: Prompts can be multi-modal (text + images). The environment is resolved by the session, not by the {env_name} path segment. The path parameter is not validated against the session’s actual environment.
POST /{env_name}/call
Call a tool in the environment. Request:X-Session-ID: Session identifier (required)Accept: Should betext/event-stream(recommended). The server returns SSE regardless, but setting this header is good practice for client clarity.
name: Tool name to call (string, required)input: Tool-specific parameters (object, required)task_id: Identifier for reconnection and tracing (string, optional). If provided on a reconnect, the server returns the result of the original task instead of starting a new one. Completed results linger for 60 seconds, enabling recovery from dropped connections.
| Event | Data | Description |
|---|---|---|
task_id | Task identifier string | Always sent first. Use this ID to reconnect if the connection drops. |
chunk | Partial JSON string | Intermediate chunk for responses exceeding 4 KB. Concatenate all chunk data with the final end data to reconstruct the full JSON. |
end | JSON string (or final chunk) | Final event. Contains the complete response JSON, or the last chunk if the response was split. |
error | Error message string | Sent if the task_id is unknown (on reconnect) or the task raised an exception. No end event follows. |
- 400 Bad Request: Missing X-Session-ID, invalid tool name, or invalid input
- 404 Not Found: Session not found, environment mismatch, or tool not found
- 410 Gone: Session was deleted
- Responses are delivered via Server-Sent Events (see Tool Execution with SSE section above)
- The
finishedfield indicates if the episode is complete - The
rewardfield provides RL feedback signal
Complete Episode Flow
Here’s a complete example showing all endpoints in sequence:Error Handling
Standard HTTP Status Codes
- 200 OK: Request succeeded
- 400 Bad Request: Invalid input (missing header, invalid JSON, etc.)
- 404 Not Found: Resource not found (environment, session, tool)
- 410 Gone: Session was deleted
- 500 Internal Server Error: Server error during processing
Error Response Format
For HTTP errors (non-SSE):Rate Limiting and Timeouts
Session Timeout
Sessions automatically expire after 15 minutes of inactivity:- “Activity” means any request with that session’s X-Session-ID
- Use
/pingto keep sessions alive - Timeout is reset after each request
Request Timeout
Individual requests may have server-specific timeouts. All tool calls use SSE, which keeps connections alive with periodic pings during long-running execution.Next Steps
Data Types
Detailed schemas for all request/response objects
Implementing a Client
Build an ORS client using these endpoints
Implementing a Server
Build an ORS server that implements these endpoints
Reference Implementation: The ORS Python SDK implements this complete API.

