agenttool

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package agenttool implements the AgentTool — the agent's way to spawn a nested sub-agent with a specific prompt.

When the model calls AgentTool, the tool:

  1. Builds a fresh user message from the supplied prompt.
  2. Runs a nested agent loop (same tools, same client, new history).
  3. Returns the sub-agent's final text response.

This mirrors AgentTool.tsx's core call() path (the non-team, non-remote, non-background case) — a synchronous forked sub-agent that returns its result text.

Reference: src/tools/AgentTool/AgentTool.tsx

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	Prompt      string `json:"prompt"`
	Description string `json:"description,omitempty"`
}

type Tool

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

Tool implements the AgentTool.

func New

func New(runAgent func(ctx context.Context, prompt string) (string, error)) *Tool

New returns an AgentTool. runAgent is a closure that runs a nested agent loop with the given prompt as the sole user message and returns the final assistant text.

func (*Tool) Description

func (*Tool) Description() string

func (*Tool) Execute

func (t *Tool) Execute(ctx context.Context, raw json.RawMessage) (tool.Result, error)

func (*Tool) InputSchema

func (*Tool) InputSchema() json.RawMessage

func (*Tool) IsConcurrencySafe

func (*Tool) IsConcurrencySafe(json.RawMessage) bool

func (*Tool) IsReadOnly

func (*Tool) IsReadOnly(json.RawMessage) bool

func (*Tool) Name

func (*Tool) Name() string

Jump to

Keyboard shortcuts

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