Get early access
Back to episodes
#8over 1 year ago

Humans as Tools: Async Agents and Durable Execution

Agents are great, but for the most accuracy-sensitive scenarios, we some times want a human in the loop. Today we'll discuss techniques for how to make this possible. We'll dive deep into concepts from our 4/22 session on 12-factor agents and extend them to handle asynchronous operations where agents need to contact humans for help, feedback, or approvals across a variety of channels.

Project details

Open in GitHub

Humans as Tools: Async Agents and Durable Execution

Video

<a href="https://www.youtube.com/watch?v=NMhH5_ju3-I">Screenshot 2025-06-10 at 8 56 45 AM</a>

This session builds on our 12-factor agents workshop to explore async agents and durable execution patterns. We'll learn how to build agents that can pause, contact humans for feedback or approval, and resume execution based on human responses.

What You'll Learn

  • How to implement async agent patterns with human-in-the-loop workflows
  • State management for durable agent execution
  • Different channels for human interaction (CLI, HTTP, email)
  • Webhook integration for non-blocking human approvals
  • Testing strategies for async agent workflows

Key Takeaways

  • Two types of human interaction - deterministic (code enforces human approval) and non-deterministic (agent chooses to contact a human)
  • approver might not be the person interacting with the chatbot
  • State management is key to building agents that can pause/resume for human interaction
  • Separate concerns of inner loop (agent) and outer loop (human interaction)

Whiteboards

inner vs outer loop

image

deterministic vs non-deterministic human approval

image

base agent architecture refresh

image

image

image

Running the Code

  • Basic TypeScript knowledge
  • Node.js 20+ installed
  • Understanding of async/await patterns
  • Familiarity with HTTP APIs and webhooks
  • OPENAI_API_KEY env var set

Quick Setup

# Install dependencies
npm install

# Run the final version w/ cli
npx tsx src/index.ts

# OR run the final version w/ http
npx tsx src/server.ts

All episodes