Skip to content

[FEATURE] Support Human-in-the-Loop (HIL) capabilities #204

@yike5460

Description

@yike5460

Problem Statement

Consider to provide Human-in-the-Loop (HIL) capabilities to enable human intervention at any point during execution

Proposed Solution

Enhancement on existing mechanism that could be used to implement HIL patterns:

Callback Handler System

Through the callback handler system. The Agent class accepts a callback_handler parameter that receives events throughout execution and processes events during the event loop cycle.

Tool-Based Intervention Points

Through custom tools that can pause execution and request human input. The tool system supports custom Python functions decorated with @tool, and tools can access the agent context through parameter injection.

Streaming Interface for Real-time Monitoring

Through stream_async() that yields events as they occur. This could enable real-time monitoring and intervention, though it would require custom implementation to pause execution.

Request State Management

The event loop maintains a request_state that can be modified during execution in event loop. A custom implementation could use this to signal when human intervention is needed.

Use Case

Provide robust mechanisms for pausing workflows, collecting human input, and resuming execution with the provided feedback or modifications, which are common cases in regulation impose and data sensitive industries, e.g. Finance

Alternatives Solutions

No response

Additional Context

No response


Status

Updates

We still have graph interrupts left to support. The following is our progress:

  • 2025-01-13: We are going to release a PR that introduces interrupt support in hooks only. Following, we will release support for node executor interrupts.
  • 2025-01-14: Adding support for hook based interrupts in graphs with interrupts - graph - hook based #1478
    • Will need to follow up to allow interrupts from agent and multiagent nodes.
  • 2025-01-15: Merged in support for raising interrupts from hooks in graphs (will go out with next release). Next I am working on supporting interrupts from agent nodes. The last item will be supporting interrupts from multi-agent nodes.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions