Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Building Agents with OpenAI  Agents SDK
  • Table Of Contents Toc
  • Feedback & Rating feedback
Building Agents with OpenAI  Agents SDK

Building Agents with OpenAI Agents SDK

By : Habib
close
close
Building Agents with OpenAI  Agents SDK

Building Agents with OpenAI Agents SDK

By: Habib

Overview of this book

Everyone’s talking about AI agents, but how do you build one that works in the real world? Not a toy demo, but an agent that solves real problems, saves time, and integrates into workflows. With vague frameworks, fragmented tooling, and endless hype, most developers are left without a clear path. The hardest part isn’t technical; it is knowing where to start. This book gives you that starting point. It’s a complete guide to building intelligent AI agents and agentic systems using the official OpenAI Agents SDK. It begins by grounding you in the core concepts, design principles, and architecture of AI agents, how they differ from other traditional systems, their advantages, and why that matters. Through practical step-by-step projects, you’ll master every feature of the SDK—tools, memory, RAG, multi-agent orchestration, tracing, handoffs, and more—while contributing to an end-to-end agent system that grows in complexity. Projects include a custom support agent, invoice and inventory assistant, health advisor, sales trainer, and data analyst, giving you production-ready skills. By the end, you’ll know how to design, build, and deploy agentic systems that interact with APIs, query databases, hand off to external systems, and drive meaningful outcomes. You won’t just understand AI agents; you’ll be ready to ship them.
Table of Contents (15 chapters)
close
close
Lock Free Chapter
1
Part 1: AI Agents
5
Part 2: OpenAI Agents SDK
11
Part 3: Build AI Agents
13
Other Books You May Enjoy
14
Index

Using custom tools with Python functions

In this section, let’s explore how to define and configure custom tools using Python functions within OpenAI Agents SDK. As a reminder, tools are a core part of the agent’s capabilities as they enable the agent to go beyond its internal knowledge and perform tasks such as fetching data, processing user requests, or triggering actions. We’ll begin with simple tool definitions using the @function_tool decorator and then progress to more advanced capabilities, such as overriding tool parameters and using Pydantic models for complex input validation.

Defining a new tool

As we discussed in the previous chapter, OpenAI Agents SDK provides a @function_tool decorator that turns any Python function into a tool that can be called by an agent. For example, we will bring back the code that we wrote in the previous chapter that creates a simple tool and calls an agent with that tool:

# Required imports
import os
from dotenv...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Building Agents with OpenAI  Agents SDK
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon