pub trait CompiledGraph<S: GraphState>: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn invoke<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<S>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stream<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<Pin<Box<dyn Stream<Item = AgentResult<StreamEvent<S>>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn step<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<StepResult<S>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn validate_state(&self, state: &S) -> AgentResult<()>;
fn state_schema(&self) -> HashMap<String, String>;
}Expand description
Compiled graph trait for execution
A compiled graph can be invoked with an initial state and returns the final state after execution.
Required Methods§
Sourcefn invoke<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<S>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invoke<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<S>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn stream<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<Pin<Box<dyn Stream<Item = AgentResult<StreamEvent<S>>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<Pin<Box<dyn Stream<Item = AgentResult<StreamEvent<S>>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the graph with streaming output
Returns a stream of (node_id, state) pairs as each node completes.
Sourcefn step<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<StepResult<S>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn step<'life0, 'async_trait>(
&'life0 self,
input: S,
config: Option<RuntimeContext>,
) -> Pin<Box<dyn Future<Output = AgentResult<StepResult<S>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute a single step of the graph
Useful for debugging or interactive execution.
Sourcefn validate_state(&self, state: &S) -> AgentResult<()>
fn validate_state(&self, state: &S) -> AgentResult<()>
Validate that a state is valid for this graph
Sourcefn state_schema(&self) -> HashMap<String, String>
fn state_schema(&self) -> HashMap<String, String>
Get the graph’s state schema