Skip to main content

CallbackContext

Trait CallbackContext 

Source
pub trait CallbackContext: ReadonlyContext {
    // Required method
    fn artifacts(&self) -> Option<Arc<dyn Artifacts>>;

    // Provided methods
    fn tool_outcome(&self) -> Option<ToolOutcome> { ... }
    fn tool_name(&self) -> Option<&str> { ... }
    fn tool_input(&self) -> Option<&Value> { ... }
    fn shared_state(&self) -> Option<Arc<SharedState>> { ... }
}
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

Required Methods§

Source

fn artifacts(&self) -> Option<Arc<dyn Artifacts>>

Provided Methods§

Source

fn tool_outcome(&self) -> Option<ToolOutcome>

Returns structured metadata about the most recent tool execution. Available in after-tool callbacks and plugin hooks. Returns None when not in a tool execution context.

Source

fn tool_name(&self) -> Option<&str>

Returns the name of the tool about to be executed. Available in before-tool and after-tool callback contexts.

Source

fn tool_input(&self) -> Option<&Value>

Returns the input arguments for the tool about to be executed. Available in before-tool and after-tool callback contexts.

Source

fn shared_state(&self) -> Option<Arc<SharedState>>

Returns the shared state for parallel agent coordination. Returns None when not running inside a ParallelAgent with shared state enabled.

Implementors§