Overview
Concrete tool for managing human-in-the-loop interactions, dispatching approval requests, and mediating CLI-based human feedback during workflow execution.
Description
The HITLManager class is a Pydantic BaseModule that serves as the central interaction manager for human-in-the-loop workflows. When `active`, it creates HITLRequest objects, generates prompt messages describing the pending action, and handles CLI-based interactions for approve/reject decisions. It supports four interaction types (`APPROVE_REJECT`, `REVIEW_EDIT_STATE`, `REVIEW_TOOL_CALLS`, `MULTI_TURN_CONVERSATION`) and two modes (`PRE_EXECUTION`, `POST_EXECUTION`). When inactive, all requests are auto-approved.
Usage
- HITL workflow: Instantiate, call `activate()`, and pass to `WorkFlow(hitl_manager=...)` to enable human checkpoints.
- Approval requests: Called internally by `HITLInterceptorAction` during workflow execution to block for human input.
- User input collection: Use `request_user_input()` to collect structured user input at workflow runtime.
Code Reference
Source Location
- Repository: EvoAgentX
- File: evoagentx/hitl/approval_manager.py (L10-481)
Signature
class HITLManager(BaseModule):
active: bool = False
def activate(self) -> None
def deactivate(self) -> None
@property
def is_active(self) -> bool
async def request_approval(
self,
task_name: str,
agent_name: str,
action_name: str,
interaction_type: HITLInteractionType,
mode: HITLMode,
action_inputs_data: dict = None,
execution_result = None,
workflow_goal: str = None,
display_context: Dict = None,
timeout: float = 1800.0
) -> HITLResponse
async def request_user_input(
self,
task_name: str,
agent_name: str,
action_name: str,
input_fields: dict,
workflow_goal: str = None,
display_context: dict = None,
timeout: float = 3600.0
) -> HITLResponse
Import
from evoagentx.hitl.approval_manager import HITLManager
from evoagentx.hitl.hitl import HITLInteractionType, HITLMode, HITLDecision
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| active |
bool |
No |
Whether HITL is active (default: False; call activate())
|
| task_name |
str |
Yes |
Workflow task name
|
| agent_name |
str |
Yes |
Agent being intercepted
|
| interaction_type |
HITLInteractionType |
Yes |
APPROVE_REJECT, REVIEW_EDIT_STATE, etc.
|
| mode |
HITLMode |
Yes |
PRE_EXECUTION or POST_EXECUTION
|
| action_inputs_data |
dict |
No |
Action inputs for review
|
Outputs
| Name |
Type |
Description
|
| request_approval returns |
HITLResponse |
Decision (APPROVE/REJECT), feedback, modified_content
|
Usage Examples
Enable HITL in Workflow
from evoagentx.hitl.approval_manager import HITLManager
from evoagentx.workflow.workflow import WorkFlow
# 1. Create and activate HITL manager
hitl_manager = HITLManager()
hitl_manager.activate()
# 2. Pass to WorkFlow
workflow = WorkFlow(
graph=graph,
llm=llm,
agent_manager=agent_manager,
hitl_manager=hitl_manager,
)
# 3. Execute — interceptor nodes will block for human approval
result = workflow.execute(inputs={"topic": "AI safety"})
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.