pub trait WorkflowHandler: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a>;
// Provided method
fn describe(&self) -> WorkflowInfo { ... }
}Expand description
A dynamic workflow handler with context-aware step chaining.
Implement this trait to define workflows where each step can use
the output of previous steps. Register handlers with
Engine::register and execute
them by name.
§Why Pin<Box<dyn Future>> instead of async fn?
The handler must be object-safe (dyn WorkflowHandler) to allow
registering different handler types in the engine’s registry.
Required Methods§
Sourcefn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a>
fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a>
Execute the workflow with the given context.
The context provides shell,
http, and agent
methods that automatically persist each step.
§Errors
Return EngineError if any step fails. The engine will mark
the run as Failed and record the error.
Provided Methods§
Sourcefn describe(&self) -> WorkflowInfo
fn describe(&self) -> WorkflowInfo
Return metadata about this workflow (description, source code).
Override this to provide a description and source code for the dashboard UI. The default returns an empty description with no source.