Selecting Tools
Tool selection should be driven by the agent's defined responsibilities. Every tool must be justified by a specific task the agent needs to perform.
6 min•By Priygop Team•Updated 2026
Tool Selection Framework
Tool Selection Framework
# Tool selection: map responsibilities to tools
def select_tools_for_agent(agent_name: str, responsibilities: list) -> dict:
"""
For each responsibility, identify the minimum set of tools required.
Reject any tool that is not needed for a defined responsibility.
"""
# Tool catalogue — all available tools
TOOL_CATALOGUE = {
"get_order": "Retrieve order details from the database by order ID",
"list_orders": "List orders for a customer with optional filters",
"issue_refund": "Issue a refund for an eligible order",
"reject_refund": "Record a refund rejection with a reason",
"send_email": "Send an email to a customer",
"create_ticket": "Create a support ticket in the helpdesk system",
"get_customer": "Retrieve customer profile and history",
"check_policy": "Check the refund policy for a given order and reason",
"notify_manager": "Send a notification to the on-call manager",
"web_search": "Search the web for information", # Probably not needed here!
}
# Responsibility → required tools mapping
RESPONSIBILITY_TOOLS = {
"Look up the order": ["get_order"],
"Check eligibility": ["get_order", "check_policy"],
"Issue refunds under $100": ["issue_refund"],
"Send confirmation emails": ["send_email"],
"Create support tickets": ["create_ticket"],
"Notify on-call manager": ["notify_manager"],
"Retrieve customer history": ["get_customer", "list_orders"],
}
required_tools = set()
for resp in responsibilities:
tools = RESPONSIBILITY_TOOLS.get(resp, [])
required_tools.update(tools)
return {
"agent": agent_name,
"responsibilities": responsibilities,
"tools_selected": list(required_tools),
"tools_rejected": [t for t in TOOL_CATALOGUE if t not in required_tools]
}
refund_agent_tools = select_tools_for_agent(
"RefundAgent",
["Look up the order", "Check eligibility",
"Issue refunds under $100", "Send confirmation emails"]
)
print(f"Agent: {refund_agent_tools['agent']}")
print(f"Tools selected: {refund_agent_tools['tools_selected']}")
print(f"Tools rejected (not needed): {refund_agent_tools['tools_rejected'][:3]}...")