Skip to main content

AgentNodeHandler

Trait AgentNodeHandler 

Source
pub trait AgentNodeHandler: Send + Sync {
    // Required method
    fn execute<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
        &'life0 self,
        tenant_id: &'life1 str,
        env_id: &'life2 str,
        agent_id: &'life3 str,
        session_id: &'life4 str,
        flow_input: &'life5 Value,
        conversational: bool,
        caller: Option<&'life6 Value>,
    ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             'life6: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn execute_with_resume<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'async_trait>(
        &'life0 self,
        tenant_id: &'life1 str,
        env_id: &'life2 str,
        agent_id: &'life3 str,
        session_id: &'life4 str,
        flow_input: &'life5 Value,
        conversational: bool,
        caller: Option<&'life6 Value>,
        resume_payload: Option<&'life7 Value>,
    ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             'life6: 'async_trait,
             'life7: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

Bridges a DwAgent flow node into the agentic-worker runtime.

The concrete impl (constructed in the runner binary, Task 4.3) wraps greentic_aw_runtime::AgentRuntime. The engine holds it as a trait object so engine.rs stays free of AW-runtime construction details.

Required Methods§

Source

fn execute<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, tenant_id: &'life1 str, env_id: &'life2 str, agent_id: &'life3 str, session_id: &'life4 str, flow_input: &'life5 Value, conversational: bool, caller: Option<&'life6 Value>, ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait, Self: 'async_trait,

Execute one agentic step. flow_input is the upstream node’s JSON payload (expects at least {"user_text": "..."}); returns the node output JSON ({"reply", "trail", "terminated_by"}).

conversational is the flow node’s conversational flag (SP3): when true the agent is offered the host end_conversation tool so it can end the segment the engine park-loop maintains, regardless of the agent’s own config default.

caller is the block the messaging provider verified for this run, carried on FlowContext rather than inside flow_input — see crate::caller_identity for why identity must not arrive through a flow’s own node mapping. None means the turn is anonymous, which is what every provider predating the contract produces.

Provided Methods§

Source

fn execute_with_resume<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'async_trait>( &'life0 self, tenant_id: &'life1 str, env_id: &'life2 str, agent_id: &'life3 str, session_id: &'life4 str, flow_input: &'life5 Value, conversational: bool, caller: Option<&'life6 Value>, resume_payload: Option<&'life7 Value>, ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait, 'life7: 'async_trait, Self: 'async_trait,

Self::execute plus the user’s answer to a flow: tool that parked the previous turn on a card (terminated_by == "awaiting_tool_input").

resume_payload is the raw inbound activity (the flow’s entry) when the engine is re-entering this node from such a park and the activity is a card submit; None otherwise. It is its own argument — like caller, and for the same reason — rather than a key inside the authorable flow_input.

The default ignores it and runs Self::execute, which keeps every existing implementor source-compatible; such a handler never produces awaiting_tool_input, so it is never handed a payload it would need.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§