Skip to main content Switch to mobile version agentsdiagram 0.4.1 See, plan and edit your AI agents: live diagrams of smolagents and PydanticAI code that can also write the code — CLI, browser and VS Code.
pip install agentsdiagram Copy PIP instructions
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.
Website, tutorials and live demos: https://alex-roc.github.io/agentsdiagram/
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).
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.
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.
Full coverage: smolagents · PydanticAI.
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/
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.
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.
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.
MIT © 2026 Alex Ojeda Copa
Both files in this release have provenance metadata.
MIT View SPDX License List
agents diagram llm mcp mermaid multi-agent pydantic-ai smolagents static-analysis visualization
Development Status 3 - Alpha
Intended Audience Developers
Operating System OS Independent
Programming Language Python :: 3
Topic Software Development :: Documentation
Software Development :: Quality Assurance
Release files for agentsdiagram 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 1.9 MB
Release files / agentsdiagram-0.4.1.tar.gz
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Release files / agentsdiagram-0.4.1-py3-none-any.whl
Security for agentsdiagram 0.4.1
Both files in this release have been uploaded with provenance metadata.
With provenance agentsdiagram-0.4.1.tar.gz Oct 23, 2026
Attestation for agentsdiagram-0.4.1.tar.gz
A 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.
Release history Release notifications | RSS feed
Oct 23, 2026 2 release files Full provenance
Oct 22, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




