Normandy.Hooks.Context (normandy v2.2.0)

View Source

What a hook callback knows about the agent it runs for: the event, the agent's name (agent_name), model and session_id, the turn_id, and values (the agent's tool_context). It carries no config, memory or client, so a hook that logs it leaks nothing the agent was not told to share.

turn_id is nil for on_session_start, on_passivate and on_prompt (the prompt is admitted before the turn starts), and for on_turn_end after a rejected input or a BaseAgent run that raised.

Summary

Functions

Builds the context for event from config; turn_id: in opts overrides the memory's.

Types

t()

@type t() :: %Normandy.Hooks.Context{
  agent_name: String.t() | nil,
  event: atom() | nil,
  model: String.t() | nil,
  session_id: String.t() | nil,
  turn_id: String.t() | nil,
  values: map()
}

Functions

build(config, event, opts \\ [])

@spec build(map(), atom(), keyword()) :: t()

Builds the context for event from config; turn_id: in opts overrides the memory's.