Skip to main content

OmniServe Cookbook

Production-ready API server examples for OmniCoreAgent.

📦 Agent File Requirements

Your agent file must define one of the following:

Examples


Quick Start

Option 1: CLI (Zero-code deployment)

Use the provider that matches your LLM_API_KEY. For an OpenAI key, run omniserve quickstart --provider openai --model gpt-4o-mini.

Option 2: Python API (Programmatic control)

[!WARNING] Environment Variable Precedence: Environment variables ALWAYS override values set in OmniServeConfig.

Environment Variables

Server settings use the OMNICOREAGENT_SERVE_* prefix. Background task settings use the OMNICOREAGENT_BACKGROUND_* prefix. You can start without either prefix; defaults use port 8000, in-memory background task state, and no auth/rate limiting until you opt in.

API Endpoints

Core Endpoints

/ready becomes true after server startup finishes, the agent is initialized, and configured MCP servers are connected. Local-only agents with no MCP servers do not need an MCP client for readiness.

Background Task Endpoints

These routes are mounted when background execution is enabled. It is enabled by default and can be turned off with OMNICOREAGENT_BACKGROUND_ENABLED=false or OmniServeConfig(background_enabled=False). *Auth required only if OMNICOREAGENT_SERVE_AUTH_ENABLED=true or --auth-token is set. POST /background/tasks/{task_id}/run accepts {"wait": true} when the client needs terminal run state in the response. With the worker enabled, OmniServe waits on the durable run record. With the worker disabled, OmniServe executes the run inline through the background manager execution path. If the run does not finish before the background wait budget, the response is 504. The wait budget is derived from the configured request timeout and leaves a small margin for OmniServe to return the structured response before the outer HTTP timeout. The detail payload includes the run_id, latest status, wait_timeout_seconds, and request_timeout_seconds so the run can still be inspected through /background/runs/{run_id}.

Docker Deployment

Cloud Deployment (Cloud Run, AWS Fargate, Railway)

The generated Dockerfile is deterministic. It does not import or execute the agent file. It sets:
  • AGENT_PATH to the in-container agent path
  • OMNICOREAGENT_WORKSPACE_BACKEND=local
  • OMNICOREAGENT_WORKSPACE_DIR=/tmp/workspace
The agent file must be inside the current Docker build context. For S3/R2 workspace persistence, pass backend and credentials at runtime: