pub trait PartitionAgentResolver: Send + Sync {
// Required method
fn resolve_partition<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
def: &'life1 ManagedAgentDef,
host: &'life2 PartitionHost,
models: &'life3 dyn ModelResolver,
) -> Pin<Box<dyn Future<Output = Result<Option<Arc<dyn Agent>>, RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}Expand description
Builds the agent of one partition of a hosted definition (spec 3.2 §7.8, §7.13): one
harness per partition, built with the partition’s mode, class and tenant, memory scope,
drivers and crossing policy over the tenant’s partition table. adk-harness’s
HarnessResolver implements it.
§Example
use std::sync::Arc;
use adk_core::Agent;
use adk_kernel::managed::{PartitionAgentResolver, PartitionHost};
use adk_managed::resolver::ModelResolver;
use adk_managed::types::{ManagedAgentDef, RuntimeError};
struct Builds;
#[async_trait::async_trait]
impl PartitionAgentResolver for Builds {
async fn resolve_partition(
&self,
_def: &ManagedAgentDef,
host: &PartitionHost,
_models: &dyn ModelResolver,
) -> Result<Option<Arc<dyn Agent>>, RuntimeError> {
// Build the partition's harness with `host.partition` and `host.partitions`.
let _ = (&host.partition, &host.partitions, host.coordinator);
Ok(None)
}
}Required Methods§
Sourcefn resolve_partition<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
def: &'life1 ManagedAgentDef,
host: &'life2 PartitionHost,
models: &'life3 dyn ModelResolver,
) -> Pin<Box<dyn Future<Output = Result<Option<Arc<dyn Agent>>, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn resolve_partition<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
def: &'life1 ManagedAgentDef,
host: &'life2 PartitionHost,
models: &'life3 dyn ModelResolver,
) -> Pin<Box<dyn Future<Output = Result<Option<Arc<dyn Agent>>, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
The agent of host.partition for def, or None when this resolver builds none.
§Errors
Returns the error that kept the agent from being built; the definition is refused.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".