Skip to main content

Crate behest_event

Crate behest_event 

Source
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 from behest::runtime::event).
  • EventActions: side-effect declarations that accompany events.
  • Hook: single-method observer that returns Vec<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§

ApprovalRequest
A request for human approval of a tool call.
CacheMetrics
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.
CompactionCircuitOpened
Emitted when the compaction circuit breaker opens due to repeated failures.
ContextBuilt
Emitted after context has been assembled from session history and adapters.
DoomLoopDetected
Emitted when the agent is detected to be in a repetitive tool call cycle.
EventActions
Side-effect declarations associated with an event.
HookStack
An ordered stack of hooks.
MessageCommitted
Notification that a message has been persisted to the session store.
ModelStarted
Emitted when a model invocation begins, carrying iteration count.
ProgressEvent
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.
TextDelta
Streaming text delta emitted during model response generation.
ToolCallCompleted
Emitted when the model finishes emitting a complete tool call.
ToolCallDelta
Streaming delta for tool call arguments during model response.
ToolCallStarted
Emitted when the model requests a tool call.
ToolExecutionFinished
Emitted when a tool function completes, carrying the result and duration.
ToolExecutionStarted
Emitted when a tool function begins executing.
UsageRecorded
Emitted after each model invocation to record token consumption.

Enums§

AgentEvent
Event emitted during agent runtime execution.
ToolExecutionResult
Result of a single tool execution.

Traits§

Hook
An observer hook that reacts to events.