Skip to content

Agent API

Prefix: /api/agent

The main server's browser-facing proxy for the loopback Agent Server. It owns character/session synchronization and remote-deployment safety checks, then forwards runtime operations to TOOL_SERVER_PORT. Proxy failures normally return 502; mutation routes return 501 when the backend is deployed remotely because controlling the server machine would be unsafe.

State and commands

GET /api/agent/flags

Returns the Agent Server flag snapshot, including the master switch and supported sub-features: Computer Use, Browser Use, user plugins, OpenClaw, and OpenFang. A proxy failure returns 502 with success: false.

POST /api/agent/flags

Legacy partial flag update. The body is {"lanlan_name":"...","flags":{...}}. The route updates the character session and forwards recognized sub-flags. A missing character returns 404; forwarding failure resets the local flags to a safe disabled state and returns 502.

GET /api/agent/state

Returns the authoritative Agent Server state snapshot: revision, flags, capabilities, notification state, and task summary.

POST /api/agent/command

Preferred mutation entry point. The current commands are:

CommandAdditional fieldsPurpose
set_agent_enabledenabled, optional profileToggle the master runtime gate
set_flagkey, valueToggle one of computer_use_enabled, browser_use_enabled, user_plugin_enabled, openclaw_enabled, openfang_enabled
refresh_statenoneReturn and broadcast a fresh state snapshot

request_id and lanlan_name are optional. Unknown commands or flag keys are rejected by the Agent Server; upstream/proxy failure is reported as 502.

Health and capabilities

MethodPathResponse boundary
GET/api/agent/health{"status":"ok","tool":{...}}; Agent Server unavailable returns 502 and status: "down"
GET/api/agent/computer_use/availabilityReadiness and reasons from the Agent Server
GET/api/agent/browser_use/availabilityBrowser dependency/model readiness
GET/api/agent/user_plugin/availabilityPlugin service reachability; unavailable returns 502
GET/api/agent/openclaw/availabilityOpenClaw/QwenPaw readiness; unavailable returns 502
GET/api/agent/mcp/availabilityCompatibility response: always unavailable because MCP left the brain/ layer

Tasks and administration

MethodPathPurpose
GET/api/agent/tasksList Agent Server task snapshots
GET/api/agent/tasks/{task_id}Read one task
POST/api/agent/tasks/{task_id}/cancelCancel one task; preserves upstream 404, uses 504 when the request reached the server but its response timed out
POST/api/agent/admin/controlForward administrative control such as {"action":"end_all"}; local-only, destructive to active work

Internal and UI-helper routes

MethodPathBoundary
POST/api/agent/internal/analyze_requestInternal fallback bridge that publishes an analyze_request onto the main event bus
GET/api/agent/user_plugin/dashboardRedirect to the local plugin dashboard; accepts validated v and loopback yui_opener_origin query values
GET/api/agent/openclaw/guideRender the local OpenClaw guide page
GET/api/agent/openclaw/guide/contentReturn localized guide Markdown; optional lang query
GET/api/agent/openclaw/guide/assets/{asset_path:path}Serve a file below the fixed guide asset directory; traversal/missing files return 404

The analyze bridge is not a public submission API. Dashboard and guide routes are browser helpers, not Agent Server task APIs.