“I want to build a tool that lets my AI agent query a PostgreSQL database. Show me a complete implementation: the Python function with proper error handling, the tool definition with accurate descriptions, and the safety considerations for letting a model generate and execute SQL queries.”
“My agent sometimes calls tools with wrong argument formats even though my definitions look correct. How do I diagnose and fix poor tool use? What changes to the description and parameter specifications most reliably improve argument quality?”
“What are the security risks of giving an AI agent access to write operations (creating records, sending emails, modifying data)? Show me a pattern for requiring explicit user confirmation before a write tool executes.”
“Show me how to build a web search tool using the Tavily or SerpAPI search API, wrapped in the Tool class pattern from this chapter, with proper error handling and a result format the model can easily read and cite.”
“I need my agent to work with both OpenAI and Anthropic APIs interchangeably. Show me how to write tool definitions once and a thin adapter layer that converts them to the correct format for each provider.”
