pub struct AgentLlmConfig {
pub model: Model,
pub max_tokens: Option<u32>,
pub reasoning: ReasoningLevel,
pub sampling: SamplingParams,
pub user: Option<String>,
pub provider_preferences: Option<ProviderPreferences>,
pub session_id: Option<SessionId>,
}Expand description
Complete LLM configuration for an agent turn.
Passed to LlmProvider::complete
and cloned into each Started event so listeners know the current config.
Fields§
§model: ModelThe model to use for this turn (includes provider prefix).
max_tokens: Option<u32>Maximum output tokens. If None, the provider decides.
reasoning: ReasoningLevelWhether reasoning/thinking mode is enabled.
sampling: SamplingParamsExtended sampling parameters (temperature, top_p, penalties).
user: Option<String>Opaque user identifier for per-user tracking in provider dashboards.
provider_preferences: Option<ProviderPreferences>Provider routing preferences (used by OpenRouter).
session_id: Option<SessionId>Stable conversation identifier for provider cache routing.
Implementations§
Source§impl AgentLlmConfig
impl AgentLlmConfig
Sourcepub fn new(model: Model) -> Self
pub fn new(model: Model) -> Self
Create a default LLM configuration. Use with_model() to set the model.
Sourcepub fn with_user(self, user: impl Into<String>) -> Self
pub fn with_user(self, user: impl Into<String>) -> Self
Set the user identifier for per-user tracking in provider dashboards.
Sourcepub fn with_reasoning(self, level: ReasoningLevel) -> Self
pub fn with_reasoning(self, level: ReasoningLevel) -> Self
Set the reasoning/thinking effort level.
Sourcepub fn with_provider_preferences(self, prefs: ProviderPreferences) -> Self
pub fn with_provider_preferences(self, prefs: ProviderPreferences) -> Self
Set provider routing preferences (used by OpenRouter).
Sourcepub fn with_session_id(self, session_id: impl Into<SessionId>) -> Self
pub fn with_session_id(self, session_id: impl Into<SessionId>) -> Self
Set the stable conversation identifier used for provider cache routing.
Sourcepub fn with_model(&self, model: Model) -> Self
pub fn with_model(&self, model: Model) -> Self
Swap in a different model while preserving all other parameters.