@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:
| Tool | Purpose |
|---|---|
http_request | Make HTTP requests |
database_query | Execute database queries |
file_read | Read files |
file_write | Write files |
slack_message | Send 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
- @capability Decorator - Bundle reusable behaviors
- Production Guide - Deploy tools in production