Skip to main content

InProcessRuntimeBuilder

Struct InProcessRuntimeBuilder 

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

Builder for the public in-process runtime.

The builder owns a standalone runtime bundle:

  • HostComposition for capabilities and drivers
  • in-memory stores for sessions, files, storage, memory, and messages
  • seeded harness/agent/session entities

build() returns an InProcessRuntime that can execute turns in-process without the durable engine or the control-plane server.

Implementations§

Source§

impl InProcessRuntimeBuilder

Source

pub fn new() -> Self

Create a builder with runtime-safe built-in capabilities and no implicit LLM driver.

Embedders must either:

Source

pub fn host_composition(self, host_composition: HostComposition) -> Self

Replace the platform definition used by the runtime.

Source

pub fn capability<C: Capability + 'static>(self, capability: C) -> Self

Register an additional capability on the runtime platform.

Source

pub fn driver_registry(self, driver_registry: DriverRegistry) -> Self

Replace the platform driver registry.

Source

pub fn provider(self, provider: Provider) -> Self

Register a canonical runtime provider selected by ModelSpec.

Source

pub fn replace_provider(self, provider: Provider) -> Self

Register a provider, replacing any same-id registration, without changing the selected default model.

This is useful for deterministic test/simulation adapters. Ordinary applications should prefer Self::provider, which rejects duplicate identities instead of silently replacing them.

Source

pub fn provider_with_default_model( self, provider: Provider, model_id: impl Into<String>, ) -> Self

Register provider at build time — replacing any provider already registered under the same name — and default the runtime model to model_id on that provider when no other default was configured.

This is the seam behind deterministic simulated runtimes: the everruns-llmsim crate’s .llm_sim_as_default(...) extension builds an llmsim provider and routes it through here.

Source

pub fn default_model(self, model: ModelSpec) -> Self

Select the runtime’s default credential-free model specification.

Source

pub fn model_spec(self, model: ModelSpec) -> Self

Select a credential-free model served by a provider registered on this builder.

Source

pub fn backends(self, backends: HostBackends) -> Self

Supply a custom backend bundle instead of the built-in in-memory stores.

Source

pub fn workspace_policy(self, policy: WorkspacePolicy) -> Self

Apply a backend-independent policy to the resolved session filesystem.

The policy wraps whichever factory the platform selected, so in-memory, host-disk, database, and custom providers receive identical access checks without changing their implementations.

Source

pub fn with_session_task_registry( self, registry: Arc<dyn SessionTaskRegistry>, ) -> Self

Inject a session-task registry. Convenience over backends(...) that initializes an in-memory backend bundle on first use, so embedders can add the registry without assembling a full HostBackends.

Source

pub fn with_schedule_store_factory(self, factory: ScheduleStoreFactory) -> Self

Inject a per-org schedule store factory (see HostBackends).

Source

pub fn with_tool_context_extensions_factory( self, factory: ToolContextExtensionsFactory, ) -> Self

Inject higher-level typed services into tool contexts.

Source

pub fn with_subagent_delegate_factory( self, factory: SubagentDelegateFactory, ) -> Self

Inject a neutral subagent delegate factory.

Source

pub fn with_tool_augmentor(self, augmentor: Arc<dyn HostToolAugmentor>) -> Self

Inject higher-level turn-dependent tools.

Source

pub fn session_file_system_factory_context( self, context: SessionFileSystemFactoryContext, ) -> Self

Supply host dependencies needed by the platform session filesystem factory.

Source

pub fn provider_retry_config(self, config: LlmRetryConfig) -> Self

Override the bounded provider-recovery policy for this runtime.

Source

pub fn provider_stall_timeout(self, timeout: Duration) -> Self

Override the no-output provider stream stall timeout.

Source

pub fn harness(self, harness: SeededHarness) -> Self

Seed a harness definition (under its embedder-chosen id) into the runtime store.

Source

pub fn agent(self, agent: AgentDefinition) -> Self

Seed an agent definition into the runtime store.

Source

pub fn session(self, session: ExecutionSession) -> Self

Seed a session into the runtime store.

Source

pub fn single_session<F>(self, configure: F) -> Self

Seed one harness, one agent, and one session with a compact sub-builder.

The generated session id is exposed from the built runtime via InProcessRuntime::default_session_id.

Source

pub fn seed_text_file( self, session_id: SessionId, path: impl Into<String>, content: impl Into<String>, ) -> Self

Seed an additional text file directly into a session workspace.

This is applied after harness/agent/session initial_files are merged.

Source

pub fn with_plugin_dir(self, path: &Path) -> Result<Self>

Load a plugin from a local directory and make it available as a plugin:{name} capability.

Reads the plugin directory via PluginFileSet::from_dir and compiles it with compile_plugin at call time. A compilation failure is surfaced immediately as a configuration error so the problem is visible before the runtime is built. Non-fatal compilation warnings are logged via tracing::warn! and also collected so they can be inspected on the built runtime via InProcessRuntime::plugin_warnings.

After loading, agents and harnesses can reference the plugin by its plugin:{name} capability ref. The hydrated config carries the compiled DeclarativeCapabilityDefinition, which the core capability resolution path recognises without a registry entry (same path as declarative capabilities).

When using Self::single_session, call SingleSessionBuilder::agent_plugin to add the capability ref to the seeded agent, or use crate::AgentBuilder::capability / with_capability directly.

Source

pub fn plugin_capability(&self, name: &str) -> Option<CapabilityRef>

Return a hydrated everruns_capability::CapabilityRef for a previously loaded plugin.

Returns None when no plugin with that name was loaded via Self::with_plugin_dir. Primarily used by callers that need the hydrated config to seed it onto a harness or agent before building.

Source

pub async fn build(self) -> Result<InProcessRuntime>

Build the in-process runtime.

Returns a configuration error when no default model is available after applying explicit configuration and any requested llmsim setup.

Trait Implementations§

Source§

impl Default for InProcessRuntimeBuilder

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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.

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

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