OpenAI: Tool Calling & Structured Outputs
Build production-grade tool-calling systems with JSON Schema definitions, parallel execution, Pydantic structured outputs, and role-based permission enforcement.
View badge details
About This Course
Course Curriculum
10 Lessons
JSON Schema Tool Definitions
Learn how function calling works in the OpenAI Responses API. Covers defining tool schemas with JSON Schema, strict mode, tool_choice parameter, and designing reliable tool interfaces with clear names, descriptions, and parameter definitions.
Weather Lookup Tool - Lab Exercises
Build a weather assistant with a get_weather(location, unit) tool. Implements the complete tool invocation loop: model decides to call the tool, arguments are parsed and executed, the result is fed back, and the model generates a natural language response. Demonstrates JSON Schema tool definition, tool_choice=auto, and non-tool fallback.
Parallel Tool Calls & Tool Execution Loops
Learn how to handle multiple simultaneous tool calls from the model, build retry-safe execution loops, handle tool errors gracefully, map tool call IDs to results, and understand the difference between deterministic and non-deterministic tools.
Multi-Source Aggregation Pipeline - Lab Exercises
Build a research aggregator that calls weather, news, and stock price tools in parallel — assembling a combined briefing from concurrent results. Demonstrates parallel tool execution, collecting multiple tool call IDs, executing all tools, and feeding all results back in a single follow-up request.
Structured Outputs with Pydantic
Learn to use response_format with JSON Schema to guarantee output structure, use Pydantic models as the schema source, enforce strict mode, handle refusals, and build data extraction pipelines that turn unstructured text into typed objects.
Data Extraction Pipeline - Lab Exercises
Extract structured contact information from unstructured email text and line items from invoice text into typed Pydantic models. Uses client.responses.parse() with ContactInfo and InvoiceData Pydantic schemas. Covers handling Optional fields, nested models, and refusal detection.
Tool Permission Boundaries & Output Verification
Learn to restrict tool access by context, build tool access sandboxes with allowlists and denylists, enforce schema validation on tool outputs, guard against tool abuse with rate limits, and design least-privilege tool sets.
Tool Permission Sandbox - Lab Exercises
Build a role-based tool permission system where admin, editor, and viewer roles each have different tool access. The model only receives the tool schemas allowed for the current role, and all tool calls are verified against role permissions before execution.
Capstone Briefing: Production Tool Orchestration Runtime
Reviews all Course 201 concepts: tool schemas, parallel calling, execution loops, structured outputs, and permissions. Previews the capstone project architecture — a production-grade tool orchestration runtime with retry logic, permission enforcement, schema validation, and structured logging.
Capstone Project: Tool Orchestration Runtime - Lab Exercises
Build a production-grade tool orchestration runtime with a tool registry, role-based access control, parallel tool execution, retry logic with exponential backoff, JSON Schema output validation, and a structured execution log tracking tool name, arguments, result, latency, and success/failure per invocation.