agentsdiagram
See your AI agents. agentsdiagram reads the code of your PydanticAI
and smolagents agents and draws them: agents, tools,
toolsets, MCP servers, capabilities, delegation between agents, hand-off workflows and
pydantic-graph flows.
It is static analysis: your code is parsed, never imported or executed. No API keys, no dependencies of your project, no network.
- CLI: Mermaid, JSON or a self-contained interactive HTML page.
- VS Code extension (also on Open VSX for Cursor, Windsurf and Positron): a live diagram next to your code that follows your edits, "Show in diagram" code lenses and diagnostics.
Quick start
uvx agentsdiagram scan path/to/project # Mermaid to stdout
uvx agentsdiagram scan . -f html -o agents.html # interactive page, open it in any browser
uvx agentsdiagram scan . -f markdown -o AGENTS-DIAGRAM.md # renders on GitHub
uvx agentsdiagram check . # diagnostics; exit 1 on errors (CI, pre-commit)
Or install it: uv tool install agentsdiagram / pip install agentsdiagram.
agentsdiagram scan [PATH] [-f mermaid|json|html|markdown] [-o FILE] [--framework pydantic_ai|smolagents]
[--include GLOB] [--exclude GLOB] [--title TEXT]
agentsdiagram check [PATH] [--strict] [--json]
agentsdiagram schema # JSON Schema of the IR
agentsdiagram lsp # language server (needs agentsdiagram[lsp]); used by the extension
Project-wide settings go in pyproject.toml:
[tool.agentsdiagram]
include = ["src/**"]
exclude = ["tests/**", "notebooks/**"]
What it understands
| PydanticAI 2.x | smolagents 1.x | |
|---|---|---|
| Agents | Agent(...), Agent.from_file("spec.yaml"), factories (make_agent()) |
CodeAgent, ToolCallingAgent |
| Tools | @agent.tool, @agent.tool_plain, tools=[f, Tool(...)] |
@tool, Tool subclasses, default tools, add_base_tools |
| Toolsets | FunctionToolset, wrappers (.prefixed(), .filtered()…), @agent.toolset |
ToolCollection, Hub/Space/LangChain sources |
| MCP | MCPToolset(...), load_mcp_toolsets("mcp.json"), MCP(url=...) |
ToolCollection.from_mcp, MCPClient |
| Multi-agent | agent run inside a tool, SubAgents, hand-off functions |
managed_agents=[...] |
| Flows | pydantic-graph GraphBuilder (steps, decisions, joins) and BaseNode |
— |
| Checks | v1 API still in use | managed agents without name/description, @tool without hints, name clashes |
Anything that only exists at runtime (lists built in a loop, tools fetched from a server) shows up as a dashed dynamic node instead of silently disappearing. Full coverage matrices: PydanticAI · smolagents.
VS Code extension
Install Agents Diagram from the Marketplace or Open VSX. It needs either
uv (the extension runs uvx agentsdiagram[lsp]) or your own command
in agentsdiagram.server.command. The Python extension is not required. See
packages/vscode/README.md.
How it works
your code ──LibCST──▶ adapters (pydantic_ai, smolagents) ──▶ facts ──link──▶ IR (JSON)
├─▶ Mermaid
├─▶ HTML viewer (React Flow)
└─▶ 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
- Plan (v0.3): draw agents and tools that do not exist yet; agentsdiagram writes the stubs.
- Edit (v0.4): connect, add and remove tools and agents in the diagram; the change is written to your code with LibCST, preserving formatting. The code stays the single source of truth.
- More frameworks through adapters (docs/adding-a-framework.md).
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 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.1.1
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.1.1.tar.gz | 671.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentsdiagram-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 874.8 kB
Release files / agentsdiagram-0.1.1.tar.gz
| Download URL | agentsdiagram-0.1.1.tar.gz |
|---|---|
| Size | 671.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36d22b5516594cbe8073fafa75af4033cc961f679c4b73e5fc63773fffc8570c
|
|
BLAKE2b-256 checksum How to use checksums |
b2028c46f28ea6073b448ff3afc891a2efc6342c7759a26518262fbc2be41812
|
| 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 22, 2026.
Transparency logRelease files / agentsdiagram-0.1.1-py3-none-any.whl
| Download URL | agentsdiagram-0.1.1-py3-none-any.whl |
|---|---|
| Size | 203.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8704569304351ae692dfdf52916d64140c3e2d51ce35ec053cbca119b1a235e
|
|
BLAKE2b-256 checksum How to use checksums |
8db4aab51c66e5972c96cb93f982d5a56a7f9a931129154e756130e9332f01cc
|
| 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 22, 2026.
Transparency logSecurity for agentsdiagram 0.1.1
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.1.1.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 22, 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.