uvx synth-ai deploy—that can host any task app directly on your laptop. The local runtime keeps everything on your machine by spawning uvicorn in-process, wiring in your .env secrets, and validating that the FastAPI task app exposes the required endpoints (/, /health, /info, /task_info, /rollout) before anything starts listening.
When to use the local runtime
- Fast feedback while iterating on routes, prompts, or trace instrumentation.
- Running baselines or smoke tests without exposing endpoints to the public internet.
- Validating that
/rolloutresponses are well-formed before promoting to Modal or a tunnel.
Prerequisites
-
uv(or Python 3.11+) to runuvx synth-ai …. -
Synth CLI pairing so the SDK can populate
SYNTH_API_KEYandENVIRONMENT_API_KEY:The setup command opens the dashboard, performs the handshake, and writes both keys to your repo’s.env. -
A validated task app module. The CLI checks and rejects apps that do not compile, lack an ASGI
app, or miss mandatory endpoints, so fix any errors before retrying.
Start a local task app
.envfiles are loaded (and override process env vars) so both API keys are present.validate_task_appimports your Python module and ensures all required FastAPI routes exist.LocalDeployCfgsetsENVIRONMENT_API_KEYplusTASKAPP_TRACING_ENABLED=1(unless--no-trace), then uvicorn serves the ASGI app on the requested host/port.- The CLI prints
Serving task app at http://HOST:PORT; stop the server withCtrl+C.
Handy flags
| Flag | Description |
|---|---|
--env PATH (repeatable) | Additional .env files to load. |
--host / --port | Change the bind address (default 127.0.0.1:8000). |
--trace/--no-trace | Toggle trace capture. When disabled, TASKAPP_TRACING_ENABLED is cleared. |
--force | Kill any process already bound to the port (legacy serve flag, still honored). |
--reload | Enable uvicorn autoreload for hot code swaps (defaults to off). |
Tip: The CLI automatically discovers task apps listed in synth_ai/task_apps.py. If you omit the path, it will prompt you to pick one interactively.
Verifying the deployment
-
Hit
GET /healthin another terminal:curl -H "X-API-Key: $ENVIRONMENT_API_KEY" http://127.0.0.1:8765/health. -
Run a smoke test to mimic trainer rollouts:
-
Inspect traces under the directory you passed via
--trace(or setTASKAPP_TRACING_ENABLED=0to disable when benchmarking).
Next steps
- Keep iterating locally until
/rolloutresponses, traces, and smoke tests look good. - When you’re ready to share the app with Synth cloud trainers, either open a Cloudflare tunnel or follow the Modal deployment guide for a fully managed container.