Skip to main content

Your agent serves one user at a time in the demo, and now 2,000 employees will start tasks that each run for 5 to 20 minutes. How do you run this in production?

Agents and tools · Pro 3

Short answer

Treat each run as a background job. A request puts the task on a queue, workers pick it up, and state is saved after every step so a run survives a restart. Add concurrency limits per user and overall, respect the provider's rate limits, set a budget per run, isolate each run's workspace, and show progress with a cancel button.

Deeper answer

A 20-minute task cannot live inside one web request. So the shape is a queue with workers, and the user's screen follows a run ID. Because workers are restarted during deploys and failures, each run must be resumable from stored state. That also lets you drain workers when you ship a new version.

The next limit is the model provider. If 400 runs start at 10 am, you will hit rate limits. You need a global limit on concurrent runs, fair limits per user so that one person cannot fill the queue, and backoff on 429 errors. Each run gets a cap on steps and money. Each run also needs its own workspace and the user's own credentials, so that data does not cross between runs. For operations, watch queue wait time, success rate, cost per task and stuck runs, and keep a switch that pauses new runs. Interviewers listen for async design, durable state, fairness under rate limits, and isolation.

What a strong answer covers

Answer it out loud in the mock interview about 2.5 min

Follow-ups to expect

Common mistakes

Learn it

Deploy and monitor an LLM app

Practice Agents and tools questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.