Help us shape the future of Go! Take the 2026 Go Developer Survey

agenttool

package
v1.41.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package agenttool provides a tool that allows an agent to call another agent. This enables composition of agents (Pattern 2: agent-as-tool delegation).

This follows adk-go's agenttool pattern exactly:

  • Tool name matches agent name (not prefixed with "call_")
  • Child agent runs in isolated session (no state bleeding)
  • Parent state is copied to child (filtered for internal keys)

Example:

searchAgent, _ := llmagent.New(llmagent.Config{...})
analysisAgent, _ := llmagent.New(llmagent.Config{...})

rootAgent, _ := llmagent.New(llmagent.Config{
    Tools: []tool.Tool{
        agenttool.New(searchAgent, nil),   // ✅ adk-go aligned pattern
        agenttool.New(analysisAgent, nil),
    },
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ag agent.Agent, cfg *Config) tool.Tool

New creates a new agent tool that wraps the given agent. This enables Pattern 2 (agent-as-tool delegation) where the parent agent maintains control and receives structured results from the child agent.

If cfg is nil, default configuration is used (skipSummarization = false).

The child agent runs in an ISOLATED session (adk-go pattern), meaning:

  • Child has its own session state
  • Parent state is copied at invocation time (excluding internal keys)
  • State changes in child do NOT affect parent session

Types

type Config

type Config struct {
	// SkipSummarization, if true, will cause the agent to skip summarization
	// after the sub-agent finishes execution.
	SkipSummarization bool
}

Config holds the configuration for an agent tool.

Jump to

Keyboard shortcuts

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