tools

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDelegateFn added in v0.2.0

func SetDelegateFn(fn func(ctx context.Context, role, request string) (string, error))

SetDelegateFn sets the delegate function used by DelegateToAgentTool.

func SetSandboxProvider added in v0.3.0

func SetSandboxProvider(sp sandbox.Provider)

SetSandboxProvider sets the sandbox provider used by CodeInterpreterTool.

func WithChromePath added in v0.4.0

func WithChromePath(path string) func(*browserTool)

WithChromePath sets a custom Chrome/Chromium binary path.

func WithHeadless added in v0.4.0

func WithHeadless(headless bool) func(*browserTool)

WithHeadless overrides the headless mode after construction. Pass false to show the browser window (useful for debugging).

func WithTabTimeout added in v0.4.0

func WithTabTimeout(d time.Duration) func(*browserTool)

WithTabTimeout sets the per-action timeout (default 30s).

Types

type Base

type Base struct {
	ToolName  string
	Desc      string
	Params    map[string]any
	ExecuteFn func(ctx context.Context, args map[string]any) (string, error)
}

Base provides a default implementation of the Tool interface.

func (*Base) Description

func (b *Base) Description() string

Description returns the tool's description.

func (*Base) Execute

func (b *Base) Execute(ctx context.Context, args map[string]any) (string, error)

Execute runs the tool's execute function with the given arguments.

func (*Base) Name

func (b *Base) Name() string

Name returns the tool's name.

func (*Base) Parameters

func (b *Base) Parameters() map[string]any

Parameters returns the tool's JSON schema parameters.

type Tool

type Tool interface {
	Name() string
	Description() string
	Parameters() map[string]any
	Execute(ctx context.Context, args map[string]any) (string, error)
}

Tool is the interface that all tools must implement.

func AskAgentTool added in v0.2.0

func AskAgentTool() Tool

AskAgentTool creates a tool that asks another agent a question via A2A.

func AskHumanTool

func AskHumanTool() Tool

AskHumanTool creates a tool that asks a human for input or approval.

func BrowserTool added in v0.4.0

func BrowserTool(headless bool, opts ...func(*browserTool)) Tool

BrowserTool creates a new browser automation tool. headless=false enables visible Chrome mode for debugging. Options: WithChromePath, WithTabTimeout, WithHeadless. Actions: navigate(url), click(selector), type(selector,text), extract_text(selector), extract_html(selector), screenshot(), scroll(direction=down|up).

func CalculatorTool

func CalculatorTool() Tool

CalculatorTool creates a tool that evaluates mathematical expressions.

func CodeInterpreterTool added in v0.3.0

func CodeInterpreterTool() Tool

CodeInterpreterTool creates a tool that executes code using the configured sandbox.

func DelegateToAgentTool added in v0.2.0

func DelegateToAgentTool() Tool

DelegateToAgentTool creates a tool that delegates a task to another agent via A2A.

func DelegateWorkTool

func DelegateWorkTool() Tool

DelegateWorkTool creates a tool that delegates a task to another agent.

func New

func New(name, description string, params map[string]any, fn func(ctx context.Context, args map[string]any) (string, error)) Tool

New creates a new Tool with the given name, description, parameters, and execute function.

func ReadFileTool

func ReadFileTool() Tool

ReadFileTool creates a tool that reads the contents of a file.

func ShellTool

func ShellTool() Tool

ShellTool creates a tool that executes shell commands on the local system.

func WebSearchTool

func WebSearchTool(apiKey string) Tool

WebSearchTool creates a tool that searches the web for current information.

func WriteFileTool

func WriteFileTool() Tool

WriteFileTool creates a tool that writes content to a file.

Jump to

Keyboard shortcuts

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