Design a Chat Assistant That Runs Agent Tasks
Practice designing a chat app where a request can start an agent that works for minutes in its own cloud computer, shows each step in the thread, takes new instructions while it runs and asks before doing anything that cannot be undone.
Problem statement
Design a chat assistant in which AI agents can carry out tasks for the user.
For this exercise, assume a chat app where a user can switch on agent mode and send a request such as 'find three flats near my office and email each landlord to book a viewing'.
The assistant then starts a task: an agent that works step by step in its own sandbox, a temporary cloud computer with a browser and a terminal. Each step appears in the chat thread with a short description and a screenshot. The user can keep watching, switch to another device, or close the app and come back later.
Also assume that while a task runs, the user can send more instructions, which the agent must take into account, or stop the task.
The agent may ask the user a question, and before anything consequential, such as buying something, sending a message or submitting a form, it must ask the user to confirm that exact action. A task waiting for an answer waits up to 24 hours, and the user gets a notification.
When a task ends (done, failed, stopped or timed out), its result appears in the thread as an assistant message, with a notification if the user is not watching.
For this exercise, these are out of scope: how the model plans its steps, how the agent operates the browser, ordinary chat replies without agent mode, payment details, sharing chats with other people, and running in more than one region (one region with several zones is enough).
What to build
- A user sends a request in agent mode and a task starts in its own sandbox; the thread shows the agent working within 5 seconds, or says clearly why it has to wait.
- The user can watch each step (text and screenshot) live in the thread on any signed-in device, close the app, and later see every step and the current state.
- While a task runs, the user can send new instructions or stop it; the agent can ask a question or ask for confirmation of an exact consequential action and wait up to 24 hours for the answer.
- When a task ends as done, failed, stopped or timed out, its result is posted in the thread as an assistant message, and the user is notified if not watching.
At scale
- For this exercise, assume users start about 2 million agent tasks a day, with peaks of 60 new tasks a second. A user may have at most 3 tasks doing active work at once; tasks waiting for an answer do not count.
- For this exercise, assume a typical task does about 10 minutes of active work (at most 60) and about 100 steps (at most 500). Each step has a short text and a screenshot of about 200 KB. Screenshots are kept for 30 days; messages and results are kept as long as the chat exists.
- For this exercise, assume starting a fresh sandbox takes about 30 seconds and one host runs up to 50 sandboxes, while the user should see the agent working within 5 seconds and see each new step on every open device within 2 seconds.
- For this exercise, assume a consequential action must never run twice or without the user's confirmation of that exact action, and a task must survive the loss of any one server or sandbox host by continuing from its last saved step.