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_pagefiles-read_fileimage-generate_imageslack-send_message
Using tools with agents
Direct Usage
Tool Selection
Tool Execution Flow
- User Request: User asks agent to perform a task
- Tool Selection: Agent selects appropriate tool based on description
- Parameter Extraction: Agent extracts parameters from context
- Validation: Parameters are validated against schema
- Execution: Tool function is called with parameters
- Result Processing: Result is returned to agent
- 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 atimeout value:
- A
TimeoutErroris raised with the message:Tool 'tool_name' timed out after X seconds - The error is returned to the LLM as the tool result
- The LLM can then decide how to proceed