The Orchestrator Agent Brain API provides RESTful endpoints and Server-Sent Events for real-time AI agent orchestration with sandboxed tool execution.
http://localhost:3001/v1Replace with your production URL in live environments
RESTful API with Server-Sent Events for real-time streaming
Support for GPT-4, Claude, and custom models via profiles
Isolated Docker execution with configurable profiles
The Orchestrator system consists of multiple microservices. Here are the connection details for each service in different environments.
Core Agent Brain REST API + SSE streams
http://localhost:3001https://api.orchestrator.ai/v1 prefixWeb UI for managing agents, sessions, and configurations
http://localhost:3002https://admin.orchestrator.aiPublic-facing website and documentation (you are here)
http://localhost:3000https://orchestrator.aihttp://localhost:3002 → Playground → Configure & test your agenthttp://localhost:3001/v1 endpoints from your applicationFor local development, ensure your application can reach the Backend API:
http://localhost:3001localhost:3000 and localhost:3002Orchestrator uses tenant-based authentication. Include your tenant ID in the X-NS-Tenant header (or tenant query parameter) with every request.
curl http://localhost:3001/v1/sessions \
-H "X-NS-Tenant: your-tenant-id" \
-H "Content-Type: application/json"All requests must include a valid tenant ID. Contact your administrator to get your tenant ID.
Create a new agent session. Sessions can be task-based (using a pre-defined task) or direct (with custom configuration).
X-NS-Tenant - Your tenant ID (required)Idempotency-Key - Unique key for idempotent creation (required)Content-Type - application/json# Task-based session
curl -X POST http://localhost:3001/v1/sessions \
-H "X-NS-Tenant: tenant_123" \
-H "Idempotency-Key: ${uuidv4()}" \
-H "Content-Type: application/json" \
-d '{
"taskId": "task_code_review",
"taskArgs": {
"repository": "myorg/myrepo",
"branch": "main"
}
}'
# Direct session with custom prompt
curl -X POST http://localhost:3001/v1/sessions \
-H "X-NS-Tenant: tenant_123" \
-H "Idempotency-Key: ${uuidv4()}" \
-H "Content-Type: application/json" \
-d '{
"systemPrompt": "You are an expert code reviewer...",
"promptId": "prompt_default",
"profileId": "profile_gpt4",
"allowedTools": ["code_executor", "file_system"]
}'taskId (string, optional)ID of pre-configured task to use
taskBlueprint (object, optional)Inline task blueprint: { id, args, version }
systemPrompt (string, optional)Custom system prompt (max 4096 chars)
promptId (string, optional)Pre-configured prompt ID
profileId (string, optional)Sandbox profile ID (model, resources, etc.)
allowedTools (string[], optional)List of tool IDs available to agent
initialMessages (array, optional)Pre-populate conversation history
policyOverrides (object, optional)Override default policies
{
"sessionId": "sess_01JCXYZ...",
"status": "active",
"plan": [
{
"id": "step_1",
"title": "Initialize repository scan",
"status": "pending",
"dependencies": []
}
]
}curl http://localhost:3001/v1/sessions/sess_01JCXYZ \
-H "X-NS-Tenant: tenant_123"curl http://localhost:3001/v1/sessions \
-H "X-NS-Tenant: tenant_123"
# Response:
# {
# "items": [
# { "id": "sess_...", "status": "active", ... },
# { "id": "sess_...", "status": "completed", ... }
# ]
# }Send a user message to the agent and trigger a turn execution. The agent will process the message using LLM and execute any needed tools.
curl -X POST http://localhost:3001/v1/sessions/sess_01JCXYZ/messages \
-H "X-NS-Tenant: tenant_123" \
-H "Idempotency-Key: ${uuidv4()}" \
-H "Content-Type: application/json" \
-d '{
"content": "Review the authentication middleware in src/auth.ts"
}'Use the Idempotency-Key header to safely retry message sends. Same key returns cached response.
Stream real-time session events using Server-Sent Events (SSE). Get LLM tokens, tool execution updates, and approval requests as they happen.
# Stream from beginning
curl -N http://localhost:3001/v1/sessions/sess_01JCXYZ/stream \
-H "X-NS-Tenant: tenant_123"
# Resume from event cursor
curl -N "http://localhost:3001/v1/sessions/sess_01JCXYZ/stream?cursor=42" \
-H "X-NS-Tenant: tenant_123"
# Or use Last-Event-ID header
curl -N http://localhost:3001/v1/sessions/sess_01JCXYZ/stream \
-H "X-NS-Tenant: tenant_123" \
-H "Last-Event-ID: 42"When a tool requires approval, the session pauses and emits an approval.required event. You must approve or deny before the agent continues.
# Approve
curl -X POST http://localhost:3001/v1/sessions/sess_01JCXYZ/approvals/appr_123/decision \
-H "X-NS-Tenant: tenant_123" \
-H "Content-Type: application/json" \
-d '{
"decision": "approved",
"reason": "Verified args are safe"
}'
# Deny
curl -X POST http://localhost:3001/v1/sessions/sess_01JCXYZ/approvals/appr_123/decision \
-H "X-NS-Tenant: tenant_123" \
-H "Content-Type: application/json" \
-d '{
"decision": "denied",
"reason": "Unsafe operation"
}'decision (string, required)Either "approved" or "denied"
reason (string, optional, max 1024 chars)Explanation for the decision
curl http://localhost:3001/v1/sessions/sess_01JCXYZ/approvals \
-H "X-NS-Tenant: tenant_123"
# Response:
# {
# "items": [
# {
# "id": "appr_123",
# "prompt": "Execute shell command: npm install",
# "status": "pending",
# "createdAt": "2024-01-15T10:30:00Z"
# }
# ]
# }# List all tools
curl http://localhost:3001/v1/tools \
-H "X-NS-Tenant: tenant_123"
# List tools allowed for a specific session
curl "http://localhost:3001/v1/tools?allowedForSession=sess_01JCXYZ" \
-H "X-NS-Tenant: tenant_123"Tasks are pre-configured agent blueprints with prompts, tools, and execution plans.
curl http://localhost:3001/v1/tasks/task_code_review \
-H "X-NS-Tenant: tenant_123"The API returns standard HTTP status codes and error responses in JSON format.
{
"error": {
"code": "validation_error",
"message": "Invalid request body",
"details": [
{
"field": "taskId",
"issue": "Required field missing"
}
]
}
}auth.missing_tenantMissing X-NS-Tenant header
not_found.sessionSession ID not found for tenant
not_found.approvalApproval ID not found
validation_errorRequest validation failed
Get your tenant ID and start building with Orchestrator today.