SkillKit.ToolExecution (SkillKit v0.1.0)

Copy Markdown View Source

Manages tool execution with suspension and resumption.

A %ToolExecution{} holds the tool module, input, context, and execution state. It handles the execute/suspend/resume lifecycle for tools that need human-in-the-loop approval.

Hooks are no longer part of this pipeline — they are dispatched by SkillKit.Hooks at the boundary level in Agent.Server.

Status transitions

  • :pending — built but not yet run
  • :running — actively executing
  • :suspended — tool returned {:pending, state}, awaiting decision
  • :complete — tool succeeded
  • :failed — tool returned an error

Summary

Functions

Executes the tool.

Resumes a suspended execution with a decision.

Types

status()

@type status() :: :pending | :running | :suspended | :complete | :failed

t()

@type t() :: %SkillKit.ToolExecution{
  context: map(),
  input: map(),
  result: any(),
  skill: SkillKit.Skill.t() | nil,
  status: status(),
  suspended_state: any(),
  tool: module()
}

Functions

execute(exec)

@spec execute(t()) :: {:ok, t()} | {:error, t()} | {:pending, t()}

Executes the tool.

Returns:

  • {:ok, execution} — tool completed successfully
  • {:error, execution} — tool failed
  • {:pending, execution} — tool suspended, awaiting a decision

resume(exec, decision)

@spec resume(t(), any()) :: {:ok, t()} | {:error, t()} | {:pending, t()}

Resumes a suspended execution with a decision.

decision is passed directly to the tool's resume/3 callback.