A hands-on, teaching-by-doing path to mastering the OpenAI Agents SDK.
This repository documents my comprehensive learning journey through the OpenAI Agents SDK, following a hands-on, teaching-by-doing approach. As I master each concept, I create my own explanations, examples, and projects to solidify understanding and help fellow learners.
"The best way to learn is to teach." β Richard Feynman
I believe in learning through active creation and explanation. This repo captures not just what I've learned, but how I learned it β including challenges, breakthroughs, and real applications.
This journey is inspired by @mjunaidca's agents-sdk-decoded β a brilliant expert-level educational resource.
- π Personal explanations in my own words
- π― Focused on practical understanding
- π Live examples built step-by-step
- π Documenting the learning process
- π‘ Beginner-friendly + real-world mindset
By the end of this journey, I aim to:
- β Master the OpenAI Agents SDK from fundamentals to advanced patterns
- β Build production-ready agentic applications
- β Understand the DACA framework for scalable systems
- β Create developer-friendly documentation
- β Help others learn agentic AI β one concept at a time
.
βββ π modules/
β βββ π 01_agents/
β βββ π 02_runner/
β βββ π 03_results/
β βββ π 04_stream/
β βββ π 05_tools/
β βββ π 06_handoffs/ # NEW: Advanced handoff, input filtering, callbacks, prompt engineering
β βββ π 07_lifecycle/ # NEW: Agent lifecycle hooks, monitoring, analytics
β βββ π 08_exceptions/ # In Progress: Exception handling, error flows
β βββ π 09_guardrails/ # In Progress: Guardrails, input validation, safety
β βββ π projects/
β βββ π 01_fantasy_world_generator/
β βββ π 02_university_helpdesk_orchestration/ # NEW: Advanced multi-agent orchestration project
β βββ π README.md
βββ π« .gitignore
βββ π .python-version
βββ π main.py
βββ π pyproject.toml
βββ π README.md
βββ π uv.lock
βββ π .env.example
βββ π LICENSE
Note: Each module and project contains its own README for detailed explanations, code summaries, and learning notes.
Module/Section | Status |
---|---|
π 01_agents | β Completed Core agent patterns, context, instructions, structured outputs, advanced orchestration, tool behavior control, agent handoffs |
β‘ 02_runner | β Completed Agent execution, RunResult exploration, execution lifecycle, synchronous execution, streaming patterns, real-time event processing, advanced context, handoffs, chat, exceptions |
π 03_results | β Completed RunResult basics, results handling, and multi-turn conversation management |
π‘ 04_stream | β Completed Advanced streaming patterns, real-time events, token-by-token streaming, run item events, and streaming with agent handoffs |
π§ 05_tools | β Completed Function tools, custom configurations, agents as tools, error handling, context-aware tools, advanced tool choice patterns |
π€ 06_handoffs | β Completed Advanced handoff orchestration, input filtering, callbacks, structured handoff data, prompt engineering |
π 07_lifecycle | β Completed Agent lifecycle hooks, monitoring, analytics, session management, performance tracking |
π¨ 08_exceptions | π§ In Progress Exception handling, error flows, advanced error management |
π‘οΈ 09_guardrails | π§ In Progress Guardrails, input validation, safety, compliance |
π§© Projects | π Started: Real-world agentic applications and showcases |
... | ... |
The modules/projects/
folder contains real-world, showcase projects that demonstrate advanced agentic workflows, tool integrations, and creative applications using the OpenAI Agents SDK.
- Fantasy World Generator: An interactive multi-agent system that builds a fantasy world, including magic systems, maps, lore, and magical creatures. Demonstrates agent orchestration, agents-as-tools, streaming, and creative AI workflows.
- University Smart Helpdesk Orchestrator: A real-world multi-agent system simulating a university helpdesk. Features advanced orchestration, context-aware routing, escalation handling, streaming UX, and smart agent handoffs. Demonstrates context models, escalation logic, and real-time agent transitions.
See each project's README for setup and usage instructions.
- Agent Handoffs & Input Filtering: See
modules/06_handoffs/
for advanced handoff orchestration, input filtering, callbacks, and prompt engineering. - Agent Lifecycle Hooks & Monitoring: See
modules/07_lifecycle/
for RunHooks, AgentHooks, session management, and analytics. - Guardrails & Exception Handling: See
modules/08_exceptions/
andmodules/09_guardrails/
for in-progress work on error management and safety. - University Helpdesk Orchestration Project: See
modules/projects/02_university_helpdesk_orchestration/
for advanced multi-agent orchestration, escalation, and context-aware routing. - All previous advanced streaming, tool integration, and orchestration features remain available in their respective modules.
- Python (version specified in
.python-version
) - uv package manager installed
.env
file with OpenAI/Gemini/OpenRouter API keys
# Clone the repository
git clone https://github.com/ZohaibCodez/agents-sdk-from-zero.git
cd agents-sdk-from-zero
# Initialize environment
uv venv
.venv\Scripts\activate # For Windows
# or
source .venv/bin/activate # For macOS/Linux
# Install dependencies
uv sync
# Copy environment variables
cp .env.example .env # Then add your API key inside
- Python version: Managed by
.python-version
- Dependency manager:
uv
(uv add
,uv sync
) - Virtual environment:
.venv/
- API secrets: Stored in
.env
file
- Understand β Study SDK internals and examples
- Apply β Build simplified working demos
- Explain β Write markdown explanations and insights
- Extend β Build real tools and integrations
- Repeat β Keep iterating and improving
This is a personal learning repo, but:
- π¬ Ask questions via GitHub Issues
- βοΈ Suggest improvements if you spot unclear parts
- π Star the repo if it helps β it motivates me to keep going!
π― Final Goal:
Master the OpenAI Agents SDK from foundation to production-ready apps.
π Philosophy:
Learn deeply. Build consistently. Teach simply.
- π’ Follow this repo for updates
- π€ Let's build the Agentic future, one concept at a time
π Learning Never Stops β This repository is a living record of my OpenAI Agents SDK mastery. Join me on the journey!
Last Updated: 2025-07-13