Skip to main content

Module callbacks

Module callbacks 

Source
Expand description

Core traits and types.

Always available regardless of feature flags. Includes:

  • Agent - The fundamental trait for all agents
  • Tool / Toolset - For extending agents with capabilities
  • Session / State - For managing conversation context
  • Event - For streaming agent responses
  • AdkError / Result - Unified error handling Callback type aliases for agent, model, and tool lifecycle hooks.

Structs§

EventsCompactionConfig
Configuration for automatic context compaction.

Enums§

BeforeModelResult
Result from a BeforeModel callback

Traits§

BaseEventsSummarizer
Trait for summarizing events during context compaction.

Type Aliases§

AfterAgentCallback
Callback invoked after an agent completes. Return Ok(Some(content)) to override.
AfterModelCallback
Callback invoked after a model call. Return Ok(Some(response)) to override.
AfterToolCallback
Callback invoked after a tool executes. Return Ok(Some(content)) to override the result.
AfterToolCallbackFull
Rich after-tool callback that receives the tool, arguments, and response.
BeforeAgentCallback
Callback invoked before an agent runs. Return Ok(Some(content)) to short-circuit.
BeforeModelCallback
Callback invoked before a model call. Can modify the request or skip the call entirely.
BeforeToolCallback
Callback invoked before a tool executes. Return Ok(Some(content)) to skip execution.
GlobalInstructionProvider
Alias for InstructionProvider used at the global (runner) level.
InstructionProvider
Async function that generates dynamic instructions from context.
OnToolErrorCallback
Callback invoked when a tool execution fails (after retries are exhausted).