Human in the Loop Approvals
When to Use HITL
Quick Start
Auto-Approval (Local Testing/CI)
import os
os.environ["GLAIP_HITL_AUTO_APPROVE"] = "true"
from glaip_sdk.agents import Agent
from tools import CalculatorTool # Any LangChain BaseTool subclass.
# Local auto-approval uses LocalPromptHandler, injected when hitl_enabled is True.
agent = Agent(
name="hitl_local_agent",
instruction="Use the calculator tool when needed.",
tools=[CalculatorTool],
tool_configs={CalculatorTool: {"hitl": {"timeout_seconds": 30}}},
agent_config={"hitl_enabled": True},
)
response = agent.run("Calculate 2 + 2", local=True)
# All HITL requests auto-approved.Auto-Approval (Remote Testing/CI)
Custom Approval Logic
Manual Approval (Separate Process)
Components
Detecting Pauses in a Run
Typical Workflow
Implementation Paths
Python SDK - Remote HITL Handler (Recommended)
REST API
CLI
Best Practices
Testing & Examples
API Reference
Decision Types
Decision
Code
Behavior
HITLRequest Fields
HITLResponse Fields
RemoteHITLHandler Configuration
Manual Approval API
Common Patterns
Conditional Approval
Interactive Approval
Logging + Auto-Approve
Error Handling
Error Handling Details
Callback Errors
Error
Behavior
POST Errors
Error
Behavior
Unrecoverable Errors
Timeout Details
Environment Variables
Complete Example
Last updated