Quick Takeaways
- Agents aren’t always chatty: For work that takes minutes or needs delayed approval, asynchronous updates beat making users wait.
- Hand off, don’t hang on: Return HTTP 202 with a task ID, run the agent in the background, and send progress or results via webhooks.
- ADK can pause and resume: Persist sessions in a database;
RequestInputand interrupt IDs let agents resume after human feedback—even after a restart. - Production needs durable jobs: In-process background tasks can be lost or throttled, so the follow-up architecture uses Cloud Tasks for retries, plus Cloud Run and Scheduler.
Move Long Work Out of the Chat
A chat works when an agent can answer quickly. It becomes a poor fit when a task takes minutes or hours, or needs human approval. Waiting keeps a connection open, ties up resources and can end in a timeout.
Google’s Agent Development Kit (ADK) supports a more flexible pattern. An app can accept a task, return HTTP 202 with a session ID, then report progress through a webhook. The user can leave and return when the agent finishes or needs input.
Pause and Resume With ADK
To resume work after a pause or restart, store the session in a database with DatabaseSessionService and enable resumability. ADK can pause a workflow at a RequestInput step or during a long-running tool call. It emits a function-call event with an interrupt ID.
When the user responds, send the response with the same session ID and the current interrupt ID. The session ID points to the task; the interrupt ID points to the pause. ADK uses saved events and checkpoints to continue the workflow, skipping completed steps where possible.
Use Async Carefully
This approach suits research, scheduled jobs and tasks that need delayed approval. It also lets people do something else while the agent works. However, a webhook or agent process can fail, and a simple in-process background task may disappear when a server restarts or scales down.
For a prototype, HTTP 202, webhooks and database-backed sessions can demonstrate the flow. For production, teams should add durable task handling, retries and monitoring. ADK makes pausing and resuming practical, but reliable operations still require careful infrastructure.
Stay Ahead with the Latest Tech Trends
Explore the future of technology with our detailed insights on Artificial Intelligence.
Access comprehensive resources on technology by visiting Wikipedia.
AITechV1
