Skip to main content

Overview

Tools are the actions agents can take. While klaw includes many built-in tools, you can create custom tools for specialized needs—connecting to internal APIs, integrating with proprietary systems, or implementing domain-specific operations.

Tool Interface

Every tool implements this interface:

Creating a Basic Tool

Example: Weather Tool

Registering Custom Tools

Add to Registry

Via Skill

Package your tool as a skill:

Tool Design Patterns

Input Validation

Always validate inputs:

Error Handling

Return clear, actionable errors:

Timeouts

Respect context cancellation:

Streaming Results

For long operations, provide progress:

Common Tool Types

HTTP API Tool

Database Tool

File Processing Tool

Testing Tools

Best Practices

  • Validate and sanitize all inputs
  • Use parameterized queries for databases
  • Limit file system access
  • Don’t expose sensitive data in error messages
The LLM reads your tool description to decide when to use it. Be specific:Bad: “Gets data” Good: “Fetches user profile data by user ID. Returns name, email, and role.”
Always respect context cancellation and set appropriate timeouts.
Format output for LLM consumption—structured, clear, and actionable.

Next Steps

Skills System

Package tools as skills

Tools Reference

Built-in tools documentation