Skip to main content

AgentRuntimeBuilder

Struct AgentRuntimeBuilder 

Source
pub struct AgentRuntimeBuilder {
    pub parent_agent_last_uuid: Option<String>,
    /* private fields */
}
Expand description

Builder for AgentRuntime.

§Required

  • llm(...) — The LLM provider.

All other methods are optional with sensible defaults.

Fields§

§parent_agent_last_uuid: Option<String>

UUID of the parent agent’s last message. When set, the first MessageAppended event will carry this as parent_uuid, branching the subagent’s messages off that point in the conversation tree (g155). Stored here for future multi-agent orchestration; not yet wired to the actual event emission path.

Implementations§

Source§

impl AgentRuntimeBuilder

Source

pub fn new() -> Self

Create a new builder with default values.

Source

pub fn parent_agent_last_uuid(self, uuid: impl Into<String>) -> Self

Set the UUID of the parent agent’s last message.

When set, this runtime’s messages will be stamped with this UUID as parent_uuid on their first MessageAppended event, branching the subagent chain off the given point in the parent’s conversation tree (g155). Currently stored for future multi-agent orchestration.

Source

pub fn llm(self, llm: Arc<dyn LlmProvider>) -> Self

Set the LLM provider (required).

Source

pub fn tools(self, tools: ToolRegistry) -> Self

Set the tool registry (optional, defaults to a local empty registry).

Source

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

Set an initial system prompt (optional).

This is prepended to the transcript as the first message.

Source

pub fn max_steps(self, n: usize) -> Self

Set the maximum number of LLM calls per turn (optional, default 32).

Source

pub fn max_transcript_chars(self, n: usize) -> Self

Set a transcript character limit (optional, default unlimited).

Source

pub fn compactor(self, compactor: Compactor) -> Self

Set an optional compactor for summarising old messages.

Source

pub fn streaming(self, enabled: bool) -> Self

Enable or disable streaming of partial tokens (optional, default false).

Source

pub fn planning_mode(self, mode: PlanningMode) -> Self

Set the planning mode (optional, defaults to PlanningMode::Immediate).

Source

pub fn hooks(self, hooks: HookRegistry) -> Self

Set the hook registry (optional).

Source

pub fn seed_transcript(self, messages: Vec<Message>) -> Self

Seed the transcript with messages from a previous session.

These messages are placed after any system prompt, before the first user turn. Use this to resume an existing conversation.

Source

pub fn permission_hook(self, hook: Arc<dyn PermissionHook>) -> Self

Set an optional permission hook for tool-call interception.

Source

pub fn event_sink(self, sink: Arc<dyn EventSink>) -> Self

Set the event sink for streaming events (optional, defaults to NullSink).

Source

pub fn shutdown_token(self, token: CancellationToken) -> Self

Set the cancellation token for graceful shutdown. When the token is cancelled, the runtime’s underlying kernel terminates the step loop with FinishReason::Cancelled at the next step boundary.

Source

pub fn build(self) -> Result<AgentRuntime>

Build the AgentRuntime.

Returns an error if the LLM provider is missing.

Trait Implementations§

Source§

impl Debug for AgentRuntimeBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AgentRuntimeBuilder

Source§

fn default() -> Self

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
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<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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 = 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