Skip to main content

Action

Trait Action 

Source
pub trait Action: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn run<'life0, 'async_trait>(
        &'life0 self,
        input: ActionInput,
        ctx: ActionContext,
    ) -> Pin<Box<dyn Future<Output = ActionResult> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn metadata(&self) -> ActionMeta { ... }
}
Expand description

Action trait - the core abstraction for atomic execution units

Actions are black boxes to the Executor. They can:

  • Perform side effects
  • Return typed outputs
  • Request user clarification
  • Fail with retry semantics

Required Methods§

Source

fn name(&self) -> &str

Get the action name (must be unique)

Source

fn description(&self) -> &str

Get the action description (for LLM planning)

Source

fn run<'life0, 'async_trait>( &'life0 self, input: ActionInput, ctx: ActionContext, ) -> Pin<Box<dyn Future<Output = ActionResult> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Execute the action

Provided Methods§

Source

fn metadata(&self) -> ActionMeta

Get action metadata (typed input/output schema hints for planning/runtime checks)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§