agentsdiagram
See, plan and edit your AI agents. agentsdiagram reads the code of your
smolagents and PydanticAI
agents and draws them: agents, tools, MCP servers, managed agents and delegation, hand-off
workflows and pydantic-graph flows. Then it lets you change them from the diagram: plan agents and
tools that do not exist yet, connect agents, swap models. Every change is written to your code.
It is static analysis: your code is parsed, never imported or executed. No API keys, no dependencies of your project, no network.
Dark theme
Website, tutorials and live demos: https://alex-roc.github.io/agentsdiagram/
Quick start
uvx agentsdiagram scan . -f html -o agents.html # an interactive page, open it in any browser
uvx agentsdiagram serve # the same, live and editable, at http://127.0.0.1:8765
uvx agentsdiagram check . # diagnostics; exit 1 on errors (CI, pre-commit)
Or install it: uv tool install agentsdiagram / pip install agentsdiagram (Python 3.11+).
In your editor: the Agents Diagram extension for
VS Code and
Open VSX (Cursor, Windsurf, Positron).
See
from smolagents import CodeAgent, InferenceClientModel, WebSearchTool, tool
@tool
def get_weather(city: str) -> str:
"""Current weather for a city.
Args:
city: Name of the city.
"""
return "sunny"
assistant = CodeAgent(tools=[get_weather, WebSearchTool()], model=InferenceClientModel())
agentsdiagram scan turns that into a diagram with the agent, its model and its two tools, and
it scales to teams: managers and managed agents, agents that delegate to agents inside tools, MCP
servers, toolsets and their wrappers, workflows that run agents in order, pydantic-graph flows.
Click a node for its details and "Go to code"; / searches; the legend filters. Anything that
only exists at runtime shows up as a dashed dynamic node instead of silently disappearing.
agentsdiagram check catches mistakes the libraries only report at runtime, if at all: a smolagents
managed agent without a description, a @tool without type hints, two tools with the same name,
PydanticAI v1 API.
Plan
Sketch a system before writing it. Plan agent in the diagram, or agentsdiagram edit add-agent,
writes a planned agent; Add tool writes a typed stub that raises
NotImplementedError("agentsdiagram: planned"). The plan is real, importable code, drawn with a
dashed outline until you implement it, and agentsdiagram check lists what is left to do.
agentsdiagram edit add-agent booker --parent assistant --description "Finds and books flights."
agentsdiagram edit add-tool booker search_flights --params "origin: str, destination: str, date: str"
agentsdiagram edit add-mcp booker --url https://maps.example.com/mcp
Edit
Connect agents (managed_agents in smolagents, a delegation tool in PydanticAI), add MCP servers,
change models and instructions, disconnect and remove, or move a PydanticAI agent's settings to an
Agent Spec. Changes are made with LibCST, so the rest of the file keeps its formatting, imports
are added where they belong, and in VS Code every change can be undone. The code stays the only
source of truth: there is no project file and nothing to sync. How it works.
What it understands
| smolagents 1.x | PydanticAI 2.x | |
|---|---|---|
| Agents | CodeAgent, ToolCallingAgent |
Agent(...), Agent.from_file("spec.yaml"), factories (make_agent()) |
| Tools | @tool, Tool subclasses, default tools, add_base_tools |
@agent.tool, @agent.tool_plain, tools=[f, Tool(...)] |
| Toolsets | ToolCollection, Hub/Space/LangChain sources |
FunctionToolset, wrappers (.prefixed(), .filtered()…), @agent.toolset |
| MCP | ToolCollection.from_mcp, MCPClient |
MCPToolset(...), load_mcp_toolsets("mcp.json"), MCP(url=...) |
| Multi-agent | managed_agents=[...] |
agent run inside a tool, SubAgents, hand-off functions |
| Flows | — | pydantic-graph GraphBuilder (steps, decisions, joins) and BaseNode |
| Checks | managed agents without name/description, @tool without hints, name clashes |
v1 API still in use |
| Plan and edit | agents, @tool stubs, MCPClient, managed_agents, models |
agents, @agent.tool_plain stubs, MCPToolset, delegation tools, models, Agent Specs |
Full coverage: smolagents · PydanticAI.
Learn
- Getting started
- Tutorials: 1. One smolagents agent · 2. One PydanticAI agent · 3. Teams of agents · 4. Plan before you code · 5. Edit from the diagram · 6. Diagrams in CI and docs · 7. With coding agents
- Guides: command line · plan and edit · VS Code extension
- Examples, from one agent to a team:
examples/
How it works
your code ──LibCST──▶ adapters (smolagents, pydantic_ai) ──▶ IR (JSON) ─┬─▶ Mermaid / Markdown
▲ ├─▶ HTML viewer (React Flow)
│ ├─▶ serve (live, editable)
└──────────── edits (LibCST, minimal diffs) ◀── edit protocol ◀─────┴─▶ LSP ─▶ VS Code panel
The IR is a small, versioned JSON format (docs/ir.md); the viewer and the extension use TypeScript types generated from its JSON Schema. Architecture and design decisions: docs/architecture.md.
Roadmap
- More frameworks through adapters (docs/adding-a-framework.md): OpenAI Agents, Google ADK, Agno, Strands, LangGraph.
- Keep a hand-arranged layout (
.agentsdiagram/layout.json, matched by kind, file and name). - Import and export smolagents
agent.json.
Development
uv sync # Python 3.11+, includes pydantic-ai and smolagents for the oracle tests
pnpm install && pnpm build # viewer + extension (pnpm 11, Node 22+)
uv run pytest # unit, snapshot, oracle, drift, edit, serve and LSP tests
pnpm test # viewer (vitest) + extension smoke test
More in docs/architecture.md and docs/releasing.md.
License
MIT © 2026 Alex Ojeda Copa
Metadata
Release files for agentsdiagram 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| agentsdiagram-0.4.0.tar.gz | 1.6 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentsdiagram-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.9 MB
Release files / agentsdiagram-0.4.0.tar.gz
| Download URL | agentsdiagram-0.4.0.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4979db225fa532cd3aa6d4166ece70e8733057d480962cb695bc716819041f81
|
|
BLAKE2b-256 checksum How to use checksums |
89ec7ea6ee4c5c09231d7ab07636c71d03d0dfc63e5b094b10197e55a5eeffc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logRelease files / agentsdiagram-0.4.0-py3-none-any.whl
| Download URL | agentsdiagram-0.4.0-py3-none-any.whl |
|---|---|
| Size | 251.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c062c3a57910d09b64e572b7e3d9295acc36103851df8ece1a9378c8827c1ed3
|
|
BLAKE2b-256 checksum How to use checksums |
0c5390adf195224376b9a882fd480f88a4fb76be8d490b73994b2e212fff39a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logSecurity for agentsdiagram 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for agentsdiagram-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.