Tool Architecture
Every tool in the system implements a consistent interface that ensures predictable behavior and seamless integration:Tool Categories
Tools are organized into categories based on their functionality and risk level:- READONLY: Safe operations that only read data
- WRITE: Operations that modify files or state
- EXECUTE: Operations that run commands or scripts
- NETWORK: Operations that make network requests
- SYSTEM: Low-level system operations
Built-in Tools
The SDK includes a comprehensive set of built-in tools organized by functionality:File Operations
- file_read: Read file contents with line numbering
- file_write: Create new files or overwrite existing ones
- file_edit: Make targeted edits to existing files
- ls: List directory contents with metadata
Search & Discovery
- glob: Find files using glob patterns
- grep: Search file contents with regex support
- bash: Execute shell commands and scripts
Workflow Tools
- batch: Execute multiple tools in parallel
- think: Agent reasoning and planning
- claude: Agentic coding with Claude Code CLI
- sub_agent: Delegate tasks to specialized agents
File Operations
file_read: Reads file contents with optional line numbering and pagination:Search & Discovery
glob: Finds files using powerful glob patterns:Workflow Tools
batch: Executes multiple tools in parallel for efficiency:Tool Execution Flow
Understanding the execution flow helps optimize tool usage and debug issues:- Query Analysis: Agent analyzes the natural language query
- Tool Selection: Agent chooses appropriate tools to accomplish the task
- Argument Validation: Tool arguments are validated against schemas
- Permission Check: Permission manager verifies execution is allowed
- Execution: Tool runs in the configured execution environment
- Result Integration: Results are added to conversation context
- Response Generation: Agent synthesizes a natural language response
Execution Context
Each tool execution receives a context object with session information:Permission Management
The Agent includes sophisticated permission management to control tool execution:Permission Modes
Permission Levels
- No Permission Required: Safe read-only operations
- File Permission: File modification operations
- Execute Permission: Command execution and system operations
- Network Permission: Network requests and external API calls
Creating Custom Tools
Extend the agent’s capabilities by creating custom tools:Tool Development Best Practices
Parameter Validation: Always validate input parameters:Advanced Tool Features
Tool Chaining
Tools can invoke other tools through the execution context:Dynamic Tool Registration
Register tools conditionally based on environment or configuration:Tool Metadata
Provide rich metadata for better agent understanding:Tool Performance Optimization
Batch Operations
Use the batch tool for parallel execution:Caching Strategies
Implement caching in custom tools for repeated operations:Debugging Tools
Tool Execution Monitoring
Monitor tool execution through the event system:Tool Result Inspection
Examine tool results for debugging:Next Steps
- Learn about Agent Architecture to understand how tools integrate with agents
- Explore Session Management to see how tools interact with session state
- Understand Environment Types for different tool execution contexts
- Check out Getting Started for practical tool usage examples