Skip to main content

AgentBuilder

Struct AgentBuilder 

pub struct AgentBuilder { /* private fields */ }

Implementations§

Source§

impl AgentBuilder

Source

pub fn new() -> AgentBuilder

Source

pub fn model_provider( self, model_provider: Box<dyn ModelProvider>, ) -> AgentBuilder

Source

pub fn tools(self, tools: ScopedToolRegistry) -> AgentBuilder

Set the agent’s sealed tool set. Production callers obtain the crate::tools::scoped::ScopedToolRegistry from ScopedToolRegistry::assemble(...) (the .registry field of its output); raw Vec<Box<dyn Tool>> fixtures use ScopedToolRegistry::from_raw_for_test, available to this crate’s unit tests and, via the dev-only test-util feature, to other crates’ test builds. Self::build applies the allowed_tools and ACP memory-strip filters on top of the sealed set.

Source

pub fn memory(self, memory: Arc<dyn Memory>) -> AgentBuilder

Source

pub fn memory_security(self, security: Arc<SecurityPolicy>) -> AgentBuilder

The security policy the memory tools were assembled with, retained so a later route_memory_to_principal can rebind those tools to the routed handle. Defaults to a permissive policy if unset (test builders); the production constructor always supplies the agent’s real policy.

Source

pub fn observer(self, observer: Arc<dyn Observer>) -> AgentBuilder

Source

pub fn prompt_builder(self, prompt_builder: SystemPromptBuilder) -> AgentBuilder

Source

pub fn tool_dispatcher( self, tool_dispatcher: Box<dyn ToolDispatcher>, ) -> AgentBuilder

Source

pub fn memory_inject_cfg(self, cfg: MemoryInjectConfig) -> AgentBuilder

Stable half of the engine’s memory-context injection policy. When unset, defaults preserve the legacy loader shape (recall limit 5, the schema-default relevance floor).

Source

pub fn config(self, config: AliasedAgentConfig) -> AgentBuilder

Source

pub fn multimodal_config( self, multimodal_config: MultimodalConfig, ) -> AgentBuilder

Source

pub fn model_name(self, model_name: String) -> AgentBuilder

Source

pub fn model_provider_name(self, name: String) -> AgentBuilder

Source

pub fn temperature(self, temperature: Option<f64>) -> AgentBuilder

Source

pub fn workspace_dir(self, workspace_dir: PathBuf) -> AgentBuilder

Source

pub fn agent_workspace_dir(self, agent_workspace_dir: PathBuf) -> AgentBuilder

Source

pub fn identity_config(self, identity_config: IdentityConfig) -> AgentBuilder

Source

pub fn interaction_context( self, interaction: Option<InteractionContext>, ) -> AgentBuilder

Source

pub fn skills(self, skills: Vec<Skill>) -> AgentBuilder

Source

pub fn skills_prompt_mode( self, skills_prompt_mode: SkillsPromptInjectionMode, ) -> AgentBuilder

Source

pub fn auto_save(self, auto_save: bool) -> AgentBuilder

Source

pub fn memory_session_id( self, memory_session_id: Option<String>, ) -> AgentBuilder

Source

pub fn classification_config( self, classification_config: QueryClassificationConfig, ) -> AgentBuilder

Source

pub fn model_route_resolver( self, model_route_resolver: Arc<ModelRouteResolver>, ) -> AgentBuilder

Source

pub fn allowed_tools(self, allowed_tools: Option<Vec<String>>) -> AgentBuilder

Source

pub fn response_cache(self, cache: Option<Arc<ResponseCache>>) -> AgentBuilder

Source

pub fn security_summary(self, summary: Option<String>) -> AgentBuilder

Source

pub fn security(self, security: Arc<SecurityPolicy>) -> AgentBuilder

Set the agent’s filesystem policy. Config-backed construction passes the same Arc<SecurityPolicy> the agent’s file tools were built with, so the no-vision image-marker gate applies the identical read ledger. Unset builders get SecurityPolicy::default(), whose workspace_dir is . (the process cwd).

Source

pub fn autonomy_level(self, level: AutonomyLevel) -> AgentBuilder

Set the prompt autonomy fallback used only when no ApprovalManager is attached. Retained for compatibility with existing builder users.

Source

pub fn shell_profile(self, profile: Option<ShellProfile>) -> AgentBuilder

Set the shell reported in the system prompt.

Pass RuntimeAdapter::shell_profile() from the same adapter the agent’s tools were built with, so the prompt cannot name a shell other than the one that will execute. Unset means no shell is reported.

Source

pub fn approval_route(self, route: Option<ApprovalRoute>) -> AgentBuilder

Source

pub fn activated_tools( self, activated: Option<Arc<Mutex<ActivatedToolSet>>>, ) -> AgentBuilder

Source

pub fn mcp_pinned_blocks(self, blocks: Vec<PinnedResourceBlock>) -> AgentBuilder

Source

pub fn mcp_pinned_section(self, section: Option<String>) -> AgentBuilder

👎Deprecated:

pass attributed blocks via mcp_pinned_blocks; an unattributed section is pruned whenever a principal selector narrows the session

Compatibility setter for callers built against the pre-attribution signature, which took the rendered section as one string.

The string carries no <server>__<uri> attribution, so it cannot be matched against a principal’s allowed tool names. Restoring it as plain text would let construction-time content outlive a narrowing that no longer grants it, which is the leak the attributed blocks exist to close. It is therefore wrapped in a block keyed with UNATTRIBUTED_PINNED_KEY, a name no allowed-tool list can contain, so narrow_to_principal_tools prunes it on the first narrowing. A caller that never narrows (the unscoped constructions this setter exists for) sees the section exactly as before.

Prefer Self::mcp_pinned_blocks: it keeps content revocable per resource instead of dropping all of it at the first narrowing.

Source

pub fn mcp_deferred_section(self, section: Option<String>) -> AgentBuilder

Source

pub fn hook_runner(self, runner: Option<Arc<HookRunner>>) -> AgentBuilder

Source

pub fn approval_manager( self, manager: Option<Arc<ApprovalManager>>, ) -> AgentBuilder

Source

pub fn agent_alias(self, alias: String) -> AgentBuilder

Set the agent alias used for turn-span attribution.

Source

pub fn channel_name(self, name: String) -> AgentBuilder

Source

pub fn exclude_memory(self, exclude: bool) -> AgentBuilder

Source

pub fn provider_switch_config(self, cfg: ProviderSwitchConfig) -> AgentBuilder

Source

pub fn config_generation( self, generation: Arc<RwLock<RawRwLock, Arc<Config>>>, ) -> AgentBuilder

Install the generation cell that provider rebuilding and context-limit resolution both read. Callers that supply one MUST derive the agent’s context_limits_resolver from the SAME cell (see Agent::context_generation_limits_resolver); otherwise limits can be resolved from a config generation the provider box was not built from.

Source

pub fn build(self) -> Result<Agent, Error>

Trait Implementations§

Source§

impl Default for AgentBuilder

Source§

fn default() -> AgentBuilder

Returns the “default value” for a type. Read more

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

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

§

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.

§

impl<T> Instrument for T

§

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

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

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
§

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

§

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
§

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
§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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