Skip to Content
DocsObservabilityAgentGraph visualization

AgentGraph visualization

AgentGraph walks an agent’s configuration and produces a graph of its wiring. Workers, tools, sub-architectures, retrievers. Useful for:

  • Documentation. Auto-render the team layout into your README or design doc.
  • Debugging. See at a glance whether a worker is connected where you think it is.
  • Onboarding. A new engineer reads the diagram before reading the code.

Quick render

from loomflow import Agent from loomflow.graph import build_graph, write_graph from loomflow.team import Team team = Team.supervisor( workers={"researcher": researcher, "writer": writer, "reviewer": reviewer}, instructions="manage the pipeline", model="claude-opus-4-7", ) graph = build_graph(team) print(graph.to_mermaid())

Output (Mermaid):

Write to disk

write_graph(team, path="agent.mmd", format="mermaid") # Mermaid syntax write_graph(team, path="agent.dot", format="graphviz") # Graphviz DOT write_graph(team, path="agent.json", format="json") # raw structure

The Mermaid file renders directly on GitHub / GitLab / Notion. The Graphviz file becomes a PNG / SVG via dot agent.dot -Tsvg -o agent.svg.

What gets included

AgentGraph walks:

  • The top-level architecture and its declared workers.
  • Each worker’s own architecture (recursively. Nested Supervisors, Reflexion-of-Supervisor, etc.).
  • Tools registered at each level (when include_tools=True).
  • MCP servers and their tool surface (when include_mcp=True).
graph = build_graph(team, include_tools=True, include_mcp=True)

Why not OTel + Tempo / Jaeger?

OTel traces show per-run dynamics. What happened during this specific agent.run(). AgentGraph shows static wiring. The shape of your agent regardless of input. Both are useful; they answer different questions.

QuestionTool
”What does this agent’s structure look like?”AgentGraph
”Why was this run slow?”OTel traces
”Which worker was called for this prompt?”OTel traces
”Could the supervisor delegate to the reviewer at all?”AgentGraph

Auto-update README diagrams. Add python -c "from app import team; from loomflow import write_graph; write_graph(team, 'docs/team.mmd')" to your release script and the README’s diagram stays in sync with the code without manual edits.

Last updated on