Skip to main content

ActivityDefinition

Trait ActivityDefinition 

Source
pub trait ActivityDefinition: Send + Sync {
    type Input: Serialize + DeserializeOwned + Send + Sync;
    type Output: Serialize + DeserializeOwned + Send + Sync;

    // Required methods
    fn activity_type() -> &'static str;
    fn execute(
        ctx: ActivityContext,
        input: Self::Input,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, CoreError>> + Send>>;
}
Expand description

A trait for defining activity types

Activities are the individual units of work that execute within a workflow. They represent operations like API calls, database queries, or Claude decisions.

Required Associated Types§

Source

type Input: Serialize + DeserializeOwned + Send + Sync

The input type for this activity

Source

type Output: Serialize + DeserializeOwned + Send + Sync

The output type for this activity

Required Methods§

Source

fn activity_type() -> &'static str

Get the activity type name

Source

fn execute( ctx: ActivityContext, input: Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, CoreError>> + Send>>

Execute the activity with the given context and input

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§