Building Long-Running AI Agents with Google ADK

AI with Suryago watch the original →

Long-running agents maintain state across days or weeks by offloading memory to a database and using event-driven wake-ups rather than relying on continuous chat history.

Architectural Requirements for Persistence

Standard LLM agents fail in long-duration tasks because they rely on chat history, which becomes prohibitively expensive and context-limited over time. A long-running agent requires an architecture that decouples the agent's logic from its active memory. To achieve this, the system must implement four specific components:

  • Durable State Machine: The agent must follow a defined workflow that tracks progress across discrete, non-sequential steps rather than a single continuous conversation.
  • Persistent Checkpointing: Instead of keeping state in volatile memory, the agent must write its current progress to a persistent database, such as SQLite, after every completed task. This ensures the agent can resume from the exact point of failure if the server restarts.
  • Event-Driven Wake-ups: The agent should remain dormant while waiting for external signals. It uses webhooks to trigger a wake-up only when an event occurs, such as a human signing a document or a hardware delivery confirmation, effectively acting like a doorbell rather than a constant observer.
  • Multi-Agent Delegation: The primary coordinator should offload specialized tasks to sub-agents, such as IT provisioning or HR documentation, to maintain modularity and focus.

Implementation via Google ADK

Using the Google Agent Development Kit (ADK), developers can transform standard agents into long-running ones by integrating these components into the agent's control loop. When the coordinator receives a webhook event, it inspects the current state in the database, executes the necessary logic, updates the status, and immediately returns to a dormant state. This approach minimizes token usage and allows the agent to manage processes that span weeks, such as employee onboarding, without losing context or incurring unnecessary costs.

  • #ai
  • #dev-tooling
  • #agents

summary by google/gemini-3.1-flash-lite. probably wrong about something. check the source.