Why the Human is an Async API in Agentic Workflows

By LatestLLM Editorial ·

Why the Human is an Async API in Agentic Workflows

Learn how to build durable, human-in-the-loop AI agents using Temporal, Google ADK, and LangGraph to prevent system failures during human interactions.

Key takeaways

  • Treating human interaction as a blocking call is a primary cause of failure in production AI agents.
  • Temporal uses 'Wait Conditions' to pause workflows and 'Signals' to resume them, allowing agents to survive crashes and long delays.
  • Durability in an agent harness ensures that state is preserved even if the underlying worker process is killed.
  • Effective human-in-the-loop design requires balancing the high cost of AI errors against the risk of human alert fatigue.
  • Temporal is framework-agnostic, working seamlessly with Google ADK and LangGraph.

Building an AI agent that can reason and act is one thing; building one that doesn't crash when a human takes three days to click 'approve' is another entirely.

⚡ TL;DR: Melanie Warrick from Temporal demonstrates how to use Temporal, Google ADK, and LangGraph to build durable AI agents. By treating human interaction as an asynchronous API using wait conditions and signals, developers can ensure agents maintain state even if workers crash or humans take weeks to respond.

The Simple Version

Imagine you are running a high-speed pizza delivery service. Most of your processes are automated: the oven heats up, the dough rises, and the driver grabs the box in seconds.

But suddenly, a customer calls to change their toppings. If your entire kitchen staff freezes and stops working just because they are waiting for that one customer to decide between pepperoni or mushrooms, your business collapses.

🎯 Think of it this way: A human in a loop is like a very slow, very unpredictable delivery driver. You shouldn't stop your entire factory just because one driver is stuck in traffic or taking a nap.

In AI agent development, we often treat "asking a human" as a simple function call. However, as Melanie Warrick explains, humans don't respond in 200 milliseconds. If your agent's code is literally "waiting" on a single thread for a human, a simple server restart or a network hiccup can cause the agent to lose its memory and fail the entire task.

How It Actually Works

The Agent Harness and Durability

When we talk about an "agent harness," we are talking about the infrastructure that surrounds the LLM to make it production-ready. This includes memory, tools, guardrails, and—most importantly—durability.

Durability means that if the power goes out or the server reboots, the agent knows exactly where it left off. Without this, an agent performing a multi-step task (like coordinating an ice cream delivery) might forget it already checked the inventory just because it was waiting for a dispatch signal.

The Three Primitives of Temporal

To achieve this durability, Temporal provides three core building blocks that structure how code is executed:

  • Workers: The processes that actually run your code.
  • Workflows: The orchestration layer that keeps track of the steps and the overall state of the system.
  • Activities: The individual tasks that interact with the outside world, such as making a model call to GPT-4 or using a Google Maps tool.
🎯 Think of it this way: The Workflow is the recipe, the Worker is the chef, and the Activity is the act of actually chopping an onion or boiling water.

Technical Deep Dive

The technical breakthrough in handling human interaction lies in moving away from blocking calls and moving toward asynchronous primitives. In a standard programming model, a function waits for a return value. In an agentic workflow, this is dangerous because it holds resources hostage.

Wait Conditions and Signals

As Warrick demonstrates, the correct way to implement "Human-in-the-loop" is through two specific mechanisms: wait conditions and signals.

Instead of a function that says result = ask_human(), you implement a workflow that hits a wait_condition. This tells the Temporal engine: "Pause this specific workflow, save its entire state to the database, and release the worker to do other tasks." The workflow is now parked.

When the human finally responds, they trigger a signal. This signal is an external event injected into the running workflow. As Warrick notes, "The workflow will be taken off of your memory or taken off of your system and put in parked if it's not running anything at that point." Once the signal arrives, the workflow resumes exactly where it left off.

Integration with LangGraph and Google ADK

In the demonstration, this is applied to a multi-agent system using Google ADK for fleet and customer agents, and LangGraph for the dispatch agent. In a LangGraph setup, the interrupt function is used to signal that the graph needs human input. This interrupt is then mapped to a Temporal wait condition.

This architecture allows for deterministic workflows and non-deterministic activities. The logic of the agent (the workflow) is deterministic and can be replayed to recover state, while the actual LLM calls (the activities) are non-deterministic and handled separately. This is why, in the demo, when Warrick kills the worker mid-approval, the system recovers perfectly upon restart. The event history is replayed, the state is reconstructed, and the agent continues without losing a single bit of progress.

Why This Matters

This approach solves the fundamental tension in AI development: the gap between the speed of silicon and the speed of biology. As we move toward more autonomous agents, we have to decide when a human *should* be in the loop.

Warrick suggests two main criteria: the cost of being wrong and alert fatigue. If an agent is managing a $10,000 transaction, the cost of an error is high, so a human must approve it. However, if you ask for human approval for every single minor task, your human operators will experience alert fatigue and start clicking "approve" blindly just to clear the queue.

By treating humans as an asynchronous API, we build systems that are resilient to the inherent unpredictability of both the internet and human beings. We stop building fragile scripts and start building robust, industrial-grade agentic systems.

Frequently asked questions

What happens to an AI agent if the server restarts while it's waiting for a human?

If the agent is built using durable primitives like Temporal, the workflow state is saved in a database. Upon restart, the worker replays the event history and resumes exactly where it left off.

What is the difference between a workflow and an activity in Temporal?

Workflows are deterministic orchestration layers that track the sequence of steps, while activities are non-deterministic tasks that perform external actions like LLM calls or API requests.

How do you prevent 'alert fatigue' in human-in-the-loop systems?

You should only involve humans when the cost of the agent being wrong is high. Over-requesting human input leads to fatigue, where users approve actions without proper review.

Sources

Source: “Why the Human is an Async API in Agentic Workflows” on YouTube by AI Engineer

Tags: AI Agents, Temporal, Software Architecture, LangGraph, Human-in-the-loop

Related articles