Skip to main content

Overview

Tools enable agents to interact with their environment, perform actions, and access external resources. PiCrust comes with a comprehensive set of built-in tools.

Built-in Tools

File System Tools

Read

Read contents of files

Write

Create or modify files

Glob

Search files with patterns

Grep

Search file contents

System Tools

Bash

Execute shell commands

Environment

Access environment variables

How Tools Work

When an agent receives a task, it:
  1. Analyzes the request to understand what needs to be done
  2. Selects the appropriate tool(s) from its available toolset
  3. Executes the tool with the necessary parameters
  4. Processes the tool output
  5. Responds to the user with results
Tool execution flow

Creating Custom Tools

Build your own tools by implementing the Tool trait:
Register your custom tool:

Tool Security

Tools like BashExecutor can execute arbitrary commands. Only enable them when necessary and consider the security implications.

Best Practices

Only enable tools that are absolutely necessary for the agent’s tasks:
Add validation in custom tools:
Log all tool executions for audit trails:

Tool Examples

Example: File Analysis

Example: Code Execution

Next Steps

MCP Tools

Extend tools with MCP servers

API Reference

View tool API docs