Summary
In this chapter, we gave agents the ability to perform real work by connecting them to tools (custom, hosted, agents, and external servers). We started with custom Python tools using @function_tool, showing how to register and describe tools so the agent can understand and use them. We explored how we can impact tool decision logic through the tool_choice and tool_use_behavior parameters.
We then built several real-world tools and agents, using four different paradigms: custom tools via Python functions, hosted tools via OpenAI modules, agents as tools, and external server tools via MCP.
With these patterns in place, you now have everything you need to build agents that not only understand and reason, but also take action, connect to live systems, and integrate seamlessly with external services.
In the next chapter, we’ll explore how to manage agent knowledge and memory.