#[non_exhaustive]pub enum HookEvent<'a> {
Show 14 variants
SessionStart {
goal: &'a str,
},
PreToolCall {
name: &'a str,
args: &'a Value,
},
PostToolCall {
name: &'a str,
args: &'a Value,
result: &'a str,
duration_ms: u64,
},
PreCompact {
transcript_len: usize,
},
PostCompact {
removed: usize,
summary_chars: usize,
},
SessionEnd {
outcome: &'a RuntimeOutcome,
},
UserPromptSubmit {
content: &'a str,
},
Stop {
outcome: &'a RuntimeOutcome,
},
SubagentStart {
goal: &'a str,
depth: usize,
},
SubagentStop {
outcome: &'a RuntimeOutcome,
depth: usize,
},
PostToolCallFailure {
name: &'a str,
args: &'a Value,
error: &'a str,
},
PermissionDenied {
tool_name: &'a str,
reason: &'a str,
},
Notification {
message: &'a str,
},
Setup,
}Expand description
Events emitted at lifecycle points during an agent run.
This enum is #[non_exhaustive] — new variants may be added in future
releases without a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
SessionStart
Fired at the start of an agent run, before any LLM call.
PreToolCall
Fired before a tool is dispatched (after the permission hook).
Fields
PostToolCall
Fired after a tool returns.
Fields
PreCompact
Fired before compaction is attempted.
PostCompact
Fired after compaction completes.
Fields
SessionEnd
Fired at the end of an agent run, before returning.
Currently only dispatched by the legacy Agent path (deleted in
Goal 219). The AgentRuntime does not yet dispatch SessionEnd.
Fields
outcome: &'a RuntimeOutcomeThe outcome that will be returned.
UserPromptSubmit
Fired after the user submits a message, before the LLM processes it.
Stop
Fired when the agent completes normally (NoMoreToolCalls).
Fields
outcome: &'a RuntimeOutcomeThe final outcome.
SubagentStart
Fired before a sub-agent is dispatched.
SubagentStop
Fired after a sub-agent completes.
PostToolCallFailure
Fired when a tool call returns an error (before PostToolCall).
Fields
PermissionDenied
Fired when a permission check denies a tool call.
Fields
Notification
Fired when the agent emits a notification to the user.
Setup
Fired once at the very beginning, before SessionStart, for one-time setup.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for HookEvent<'a>
impl<'a> RefUnwindSafe for HookEvent<'a>
impl<'a> Send for HookEvent<'a>
impl<'a> Sync for HookEvent<'a>
impl<'a> Unpin for HookEvent<'a>
impl<'a> UnsafeUnpin for HookEvent<'a>
impl<'a> UnwindSafe for HookEvent<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more