Skip to main content
Learn how to create, configure, and use tools with Laddr agents.

Basic Tool Structure

Tools are Python functions decorated with @tool:

The @tool Decorator

Syntax

Parameters


JSON Schema Types

String

Number

Boolean

Array

Object (Nested)


Tool Patterns

API Wrapper

Data Transformer

File Operations


Registering Tools with Agents

Single Tool

Multiple Tools


Tracing Configuration

Enable/Disable Tracing

Mask Sensitive Fields


Error Handling

Return Error Status

Raise Exceptions

Return error dictionaries for recoverable errors. Raise exceptions for critical failures.

Testing Tools

Manual Testing

Unit Testing

Integration Testing


Best Practices

1. Clear Descriptions

2. Validate Inputs

3. Consistent Return Format

4. Handle Errors Gracefully


Advanced Patterns

Async Tools

Tool Composition


Next Steps