Skip to content

[Visualization Extension] Enhance agent graph visualization to prevent infinite recursion, add mermaid graph #445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
17 changes: 14 additions & 3 deletions docs/visualization.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Agent Visualization

Agent visualization allows you to generate a structured graphical representation of agents and their relationships using **Graphviz**. This is useful for understanding how agents, tools, and handoffs interact within an application.
Agent visualization allows you to generate a structured graphical representation of agents and their relationships. Two rendering options are available:
- **Graphviz** (offline): Default renderer that generates graphs locally
- **Mermaid** (online): Alternative renderer that uses mermaid.ink API

This is useful for understanding how agents, tools, and handoffs interact within an application.

## Installation

Expand All @@ -18,6 +22,15 @@ You can generate an agent visualization using the `draw_graph` function. This fu
- **Tools** are represented as green ellipses.
- **Handoffs** are directed edges from one agent to another.

The renderer can be specified using the `renderer` parameter:
```python
# Using Graphviz (default)
draw_graph(agent, renderer="graphviz")

# Using Mermaid API
draw_graph(agent, renderer="mermaid")
```

### Example Usage

```python
Expand Down Expand Up @@ -82,5 +95,3 @@ draw_graph(triage_agent, filename="agent_graph.png")
```

This will generate `agent_graph.png` in the working directory.


Loading