HasTools
Declaring Tools
from djangosdk.agents.base import Agent
from djangosdk.tools.decorator import tool
@tool
def lookup_order(order_id: str) -> str:
"""Look up an order by ID.
Args:
order_id: The order identifier.
"""
return f"Order {order_id}: shipped on 2026-03-28"
@tool
def cancel_order(order_id: str, reason: str = "customer request") -> str:
"""Cancel an existing order.
Args:
order_id: The order to cancel.
reason: Reason for cancellation.
"""
return f"Cancelled {order_id}"
class SupportAgent(Agent):
tools = [lookup_order, cancel_order]How It Works
Async Tool Execution
Class Attributes
Attribute
Type
Default
Description
Error Handling
Last updated
Was this helpful?