Expand description
Event types, EventActions, and the Hook system for the behest
agent runtime.
This crate provides:
AgentEvent: the canonical 17-variant event covering the full agent lifecycle (moved here frombehest::runtime::event).EventActions: side-effect declarations that accompany events.Hook: single-method observer that returnsVec<EventActions>.HookStack: ordered dispatch of multiple hooks.
§Design
Hooks use a single-method pattern (inspired by Rig): one on_event()
method receives an AgentEvent and returns Vec<EventActions>.
Adding new event types never requires changing the Hook trait
signature.
Structs§
- Approval
Request - A request for human approval of a tool call.
- Cache
Metrics - Emitted after each model call when the provider reported prompt cache statistics. All fields are zero when the provider did not report cache hits or writes for this call.
- Compaction
Circuit Opened - Emitted when the compaction circuit breaker opens due to repeated failures.
- Context
Built - Emitted after context has been assembled from session history and adapters.
- Doom
Loop Detected - Emitted when the agent is detected to be in a repetitive tool call cycle.
- Event
Actions - Side-effect declarations associated with an event.
- Hook
Stack - An ordered stack of hooks.
- Message
Committed - Notification that a message has been persisted to the session store.
- Model
Started - Emitted when a model invocation begins, carrying iteration count.
- Progress
Event - A progress event emitted during tool execution or other long-running ops.
- RunCancelled
- Terminal event emitted when a run is cancelled before completion.
- RunCompleted
- Terminal event emitted when a run finishes successfully.
- RunFailed
- Terminal event emitted when a run terminates with an error.
- RunStarted
- Emitted when a run begins execution after session load and input admission.
- Text
Delta - Streaming text delta emitted during model response generation.
- Tool
Call Completed - Emitted when the model finishes emitting a complete tool call.
- Tool
Call Delta - Streaming delta for tool call arguments during model response.
- Tool
Call Started - Emitted when the model requests a tool call.
- Tool
Execution Finished - Emitted when a tool function completes, carrying the result and duration.
- Tool
Execution Started - Emitted when a tool function begins executing.
- Usage
Recorded - Emitted after each model invocation to record token consumption.
Enums§
- Agent
Event - Event emitted during agent runtime execution.
- Tool
Execution Result - Result of a single tool execution.
Traits§
- Hook
- An observer hook that reacts to events.