Skip to main content

Overview

Lye tools follow a specific format that makes them compatible with Tyler agents and LLM function calling. Each tool consists of a definition (for the LLM) and an implementation (the actual function).

Tool Structure

Each Lye tool is a dictionary with the following structure:

Tool Implementation

Tool functions follow specific patterns:
Automatic Weave Tracing: Tyler automatically wraps all tool implementations with weave.op() when they are registered. You don’t need to add @weave.op() decorators to your tools - they will appear in Weave traces automatically with the tool name as the operation name.

Basic Tool

Tool with Files

Tools that return files use a tuple format:

Parameter Types

Basic Types

Enums

Arrays

Optional Parameters

Return Formats

Simple string return

Structured return with files

Error Handling

Tool Naming Conventions

Lye follows consistent naming patterns:
  • Format: category-action_target
  • Examples:
    • web-fetch_page
    • files-read_file
    • image-generate_image
    • slack-send_message

Using tools with agents

Direct Usage

Tool Selection

Tool Execution Flow

  1. User Request: User asks agent to perform a task
  2. Tool Selection: Agent selects appropriate tool based on description
  3. Parameter Extraction: Agent extracts parameters from context
  4. Validation: Parameters are validated against schema
  5. Execution: Tool function is called with parameters
  6. Result Processing: Result is returned to agent
  7. Response: Agent incorporates result into response

Best practices

Clear descriptions

Parameter descriptions

Error messages

File returns

Tool Timeout

For tools that may take a long time (external API calls, file processing), set a timeout value:
When a tool exceeds its timeout:
  1. A TimeoutError is raised with the message: Tool 'tool_name' timed out after X seconds
  2. The error is returned to the LLM as the tool result
  3. The LLM can then decide how to proceed

Example: Complete Tool

Testing tools