pub struct InProcessRuntimeBuilder { /* private fields */ }Expand description
Builder for the public in-process runtime.
The builder owns a standalone runtime bundle:
PlatformDefinitionfor 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
impl InProcessRuntimeBuilder
Sourcepub fn new() -> InProcessRuntimeBuilder
pub fn new() -> InProcessRuntimeBuilder
Create a builder with runtime-safe built-in capabilities and no implicit LLM driver.
Embedders must either:
- call
Self::llm_simfor deterministic local examples/tests, or - register their own driver(s) on the platform definition and set a
default model via
Self::default_model.
Sourcepub fn mcp_auth_provider(
self,
provider: Arc<dyn McpAuthProvider>,
) -> InProcessRuntimeBuilder
pub fn mcp_auth_provider( self, provider: Arc<dyn McpAuthProvider>, ) -> InProcessRuntimeBuilder
Set the auth provider used to acquire credentials for scoped MCP servers (knowledge/integrations/runtime-mcp.md D3). Defaults to no credentials, suitable for unauthenticated servers or servers carrying literal auth headers.
Sourcepub fn platform_definition(
self,
platform_definition: PlatformDefinition,
) -> InProcessRuntimeBuilder
pub fn platform_definition( self, platform_definition: PlatformDefinition, ) -> InProcessRuntimeBuilder
Replace the platform definition used by the runtime.
Sourcepub fn capability<C>(self, capability: C) -> InProcessRuntimeBuilderwhere
C: Capability + 'static,
pub fn capability<C>(self, capability: C) -> InProcessRuntimeBuilderwhere
C: Capability + 'static,
Register an additional capability on the runtime platform.
Sourcepub fn driver_registry(
self,
driver_registry: DriverRegistry,
) -> InProcessRuntimeBuilder
pub fn driver_registry( self, driver_registry: DriverRegistry, ) -> InProcessRuntimeBuilder
Replace the platform driver registry.
Sourcepub fn provider(self, provider: RuntimeProvider) -> InProcessRuntimeBuilder
pub fn provider(self, provider: RuntimeProvider) -> InProcessRuntimeBuilder
Register a canonical runtime provider selected by ModelSpec.
Sourcepub fn llm_sim(self, config: LlmSimConfig) -> InProcessRuntimeBuilder
pub fn llm_sim(self, config: LlmSimConfig) -> InProcessRuntimeBuilder
Register the built-in llmsim driver for deterministic local execution.
Sourcepub fn default_model(self, model: ResolvedModel) -> InProcessRuntimeBuilder
pub fn default_model(self, model: ResolvedModel) -> InProcessRuntimeBuilder
Set the runtime default model used when sessions/agents do not override it.
Sourcepub fn model_spec(self, model: ModelSpec) -> InProcessRuntimeBuilder
pub fn model_spec(self, model: ModelSpec) -> InProcessRuntimeBuilder
Select a credential-free model served by a provider registered on this builder.
Sourcepub fn backends(self, backends: HostBackends) -> InProcessRuntimeBuilder
pub fn backends(self, backends: HostBackends) -> InProcessRuntimeBuilder
Supply a custom backend bundle instead of the built-in in-memory stores.
Sourcepub fn workspace_policy(
self,
policy: WorkspacePolicy,
) -> InProcessRuntimeBuilder
pub fn workspace_policy( self, policy: WorkspacePolicy, ) -> InProcessRuntimeBuilder
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.
Sourcepub fn with_session_task_registry(
self,
registry: Arc<dyn SessionTaskRegistry>,
) -> InProcessRuntimeBuilder
pub fn with_session_task_registry( self, registry: Arc<dyn SessionTaskRegistry>, ) -> InProcessRuntimeBuilder
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.
Sourcepub fn with_schedule_store_factory(
self,
factory: Arc<dyn Fn(i64) -> Arc<dyn SessionScheduleStore> + Sync + Send>,
) -> InProcessRuntimeBuilder
pub fn with_schedule_store_factory( self, factory: Arc<dyn Fn(i64) -> Arc<dyn SessionScheduleStore> + Sync + Send>, ) -> InProcessRuntimeBuilder
Inject a per-org schedule store factory (see HostBackends).
Sourcepub fn with_platform_store_factory(
self,
factory: Arc<dyn Fn(i64, TypedId<SessionIdMarker>) -> Arc<dyn PlatformStore> + Sync + Send>,
) -> InProcessRuntimeBuilder
pub fn with_platform_store_factory( self, factory: Arc<dyn Fn(i64, TypedId<SessionIdMarker>) -> Arc<dyn PlatformStore> + Sync + Send>, ) -> InProcessRuntimeBuilder
Inject a per-(org, session) platform store factory (see HostBackends).
Sourcepub fn session_file_system_factory_context(
self,
context: SessionFileSystemFactoryContext,
) -> InProcessRuntimeBuilder
pub fn session_file_system_factory_context( self, context: SessionFileSystemFactoryContext, ) -> InProcessRuntimeBuilder
Supply host dependencies needed by the platform session filesystem factory.
Sourcepub fn provider_retry_config(
self,
config: LlmRetryConfig,
) -> InProcessRuntimeBuilder
pub fn provider_retry_config( self, config: LlmRetryConfig, ) -> InProcessRuntimeBuilder
Override the bounded provider-recovery policy for this runtime.
Sourcepub fn provider_stall_timeout(
self,
timeout: Duration,
) -> InProcessRuntimeBuilder
pub fn provider_stall_timeout( self, timeout: Duration, ) -> InProcessRuntimeBuilder
Override the no-output provider stream stall timeout.
Sourcepub fn harness(self, harness: Harness) -> InProcessRuntimeBuilder
pub fn harness(self, harness: Harness) -> InProcessRuntimeBuilder
Seed a harness into the runtime store.
Sourcepub fn agent(self, agent: Agent) -> InProcessRuntimeBuilder
pub fn agent(self, agent: Agent) -> InProcessRuntimeBuilder
Seed an agent into the runtime store.
Sourcepub fn session(self, session: Session) -> InProcessRuntimeBuilder
pub fn session(self, session: Session) -> InProcessRuntimeBuilder
Seed a session into the runtime store.
Sourcepub fn single_session<F>(self, configure: F) -> InProcessRuntimeBuilder
pub fn single_session<F>(self, configure: F) -> InProcessRuntimeBuilder
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.
Sourcepub fn seed_text_file(
self,
session_id: TypedId<SessionIdMarker>,
path: impl Into<String>,
content: impl Into<String>,
) -> InProcessRuntimeBuilder
pub fn seed_text_file( self, session_id: TypedId<SessionIdMarker>, path: impl Into<String>, content: impl Into<String>, ) -> InProcessRuntimeBuilder
Seed an additional text file directly into a session workspace.
This is applied after harness/agent/session initial_files are merged.
Sourcepub fn with_plugin_dir(
self,
path: &Path,
) -> Result<InProcessRuntimeBuilder, AgentLoopError>
pub fn with_plugin_dir( self, path: &Path, ) -> Result<InProcessRuntimeBuilder, AgentLoopError>
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 [AgentBuilder::capability] / with_capability
directly.
Sourcepub fn plugin_capability(&self, name: &str) -> Option<AgentCapabilityConfig>
pub fn plugin_capability(&self, name: &str) -> Option<AgentCapabilityConfig>
Return a hydrated AgentCapabilityConfig 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.
Sourcepub async fn build(self) -> Result<InProcessRuntime, AgentLoopError>
pub async fn build(self) -> Result<InProcessRuntime, AgentLoopError>
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
impl Default for InProcessRuntimeBuilder
Source§fn default() -> InProcessRuntimeBuilder
fn default() -> InProcessRuntimeBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for InProcessRuntimeBuilder
impl !UnwindSafe for InProcessRuntimeBuilder
impl Freeze for InProcessRuntimeBuilder
impl Send for InProcessRuntimeBuilder
impl Sync for InProcessRuntimeBuilder
impl Unpin for InProcessRuntimeBuilder
impl UnsafeUnpin for InProcessRuntimeBuilder
Blanket Implementations§
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request