tool

package
v0.0.0-...-b496115 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSubagentFinalizationPolicy

func NewSubagentFinalizationPolicy(onBegin func(agent.FinalizationReason)) agent.FinalizationPolicy

Types

type Bash

type Bash struct {
	// contains filtered or unexported fields
}

func NewBash

func NewBash(cwd string) *Bash

func (*Bash) Definition

func (*Bash) Definition() agent.ToolDefinition

func (*Bash) Execute

func (b *Bash) Execute(ctx context.Context, arguments json.RawMessage, updates agent.ToolUpdateSink) (agent.ToolResult, error)

func (*Bash) Presentation

func (b *Bash) Presentation(snapshot PresentationSnapshot) agent.ToolPresentation

type Edit

type Edit struct {
	// contains filtered or unexported fields
}

func NewEdit

func NewEdit(cwd string) *Edit

func (*Edit) Definition

func (*Edit) Definition() agent.ToolDefinition

func (*Edit) Execute

func (e *Edit) Execute(ctx context.Context, arguments json.RawMessage, updates agent.ToolUpdateSink) (agent.ToolResult, error)

func (*Edit) Presentation

func (*Edit) Presentation(snapshot PresentationSnapshot) agent.ToolPresentation

type PresentationSnapshot

type PresentationSnapshot struct {
	ID           string
	Name         string
	RawArguments string
	Arguments    map[string]any
	Complete     bool
}

type Read

type Read struct {
	// contains filtered or unexported fields
}

func NewRead

func NewRead(cwd string) *Read

func (*Read) Definition

func (*Read) Definition() agent.ToolDefinition

func (*Read) Execute

func (r *Read) Execute(ctx context.Context, arguments json.RawMessage, _ agent.ToolUpdateSink) (agent.ToolResult, error)

func (*Read) Presentation

func (*Read) Presentation(snapshot PresentationSnapshot) agent.ToolPresentation

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(tools []Tool, resources ...io.Closer) (*Registry, error)

func (*Registry) Close

func (r *Registry) Close() error

func (*Registry) Definitions

func (r *Registry) Definitions() []agent.ToolDefinition

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, call agent.ToolCall, updates agent.ToolUpdateSink) (agent.ToolResult, error)

func (*Registry) Presentation

func (r *Registry) Presentation(snapshot agent.ToolCallSnapshot) agent.ToolPresentation

type Subagent

type Subagent struct {
	// contains filtered or unexported fields
}

func NewSubagent

func NewSubagent(run SubagentRun, supportedThinkingLevels ...agent.ThinkingLevel) *Subagent

func NewSubagentWithThinkingLevels

func NewSubagentWithThinkingLevels(run SubagentRun, supportedThinkingLevels func(SubagentModelProfile) []agent.ThinkingLevel) *Subagent

func (*Subagent) Close

func (s *Subagent) Close() error

func (*Subagent) Definition

func (*Subagent) Definition() agent.ToolDefinition

func (*Subagent) Execute

func (s *Subagent) Execute(ctx context.Context, arguments json.RawMessage, updates agent.ToolUpdateSink) (agent.ToolResult, error)

func (*Subagent) Presentation

func (s *Subagent) Presentation(snapshot PresentationSnapshot) agent.ToolPresentation

func (*Subagent) StatusUpdates

func (s *Subagent) StatusUpdates() <-chan agent.SubagentStatus

type SubagentCancel

type SubagentCancel struct {
	// contains filtered or unexported fields
}

func NewSubagentCancel

func NewSubagentCancel(subagents *Subagent) *SubagentCancel

func (*SubagentCancel) Definition

func (*SubagentCancel) Definition() agent.ToolDefinition

func (*SubagentCancel) Execute

func (cancel *SubagentCancel) Execute(ctx context.Context, arguments json.RawMessage, _ agent.ToolUpdateSink) (agent.ToolResult, error)

func (*SubagentCancel) Presentation

type SubagentModelProfile

type SubagentModelProfile string
const (
	SubagentModelFast     SubagentModelProfile = "fast"
	SubagentModelBalanced SubagentModelProfile = "balanced"
	SubagentModelPowerful SubagentModelProfile = "powerful"
)

type SubagentProgress

type SubagentProgress struct {
	Usage              agent.Usage
	Generations        int
	Finalizing         bool
	FinalizationReason agent.FinalizationReason
}

type SubagentWait

type SubagentWait struct {
	// contains filtered or unexported fields
}

func NewSubagentWait

func NewSubagentWait(subagents *Subagent) *SubagentWait

func (*SubagentWait) Definition

func (*SubagentWait) Definition() agent.ToolDefinition

func (*SubagentWait) Execute

func (wait *SubagentWait) Execute(ctx context.Context, arguments json.RawMessage, _ agent.ToolUpdateSink) (agent.ToolResult, error)

func (*SubagentWait) Presentation

func (*SubagentWait) Presentation(snapshot PresentationSnapshot) agent.ToolPresentation

type Tool

type Tool interface {
	Definition() agent.ToolDefinition
	Execute(ctx context.Context, arguments json.RawMessage, updates agent.ToolUpdateSink) (agent.ToolResult, error)
}

Tool returns ordinary argument and execution failures as ToolResult values with IsError set. It returns a Go error only when the agent turn itself must stop, such as cancellation or a failed presentation update. Execute may be called concurrently for calls from the same provider response.

type UpdateGoal

type UpdateGoal struct {
	// contains filtered or unexported fields
}

func NewUpdateGoal

func NewUpdateGoal(complete func() error) *UpdateGoal

func (*UpdateGoal) Definition

func (*UpdateGoal) Definition() agent.ToolDefinition

func (*UpdateGoal) Execute

func (tool *UpdateGoal) Execute(ctx context.Context, arguments json.RawMessage, _ agent.ToolUpdateSink) (agent.ToolResult, error)

func (*UpdateGoal) Presentation

func (*UpdateGoal) Presentation(snapshot PresentationSnapshot) agent.ToolPresentation

type Write

type Write struct {
	// contains filtered or unexported fields
}

func NewWrite

func NewWrite(cwd string) *Write

func (*Write) Definition

func (*Write) Definition() agent.ToolDefinition

func (*Write) Execute

func (w *Write) Execute(ctx context.Context, arguments json.RawMessage, _ agent.ToolUpdateSink) (agent.ToolResult, error)

func (*Write) Presentation

func (*Write) Presentation(snapshot PresentationSnapshot) agent.ToolPresentation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL