How It Works
A client subscribes to the event stream, and the server pushes agent updates live as work progresses.Features
- REST API - HTTP endpoints for agent operations
- SSE Streaming - Real-time event streaming to clients
- CORS Support - Configurable cross-origin settings
- Multi-client - Handle multiple concurrent connections
Quick Start
API Reference
ServerConfig
AgentServer
HTTP Endpoints
| Endpoint | Method | Description |
|---|---|---|
/health | GET | Health check |
/info | GET | Server information |
/events | GET | SSE event stream |
/publish | POST | Publish event to clients |
Examples
Context Manager
Event Handler
Client Connection (JavaScript)
Publishing Events
Best Practices
Restrict CORS in production
Restrict CORS in production
Replace
cors_origins=["*"] with explicit front-end origins before exposing the server publicly.Set auth_token for remote clients
Set auth_token for remote clients
Use
ServerConfig(auth_token=...) when the server binds outside loopback so /publish cannot be abused.Prefer SSE for progress, REST for commands
Prefer SSE for progress, REST for commands
Stream long agent runs on
/events; submit work via REST and broadcast milestones to connected clients.Monitor client_count during load tests
Monitor client_count during load tests
Watch
server.client_count and tune max_connections before production traffic spikes.Related
Async Jobs
Submit long-running work and poll or stream results via the jobs API.
Agent API Launch
Launch agents as HTTP services with minimal setup.

