Documentation
¶
Overview ¶
Package executor implements skill execution with sandboxing.
Index ¶
- Variables
- type DefaultExecutor
- func (e *DefaultExecutor) CanExecute(ctx context.Context, skillID string) (bool, error)
- func (e *DefaultExecutor) Execute(ctx context.Context, req execution.ExecutionRequest) (*execution.ExecutionResult, error)
- func (e *DefaultExecutor) ExecuteFromPlan(ctx context.Context, plan *agent.ExecutionPlan, meta agent.ExecutionMeta) (*execution.ExecutionResult, error)
- func (e *DefaultExecutor) ExecutePlan(ctx context.Context, plan *execution.ExecutionPlan, ...) error
- func (e *DefaultExecutor) Get(id string) (skills.Skill, error)
- func (e *DefaultExecutor) GetSkill(ctx context.Context, skillID string) (skills.Skill, error)
- func (e *DefaultExecutor) List() []string
- func (e *DefaultExecutor) ListSkills(ctx context.Context) []string
- func (e *DefaultExecutor) LoadSkill(ctx context.Context, s skills.Skill) error
- func (e *DefaultExecutor) LoadSkillWithWasm(ctx context.Context, s skills.Skill, wasmBytes []byte) error
- func (e *DefaultExecutor) SetToolRunner(tools toolrunner.ToolRunner)
- func (e *DefaultExecutor) SkillCount() int
- func (e *DefaultExecutor) UnloadSkill(ctx context.Context, skillID string) error
- type StepRunner
- type WasmSkill
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSkillAlreadyLoaded is returned when loading a skill that's already loaded. ErrSkillAlreadyLoaded = errors.New("executor: skill already loaded") // ErrSkillNotFound is returned when skill doesn't exist. ErrSkillNotFound = errors.New("executor: skill not found") // ErrNilSkill is returned when skill is nil. ErrNilSkill = errors.New("executor: nil skill") // ErrEmptySkillID is returned when skill ID is empty. ErrEmptySkillID = errors.New("executor: empty skill ID") // ErrNoWasmBytes is returned when skill has no Wasm module. ErrNoWasmBytes = errors.New("executor: skill has no wasm bytes") )
var ErrNilExecutionPlan = errors.New("executor: nil execution plan")
ErrNilExecutionPlan is returned when execution plan is nil.
Functions ¶
This section is empty.
Types ¶
type DefaultExecutor ¶
type DefaultExecutor struct {
// contains filtered or unexported fields
}
DefaultExecutor implements SkillExecutor with real Wasm execution.
func NewDefaultExecutor ¶
func NewDefaultExecutor() *DefaultExecutor
NewDefaultExecutor creates a new executor.
func NewDefaultExecutorWithRuntime ¶
func NewDefaultExecutorWithRuntime(rt *wasm.Runtime, tools toolrunner.ToolRunner) *DefaultExecutor
NewDefaultExecutorWithRuntime creates an executor with Wasm execution.
func (*DefaultExecutor) CanExecute ¶
CanExecute checks if the skill can be executed.
func (*DefaultExecutor) Execute ¶
func (e *DefaultExecutor) Execute(ctx context.Context, req execution.ExecutionRequest) (*execution.ExecutionResult, error)
Execute runs a skill with the given input.
func (*DefaultExecutor) ExecuteFromPlan ¶
func (e *DefaultExecutor) ExecuteFromPlan(ctx context.Context, plan *agent.ExecutionPlan, meta agent.ExecutionMeta) (*execution.ExecutionResult, error)
ExecuteFromPlan executes a validated execution plan.
This is the PREFERRED entry point for skill execution. It:
- Validates the plan is not nil and has a skill ID
- Serializes plan.Arguments to JSON
- Calls the underlying Execute method
Direct calls to Execute with raw bytes are discouraged.
func (*DefaultExecutor) ExecutePlan ¶
func (e *DefaultExecutor) ExecutePlan(ctx context.Context, plan *execution.ExecutionPlan, ec *execution.ExecutionContext) error
ExecutePlan runs a multi-step execution plan using a StepRunner.
func (*DefaultExecutor) Get ¶
func (e *DefaultExecutor) Get(id string) (skills.Skill, error)
Get retrieves a skill by ID.
func (*DefaultExecutor) List ¶
func (e *DefaultExecutor) List() []string
List returns all loaded skill IDs.
func (*DefaultExecutor) ListSkills ¶
func (e *DefaultExecutor) ListSkills(ctx context.Context) []string
ListSkills returns all loaded skill IDs.
func (*DefaultExecutor) LoadSkillWithWasm ¶
func (e *DefaultExecutor) LoadSkillWithWasm(ctx context.Context, s skills.Skill, wasmBytes []byte) error
LoadSkillWithWasm loads a skill with its Wasm module bytes.
func (*DefaultExecutor) SetToolRunner ¶
func (e *DefaultExecutor) SetToolRunner(tools toolrunner.ToolRunner)
SetToolRunner updates the tool runner.
func (*DefaultExecutor) SkillCount ¶
func (e *DefaultExecutor) SkillCount() int
SkillCount returns the number of loaded skills.
func (*DefaultExecutor) UnloadSkill ¶
func (e *DefaultExecutor) UnloadSkill(ctx context.Context, skillID string) error
UnloadSkill removes a skill from execution.
type StepRunner ¶
type StepRunner struct {
// contains filtered or unexported fields
}
StepRunner executes a single step from an execution plan.
func NewStepRunner ¶
func NewStepRunner(executor *DefaultExecutor, tools toolrunner.ToolRunner) *StepRunner
NewStepRunner creates a new step runner.
func (*StepRunner) RunStep ¶
func (sr *StepRunner) RunStep(ctx context.Context, ec *execution.ExecutionContext, step execution.ExecutionStep) (*execution.StepResult, error)
RunStep executes one step and records the result in the execution context.