Skip to main content

ExecutionContextFactory

Trait ExecutionContextFactory 

Source
pub trait ExecutionContextFactory<Ctx>: Send + Sync {
    // Required method
    fn build(
        &self,
        seed: &ToolContextSeed,
        app: Ctx,
        deps: HostDependencies,
    ) -> ToolContext<Ctx>;
}
Expand description

Abstraction for how hosts build a crate::tools::ToolContext from durable seeds and fresh runtime dependencies.

The SDK provides crate::tools::ToolContext::from_seed as the default implementation — hosts can call it directly or implement this trait to add additional ambient state (e.g. database connections wrapped in the application context Ctx).

Required Methods§

Source

fn build( &self, seed: &ToolContextSeed, app: Ctx, deps: HostDependencies, ) -> ToolContext<Ctx>

Build a ready-to-use ToolContext from the durable seed, the application context, and host-provided runtime dependencies.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§