Back to Agno

CodingTools

cookbook/91_tools/coding_tools/README.md

2.6.41.6 KB
Original Source

CodingTools

A minimal, powerful toolkit for coding agents. Provides 4 core tools and 3 optional exploration tools.

Philosophy

Inspired by the Pi coding agent: a small number of composable tools is more powerful than many specialized ones. With read_file, edit_file, write_file, and run_shell, an agent can perform any coding task.

Tools

Core (enabled by default)

ToolDescription
read_fileRead files with line numbers and pagination
edit_fileExact text find-and-replace with unified diff output
write_fileCreate or overwrite files, auto-creates parent dirs
run_shellExecute shell commands with timeout and output truncation

Exploration (opt-in)

ToolDescription
grepSearch file contents for a pattern
findSearch for files by glob pattern
lsList directory contents

Usage

python
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.coding import CodingTools

# Core tools only (default)
agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[CodingTools(base_dir="./workspace")],
)

# All 7 tools
agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[CodingTools(base_dir="./workspace", all=True)],
)

# Selective
agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[CodingTools(base_dir="./workspace", enable_grep=True, enable_find=True)],
)

Examples

FileDescription
01_basic_usage.pyCore 4 tools with a coding agent
02_all_tools.pyAll 7 tools enabled