Visualize OpenAI Agents SDK handoffs and estimate their cost
Paste the code that defines your agents and Nodagentry draws them as a graph: who runs first, who hands off to whom, and the estimated cost of each agent. Then run it in the free simulator, try a cheaper model on the expensive agent and compare before and after.
From handoffs to graph
A triage agent that hands customers to billing or refunds, all on the same model.
from agents import Agent, Runner
billing = Agent(name="Billing", instructions="Answer billing questions.", model="gpt-4.1")
refunds = Agent(name="Refunds", instructions="Handle refund requests.", model="gpt-4.1")
triage = Agent(
name="Triage",
instructions="Send the customer to the right agent.",
model="gpt-4.1",
handoffs=[billing, refunds],
)
result = Runner.run_sync(triage, "I was charged twice for one order.")
Triage only routes, so it rarely needs gpt-4.1. In the editor, apply the top insight or move Triage to Frontier Mini, run again, and Change in your code suggests the model name to use.
How the SDK maps to the graph
| In your code | In Nodagentry |
|---|---|
| Agent(name=..., model=...) | A model step on that model's price tier |
| Runner.run(triage, ...) / run(triage, ...) | Input flows to that agent first |
| handoffs=[billing, handoff(refunds)] | A branch: one route per target, plus reply |
| tools=[other_agent.as_tool(...)] | A step after the calling agent |
| tools=[function_tool, WebSearchTool()] | Listed on the step; tools add no model cost |
| Agents no run reaches | Left out, and listed in the import notes |
Models are read from model= as a string, a variable, or a model object such as LitellmModel(model=...).
Price tiers
Each agent lands on one of five tiers. You can change any step's tier in the Inspector.
| Tier | Models in your code | Per 1M tokens in / out |
|---|---|---|
| Frontier Pro | claude-opus-4-1, o3, gpt-4.5 | $15 / $60 |
| Frontier | gpt-4o, gpt-4.1, claude-sonnet-4-5, gemini-2.5-pro | $2.5 / $10 |
| Frontier Mini | gpt-4o-mini, claude-3-5-haiku, gemini-2.5-flash, o3-mini | $0.8 / $3.2 |
| Open 70B | llama-3.3-70b, mixtral-8x7b, qwen2.5:72b | $0.4 / $0.8 |
| Local 7B | llama3.1:8b, qwen2.5:7b, mistral | $0.05 / $0.1 |
What it can't see yet
- Guardrails run extra model calls; they are noted on the agent but not priced.
- Agents built in a loop or from config at run time.
- How many turns an agent takes with its tools. The estimate covers one turn per agent.
Questions
- Is my code uploaded or run?
- No. The importer reads the code as text in your browser to find agents, handoffs and models. Nothing is executed and the code is not sent to a server. If you are signed in, the imported graph is saved to your account as a new workflow.
- Does it work with the JavaScript SDK too?
- Yes. It reads new Agent({...}) and Agent.create({...}) from @openai/agents as well as Agent(...) in Python, and finds the starting agent from Runner.run, run_sync or run().
- What if an agent doesn't set a model?
- It uses the SDK's default model (gpt-4.1 when this guide was written). The importer says which agents it assumed, and you can change the tier in the Inspector.
- How are handoffs drawn?
- An agent with handoffs gets a branch after it: one route per handoff target and one for answering directly. Handoffs back to an earlier agent are drawn as a single pass, so the estimate is the cost of one trip through the agents.
- Is Nodagentry affiliated with OpenAI?
- No. Nodagentry is an independent product by Wasapile Labs. OpenAI is a trademark of OpenAI.
Next
Catch cost increases before they merge with the CI cost check, or see how LangGraph and CrewAI code import.