Skip to main content

@tool Decorator

The @tool decorator defines integrations with external systems. Tools perform I/O operations like API calls, database queries, and file operations.

Basic Usage

from waxell_sdk import agent, tool

@agent(name="notifier")
class Notifier:

@tool
def send_email(self, ctx, to: str, subject: str, body: str):
"""Send an email notification."""
# Tool implementation provided by runtime
pass

Tool Parameters

Tools support typed parameters with validation:

from pydantic import BaseModel, EmailStr

class EmailParams(BaseModel):
to: EmailStr
subject: str
body: str
cc: list[EmailStr] = []

@tool
def send_email(self, ctx, params: EmailParams):
"""Send an email with validated parameters."""
pass

Built-in Tools

Waxell provides common tools out of the box:

ToolPurpose
http_requestMake HTTP requests
database_queryExecute database queries
file_readRead files
file_writeWrite files
slack_messageSend Slack messages

Tool Registration

Tools are registered in the control plane for governance:

# Tools can require approval
@tool(requires_approval=True)
def delete_record(self, ctx, record_id: str):
"""Delete a record (requires human approval)."""
pass

Next Steps