Skip to main content

What are Tools?

Tools are the actions agents can take to interact with the world. They’re how agents read files, execute commands, search the web, and accomplish real tasks. When an agent receives a request, it decides which tools to use, calls them with appropriate parameters, receives the results, and uses that information to continue reasoning or respond to the user.

The Tool-Use Loop

1

Receive Input

Agent receives a message from the user via a channel.
2

LLM Decision

The LLM analyzes the request and decides which tool(s) to use.
3

Tool Execution

klaw executes the tool with the provided parameters (2-minute timeout).
4

Result Processing

Tool output is formatted and fed back to the LLM.
5

Continue or Respond

LLM either calls more tools or generates a final response.

Built-in Tools

klaw includes 12 powerful tools out of the box:

Command Execution

bash

Execute shell commands with full system access.
Features:
  • 2-minute default timeout
  • Working directory preservation
  • Exit code and output capture
  • Streaming output for long commands

File Operations

read

Read file contents with line numbers.

write

Create or overwrite files.

edit

Precise string replacement in files.

glob

Find files by pattern.

grep

Search file contents with regex.

web_search

Search the internet.

Web

web_fetch

Fetch and process web content.
Features:
  • HTML to markdown conversion
  • AI-powered content extraction
  • Redirect handling
  • 15-minute cache

Agent Management

agent_spawn

Create persistent agent bindings for the orchestrator.

delegate

Spawn an ephemeral sub-agent to handle a task inline. The sub-agent runs independently with its own tool set and returns a text result.
Features:
  • Runs inline — result returned directly to the parent agent
  • Optional tool allowlist to restrict sub-agent capabilities
  • Custom system prompt and max tokens per sub-agent
  • Depth-limited nesting (max 3 levels)
  • 5-minute timeout, 30k char output truncation

skill

Install and manage skills.

Scheduling

cron

Schedule recurring tasks.

Tool Schema

Each tool defines a JSON schema for its parameters:

Example Schema (bash)

Tool Execution Flow

When an agent calls a tool:

Tool Permissions

Control which tools agents can access:

Permission Levels

Custom Tools

Create custom tools by implementing the Tool interface:
Register the tool:

Tool Output Formatting

Tool results are formatted for LLM consumption:

Timeouts and Limits

Override in config:

Best Practices

Only grant bash access when truly needed. Use specific file tools when possible.
Long-running commands should have explicit timeouts to prevent hanging.
Set workdir to limit file operations to specific directories.
Tool outputs are visible in the conversation. Sensitive data may be exposed.

Next Steps

Skills

Compose tools into capability bundles

Custom Tools Guide

Build your own tools