What you will learn
Worker queues, Quotas, Tracing, Versioning, Runbooks.
Engineering the capability
Long-running agents need admission control, per-user quotas, durable task identity, and observable terminal states. Separate request handling from workers when a task can exceed a normal request lifetime. A worker should check cancellation and remaining budget before starting the next expensive step.
Set limits for steps, elapsed time, tool calls, context growth, and spending. Limits are product decisions and should produce understandable outcomes. Quotas must be enforced in shared state when multiple workers serve the same user; an in-process counter is insufficient across replicas.
Version prompts, tool schemas, policies, and worker code together. A queued task may resume after a deployment, so either preserve compatibility or record which version should execute it. Runbooks need stuck-task recovery and side-effect reconciliation, not only server restart instructions.
Worked case
A deployment changes the meaning of a tool argument while 30 tasks are paused. Resuming them with the new schema can produce incorrect calls. Preserve the old schema for those jobs or migrate task state explicitly and reevaluate the next action before executing it.
Put it into practice
Continue with the next lab: operate a small agent job queue. Build the artifact, record the failure cases, and explain the tradeoff before moving on.