๐ง Multi-Agent AI SystemsMarch 17, 2026โ
Tests passing
Agent Communication Visualizer
A CLI tool for visualizing communication flows between agents in multi-agent systems. It reads log files or live streams of agent interactions, analyzes message flows, and generates communication graphs to identify collaboration bottlenecks and inefficiencies.
What It Does
- Parse log files to extract communication flows.
- Generate directed graphs to visualize agent interactions.
- Save the generated graphs as PNG files.
Installation
Install the required Python packages using pip:
pip install networkx matplotlibUsage
Given a log file logs.txt with the following content:
agent1,agent2
agent2,agent3
agent3,agent1Run the tool:
python agent_communication_visualizer.py --logs logs.txt --output communication_graph.pngThis will generate a graph showing the communication flows between the agents and save it as communication_graph.png.
Source Code
import argparse
import networkx as nx
import matplotlib.pyplot as plt
import os
def parse_logs(log_file):
"""
Parse the log file to extract communication flows.
Args:
log_file (str): Path to the log file.
Returns:
list of tuples: List of (sender, receiver) communication pairs.
"""
communication_flows = []
try:
with open(log_file, 'r') as file:
for line in file:
parts = line.strip().split(',')
if len(parts) == 2:
sender, receiver = parts
communication_flows.append((sender.strip(), receiver.strip()))
else:
raise ValueError("Invalid log format. Each line must contain exactly one sender and one receiver, separated by a comma.")
except FileNotFoundError:
raise FileNotFoundError(f"Log file '{log_file}' not found.")
except Exception as e:
raise ValueError(f"Error parsing log file: {e}")
return communication_flows
def generate_graph(communication_flows, output_file):
"""
Generate a communication flow graph and save it as a PNG file.
Args:
communication_flows (list of tuples): List of (sender, receiver) communication pairs.
output_file (str): Path to save the output graph PNG file.
"""
graph = nx.DiGraph()
for sender, receiver in communication_flows:
graph.add_edge(sender, receiver)
plt.figure(figsize=(10, 8))
pos = nx.spring_layout(graph)
nx.draw(graph, pos, with_labels=True, node_size=2000, node_color='lightblue', font_size=10, font_weight='bold', arrowsize=20)
plt.title("Agent Communication Flow")
plt.savefig(output_file)
plt.close()
def main():
parser = argparse.ArgumentParser(description="Agent Communication Visualizer")
parser.add_argument('--logs', required=True, help="Path to the log file containing agent communication data.")
parser.add_argument('--output', required=True, help="Path to save the generated communication graph PNG file.")
args = parser.parse_args()
try:
communication_flows = parse_logs(args.logs)
if not communication_flows:
print("No communication flows found in the log file.")
return
generate_graph(communication_flows, args.output)
print(f"Communication graph saved to {args.output}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- agent_communication_visualizer
- Category
- Multi-Agent AI Systems
- Generated
- March 17, 2026
- Tests
- Passing โ
- Fix Loops
- 2
Quick Install
Clone just this tool:
git clone --depth 1 --filter=blob:none --sparse \ https://github.com/ptulin/autoaiforge.git cd autoaiforge git sparse-checkout set generated_tools/2026-03-17/agent_communication_visualizer cd generated_tools/2026-03-17/agent_communication_visualizer pip install -r requirements.txt 2>/dev/null || true python agent_communication_visualizer.py