Skip to main content

Crate thulp_skills

Crate thulp_skills 

Source
Expand description

§thulp-skills

Skill system for composing and executing complex tool workflows.

Skills are predefined sequences of tool calls that accomplish higher-level tasks.

§Features

  • Skill Composition: Define multi-step workflows as skills
  • Timeout Support: Prevent hanging executions with configurable timeouts
  • Retry Logic: Handle transient failures with exponential backoff
  • Context Propagation: Pass results between steps using template variables
  • Pluggable Execution: Use SkillExecutor trait for custom execution strategies
  • Lifecycle Hooks: Observe execution with ExecutionHooks

§Example

use thulp_skills::{Skill, SkillStep, DefaultSkillExecutor, ExecutionContext, SkillExecutor};

// Define a skill
let skill = Skill::new("search_and_summarize", "Search and summarize results")
    .with_input("query")
    .with_step(SkillStep {
        name: "search".to_string(),
        tool: "web_search".to_string(),
        arguments: json!({"query": "{{query}}"}),
        ..Default::default()
    })
    .with_step(SkillStep {
        name: "summarize".to_string(),
        tool: "summarize".to_string(),
        arguments: json!({"text": "{{search}}"}),
        ..Default::default()
    });

// Execute with the default executor
let executor = DefaultSkillExecutor::new(transport);
let mut context = ExecutionContext::new()
    .with_input("query", json!("rust async programming"));

let result = executor.execute(&skill, &mut context).await?;

Re-exports§

pub use config::BackoffStrategy;
pub use config::ExecutionConfig;
pub use config::RetryConfig;
pub use config::RetryableError;
pub use config::TimeoutAction;
pub use config::TimeoutConfig;
pub use default_executor::DefaultSkillExecutor;
pub use executor::ExecutionContext;
pub use executor::SkillExecutor;
pub use executor::StepResult;
pub use hooks::CompositeHooks;
pub use hooks::ExecutionHooks;
pub use hooks::NoOpHooks;
pub use hooks::TracingHooks;
pub use retry::calculate_delay;
pub use retry::is_error_retryable;
pub use retry::with_retry;
pub use retry::RetryError;
pub use timeout::with_timeout;
pub use timeout::with_timeout_infallible;
pub use timeout::TimeoutError;

Modules§

config
Configuration types for skill execution.
default_executor
Default skill executor implementation.
executor
Skill execution abstraction.
hooks
Execution lifecycle hooks.
retry
Retry utilities for skill execution.
timeout
Timeout utilities for skill execution.

Structs§

Skill
A skill definition - a sequence of tool calls
SkillRegistry
Registry for managing skills
SkillResult
Result of executing a skill
SkillStep
A step in a skill workflow

Enums§

SkillError
Errors that can occur in skill execution

Type Aliases§

Result
Result type for skill operations