Skip to main content

AgentSystemBuilder

Struct AgentSystemBuilder 

Source
pub struct AgentSystemBuilder<C, S, M, H = NoRapHttp>{ /* private fields */ }
Expand description

Builder for an AgentSystem.

Two construction modes decide how messages flow back into the system:

Tool/prompt configuration is either static (the tools, extra_system_prompt, and rap_notifier methods — every thread sees the same set) or dynamic via thread_config, which resolves a ThreadConfig per thread load. The built-in thread and subscription tools (spawn_thread, report_to_parent, close_thread, send_message_to_child, cancel_subscription, sleep_until_event_or_input) are added on top in both cases; disable with without_builtin_tools.

Implementations§

Source§

impl<C, S, M, H> AgentSystemBuilder<C, S, M, H>
where C: ConversationStore + 'static, S: StateStore + 'static, M: InputSender + 'static, H: HttpClient + 'static,

Source

pub fn tool(self, tool: Box<dyn Tool<M>>) -> Self

Register an additional tool (static configuration).

Source

pub fn tools(self, tools: impl IntoIterator<Item = Box<dyn Tool<M>>>) -> Self

Register additional tools (static configuration).

Source

pub fn extra_system_prompt(self, prompt: impl Into<String>) -> Self

Append text to the built-in system prompt (static configuration).

Source

pub fn thread_config<H2: HttpClient + 'static>( self, source: impl ThreadConfigSource<M, H2> + 'static, ) -> AgentSystemBuilder<C, S, M, H2>

Resolve tools, prompt, and notifier dynamically per thread instead of using the static tools/extra_system_prompt/rap_notifier configuration (which must not be combined with a source). Use this when threads need different toolsets — e.g. one session per working directory, each with its own tool servers.

Source

pub fn callback_url(self, url: impl Into<String>) -> Self

The base URL RAP tool servers should POST results to.

Source

pub fn without_builtin_tools(self) -> Self

Do not register the built-in thread/subscription tools. Useful for systems that need a minimal or fully custom toolset.

Source

pub fn with_tokio_sleep_tools(self) -> Self

Register timed sleep tools backed by in-process tokio timers (sleep, sleep_until). Only suitable for resident runtimes; on serverless platforms register durable-timer equivalents instead.

Source

pub fn rap_notifier<H2: HttpClient + 'static>( self, notifier: RapNotifier<H2>, ) -> AgentSystemBuilder<C, S, M, H2>

Configure the notifier that sends best-effort lifecycle notifications (tool cancellation, thread closure) to RAP tool servers (static configuration; with thread_config the notifier comes from each thread’s ThreadConfig instead).

Source

pub fn build(self) -> AgentSystem<C, S, M, H>

Build a step-mode system driven by an external transport.

Source§

impl<C, S, M> AgentSystemBuilder<C, S, M, NoRapHttp>
where C: ConversationStore + 'static, S: StateStore + 'static, M: InputSender + 'static,

Source

pub fn new( conversation_store: C, state_store: S, model: impl ModelSource + 'static, sender: M, ) -> Self

Start building a system whose loopback path is sender (the platform’s own transport, e.g. SQS). Use new_local for a self-contained in-process system.

Source§

impl<C, S> AgentSystemBuilder<C, S, ChannelSender, NoRapHttp>
where C: ConversationStore + 'static, S: StateStore + 'static,

Source

pub fn new_local( conversation_store: C, state_store: S, model: impl ModelSource + 'static, ) -> Self

Start building a self-contained local system with an internal in-process input queue. Tools should be registered against ChannelSender.

Source§

impl<C, S, H> AgentSystemBuilder<C, S, ChannelSender, H>
where C: ConversationStore + 'static, S: StateStore + 'static, H: HttpClient + 'static,

Source

pub fn build_local(self) -> LocalAgentSystem<C, S, H>

Build a local system without starting it. Most embeddings can call start or start_with_observer directly; use this two-phase form when the built LocalAgentSystem must be held before running it. Requires construction via new_local.

Source

pub fn start(self) -> LaunchingSystem<C, S, H>

Build the local system and start it with the built-in thread-builder API: create threads through LaunchingSystem::thread_builder, and reattach to existing threads with LaunchingSystem::thread_handle.

Shorthand for build_local() followed by LocalAgentSystem::start. Requires construction via new_local.

Source

pub fn start_with_observer<O, F>( self, make_observer: F, ) -> RunningSystem<O::SubscribeRequest>
where O: ThreadObserver + 'static, F: Fn(&ThreadId<str>) -> O + 'static,

Build the local system and start it with a custom ThreadObserver.

Shorthand for build_local() followed by LocalAgentSystem::start_with_observer, which documents the observer contract. Requires construction via new_local.

Auto Trait Implementations§

§

impl<C, S, M, H = NoRapHttp> !RefUnwindSafe for AgentSystemBuilder<C, S, M, H>

§

impl<C, S, M, H = NoRapHttp> !Send for AgentSystemBuilder<C, S, M, H>

§

impl<C, S, M, H = NoRapHttp> !Sync for AgentSystemBuilder<C, S, M, H>

§

impl<C, S, M, H = NoRapHttp> !UnwindSafe for AgentSystemBuilder<C, S, M, H>

§

impl<C, S, M, H> Freeze for AgentSystemBuilder<C, S, M, H>
where C: Freeze, S: Freeze, Vec<Box<dyn Tool<M>>>: Freeze, Option<Box<dyn ThreadConfigSource<M, H>>>: Freeze, M: Freeze, Option<RapNotifier<H>>: Freeze, Option<LaunchRegistry<M>>: Freeze,

§

impl<C, S, M, H> Unpin for AgentSystemBuilder<C, S, M, H>
where C: Unpin, S: Unpin, Vec<Box<dyn Tool<M>>>: Unpin, Option<Box<dyn ThreadConfigSource<M, H>>>: Unpin, M: Unpin, Option<RapNotifier<H>>: Unpin, Option<LaunchRegistry<M>>: Unpin,

§

impl<C, S, M, H> UnsafeUnpin for AgentSystemBuilder<C, S, M, H>

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<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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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