Interactive course · 20 lessons · ~6 hours

The OpenAI SDK, the way production code uses it.

A "hello world" call takes three lines. A feature you can ship needs more: typed output you can trust, tools the model can call safely, streaming, retries, cost control and tests that do not hit the API. This course covers all of it in Python, from the first request to an agent.

0 of 20 lessons complete0%

The one idea this course is built on

A model call is a stateless function: input items in, output items out, over HTTPS. The model remembers nothing between calls, cannot run your code, and returns text unless you constrain it. Memory, tools, structured data and agents are all things your code builds around that one loop.

Your Python code · builds the input (instructions, history, files, tool schemas) · keeps state and memory · runs tools the model asks for · validates, retries, logs, bills client.responses.create(...) HTTPS POST: model + input items response: output items + usage (tokens) The model (OpenAI's servers) · reads the whole input as tokens · generates output tokens, one by one · returns EITHER a message OR a request to call your tool · keeps nothing unless you ask it to It never executes your functions itself. The tool loop (lesson 07), which every agent is built on call → model asks for get_sales(month) → your code runs it → send the result back → repeat until a final message
Everything in this course is a variation of this loop. Streaming changes how the output arrives, structured outputs change its shape, and tools add round trips. The Agents SDK automates the loop.
Who this is for, and what you need

You know Python functions, classes, and roughly what a dict or JSON is. Lessons use Python 3.11+ and the official openai package. Running the examples needs an API key with billing enabled, which costs cents for this course. The project also has an offline mode with a fake client, so you can run its tests with no key at all.

This API moves fast

Model names, prices and some parameters change every few months. The lessons teach concepts that stay stable (the request/response loop, tools, schemas, retries) and show where to check the current details: the API reference at platform.openai.com/docs and the SDK's changelog on GitHub.

Pick a path

~1.5 hours

I just need it working

Lessons 02, 03, 05, 06. Setup, the request shape, streaming and typed output.

~3 hours

I am building a feature

Lessons 03, 06, 07, 10, 12, 13. Add tools, embeddings, error handling and cost control.

~2 hours

I want agents

Lessons 07, 08, 15, 17, 18. The tool loop, hosted tools, state, the Agents SDK and evaluation.

~6 hours

Everything, properly

Start at lesson 01 and go in order, then build the project.

Ships with a hands-on project

🛠 A retail analyst assistant

Ask "which category lost the most revenue to returns last quarter?" and get a correct, cited answer. The assistant queries the SQL course's retail database through a read-only SQL tool, returns structured answers, streams its reply, finds products by meaning with embeddings, and tracks token cost per question. It ships with pytest tests that run against a fake client, so they need no key and no network.

Open the project →

The curriculum