Skip to main content

HistoryProcessor

Type Alias HistoryProcessor 

Source
pub type HistoryProcessor = Box<dyn Fn(Arc<dyn CallbackContext>, Vec<Content>) -> Pin<Box<dyn Future<Output = Result<Vec<Content>, AdkError>> + Send>> + Sync + Send>;
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 Rewrites an agent’s conversation history before each model request of a turn.

Receives the history the agent continues from and returns its replacement: later steps of the turn append to the returned contents, so a compaction runs once and carries over. The history holds the agent’s own contents only, never what a toolset, plugin, invocation hook or BeforeModelCallback adds to one request. An error ends the turn with that error.

A cut that keeps a function response without its call is rejected by providers; balanced_content_cut finds a safe one.

Aliased Type§

pub struct HistoryProcessor(/* private fields */);