Skip to main content

Overview

agent.serve() returns an ordinary ASGI app running under uvicorn, so anywhere you can run a Python web service will do:
  1. Self-hosted Servers - uvicorn, gunicorn, or Docker
  2. Kubernetes - a standard Deployment and Service
  3. Serverless - AWS Lambda, Cloud Run, and similar
  4. ASGI Servers - any ASGI-compatible platform
The app carries no authentication of its own. Put it behind whatever your infrastructure already uses.

Observability

Tracing is off unless you ask for it. A trace carries prompts, tool arguments and tool results, so nothing leaves your process by default:
You can also decide per run - agent.run("...", tracing=False) sends nothing for that call, and tracing=True traces one run without turning it on for the agent. See Tracing for the full picture.

Self-Hosted Deployment

Local Development

Run agents locally:
Access at http://localhost:8000.

Production Server

For production, use Gunicorn with uvicorn workers:
Create server.py:

uvicorn Deployment

Run with uvicorn directly:

Docker Deployment

Dockerfile

Create a Dockerfile:

Build and Run

Docker Compose

Create docker-compose.yml:
Run:

Kubernetes Deployment

Deployment YAML

Deploy:

MCP Server Deployment

Deploy LiteMCP servers:

MCP with Gunicorn

MCP as ASGI App

LiteMCP is a full ASGI application:

Serverless Deployment

AWS Lambda

Use Mangum for Lambda compatibility:

Google Cloud Run

Create app.yaml:
Deploy:

Environment Configuration

Production Settings

Configure for production (src/agentor/config.py):

Required Environment Variables

Health Checks

Agents automatically include health endpoints:
Test:

Monitoring

Logging

Configure logging levels:

Tracing

Enable Celesto tracing (src/agentor/tracer.py):

Metrics

Integrate with Prometheus:

Load Balancing

Nginx Configuration

Security

API Authentication

Implement authentication middleware:

HTTPS/TLS

Use a reverse proxy (Nginx, Caddy) or configure uvicorn with SSL:

Performance Tuning

Worker Configuration

Optimal workers = (2 × CPU cores) + 1:

Concurrency Control

Limit concurrent requests:

Troubleshooting

Common Issues

Port already in use:
Module not found:
API key errors:

Debug Mode

Enable detailed logging:

Next Steps

Agents

Learn about agent configuration

A2A Protocol

Deploy A2A-compatible agents

MCP Servers

Deploy MCP servers

Celesto AI

Deploy to Celesto platform
Last modified on August 28, 2026