pub trait AgentRunAdapter: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn version(&self) -> &'static str;
// Provided methods
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn emit<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
state: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn restore<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn error<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
error: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Contract adapters must implement to surface framework-native runs as FleetForge runs.
Required Methods§
Provided Methods§
Sourcefn start<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called before the framework starts producing steps for a run.
Sourcefn emit<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn emit<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
payload: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called for intermediate output/state events emitted by the framework.
Sourcefn checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
state: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
state: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called whenever the framework checkpoints durable state.
Sourcefn restore<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn restore<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when FleetForge requests a restore. Return Ok(Some(state)) with the
previously persisted checkpoint payload if available.
Sourcefn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called once the framework considers the run complete.
Sourcefn error<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
error: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn error<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AgentRunContext,
error: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentRunEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when the framework surfaces a terminal error.