A2A-Mermaid-Tracer
CLI tool to generate Mermaid.js sequence diagrams from A2A (Agent2Agent) protocol communication traces.
Visualize multi-agent interactions at a glance.
Features
- Parse JSON-RPC 2.0 trace logs (JSON array or NDJSON format)
- Generate Mermaid sequence diagrams with:
- Request arrows (solid)
- Response arrows (dashed)
- Error indicators (cross arrows)
- Timestamp annotations
- Task ID references
- Task grouping (
--group-by-taskfor rect blocks)
- Output to stdout or file (
.mdwith code block, or raw.mmd) - Stdin support (
--input -) for pipeline usage - Strict mode (
--strict) to fail on malformed entries
Installation
pip install a2a-mermaid-tracer
Or for development:
git clone https://github.com/matthieu-music/a2a-mermaid-tracer.git
cd a2a-mermaid-tracer
pip install -e ".[dev]"
Quick Start
# From a file
a2a-mermaid-tracer generate --input traces.json --output diagram.md
# From stdin
cat traces.json | a2a-mermaid-tracer generate --input - --title "My Agents"
# With task grouping
a2a-mermaid-tracer generate --input traces.json --group-by-task
# Strict mode (fail on bad entries)
a2a-mermaid-tracer generate --input traces.json --strict
Example output
sequenceDiagram
participant OrchestratorAgent as OrchestratorAgent
participant ResearchAgent as ResearchAgent
participant AnalystAgent as AnalystAgent
participant WriterAgent as WriterAgent
OrchestratorAgent ->> ResearchAgent: "Find Q1 2025 earnings for AAPL"
Note right of OrchestratorAgent: 10:30:00
ResearchAgent -->> OrchestratorAgent: "AAPL Q1 2025: Revenue $124.3B, EPS $2.40"
OrchestratorAgent ->> AnalystAgent: "Analyze AAPL earnings vs Q1 2024"
Note right of OrchestratorAgent: 10:30:04
AnalystAgent --x OrchestratorAgent: ERROR: Missing Q1 2024 data for comparison
OrchestratorAgent ->> ResearchAgent: "Find Q1 2024 earnings for AAPL"
Note right of OrchestratorAgent: 10:30:09
ResearchAgent -->> OrchestratorAgent: "AAPL Q1 2024: Revenue $119.6B, EPS $2.18"
OrchestratorAgent ->> AnalystAgent: "Analyze AAPL Q1 2025 vs Q1 2024"
Note right of OrchestratorAgent: 10:30:12
AnalystAgent -->> OrchestratorAgent: "Revenue +3.9% YoY, EPS +10.1% YoY"
OrchestratorAgent ->> WriterAgent: "Write a brief earnings report for AAPL"
Note right of OrchestratorAgent: 10:30:17
WriterAgent -->> OrchestratorAgent: "AAPL Q1 2025 Report: Strong growth with"
CLI Reference
Usage: a2a-mermaid-tracer generate [OPTIONS]
Options:
-i, --input PATH Path to trace file (JSON array or NDJSON). Use '-' for stdin. [required]
-o, --output PATH Path to write the Mermaid diagram (default: stdout)
-t, --title TEXT Optional title for the diagram
--strict Fail on malformed entries instead of skipping them
--group-by-task Group interactions by task ID in rect blocks
--help Show this message and exit.
Trace format
The input file should contain JSON-RPC 2.0 messages with sender/receiver metadata:
[
{
"sender": "AgentA",
"receiver": "AgentB",
"timestamp": "2025-06-15T10:30:00Z",
"message": {
"jsonrpc": "2.0",
"id": "req-001",
"method": "message/send",
"params": { ... }
}
}
]
NDJSON (one JSON object per line) is also supported — see examples/sample_traces.ndjson.
Development
pip install -e ".[dev]"
ruff check src/ tests/
ruff format src/ tests/
pytest
License
MIT
Metadata
Release files for a2a-mermaid-tracer 0.2.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 | Actions |
|---|---|---|---|---|
| a2a_mermaid_tracer-0.2.0.tar.gz | 104.7 kB | Without provenance | Details for a2a_mermaid_tracer-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a2a_mermaid_tracer-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for a2a_mermaid_tracer-0.2.0-py3-none-any.whl |
Total release size: 115.1 kB
Release files / a2a_mermaid_tracer-0.2.0.tar.gz
| Download URL | a2a_mermaid_tracer-0.2.0.tar.gz |
|---|---|
| Size | 104.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23ffd152560ebce55d0ebbb7ceaa6b1d4d669acee236bca75afcef04a72dc214
|
|
BLAKE2b-256 checksum How to use checksums |
3c5f46cf883ca91949e6ccb4774673287af4084546a9430a417d367b916ae5c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / a2a_mermaid_tracer-0.2.0-py3-none-any.whl
| Download URL | a2a_mermaid_tracer-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c29b176728e59e390c48d90998a13a80a1134a3b9d7a5bbd341bf5e5079068a4
|
|
BLAKE2b-256 checksum How to use checksums |
2149b6cc80446c423089376da45dfe5afb7dbbd122e63efc10d27928f153dd72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for a2a-mermaid-tracer 0.2.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.