Skip to main content

HookEvent

Enum HookEvent 

Source
pub enum HookEvent<'a> {
    LoopIteration {
        turn: usize,
    },
    PreLlmCall {
        request: &'a CompletionRequest,
    },
    PostLlmCall {
        response: &'a CompletionResponse,
    },
    PreToolExecution {
        tool_name: &'a str,
        input: &'a Value,
    },
    PostToolExecution {
        tool_name: &'a str,
        output: &'a ToolOutput,
    },
    ContextCompaction {
        old_tokens: usize,
        new_tokens: usize,
    },
    SessionStart {
        session_id: &'a str,
    },
    SessionEnd {
        session_id: &'a str,
    },
}
Expand description

Events fired during the agentic loop for observability.

Variants§

§

LoopIteration

Start of a loop iteration.

Fields

§turn: usize

The current turn number (0-indexed).

§

PreLlmCall

Before calling the LLM provider.

Fields

§request: &'a CompletionRequest

The request about to be sent.

§

PostLlmCall

After receiving the LLM response.

Fields

§response: &'a CompletionResponse

The response received.

§

PreToolExecution

Before executing a tool.

Fields

§tool_name: &'a str

Name of the tool.

§input: &'a Value

Input arguments.

§

PostToolExecution

After executing a tool.

Fields

§tool_name: &'a str

Name of the tool.

§output: &'a ToolOutput

The tool’s output.

§

ContextCompaction

Context was compacted.

Fields

§old_tokens: usize

Token count before compaction.

§new_tokens: usize

Token count after compaction.

§

SessionStart

A session started.

Fields

§session_id: &'a str

The session identifier.

§

SessionEnd

A session ended.

Fields

§session_id: &'a str

The session identifier.

Trait Implementations§

Source§

impl<'a> Debug for HookEvent<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,