pub type ActionHook = Arc<dyn Fn(String, Value) -> Pin<Box<dyn Future<Output = bool> + Send>> + Send + Sync>;Expand description
Async hook called before each tool action. Return true to proceed, false to block.
When blocked, the loop inserts a synthetic observation
{"ok": false, "error": "action blocked by reviewer", "kind": "blocked"}
and continues to the next iteration without invoking the tool.
§Observer interaction
When a hook allows an action (true), the normal observer sequence fires:
Observer::on_tool_call— called before the tool is dispatchedObserver::on_step— called after the observation is recorded
When a hook blocks an action (false), the sequence is:
Observer::on_action_blocked— called instead ofon_tool_callObserver::on_step— called after the synthetic blocked observation is recorded
Use make_action_hook to construct a hook from a plain async fn without
writing the Arc<dyn Fn…> boilerplate by hand.
Aliased Type§
pub struct ActionHook { /* private fields */ }