๐ง Autonomous AI AgentsApril 23, 2026โ
Tests passing
Agent Debugger
A Python CLI tool for debugging autonomous AI agents by simulating task flows and inspecting decision-making processes. It provides developers with step-by-step insights into agent behavior and traces intermediate states for better understanding and debugging.
What It Does
- Simulate task execution without real-world effects
- Inspect intermediate agent states and decisions
- Generate visual graphs for task flows and dependencies
Installation
- Python 3.8+
- networkx==3.1
- matplotlib==3.8.0
Usage
Run the tool with the following command:
python agent_debugger.py --config <path_to_config_file> --output <output_image_path>Example
Given a configuration file agent_config.json:
{
"tasks": [
{"id": "task1", "name": "Task 1", "dependencies": []},
{"id": "task2", "name": "Task 2", "dependencies": ["task1"]}
]
}Run the tool:
python agent_debugger.py --config agent_config.json --output task_flow.pngThis will generate a graph image task_flow.png visualizing the task flow.
Source Code
import argparse
import json
import networkx as nx
import matplotlib.pyplot as plt
from typing import Dict, Any
def load_config(config_path: str) -> Dict[str, Any]:
"""Load the agent configuration from a JSON file."""
try:
with open(config_path, 'r') as file:
return json.load(file)
except FileNotFoundError:
raise FileNotFoundError(f"Configuration file not found: {config_path}")
except json.JSONDecodeError:
raise ValueError(f"Invalid JSON format in configuration file: {config_path}")
def simulate_agent(config: Dict[str, Any]) -> nx.DiGraph:
"""Simulate the agent's task flow and return a directed graph."""
graph = nx.DiGraph()
tasks = config.get("tasks", [])
if not tasks:
raise ValueError("Configuration file must contain a 'tasks' key with a list of tasks.")
for task in tasks:
task_id = task.get("id")
if not task_id:
raise ValueError("Each task must have an 'id'.")
graph.add_node(task_id, **task)
for dependency in task.get("dependencies", []):
graph.add_edge(dependency, task_id)
return graph
def visualize_task_flow(graph: nx.DiGraph, output_path: str):
"""Generate a visual representation of the task flow graph."""
pos = nx.spring_layout(graph)
plt.figure(figsize=(10, 8))
nx.draw(graph, pos, with_labels=True, node_color='lightblue', edge_color='gray', node_size=2000, font_size=10, font_weight='bold')
labels = nx.get_node_attributes(graph, 'name')
nx.draw_networkx_labels(graph, pos, labels=labels)
plt.title("Task Flow Graph")
plt.savefig(output_path)
plt.close()
def main():
parser = argparse.ArgumentParser(description="Agent Debugger: Simulate and visualize AI agent task flows.")
parser.add_argument('--config', required=True, help="Path to the agent configuration JSON file.")
parser.add_argument('--output', default="task_flow.png", help="Path to save the task flow graph image.")
args = parser.parse_args()
try:
config = load_config(args.config)
graph = simulate_agent(config)
visualize_task_flow(graph, args.output)
print(f"Task flow 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_debugger
- Category
- Autonomous AI Agents
- Generated
- April 23, 2026
- Tests
- Passing โ
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-04-23/agent_debugger cd generated_tools/2026-04-23/agent_debugger pip install -r requirements.txt 2>/dev/null || true python agent_debugger.py