pub struct PipelineConfig {Show 16 fields
pub max_context_tokens: usize,
pub max_output_tokens: usize,
pub enable_tools: bool,
pub iteration_budget_enabled: bool,
pub max_iterations: usize,
pub tracked_task_max_iterations: usize,
pub enable_context_reduction: bool,
pub enable_fallback: bool,
pub always_include_categories: Vec<ContextCategory>,
pub max_history_messages: usize,
pub log_token_usage: bool,
pub auto_compact_threshold: f64,
pub compaction_strategy: CompactionStrategy,
pub tool_result_max_chars: usize,
pub tool_routing_strategy: ToolRoutingStrategy,
pub reflection: ReflectionConfig,
}Expand description
Configuration for the pipeline
Fields§
§max_context_tokens: usizeMaximum tokens for context (model-dependent)
max_output_tokens: usizeMaximum output tokens
enable_tools: boolEnable tool execution
iteration_budget_enabled: boolWhether to enforce an iteration budget for agentic loops.
max_iterations: usizeMaximum agentic loop iterations for general requests when budgeting is enabled.
tracked_task_max_iterations: usizeMaximum agentic loop iterations for tracked-task requests when budgeting is enabled.
enable_context_reduction: boolEnable context reduction
enable_fallback: boolEnable fallback to secondary provider
always_include_categories: Vec<ContextCategory>Categories to always include
max_history_messages: usizeMaximum number of history messages to include in prompt Older messages are dropped to save tokens
log_token_usage: boolLog token usage before/after optimization
auto_compact_threshold: f64Auto-compaction threshold (0.0-1.0) When estimated tokens exceed this percentage of the limit, automatically trigger context summarization. Default: 0.8 (80% of limit)
compaction_strategy: CompactionStrategyStrategy to use when auto-compaction is triggered Default: CompactionStrategy::Summarize
tool_result_max_chars: usizeMaximum characters to include from a single tool result in the continuation prompt. Results larger than this are truncated with an indicator so the LLM knows content was omitted. Default: 8000 (up from the previous hard-coded 2000)
tool_routing_strategy: ToolRoutingStrategyStrategy for selecting tools to expose to the LLM for each request.
ToolRoutingStrategy::Keyword(default): uses the keyword-basedRequestAnalyzer— fast, deterministic, zero extra latency.ToolRoutingStrategy::Llm: always fires a pre-flight LLM call to semantically select tools — highest accuracy, one extra round-trip.ToolRoutingStrategy::Hybrid: uses keywords when confidence is high; falls back to LLM routing when confidence is below the threshold.
reflection: ReflectionConfigConfiguration for ERL-inspired experiential reflection.
When enabled, the agent generates structured reflections on suboptimal turns and stores them for retrieval in future context injection.
Implementations§
Source§impl PipelineConfig
impl PipelineConfig
Sourcepub fn context_tokens_for_provider(provider: &str) -> usize
pub fn context_tokens_for_provider(provider: &str) -> usize
Get recommended context tokens for a specific provider (static fallback).
Prefer [for_model] or [for_model_with_cache] for dynamic, model-specific limits.
This method only provides provider-level defaults and may be inaccurate for
models with different context sizes (e.g., gpt-3.5-turbo vs gpt-4o).
Sourcepub fn for_provider(provider: &str) -> PipelineConfig
pub fn for_provider(provider: &str) -> PipelineConfig
Create config optimized for a specific provider (static).
Prefer [for_model] for model-specific limits.
Sourcepub fn for_model(provider: &str, model_id: &str) -> PipelineConfig
pub fn for_model(provider: &str, model_id: &str) -> PipelineConfig
Create config optimized for a specific provider and model using dynamic capabilities.
This uses heuristic-based model capabilities. For learned/cached capabilities,
use [for_model_with_cache] instead.
Sourcepub fn for_model_with_cache(
provider: &str,
model_id: &str,
cache: &ModelCapabilitiesCache,
) -> PipelineConfig
pub fn for_model_with_cache( provider: &str, model_id: &str, cache: &ModelCapabilitiesCache, ) -> PipelineConfig
Create config for a model using a capabilities cache (for learned/API-discovered limits).
This method uses cached capabilities if available, falling back to heuristics. The cache can contain:
- API-discovered limits (most accurate)
- Error-learned limits (from context_length_exceeded errors)
- User-configured overrides
Sourcepub fn update_from_cache(
&mut self,
provider: &str,
model_id: &str,
cache: &ModelCapabilitiesCache,
)
pub fn update_from_cache( &mut self, provider: &str, model_id: &str, cache: &ModelCapabilitiesCache, )
Update this config’s context limits from a capabilities cache.
Useful when you want to reconfigure an existing pipeline after learning new model limits (e.g., from a context_length_exceeded error).
Trait Implementations§
Source§impl Clone for PipelineConfig
impl Clone for PipelineConfig
Source§fn clone(&self) -> PipelineConfig
fn clone(&self) -> PipelineConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PipelineConfig
impl Debug for PipelineConfig
Source§impl Default for PipelineConfig
impl Default for PipelineConfig
Source§fn default() -> PipelineConfig
fn default() -> PipelineConfig
Source§impl PipelineConfigExt for PipelineConfig
impl PipelineConfigExt for PipelineConfig
Source§fn with_user_settings(self, settings: &PipelineSettings) -> Self
fn with_user_settings(self, settings: &PipelineSettings) -> Self
AppConfig.pipeline to this configuration. Read moreAuto Trait Implementations§
impl Freeze for PipelineConfig
impl RefUnwindSafe for PipelineConfig
impl Send for PipelineConfig
impl Sync for PipelineConfig
impl Unpin for PipelineConfig
impl UnwindSafe for PipelineConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().