Skip to main content

DefaultSkillExecutor

Struct DefaultSkillExecutor 

Source
pub struct DefaultSkillExecutor<T, H = NoOpHooks> { /* private fields */ }
Expand description

Default skill executor that uses a Transport to execute tool calls.

This executor implements the standard skill execution flow:

  1. Execute steps sequentially
  2. Apply timeout and retry logic per step
  3. Propagate outputs from earlier steps to later steps
  4. Invoke lifecycle hooks at appropriate points

§Type Parameters

  • T - The transport type for executing tool calls
  • H - The hooks type for lifecycle callbacks (defaults to NoOpHooks)

§Example

use thulp_skills::{DefaultSkillExecutor, ExecutionContext, TracingHooks};

// With default no-op hooks
let executor = DefaultSkillExecutor::new(transport);

// With tracing hooks
let executor = DefaultSkillExecutor::with_hooks(transport, TracingHooks::new());

let mut context = ExecutionContext::new()
    .with_input("query", json!("test"));

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

Implementations§

Source§

impl<T: Transport> DefaultSkillExecutor<T, NoOpHooks>

Source

pub fn new(transport: T) -> Self

Create a new executor with the given transport and no-op hooks.

Source§

impl<T: Transport, H: ExecutionHooks> DefaultSkillExecutor<T, H>

Source

pub fn with_hooks(transport: T, hooks: H) -> Self

Create a new executor with the given transport and hooks.

Source

pub fn from_arcs(transport: Arc<T>, hooks: Arc<H>) -> Self

Create a new executor from Arc-wrapped transport and hooks.

This is useful when you want to share the transport or hooks across multiple executors.

Source

pub fn transport(&self) -> &T

Get a reference to the transport.

Source

pub fn hooks(&self) -> &H

Get a reference to the hooks.

Trait Implementations§

Source§

impl<T: Transport, H: ExecutionHooks> SkillExecutor for DefaultSkillExecutor<T, H>

Source§

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. Read more
Source§

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,

Execute a single step. Read more

Auto Trait Implementations§

§

impl<T, H> Freeze for DefaultSkillExecutor<T, H>

§

impl<T, H> RefUnwindSafe for DefaultSkillExecutor<T, H>

§

impl<T, H> Send for DefaultSkillExecutor<T, H>
where T: Sync + Send, H: Sync + Send,

§

impl<T, H> Sync for DefaultSkillExecutor<T, H>
where T: Sync + Send, H: Sync + Send,

§

impl<T, H> Unpin for DefaultSkillExecutor<T, H>

§

impl<T, H> UnsafeUnpin for DefaultSkillExecutor<T, H>

§

impl<T, H> UnwindSafe for DefaultSkillExecutor<T, H>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more