Deployment Overview
LeafMesh deployment requires Python, Redis, and LLM API access. This section covers requirements, deployment options, and operational considerations.
System Requirements
| Component | Minimum | Recommended |
|---|---|---|
| Python | 3.11 | 3.11 – 3.14 |
| Redis | 6.0+ | 7.0+ |
| Memory | 4GB | 8GB+ |
| LLM API Access | 1 provider | 2+ providers |
Dependencies
Required:
aiohttp— Async HTTP clientredis— Redis clientpydantic— Configuration validationapscheduler— Agent scheduling
Optional:
fastapi,uvicorn— API servicespyyaml— YAML configuration loading
Observability dependencies are bundled by LeafMesh — no extra packages required.
Deployment Options
| Option | Best For |
|---|---|
| Single process | Development, small deployments (one instance, no workers mode) |
| Managed containers | Production via [leafmesh-deploy](cloud-deploy) — App Runner / Container Apps from your project's Dockerfile |
| Docker / docker-compose | Reproducible deployments, CI/CD (every scaffolded project ships a Dockerfile + docker-compose.yml) |
| Kubernetes | Existing clusters; auto-scaling, high availability |
| Multi-instance | Horizontal scaling — requires LEAFMESH_WORKERS_MODE=1 and a shared Redis ([Scaling](scaling)) |
Running more than one instance? Set
LEAFMESH_WORKERS_MODE=1on every instance and point them at the same Redis. See Scaling for the guarantees this enables.
Minimal Deployment
# app.py
import asyncio
from leafmesh import LeafMesh
leafmesh = LeafMesh.from_store()
async def main():
await leafmesh.start()
# Application logic...
await leafmesh.stop()
asyncio.run(main())With Redis running locally:
# Start Redis
redis-server
# Run the application
python app.pyWith API Server
import asyncio
from leafmesh import LeafMesh
leafmesh = LeafMesh.from_store()
async def main():
await leafmesh.start()
# API server runs on port 18820 by default
# Includes all service endpoints
asyncio.run(main())Network Requirements
- Redis: localhost:6379 (default) or cluster addresses
- LLM APIs: HTTPS to provider endpoints (api.openai.com, api.anthropic.com, etc.)
- API server: Port 18820 (configurable) for external access
Next Steps
- Production Setup — Production configuration
- Docker Deployment — Container deployment
- Kubernetes Deployment — Kubernetes orchestration
- Scaling — Scaling strategies
LeafMesh — Deployment overview