Building long-running AI agents with ADK

By Google Cloud Tech

Share:

Key Concepts

  • Long-Running AI Agents: Agents designed to persist over extended periods (weeks) to manage multi-step workflows without losing context.
  • Durable Memory Schema: Storing agent state as structured data (enums in a database) rather than relying solely on raw JSON chat logs.
  • Event-Driven Dormancy: A state where the agent remains "at rest" (not consuming compute resources) while waiting for external triggers.
  • Multi-Agent Delegation: The ability of a coordinator agent to assign specific tasks to specialized sub-agents to maintain clean reasoning chains.
  • State Machine: A logic framework that dictates the sequence of operations, preventing agents from skipping steps.

1. Overview of the New Hire Onboarding Agent

The video introduces an open-source project developed by Shubham and Eric that demonstrates a "long-running agent pattern." The primary use case is a New Hire Onboarding Coordinator, which manages the complex, multi-day process of bringing a new employee into a company.

Workflow Steps:

  1. Welcome Packet: The agent sends a welcome packet and enters a dormant state.
  2. Documentation: The agent waits for the employee to sign documents.
  3. IT Provisioning: The agent coordinates with sub-agents to handle hardware setup.
  4. Hardware Delivery: The agent waits for a delivery confirmation (simulated via webhook).
  5. Day One Schedule: Upon completion of previous steps, the agent generates a personalized schedule.

2. Technical Architecture and Methodology

The system is designed to overcome the limitations of standard "chatbot" agents, which often suffer from token bloat and context loss.

  • State Management: Unlike traditional agents that store history in vector stores as raw chat logs, this pattern uses a durable memory schema. The state is stored as an enum in a database, ensuring the agent always knows exactly where it is in the workflow.
  • Event-Driven Execution: The agent utilizes a "pause gate" mechanism. When a task is sent, the agent stops running entirely. There is no polling loop or thread spinning; the container remains at rest until an external event (e.g., a signature or a webhook) triggers a resume.
  • Intentional Sequencing: The agent operates via a state machine. This ensures that steps cannot be skipped or reordered, providing a reliable and predictable workflow.

3. Key Differentiators from Standard Chatbots

The presenter highlights three specific technical advantages of this pattern:

  1. No Context Pollution: By avoiding the accumulation of raw chat logs, the system prevents "token bloat," ensuring the agent remains efficient even after weeks of inactivity.
  2. True Dormancy: The agent is fully "asleep" between tasks, making the deployment scalable and cost-effective.
  3. Multi-Agent Delegation: The coordinator agent does not handle every technical detail. It delegates specific tasks (like IT provisioning) to specialized sub-agents, which keeps the primary reasoning chain clean and focused.

4. Real-World Application: The Onboarding Demo

The video demonstrates a live local deployment of the agent:

  • UI/UX Integrity: The interface does not "optimistically update." It waits for the backend SDK to confirm the resume turn is complete before updating the UI, proving that the long-running pattern is functional rather than simulated.
  • Webhook Integration: The system simulates a carrier webhook for hardware delivery. In a production environment, this would be a real-time callback from a shipping provider API, demonstrating how the agent integrates with external business systems.

5. Conclusion and Takeaways

The long-running agent pattern represents a shift from ephemeral, conversational AI to durable, process-oriented automation. By combining state machine logic with event-driven architecture, developers can build agents that manage complex, multi-week business processes reliably. The project is open-source, including a customizable front-end, and is recommended for those looking to move beyond simple chatbot implementations into robust, agentic workflows.

Chat with this Video

AI-Powered

Load the transcript when you're ready to chat so the initial page stays lighter.

Ready to summarize another video?

Summarize YouTube Video