sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

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

Open yike5460 opened this issue 8 months ago • 9 comments

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

yike5460 avatar Jun 11 '25 09:06 yike5460