What problem does it solve?
Prevents unsafe or unintended side-effectful tool calls by pausing agent execution for human review, adds robust middleware hooks for logging and error handling, and enforces structured outputs for predictable downstream processing.
Core Features & Use Cases
- Human-in-the-Loop Approval: Configure per-tool HITL policies to require approve, edit, or reject decisions before executing dangerous actions like sending or deleting data.
- Custom Middleware Hooks: Intercept and wrap model and tool calls with before_model, after_model, wrap_tool_call, before_agent, and after_agent hooks for retries, logging, and validation.
- Resume and Edit Commands: Support resuming agent execution via Command objects with edited arguments and decision feedback, enabling workflows that correct or abort actions after human review.
- Structured Output: Encourage use of typed schemas (Pydantic / Zod) to produce deterministic, validated outputs compatible with downstream systems.
- Use Case: Gate outbound emails and data-deletion tools in production agents so a human can correct addresses, provide feedback, or block sensitive operations.
Quick Start
Set up an agent that pauses before sending emails and requires human approval using HumanInTheLoopMiddleware with a persistent MemorySaver checkpointer and invoke with config thread_id "session-1".