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() -> Self
pub fn new() -> Self
Create a builder with 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>) -> Self
pub fn mcp_auth_provider(self, provider: Arc<dyn McpAuthProvider>) -> Self
Set the auth provider used to acquire credentials for scoped MCP servers (specs/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,
) -> Self
pub fn platform_definition( self, platform_definition: PlatformDefinition, ) -> Self
Replace the platform definition used by the runtime.
Sourcepub fn capability<C: Capability + 'static>(self, capability: C) -> Self
pub fn capability<C: Capability + 'static>(self, capability: C) -> Self
Register an additional capability on the runtime platform.
Sourcepub fn driver_registry(self, driver_registry: DriverRegistry) -> Self
pub fn driver_registry(self, driver_registry: DriverRegistry) -> Self
Replace the platform driver registry.
Sourcepub fn llm_sim(self, config: LlmSimConfig) -> Self
pub fn llm_sim(self, config: LlmSimConfig) -> Self
Register the built-in llmsim driver for deterministic local execution.
Sourcepub fn default_model(self, model: ResolvedModel) -> Self
pub fn default_model(self, model: ResolvedModel) -> Self
Set the runtime default model used when sessions/agents do not override it.
Sourcepub fn backends(self, backends: RuntimeBackends) -> Self
pub fn backends(self, backends: RuntimeBackends) -> Self
Supply a custom backend bundle instead of the built-in in-memory stores.
Sourcepub fn with_session_task_registry(
self,
registry: Arc<dyn SessionTaskRegistry>,
) -> Self
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 RuntimeBackends.
Sourcepub fn with_schedule_store_factory(self, factory: ScheduleStoreFactory) -> Self
pub fn with_schedule_store_factory(self, factory: ScheduleStoreFactory) -> Self
Inject a per-org schedule store factory (see RuntimeBackends).
Sourcepub fn with_platform_store_factory(self, factory: PlatformStoreFactory) -> Self
pub fn with_platform_store_factory(self, factory: PlatformStoreFactory) -> Self
Inject a per-(org, session) platform store factory (see RuntimeBackends).
Sourcepub fn session_file_system_factory_context(
self,
context: SessionFileSystemFactoryContext,
) -> Self
pub fn session_file_system_factory_context( self, context: SessionFileSystemFactoryContext, ) -> Self
Supply host dependencies needed by the platform session filesystem factory.
Sourcepub fn single_session<F>(self, configure: F) -> Self
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.
Sourcepub fn seed_text_file(
self,
session_id: SessionId,
path: impl Into<String>,
content: impl Into<String>,
) -> Self
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.
Sourcepub fn with_plugin_dir(self, path: &Path) -> Result<Self>
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 [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>
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§
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> 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