Skip to main content

InProcessHost

Struct InProcessHost 

Source
pub struct InProcessHost { /* private fields */ }
Expand description

In-process host: nested TurnRuntime with shared sampler, tool pool, and limits.

Implementations§

Source§

impl InProcessHost

Source

pub fn new(sampler: Arc<dyn LlmSampler>, tools: Vec<SharedTool>) -> Self

Create a host with default depth/concurrency caps and unlimited agent budget.

Source

pub const fn with_agent_budget(self, budget: u64) -> Self

Absolute agent-call budget for this host (every successful admission counts 1).

Source

pub const fn with_max_spawn_depth(self, max: Option<u32>) -> Self

Cap nesting depth (depth must be < max). None disables the limit.

Source

pub fn with_max_concurrent_children(self, max: Option<usize>) -> Self

Cap concurrent in-flight children. None disables the limit.

Source

pub fn with_agent_registry(self, registry: AgentRegistry) -> Self

Install a full agent registry for agent_type resolution.

Source

pub fn with_agent_definitions( self, defs: impl IntoIterator<Item = AgentDefinition>, ) -> Self

Register agent definitions (merged into the host registry).

Source

pub fn with_prompt_assembler(self, assembler: Arc<dyn PromptAssembler>) -> Self

Install a prompt assembler applied when resolving agent_type definitions.

Source

pub fn with_isolation(self, isolation: Arc<dyn IsolationBackend>) -> Self

Install an isolation backend (default InProcessIsolation).

Source

pub fn with_metrics(self, metrics: SharedMetrics) -> Self

Metrics sink for spawn/turn accounting.

Source

pub fn with_parent_handle(self, handle: ChatStateHandle) -> Self

Parent conversation handle used when fork_context is set without messages.

Source

pub fn with_run_store(self, store: Arc<dyn WorkflowRunStore>) -> Self

Workflow run store enabling resume_from on spawn opts.

Source

pub fn with_instructions(self, instructions: impl Into<String>) -> Self

Override child system instructions (used when agent_type is unset).

Source

pub fn agent_registry(&self) -> &AgentRegistry

Shared agent registry (clone is cheap).

Source

pub fn agents_spent(&self) -> u64

Agents admitted so far (including in-flight after reservation).

Source

pub fn agents_remaining(&self) -> Option<u64>

Remaining budget when capped.

Source

pub const fn max_spawn_depth(&self) -> Option<u32>

Configured max spawn depth.

Source

pub const fn max_concurrent_children(&self) -> Option<usize>

Configured max concurrent children.

Trait Implementations§

Source§

impl Debug for InProcessHost

Source§

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

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

impl SessionHost for InProcessHost

Source§

fn spawn_agent<'life0, 'async_trait>( &'life0 self, opts: SpawnOpts, ) -> Pin<Box<dyn Future<Output = Result<AgentRunResult, MachiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Spawn and run a nested agent to completion.
Source§

fn spawn_agents<'life0, 'async_trait>( &'life0 self, opts: Vec<SpawnOpts>, ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentRunResult>, MachiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Spawn many nested agents concurrently (order of results matches input).

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