pub trait SkillExecutor: Send + Sync {
// Required methods
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
skill: &'life1 Skill,
context: &'life2 mut ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<SkillResult, SkillError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn execute_step<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
step: &'life1 SkillStep,
context: &'life2 mut ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<StepResult, SkillError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Trait for executing skills.
This trait abstracts the execution of skills, allowing different implementations to handle execution in different ways (e.g., local execution, remote execution, cached execution, etc.).
§Example
ⓘ
use thulp_skills::{SkillExecutor, ExecutionContext};
struct MyExecutor;
#[async_trait]
impl SkillExecutor for MyExecutor {
async fn execute(
&self,
skill: &Skill,
context: &mut ExecutionContext,
) -> Result<SkillResult, SkillError> {
// Custom execution logic
}
async fn execute_step(
&self,
step: &SkillStep,
context: &mut ExecutionContext,
) -> Result<StepResult, SkillError> {
// Custom step execution logic
}
}Required Methods§
Sourcefn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
skill: &'life1 Skill,
context: &'life2 mut ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<SkillResult, SkillError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
skill: &'life1 Skill,
context: &'life2 mut ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<SkillResult, SkillError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a complete skill.
This method executes all steps in the skill sequentially, passing outputs from earlier steps to later steps via the context.
§Arguments
skill- The skill to executecontext- Mutable execution context for inputs/outputs
§Returns
A SkillResult containing the outcome of all steps.