This page maps the most common ways to ship a Swarms agent to production and helps you pick the right one based on workload, complexity, and cost.Documentation Index
Fetch the complete documentation index at: https://docs.swarms.world/llms.txt
Use this file to discover all available pages before exploring further.
Deployment types at a glance
| Deployment | Use case | Complexity | Scalability | Cost | Best for |
|---|---|---|---|---|---|
| FastAPI + Uvicorn | REST API endpoints | Low | Medium | Low | Quick prototypes, internal tools, real-time agent calls |
| Cron Jobs | Scheduled tasks | Low | Low | Very low | Batch processing, periodic agents (digest, daily reports) |
- FastAPI Agent API — full guide with code, auth, rate limiting, Docker, Gunicorn.
- Cron jobs: see the runnable examples in the repo at
examples/guides/deployment/cron_job_examples/.
Quick-start
1. FastAPI + Uvicorn (REST API)
- Best for: exposing agents over HTTP for synchronous calls.
- Setup time: 5–10 minutes.
- Walkthrough: FastAPI Agent API.
- Reference code: fastapi_agent_api_example.py
2. Cron jobs (scheduled tasks)
- Best for: running agents on a schedule (every hour, daily summary, weekly report).
- Setup time: 2–5 minutes.
- Reference code: cron_job_examples/
Choosing a target
Performance
- FastAPI — excellent for high-throughput synchronous APIs.
- Cron jobs — good for batch processing where latency doesn’t matter.
- Docker — consistent performance across environments.
- Kubernetes — best for complex, scalable, multi-service systems.
Security
- FastAPI — built-in mechanisms for auth, CORS, rate limiting.
- Cron jobs — runs with the system user’s permissions; isolate carefully.
- Docker — sandboxed processes, easier to apply security patches.
- Kubernetes — full RBAC, network policies, secrets management.
Monitoring & observability
- FastAPI — standard Python logging hooks; integrates with Prometheus, Datadog, etc.
- Cron jobs — basic log files; pair with a log shipper for visibility.
- Docker — container-level metrics via the runtime.
- Kubernetes — first-class metrics, alerting, and tracing.
Cost
- FastAPI — pay for the compute that hosts the process.
- Cron jobs — minimal cost; runs on existing infrastructure.
- Docker — efficient resource utilisation.
- Kubernetes — advanced auto-scaling and resource governance.
What to pick
| You are… | Pick |
|---|---|
| Building an API for your agents | FastAPI + Uvicorn |
| Running batch jobs / scheduled agents | Cron jobs |
| Shipping to production with consistency requirements | FastAPI + Docker |
| Auto-scaling under variable load | Cloud Run or Kubernetes |
| Running on existing infrastructure with minimal cost | Cron jobs or Cloud Functions |
| Building a complex multi-service platform | Kubernetes |
Recommended progression
- Start with FastAPI if you need synchronous agent calls.
- Add cron jobs for any scheduled or batch agents.
- Move to Docker once you need consistent environments and easy deployment.
- Consider Kubernetes once you have multiple services that need orchestration, auto-scaling, or advanced resource policies.
See also
- FastAPI Agent API — step-by-step API deployment guide.
- Agent Streaming — pair token streaming with FastAPI’s
StreamingResponsefor real-time UX.