Skip to main content

AgentSessionConfig

Struct AgentSessionConfig 

Source
pub struct AgentSessionConfig {
Show 23 fields pub agent: Option<Agent>, pub provider: Option<Arc<dyn Provider>>, pub session_manager: SessionManager, pub settings_manager: SettingsManager, pub cwd: String, pub scoped_models: Vec<ScopedModel>, pub initial_active_tool_names: Option<Vec<String>>, pub allowed_tool_names: Option<Vec<String>>, pub excluded_tool_names: Option<Vec<String>>, pub tools: Vec<Arc<dyn AgentTool>>, pub system_prompt: String, pub model: Option<Model>, pub thinking_level: ModelThinkingLevel, pub messages: Vec<AgentMessage>, pub extension_runner: Option<Arc<dyn ExtensionRunner>>, pub host_extension_runner: Option<Arc<HostExtensionRunner>>, pub model_runtime: Option<Arc<ModelRuntime>>, pub compaction_stream_override: Option<CompactionStreamHandle>, pub skills: Vec<Skill>, pub prompt_templates: Vec<PromptTemplate>, pub resource_loader: Option<DefaultResourceLoader>, pub session_start_event: Option<SessionStartEvent>, pub base_config: Option<AgentLoopConfig>,
}
Expand description

Construction inputs for AgentSession.

The services factory builds this and passes it to AgentSession::new. Product dependencies remain concrete: model_runtime is a typed handle, while compaction test overrides use their own typed seam.

Fields§

§agent: Option<Agent>

Pre-built agent. When None, AgentSession::new builds one from provider + defaults and installs SessionHooks closures.

§provider: Option<Arc<dyn Provider>>

Provider used when agent is None.

§session_manager: SessionManager

Session persistence manager (moved into an async mutex).

§settings_manager: SettingsManager

Settings manager (owned; later slices mutate retry/compaction flags).

§cwd: String

Working directory.

§scoped_models: Vec<ScopedModel>

Scoped models from --models.

§initial_active_tool_names: Option<Vec<String>>

Initial active built-in tool names.

§allowed_tool_names: Option<Vec<String>>

Optional tool allowlist.

§excluded_tool_names: Option<Vec<String>>

Optional tool denylist.

§tools: Vec<Arc<dyn AgentTool>>

Initial tools installed on the agent when building from provider.

§system_prompt: String

Initial system prompt.

§model: Option<Model>

Initial model (when building agent).

§thinking_level: ModelThinkingLevel

Initial thinking level.

§messages: Vec<AgentMessage>

Initial transcript messages.

§extension_runner: Option<Arc<dyn ExtensionRunner>>

Extension runner (defaults to NullExtensionRunner).

§host_extension_runner: Option<Arc<HostExtensionRunner>>

Concrete host runner retained for reload/restart (no trait downcast).

§model_runtime: Option<Arc<ModelRuntime>>

Typed model/auth runtime used by model selection and compaction.

§compaction_stream_override: Option<CompactionStreamHandle>

Optional compaction stream override for tests and headless integrations.

§skills: Vec<Skill>

Skills for /skill:name expansion (populated by resources slice).

§prompt_templates: Vec<PromptTemplate>

Prompt templates for /template expansion.

§resource_loader: Option<DefaultResourceLoader>

Resource loader retained for extension-driven resource refreshes.

§session_start_event: Option<SessionStartEvent>

Session-start metadata emitted to extensions on first bind (None = default startup).

§base_config: Option<AgentLoopConfig>

Base agent loop config overrides (hooks are always installed by session).

Implementations§

Source§

impl AgentSessionConfig

Source

pub fn test_config( provider: Arc<dyn Provider>, model: Model, ) -> Result<Self, AgentSessionError>

Minimal config for tests: in-memory session + null extensions.

SessionManager::in_memory with no custom id only fails if validation is introduced later; the None options path is the documented default.

§Errors

Returns AgentSessionError::Session if both in-memory session construction attempts fail.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more