tools

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// MaxRecursionDepth is the maximum allowed recursion depth
	MaxRecursionDepth = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentTool

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

AgentTool wraps an agent to make it callable as a tool

func NewAgentTool

func NewAgentTool(agent SubAgent) *AgentTool

NewAgentTool creates a new agent tool wrapper

func (*AgentTool) Description

func (at *AgentTool) Description() string

Description returns the description of what the tool does

func (*AgentTool) DisplayName

func (at *AgentTool) DisplayName() string

DisplayName implements interfaces.ToolWithDisplayName.DisplayName

func (*AgentTool) Execute

func (at *AgentTool) Execute(ctx context.Context, args string) (string, error)

Execute implements interfaces.Tool.Execute

func (*AgentTool) Internal

func (at *AgentTool) Internal() bool

Internal implements interfaces.InternalTool.Internal

func (*AgentTool) Name

func (at *AgentTool) Name() string

Name returns the name of the tool

func (*AgentTool) Parameters

func (at *AgentTool) Parameters() map[string]interfaces.ParameterSpec

Parameters returns the parameters that the tool accepts

func (*AgentTool) Run

func (at *AgentTool) Run(ctx context.Context, input string) (string, error)

Run executes the tool with the given input

func (*AgentTool) SetDescription

func (at *AgentTool) SetDescription(description string)

SetDescription allows updating the tool description

func (*AgentTool) WithLogger

func (at *AgentTool) WithLogger(logger logging.Logger) *AgentTool

WithLogger sets a custom logger for the agent tool

func (*AgentTool) WithTimeout

func (at *AgentTool) WithTimeout(timeout time.Duration) *AgentTool

WithTimeout sets a custom timeout for the agent tool

func (*AgentTool) WithTracer

func (at *AgentTool) WithTracer(tracer interfaces.Tracer) *AgentTool

WithTracer sets a custom tracer for the agent tool

type Registry

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

Registry implements the ToolRegistry interface

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new tool registry

func (*Registry) Get

func (r *Registry) Get(name string) (interfaces.Tool, bool)

Get returns a tool by name

func (*Registry) List

func (r *Registry) List() []interfaces.Tool

List returns all registered tools

func (*Registry) Register

func (r *Registry) Register(tool interfaces.Tool)

Register registers a tool with the registry

type SubAgent

type SubAgent interface {
	Run(ctx context.Context, input string) (string, error)
	GetName() string
	GetDescription() string
}

SubAgent interface defines the minimal interface needed for a sub-agent

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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