Documentation
¶
Overview ¶
Package tool provides ADK-Go tool.Tool adapters for agent-go consumers.
Package tool provides shared tool system types and definitions for agent-go consumers.
Index ¶
- func NewAdkTool(cfg AdkToolConfig, handler func(name string, args json.RawMessage) *ToolResult) adktool.Tool
- func ToOpenAIDefinitions(defs []ToolDefinition) []fwllm.OpenAIToolDefinition
- type AdkToolConfig
- type ApprovalMode
- type AskQuestionsArgs
- type DelegateTaskArgs
- type EditFileArgs
- type FileSearchArgs
- type GrepSearchArgs
- type ListDirArgs
- type MemoryArgs
- type NewWorkspaceArgs
- type QuestionItem
- type ReadFileArgs
- type RiskLevel
- type RunCommandArgs
- type SubTaskDelegate
- type SubTaskResult
- type TokenUsageInfo
- type ToolDefinition
- type ToolExecutor
- type ToolHandler
- type ToolResult
- type WriteFileArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdkTool ¶ added in v0.2.0
func NewAdkTool(cfg AdkToolConfig, handler func(name string, args json.RawMessage) *ToolResult) adktool.Tool
NewAdkTool creates an ADK-compatible tool from a handler and config.
func ToOpenAIDefinitions ¶ added in v0.2.0
func ToOpenAIDefinitions(defs []ToolDefinition) []fwllm.OpenAIToolDefinition
ToOpenAIDefinitions converts a slice of ToolDefinition (ADK format) to OpenAI-compatible tool definitions for use with non-ADK LLM calls.
Types ¶
type AdkToolConfig ¶ added in v0.2.0
type AdkToolConfig struct {
Name string
Description string
Parameters map[string]any // OpenAI-style parameter definitions
}
AdkToolConfig configures an ADK tool adapter.
type ApprovalMode ¶
type ApprovalMode string
const ( ApprovalModeAuto ApprovalMode = "auto" ApprovalModeDefault ApprovalMode = "default" ApprovalModeManual ApprovalMode = "manual" )
func ParseApprovalMode ¶
func ParseApprovalMode(s string) ApprovalMode
type AskQuestionsArgs ¶
type AskQuestionsArgs struct {
Questions []QuestionItem `json:"questions"`
}
type DelegateTaskArgs ¶
type EditFileArgs ¶
type EditFileArgs struct {
Path string `json:"path"`
Edits json.RawMessage `json:"edits"`
}
type FileSearchArgs ¶
type FileSearchArgs struct {
Glob string `json:"glob"`
}
type GrepSearchArgs ¶
type ListDirArgs ¶
type ListDirArgs struct {
Path string `json:"path"`
}
type MemoryArgs ¶
type NewWorkspaceArgs ¶
type QuestionItem ¶
type ReadFileArgs ¶
type RunCommandArgs ¶
type RunCommandArgs struct {
Command string `json:"command"`
}
type SubTaskDelegate ¶
type SubTaskResult ¶
type TokenUsageInfo ¶
type ToolDefinition ¶
ToolDefinition 工具定义(供 LLM function calling 使用)
func DefaultToolDefinitions ¶ added in v0.2.0
func DefaultToolDefinitions() []ToolDefinition
DefaultToolDefinitions returns a shared set of 18 tool definitions in ToolDefinition format (framework-neutral, no application-specific names). These are the standard tools available to all agent-go based applications. Application-specific tools (e.g., logo generator, FFmpeg) should be defined in the application layer, not here.
type ToolExecutor ¶
type ToolExecutor struct {
// contains filtered or unexported fields
}
ToolExecutor 基于注册表的工具执行器
func (*ToolExecutor) Execute ¶
func (e *ToolExecutor) Execute(toolName string, args json.RawMessage) *ToolResult
Execute 统一执行入口
func (*ToolExecutor) Get ¶
func (e *ToolExecutor) Get(name string) (ToolHandler, bool)
Get 获取已注册的工具处理器
func (*ToolExecutor) Register ¶
func (e *ToolExecutor) Register(name string, handler ToolHandler)
Register 注册一个工具处理器
type ToolResult ¶
type ToolResult struct {
Success bool `json:"success"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
Diff string `json:"diff,omitempty"`
BackupPath string `json:"backup_path,omitempty"`
FileExists bool `json:"file_exists,omitempty"`
}
ToolResult 工具执行结果