synth-ai deploy is a thin wrapper around two workflows:
- Local runtime (
--runtime local) starts your task app with uvicorn. - Modal runtime (
--runtime modal) shell-executes the Modal CLI against a Python entrypoint you provide.
ENVIRONMENT_API_KEY via the standard secrets helper, so you are asked for the key the first time it’s missing.
Run Locally with uvicorn
- The CLI loads
ENVIRONMENT_API_KEY(and optionally other secrets) into the process usingsynth_ai.utils.env.resolve_env_var. LocalTaskAppConfigis built with the provided host, port, andtraceflag and passed todeploy_uvicorn_app.- uvicorn runs in the foreground. You can stop it with
Ctrl+C.
127.0.0.1 and 8000, tracing is enabled unless you specify --no-trace.
Deploy via Modal
- You must supply both the task app file (
--task-app) and the Modal wrapper script (--modal-app). The command does not generate or discover these automatically. --modal-clican point to a specific binary; otherwiseget_default_modal_bin_path()is used to locatemodal.- The CLI assembles the command
modal <deploy|serve> <modal_app.py>, appending--namewhen provided, and streams the subprocess output. --modal-mode serveis allowed but cannot be combined with--dry-run(the command raises an error).
Options
--task-app PATH— Python file that defines your task app; omitted value triggers an interactive file picker.--runtime {local,modal,tunnel}— Required runtime selection.--env PATH— Required. Path to.envfile containingSYNTH_API_KEYandENVIRONMENT_API_KEY.--trace/--no-trace— Toggle trace emission for local runs (default--trace).--host VALUE/--port VALUE— Bind address and port for uvicorn (localandtunnelruntimes).--wait/--no-wait— Wait for deployment to complete (blocking mode). Default is non-blocking (background).--tunnel-mode {quick,managed}— Tunnel mode fortunnelruntime (default:quick).--tunnel-subdomain TEXT— Custom subdomain for managed tunnel (tunnelruntime only).--modal-app PATH— Modal entrypoint to execute (modalruntime only).--name TEXT— Override the Modal app name (modalruntime only).--modal-mode {deploy,serve}— Choose between persistent deployment or ephemeral serve (modalruntime only).--modal-cli PATH— Explicit path to the Modal CLI binary (modalruntime only).--dry-run— Print the Modal command instead of executing it (modalruntime only, not valid with--modal-mode serve).
Runtime Behaviors
Local Runtime (--runtime local)
- Non-blocking by default: Starts uvicorn server in background using
nohup - Service Records: Automatically records deployment to
~/.synth-ai/services.json - Background Process: Server continues running after command exits
- Use
--wait: To run in blocking mode (foreground)
Tunnel Runtime (--runtime tunnel)
- Non-blocking by default: Starts tunnel and returns immediately
- Tunnel Records: Automatically records tunnel to
~/.synth-ai/services.json - Quick Tunnels: Free, ephemeral tunnels (no account required)
- Managed Tunnels: Stable tunnels with custom subdomains (requires
SYNTH_API_KEY) - Use
--wait: To run in blocking mode and keep tunnel alive
Modal Runtime (--runtime modal)
- Non-blocking by default: Starts Modal deployment process and returns immediately
- Use
--wait: To wait for deployment to complete
Notes
- API Keys Required:
SYNTH_API_KEYandENVIRONMENT_API_KEYmust be present in either:- Your environment (exported variables), OR
- The
.envfile provided via--env
- Non-Blocking Default: All deployments run in background by default to prevent indefinite stalls
- Service Discovery: Use
synth-ai scanto discover deployed services and check their health