Deployment, scaling, and graceful shutdown

July 27, 2026 ยท View on GitHub

Run workers and AgentRuntime.serve() processes as long-lived services. Scale by adding worker instances and use task domains or queue limits to isolate workloads. On shutdown, stop task handlers and runtimes so in-flight tasks can be redelivered instead of being abandoned.

Do not construct a new runtime per web request. Reuse clients and runtimes for the application lifetime; use reliability for timeout and retry policy.