pub struct InProcessRuntimeBuilder { /* private fields */ }Expand description
Builder for the public in-process runtime.
The builder owns a standalone runtime bundle:
HostCompositionfor 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 runtime-safe built-in capabilities and no implicit LLM driver.
Embedders must either:
- call
Self::provider_with_default_model(e.g. via theeverruns-llmsim.llm_sim_as_default(...)extension) for 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 host_composition(self, host_composition: HostComposition) -> Self
pub fn host_composition(self, host_composition: HostComposition) -> 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 provider(self, provider: Provider) -> Self
pub fn provider(self, provider: Provider) -> Self
Register a canonical runtime provider selected by ModelSpec.
Sourcepub fn replace_provider(self, provider: Provider) -> Self
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.
Sourcepub fn provider_with_default_model(
self,
provider: Provider,
model_id: impl Into<String>,
) -> Self
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.
Sourcepub fn default_model(self, model: ModelSpec) -> Self
pub fn default_model(self, model: ModelSpec) -> Self
Select the runtime’s default credential-free model specification.
Sourcepub fn model_spec(self, model: ModelSpec) -> Self
pub fn model_spec(self, model: ModelSpec) -> Self
Select a credential-free model served by a provider registered on this builder.
Sourcepub fn backends(self, backends: HostBackends) -> Self
pub fn backends(self, backends: HostBackends) -> Self
Supply a custom backend bundle instead of the built-in in-memory stores.
Sourcepub fn workspace_policy(self, policy: WorkspacePolicy) -> Self
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.
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 HostBackends.
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 HostBackends).
Sourcepub fn with_tool_context_extensions_factory(
self,
factory: ToolContextExtensionsFactory,
) -> Self
pub fn with_tool_context_extensions_factory( self, factory: ToolContextExtensionsFactory, ) -> Self
Inject higher-level typed services into tool contexts.
Sourcepub fn with_subagent_delegate_factory(
self,
factory: SubagentDelegateFactory,
) -> Self
pub fn with_subagent_delegate_factory( self, factory: SubagentDelegateFactory, ) -> Self
Inject a neutral subagent delegate factory.
Sourcepub fn with_tool_augmentor(self, augmentor: Arc<dyn HostToolAugmentor>) -> Self
pub fn with_tool_augmentor(self, augmentor: Arc<dyn HostToolAugmentor>) -> Self
Inject higher-level turn-dependent tools.
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 provider_retry_config(self, config: LlmRetryConfig) -> Self
pub fn provider_retry_config(self, config: LlmRetryConfig) -> Self
Override the bounded provider-recovery policy for this runtime.
Sourcepub fn provider_stall_timeout(self, timeout: Duration) -> Self
pub fn provider_stall_timeout(self, timeout: Duration) -> Self
Override the no-output provider stream stall timeout.
Sourcepub fn harness(self, harness: SeededHarness) -> Self
pub fn harness(self, harness: SeededHarness) -> Self
Seed a harness definition (under its embedder-chosen id) into the runtime store.
Sourcepub fn agent(self, agent: AgentDefinition) -> Self
pub fn agent(self, agent: AgentDefinition) -> Self
Seed an agent definition into the runtime store.
Sourcepub fn session(self, session: ExecutionSession) -> Self
pub fn session(self, session: ExecutionSession) -> Self
Seed a session into the runtime store.
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 crate::AgentBuilder::capability / with_capability
directly.
Sourcepub fn plugin_capability(&self, name: &str) -> Option<CapabilityRef>
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.
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.