Documentation Index
Fetch the complete documentation index at: https://docs-omnicoreagent.omnirexfloralabs.com/llms.txt
Use this file to discover all available pages before exploring further.
OmniServe — Production API Server
Turn any agent into a production-ready REST/SSE API with a single command. OmniServe is an optional production extra:Agent File Requirements
Your Python file must define one of the following:OmniServe looks for
agent variable first, then create_agent() function. Your file must export one of these.Quick Start
Step 1: Create your agent file (my_agent.py)
Step 2: Set environment variables
Step 3: Run the server
Step 4: Test the API
CLI Commands
| Command | Description |
|---|---|
omniserve run | Run your agent file as API server |
omniserve quickstart | Zero-code server with defaults |
omniserve config | View or generate configuration |
omniserve generate-dockerfile | Generate production Dockerfile |
CLI Options: omniserve run
CLI Options: omniserve quickstart
Start a server instantly without writing any code:
LLM_API_KEY. For an OpenAI key, run
omniserve quickstart --provider openai --model gpt-4o-mini.
Examples:
API Endpoints
Core Endpoints
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST | /run | Yes* | SSE streaming response |
POST | /run/sync | Yes* | JSON response (blocking) |
GET | /health | No | Health check |
GET | /ready | No | Readiness check |
GET | /prometheus | No | Prometheus metrics |
GET | /tools | Yes* | List available tools |
GET | /metrics | Yes* | Agent usage metrics |
GET | /events/{session_id} | Yes* | Replay stored telemetry events, then follow live telemetry events over SSE; add ?run_id=... to isolate one run |
GET | /events/{session_id}/list | Yes* | Return stored telemetry events as JSON; add ?run_id=... to isolate one run |
GET | /events/{session_id}/trace | Yes* | Compact telemetry trace summary for the latest session trace, or ?run_id=... for one run |
GET | /telemetry/events | Yes* | Return stored telemetry events filtered by trace_id, run_id, session_id, task_id, or event_type |
GET | /telemetry/events/stream | Yes* | Replay and follow telemetry events over SSE for session_id; add run_id to isolate one run |
GET | /telemetry/traces | Yes* | List traces filtered by trace, run, session, task, agent, workflow, model, or status |
GET | /telemetry/traces/{trace_id} | Yes* | Return one exact trace |
GET | /telemetry/runs/{run_id}/trace | Yes* | Return the latest trace correlated to one run |
GET | /telemetry/sessions/{session_id}/trace | Yes* | Return the latest trace for one session |
GET | /docs | No | Swagger UI |
GET | /redoc | No | ReDoc UI |
/ready returns ready: true only after the FastAPI lifespan has completed
startup, the served agent is initialized, and any configured MCP servers are
connected. Agents without MCP servers do not need an MCP client to pass
readiness.
Background Task Endpoints
These routes are mounted when background execution is enabled. It is enabled by default and can be turned off withOMNICOREAGENT_BACKGROUND_ENABLED=false or
OmniServeConfig(background_enabled=False).
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /background/status | Yes* | Inspect background manager counts and run status totals |
POST | /background/agents | Yes* | Register the served agent or an agent spec for background execution |
GET | /background/agents | Yes* | List registered background agents |
GET | /background/agents/{agent_id} | Yes* | Inspect a background agent spec |
DELETE | /background/agents/{agent_id} | Yes* | Delete a background agent spec |
POST | /background/tasks | Yes* | Create a background task |
GET | /background/tasks | Yes* | List background tasks |
GET | /background/tasks/{task_id} | Yes* | Inspect a background task |
GET | /background/tasks/{task_id}/status | Yes* | Inspect schedule state, run counts, and latest run |
PATCH | /background/tasks/{task_id} | Yes* | Patch a background task |
POST | /background/tasks/{task_id}/run | Yes* | Queue a manual background run, optionally waiting for terminal state |
POST | /background/tasks/{task_id}/pause | Yes* | Pause scheduled dispatch |
POST | /background/tasks/{task_id}/resume | Yes* | Resume scheduled dispatch |
DELETE | /background/tasks/{task_id} | Yes* | Delete a background task |
POST | /background/runs/{run_id}/cancel | Yes* | Cancel a queued or running run |
GET | /background/runs | Yes* | List background runs |
GET | /background/runs/{run_id} | Yes* | Inspect run status |
GET | /background/runs/{run_id}/attempts | Yes* | List run attempts |
GET | /background/runs/{run_id}/events | Yes* | Replay lifecycle events |
GET | /background/runs/{run_id}/workspace | Yes* | Inspect run workspace files |
--auth-token is set or OMNICOREAGENT_SERVE_AUTH_ENABLED=true
with OMNICOREAGENT_SERVE_AUTH_TOKEN.
Request/Response Examples
trace_id is the exact lookup handle returned by the
agent runtime. run_id is the serving/runtime correlation handle returned from
/run/sync and SSE completion payloads. Use trace_id when you need one exact
trace. Use run_id when your UI or application needs all telemetry for one
execution inside a shared session.
/telemetry/events defaults to limit=200; /telemetry/traces defaults to
limit=100. Both accept lower limits per request. Exact trace, run trace, and
session trace detail endpoints return 404 when no matching trace exists or an
accessor returns a trace that does not match the requested selector.
Background Task Example
OmniServe registers the served agent as a background-capable agent during server startup. The default background agent id isdefault; override it with
OMNICOREAGENT_BACKGROUND_AGENT_ID or OmniServeConfig(background_agent_id="...").
{"wait": true} when the response should wait for terminal run state. If
the run does not finish before the background wait budget, OmniServe returns
504 with the run_id, latest status, wait_timeout_seconds, and
request_timeout_seconds in detail; use the run_id with
/background/runs/{run_id} to inspect the run later.
If auth is enabled with --auth-token or
OMNICOREAGENT_SERVE_AUTH_ENABLED=true, add
-H "Authorization: Bearer YOUR_TOKEN" to protected requests.
Each run stores operational state in the task store and writes lifecycle files
into the configured workspace namespace. Use the default in-memory task store
for local development, or choose sql, redis, or mongodb when runs must
survive restarts. Durable stores preserve queued runs across server restarts:
OmniServe can queue a run, stop, start again with the same task store, and the
new manager can claim and complete that run.
Choose one durable backend per deployment. Use SQL/SQLite for local durability
or simple single-node services. Use Redis when your deployment already operates
Redis with persistence and no eviction for task-store keys. Use MongoDB when
MongoDB is your durable operational store.
Common inspection endpoints:
Environment Variables
Server settings use theOMNICOREAGENT_SERVE_* prefix. Background task settings
use the OMNICOREAGENT_BACKGROUND_* prefix. Environment variables always
override code values.
You can run OmniServe without adding any OMNICOREAGENT_SERVE_* variables. The defaults
enable the background API, start the worker, and use in-memory background task
state. Add variables only when you want to change server behavior,
authentication, rate limits, or background storage.
| Variable | Default | Description |
|---|---|---|
OMNICOREAGENT_SERVE_HOST | 0.0.0.0 | Server host. Must not be empty |
OMNICOREAGENT_SERVE_PORT | 8000 | Server port. Must be 1-65535 |
OMNICOREAGENT_SERVE_WORKERS | 1 | Direct OmniServe worker count. Must be 1; scale by running multiple processes |
OMNICOREAGENT_SERVE_API_PREFIX | "" | API path prefix (e.g., /api/v1). Normalized to a leading slash with no trailing slash; whitespace is invalid |
OMNICOREAGENT_SERVE_ENABLE_DOCS | true | Swagger UI at /docs |
OMNICOREAGENT_SERVE_ENABLE_REDOC | true | ReDoc at /redoc |
OMNICOREAGENT_SERVE_CORS_ENABLED | true | Enable CORS |
OMNICOREAGENT_SERVE_CORS_ORIGINS | * | Allowed origins (comma-separated) |
OMNICOREAGENT_SERVE_CORS_METHODS | * | Allowed methods (comma-separated) |
OMNICOREAGENT_SERVE_CORS_HEADERS | * | Allowed headers (comma-separated) |
OMNICOREAGENT_SERVE_CORS_CREDENTIALS | true | Allow credentials |
OMNICOREAGENT_SERVE_AUTH_ENABLED | false | Enable Bearer token auth. Requires a non-empty auth token |
OMNICOREAGENT_SERVE_AUTH_TOKEN | — | Bearer token value used when auth is enabled |
OMNICOREAGENT_SERVE_RATE_LIMIT_ENABLED | false | Enable rate limiting |
OMNICOREAGENT_SERVE_RATE_LIMIT_REQUESTS | 100 | Requests per window. Must be at least 1 when enabled |
OMNICOREAGENT_SERVE_RATE_LIMIT_WINDOW | 60 | Window in seconds. Must be at least 1 when enabled |
OMNICOREAGENT_SERVE_REQUEST_LOGGING | true | Log requests |
OMNICOREAGENT_SERVE_LOG_LEVEL | INFO | Log level: CRITICAL, ERROR, WARNING, INFO, DEBUG, or TRACE |
OMNICOREAGENT_SERVE_REQUEST_TIMEOUT | 300 | Request timeout in seconds |
OMNICOREAGENT_BACKGROUND_ENABLED | true | Expose background task endpoints |
OMNICOREAGENT_BACKGROUND_AGENT_ID | default | Agent id for the served agent in background tasks |
OMNICOREAGENT_BACKGROUND_TASK_STORE | in_memory | Background control-plane store: in_memory, sql, redis, or mongodb |
OMNICOREAGENT_BACKGROUND_TASK_STORE_URL | — | SQL or Redis URL. Use OMNICOREAGENT_BACKGROUND_TASK_STORE=redis for Redis URLs |
OMNICOREAGENT_BACKGROUND_TASK_STORE_URI | — | MongoDB URI |
OMNICOREAGENT_BACKGROUND_TASK_STORE_DATABASE | omnicoreagent | MongoDB database name |
OMNICOREAGENT_BACKGROUND_TASK_STORE_PREFIX | — | Redis key prefix |
OMNICOREAGENT_BACKGROUND_TASK_STORE_COLLECTION_PREFIX | — | MongoDB collection prefix |
OMNICOREAGENT_BACKGROUND_TASK_STORE_CONNECT_TIMEOUT | — | Backend connect timeout in seconds |
OMNICOREAGENT_BACKGROUND_START_WORKER | true | Start scheduler and worker loop during server lifespan |
The background task store is not conversation memory. Memory stays in
MemoryRouter. The task store is the control plane for schedules, runs,
attempts, leases, retries, and cancellation. Leave it at the in-memory default
to start; choose sql, redis, or mongodb when that state must survive
restarts. Redis durable deployments need persistence enabled and a no-eviction
policy for task-store keys. MongoDB durable deployments use majority writes.Docker Deployment
Generate a Dockerfile
Build and run
| Setting | Value |
|---|---|
AGENT_PATH | In-container path to the selected agent file |
OMNICOREAGENT_WORKSPACE_BACKEND | local |
OMNICOREAGENT_WORKSPACE_DIR | /tmp/workspace |
-e, never baked into the image.
Cloud deployment examples
Python API (Programmatic Control)
For full programmatic control, useOmniServe directly in your Python script:
CLI vs Python API:
omniserve run --agent my_agent.py— CLI loads your agent file and applies CLI flagspython server.py— You control everything programmatically viaOmniServeConfig
Learn More: See OmniServe Cookbook for more examples.