OpenAI Agents SDK tutorial shows how to build multi‑agent systems for EV advice and support
A new Towards Data Science guide walks developers through creating an EV purchase adviser and a support bot with the OpenAI Agents SDK.
Source: Towards Data ScienceA tutorial published on Towards Data Science on November 8, 2026 demonstrates how to construct multi‑agent applications with the OpenAI Agents SDK, building an electric‑vehicle (EV) purchase adviser and a customer‑support bot in Python. The guide highlights reusable patterns—fan‑out, pipelines, hierarchies, and swarms—that let developers scale simple agents into sophisticated, coordinated systems.
What is the OpenAI Agents SDK?
The OpenAI Agents SDK is a Python library that streamlines the creation, orchestration, and communication of multiple AI agents. According to the tutorial, the SDK supplies a set of primitives for defining agents, routing messages, and managing state, allowing developers to focus on the logic of each role rather than low‑level integration. The SDK’s design encourages modularity: each agent can be instantiated with a distinct prompt or model, and the framework handles the plumbing needed for agents to call one another.
How does the tutorial build an EV purchase adviser?
The article walks readers through a step‑by‑step Python notebook. First, the author defines a product‑selection agent that asks the user about driving habits, budget, and charging preferences. The agent then queries a curated dataset of EV specifications and returns a shortlist of models. Next, a price‑comparison agent pulls pricing data from public APIs, formats the results, and presents the best deals. The two agents exchange messages through the SDK’s routing layer, enabling a smooth conversational flow where the user receives both recommendation and cost information in a single interaction.
What are fan‑out, pipelines, hierarchies, and swarms, and how are they used?
The tutorial introduces four architectural patterns that reuse the same building blocks:
- Fan‑out: One request triggers multiple parallel agents. In the EV adviser, the initial user query is broadcast to both the selection and price agents simultaneously, reducing latency.
- Pipelines: Output from one agent becomes input for the next. After the selection agent narrows the model list, the price agent receives that list to fetch up‑to‑date costs.
- Hierarchies: Agents are arranged in a tree, with higher‑level agents delegating subtasks to specialists. The support bot example places a top‑level triage agent that forwards technical questions to a troubleshooting agent or a billing agent as needed.
- Swarms: A collection of identical agents explores a solution space collectively, voting on the best answer. The guide shows a swarm of recommendation agents that each generate a ranked list of EVs; the final recommendation aggregates the rankings.
These patterns illustrate how a single SDK can power a spectrum of workflows, from simple request‑response bots to complex, collaborative AI teams.
How can developers reuse these building blocks in their own projects?
Because the SDK abstracts communication, developers can swap out prompts, models, or data sources without rewriting orchestration code. The tutorial emphasizes that the same fan‑out, pipeline, hierarchy, or swarm logic can be applied to unrelated domains—such as a travel‑planning assistant, a code‑review bot, or a research‑paper summarizer—by redefining the agents’ responsibilities. This reuse lowers engineering overhead and encourages rapid prototyping of multi‑agent solutions.
Applying the OpenAI Agents SDK concepts with Grafy
Grafy’s Code studio (see /code) lets you write, run, and iterate on Python scripts directly in the browser, with instant access to a wide range of cloud models via OpenRouter, Vertex AI, and others. You can replicate the tutorial’s EV adviser by:
- Opening a new notebook in Grafy Code.
- Installing the OpenAI Agents SDK with a single pip command.
- Copy‑pasting the example agent definitions and adjusting prompts to fit your use case.
- Using Grafy’s Graph view (/graph) to visualize the message flow between agents, which mirrors the fan‑out and pipeline diagrams in the tutorial.
- Testing the multi‑agent system interactively with Grafy Chat (/chat) to simulate user queries and watch how agents respond.
While Grafy does not yet host a dedicated multi‑agent UI, the combination of Code, Graph, and Chat provides a low‑friction environment for experimenting with the SDK’s patterns without leaving the platform.
What does this mean for the broader AI creator community?
The tutorial’s emphasis on reusable primitives signals a maturation of the multi‑agent paradigm: rather than building monolithic assistants, developers can assemble modular agents that specialize and collaborate. This approach aligns with Grafy’s broader vision of composable AI workflows, where creators can stitch together generation, editing, and reasoning components across apps. As more SDKs adopt similar abstractions, we can expect a rise in plug‑and‑play agent libraries, community‑shared agent templates, and tighter integration with low‑code platforms like Grafy.
Source: Towards Data Science – https://towardsdatascience.com/how-to-build-multi-agent-systems-with-the-openai-agents-sdk/
Frequently asked questions
How does the OpenAI Agents SDK handle state between agent calls?
The SDK maintains a lightweight context object that stores key‑value pairs passed along with each message. Agents can read from or write to this context, enabling them to remember prior inputs, user preferences, or intermediate results throughout a conversation.
Can the fan‑out pattern be used with models other than OpenAI’s?
Yes. Because the SDK abstracts the model interface, any compatible model—whether hosted on Vertex AI, Replicate, or a self‑hosted endpoint—can be assigned to an agent. Fan‑out simply routes the same request to multiple agents, regardless of the underlying model provider.
Is it possible to visualize agent interactions without writing code?
Grafy’s Graph app lets you import a JSON description of agent nodes and edges, automatically rendering a flowchart. While the tutorial itself is code‑centric, you can export the agent topology and drop it into Graph to get a visual overview of the system’s structure.
Source: Towards Data Science — How to Build Multi-Agent Systems with the OpenAI Agents SDK


