Documentation
¶
Overview ¶
Package tool_invocation provides a pipeline for routing tool invocations to appropriate backends (HTTP, registry) with sandboxing and timeout enforcement.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedToolType is returned for unknown tool types. ErrUnsupportedToolType = errors.New("tool_invocation: unsupported tool type") // ErrMissingToolName is returned when a tool name/URL is empty. ErrMissingToolName = errors.New("tool_invocation: tool name is required") // ErrNilHTTPClient is returned when HTTP tool is invoked without a configured client. ErrNilHTTPClient = errors.New("tool_invocation: HTTP client not configured") // ErrNilRegistryClient is returned when registry tool is invoked without a configured client. ErrNilRegistryClient = errors.New("tool_invocation: registry client not configured") )
Functions ¶
func WireHTTPFetch ¶
func WireHTTPFetch(hf *wasm.HostFunctions, pipeline *ToolInvocationPipeline)
WireHTTPFetch connects the ToolInvocationPipeline to Wasm HostFunctions.HTTPFetch. After calling this, Wasm skills can make sandboxed HTTP requests via the host API.
Types ¶
type ToolInvocation ¶
type ToolInvocation struct {
// Name is the tool name or URL.
Name string
// Type is the tool backend: "http", "registry".
Type string
// Arguments contains tool-specific parameters.
Arguments map[string]any
// Meta contains execution metadata for auditing.
Meta ToolInvocationMeta
}
ToolInvocation represents a request to invoke a tool.
type ToolInvocationMeta ¶
ToolInvocationMeta contains metadata for execution tracking.
type ToolInvocationPipeline ¶
type ToolInvocationPipeline struct {
// contains filtered or unexported fields
}
ToolInvocationPipeline routes tool invocations to the appropriate backend. Supported tool types: "http" (sandboxed HTTP via allowlist), "registry" (external registry).
func NewToolInvocationPipeline ¶
func NewToolInvocationPipeline( httpClient *wasm.SandboxedHTTPClient, registryClient *toolrunner.RegistryClient, timeout time.Duration, ) *ToolInvocationPipeline
NewToolInvocationPipeline creates a new tool invocation pipeline. httpClient and registryClient may be nil; invoking a tool type with a nil client returns a descriptive error.
func (*ToolInvocationPipeline) Invoke ¶
func (p *ToolInvocationPipeline) Invoke(ctx context.Context, inv ToolInvocation) (*ToolResult, error)
Invoke executes a tool invocation and returns the result.