Human in the loop middleware.
HumanInTheLoopMiddleware(
self,
interrupt_on: dict[str, bool | InterruptOnConfig],
*,
description_prefix: str = 'Tool execution requires approval'
)| Name | Type | Description |
|---|---|---|
interrupt_on* | dict[str, bool | InterruptOnConfig] | Mapping of tool name to allowed actions. If a tool doesn't have an entry, it's auto-approved by default.
|
description_prefix | str | Default: 'Tool execution requires approval'The prefix to use when constructing action requests. This is used to provide context about the tool call and the action being requested. Not used if a tool has a |
| Name | Type |
|---|---|
| interrupt_on | dict[str, bool | InterruptOnConfig] |
| description_prefix | str |
Logic to run before the agent execution starts.
Async logic to run before the agent execution starts.
Logic to run before the model is called.
Async logic to run before the model is called.
Intercept and control model execution via handler callback.
Intercept and control async model execution via handler callback.
Logic to run after the agent execution completes.
Async logic to run after the agent execution completes.
Intercept tool execution for retries, monitoring, or modification.
Intercept and control async tool execution via handler callback.