Struct AgentBuilder
pub struct AgentBuilder { /* private fields */ }Implementations§
Source§impl AgentBuilder
impl AgentBuilder
pub fn new() -> AgentBuilder
pub fn model_provider( self, model_provider: Box<dyn ModelProvider>, ) -> AgentBuilder
Sourcepub fn tools(self, tools: ScopedToolRegistry) -> AgentBuilder
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.
pub fn memory(self, memory: Arc<dyn Memory>) -> AgentBuilder
Sourcepub fn memory_security(self, security: Arc<SecurityPolicy>) -> AgentBuilder
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.
pub fn observer(self, observer: Arc<dyn Observer>) -> AgentBuilder
pub fn prompt_builder(self, prompt_builder: SystemPromptBuilder) -> AgentBuilder
pub fn tool_dispatcher( self, tool_dispatcher: Box<dyn ToolDispatcher>, ) -> AgentBuilder
Sourcepub fn memory_inject_cfg(self, cfg: MemoryInjectConfig) -> AgentBuilder
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).
pub fn config(self, config: AliasedAgentConfig) -> AgentBuilder
pub fn multimodal_config( self, multimodal_config: MultimodalConfig, ) -> AgentBuilder
pub fn model_name(self, model_name: String) -> AgentBuilder
pub fn model_provider_name(self, name: String) -> AgentBuilder
pub fn temperature(self, temperature: Option<f64>) -> AgentBuilder
pub fn workspace_dir(self, workspace_dir: PathBuf) -> AgentBuilder
pub fn agent_workspace_dir(self, agent_workspace_dir: PathBuf) -> AgentBuilder
pub fn identity_config(self, identity_config: IdentityConfig) -> AgentBuilder
pub fn interaction_context( self, interaction: Option<InteractionContext>, ) -> AgentBuilder
pub fn skills(self, skills: Vec<Skill>) -> AgentBuilder
pub fn skills_prompt_mode( self, skills_prompt_mode: SkillsPromptInjectionMode, ) -> AgentBuilder
pub fn auto_save(self, auto_save: bool) -> AgentBuilder
pub fn memory_session_id( self, memory_session_id: Option<String>, ) -> AgentBuilder
pub fn classification_config( self, classification_config: QueryClassificationConfig, ) -> AgentBuilder
pub fn model_route_resolver( self, model_route_resolver: Arc<ModelRouteResolver>, ) -> AgentBuilder
pub fn allowed_tools(self, allowed_tools: Option<Vec<String>>) -> AgentBuilder
pub fn response_cache(self, cache: Option<Arc<ResponseCache>>) -> AgentBuilder
pub fn security_summary(self, summary: Option<String>) -> AgentBuilder
Sourcepub fn security(self, security: Arc<SecurityPolicy>) -> AgentBuilder
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).
Sourcepub fn autonomy_level(self, level: AutonomyLevel) -> AgentBuilder
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.
Sourcepub fn shell_profile(self, profile: Option<ShellProfile>) -> AgentBuilder
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.
pub fn approval_route(self, route: Option<ApprovalRoute>) -> AgentBuilder
pub fn activated_tools( self, activated: Option<Arc<Mutex<ActivatedToolSet>>>, ) -> AgentBuilder
pub fn mcp_pinned_blocks(self, blocks: Vec<PinnedResourceBlock>) -> AgentBuilder
Sourcepub 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
pub fn mcp_pinned_section(self, section: Option<String>) -> AgentBuilder
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.
pub fn mcp_deferred_section(self, section: Option<String>) -> AgentBuilder
pub fn hook_runner(self, runner: Option<Arc<HookRunner>>) -> AgentBuilder
pub fn approval_manager( self, manager: Option<Arc<ApprovalManager>>, ) -> AgentBuilder
Sourcepub fn agent_alias(self, alias: String) -> AgentBuilder
pub fn agent_alias(self, alias: String) -> AgentBuilder
Set the agent alias used for turn-span attribution.
pub fn channel_name(self, name: String) -> AgentBuilder
pub fn exclude_memory(self, exclude: bool) -> AgentBuilder
pub fn provider_switch_config(self, cfg: ProviderSwitchConfig) -> AgentBuilder
Sourcepub fn config_generation(
self,
generation: Arc<RwLock<RawRwLock, Arc<Config>>>,
) -> AgentBuilder
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.
pub fn build(self) -> Result<Agent, Error>
Trait Implementations§
Source§impl Default for AgentBuilder
impl Default for AgentBuilder
Source§fn default() -> AgentBuilder
fn default() -> AgentBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for AgentBuilder
impl !UnwindSafe for AgentBuilder
impl Freeze for AgentBuilder
impl Send for AgentBuilder
impl Sync for AgentBuilder
impl Unpin for AgentBuilder
impl UnsafeUnpin for AgentBuilder
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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