agenttool

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(registry *tool.Registry, ag agent.Agent, opts ...Option) error

Register registers an Agent as a callable tool in the registry.

Types

type ArgExtractor

type ArgExtractor func(parsed map[string]any) (string, error)

ArgExtractor extracts the input string from parsed tool arguments. The default extractor reads the "input" field; custom extractors can handle richer parameter schemas.

type Option

type Option func(*config)

Option is a functional option for configuring agent-as-tool registration.

func WithArgExtractor

func WithArgExtractor(fn ArgExtractor) Option

WithArgExtractor overrides how raw JSON arguments are converted to the input string sent to the agent. This is useful when the parameter schema contains fields beyond the default "input" property.

func WithDescription

func WithDescription(desc string) Option

WithDescription overrides the tool description (defaults to agent.Description()).

func WithName

func WithName(name string) Option

WithName overrides the tool name (defaults to agent.Name()).

func WithParameters

func WithParameters(params any) Option

WithParameters overrides the JSON Schema parameters. When using a custom schema, also provide WithArgExtractor to match the new schema, otherwise the default extractor (which reads "input") is used.

Jump to

Keyboard shortcuts

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