Skip to main content

Module interventions

Module interventions 

Source
Expand description

Interventions: policies that inspect and gate the agent’s lifecycle.

An InterventionHandler returns an InterventionAction at each lifecycle point it overrides: proceed, deny, guide, confirm (ask a human) or transform. Pass handlers to AgentConfig::interventions; they run in registration order, after the agent’s other hooks on Before* events and before them on After* events. Ready-made handlers are in vended_interventions.

Structs§

Confirm
Asks a human to approve the tool call (Confirm); only before_tool_call supports it.
Deny
Blocks the operation (Deny): on Before* events the cancel message is DENIED: <reason>, which the model sees.
Evaluate
Decides whether a human’s response approves a Confirm.
Guide
Steers the model with feedback (Guide).
Proceed
Lets the operation continue unchanged (Proceed).
Transform
Mutates the event in place before execution continues (Transform); later handlers see the change. An error from the mutation is handled by the handler’s on_error policy.

Enums§

InterventionAction
What a handler decides at a lifecycle point (InterventionAction), for the event E it was given.
OnError
What happens when a handler fails during evaluation (OnError).

Traits§

InterventionHandler
A policy evaluated at the agent’s lifecycle points (InterventionHandler).

Functions§

default_evaluate
The default approval test of a Confirm: true, or "y"/"yes" (case-insensitive, trimmed of Unicode whitespace other than U+0085, plus U+FEFF).

Type Aliases§

InterventionResult
What a lifecycle method returns: the action for its event, or an error that the handler’s OnError policy resolves.