- Intent classification with LLM structured output (single/multi/ambiguous) - Discount agent with apply_discount and generate_coupon tools - Interrupt manager with 30-min TTL auto-expiration and retry prompts - Webhook escalation module with exponential backoff retry (max 3) - Three vertical industry templates (e-commerce, SaaS, fintech) - Template loading in AgentRegistry - Enhanced supervisor prompt with dynamic agent descriptions - 153 tests passing, 90.18% coverage
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""Agent tools registry -- maps tool name strings to actual tool functions."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from langchain_core.tools import BaseTool
|
|
|
|
from app.agents.discount import apply_discount, generate_coupon
|
|
from app.agents.fallback import fallback_respond
|
|
from app.agents.order_actions import cancel_order
|
|
from app.agents.order_lookup import get_order_status, get_tracking_info
|
|
|
|
_TOOL_MAP: dict[str, BaseTool] = {
|
|
"get_order_status": get_order_status,
|
|
"get_tracking_info": get_tracking_info,
|
|
"cancel_order": cancel_order,
|
|
"fallback_respond": fallback_respond,
|
|
"apply_discount": apply_discount,
|
|
"generate_coupon": generate_coupon,
|
|
}
|
|
|
|
|
|
def get_tools_by_names(tool_names: list[str]) -> list[BaseTool]:
|
|
"""Resolve tool name strings from YAML config to actual tool objects."""
|
|
tools = []
|
|
for name in tool_names:
|
|
if name not in _TOOL_MAP:
|
|
available = ", ".join(sorted(_TOOL_MAP.keys()))
|
|
raise ValueError(f"Unknown tool '{name}'. Available tools: {available}")
|
|
tools.append(_TOOL_MAP[name])
|
|
return tools
|