Tools#

Build typed tools from annotations and docstrings.

Read the walkthrough before consulting individual signatures.

Public interfaces#

Interface

Purpose

AgentTool

A tool is a name, an input schema, and an async callable.

ToolExecutionMode

Local scheduling policy for one Agent tool.

get_tool_guidelines

Extract immutable Guidelines entries from a function docstring.

get_tool_snippet

Extract the Snippet section from a function docstring.

render_tool_description

Return a tool description that carries its snippet and guidelines.

render_tool_guidance

Render grouped tool metadata for insertion into a system prompt.

render_tool_search_text

Return every model-facing text field of one tool for search indexing.

tool

Turn a typed function and its structured docstring into an AgentTool.

bash

Run a shell command with captured output from the current working directory.

delete_file

Delete one regular file by relative or absolute path.

glob

Find paths matching a relative or absolute glob pattern.

grep

Search UTF-8 text files selected by a relative or absolute glob pattern.

read

Read a local file: UTF-8 text as a line range, or a PNG, JPEG, GIF, or WebP image as an image.

read_file

Read a line range from a UTF-8 text file.

edit

Edit an existing UTF-8 file by replacing exact text; always use this tool to modify a file.

write_file

Atomically write a UTF-8 text file.

view_image

View a PNG, JPEG, GIF, or WebP from a local path or HTTP(S) URL.