agentuse serve. Integrate with external services, CI/CD pipelines, or any system that can make HTTP requests.
Quick Start
- Start the server:
- Trigger an agent via HTTP:
API Reference
POST /run
Execute an agent and receive the result. Request:| Field | Type | Required | Description |
|---|---|---|---|
agent | string | Yes | Path to agent file (relative to project root) |
prompt | string | No | Additional prompt appended to agent instructions |
model | string | No | Override model in agent file |
timeout | number | No | Max execution time in seconds (default: 300) |
maxSteps | number | No | Max tool call steps |
| Error Code | HTTP Status | Description |
|---|---|---|
AGENT_NOT_FOUND | 404 | Agent file doesn’t exist |
INVALID_PATH | 400 | Path outside project root |
INVALID_REQUEST | 400 | Invalid JSON body |
MISSING_FIELD | 400 | Required field missing |
TIMEOUT | 504 | Execution timed out |
EXECUTION_ERROR | 500 | Runtime error |
Streaming Response
For real-time output, request NDJSON streaming:Authentication
When exposing the server externally, authentication is required:Exposing Your Local Server
- Tailscale (Private)
- Cloudflare Tunnel (Public)
Access from your devices or team only:Connect via
http://<machine-name>:12233 from any device on your tailnet.Integration Examples
GitHub Webhook
Create an agent to handle GitHub events:Slack Integration
Slack slash commands require a response within 3 seconds and signature verification. Use a workflow tool as middleware: With n8n or Make:- Add Slack trigger node (receives slash commands)
- Add HTTP Request node → POST to
http://server:12233/run - Return agent response to Slack
- Trigger: Slack → New Slash Command
- Action: Webhooks → POST to AgentUse
/run - Action: Slack → Send Channel Message with result
Direct Slack integration requires handling the 3-second timeout, form-urlencoded parsing, and request signature verification. Workflow tools handle this automatically.
n8n / Make / Zapier
Use HTTP request nodes to trigger agents:- Set URL to
http://your-server:12233/run - Method: POST
- Headers:
Content-Type: application/json - Body:
Cron Job (External)
Trigger from system cron instead of built-in scheduler:Server Configuration
See CLI Commands - agentuse serve for all server options including port, host, debug mode, and authentication configuration.Production Deployment
For deployingagentuse serve in production with reverse proxies (nginx), process management (PM2), and Docker, see Self-Hosting.
