๐ง Autonomous AI AgentsMarch 18, 2026โ
Tests passing
Autonomous Agent Debugger
This tool acts as a debugging utility for autonomous AI agents, allowing developers to trace decision paths, inspect intermediate data states, and identify bottlenecks in the agent's execution. It provides interactive debugging features tailored to AI workflows.
What It Does
- Dynamically load and execute AI agent scripts.
- Interactive debugging interface with step-by-step execution.
- Error handling and traceback display for debugging issues.
Installation
Install the required dependencies using pip:
pip install rich prompt_toolkitUsage
Suppose you have an AI agent script my_agent.py with the following content:
def run_agent(task_input):
return f"Agent processed: {task_input}"You can debug it using:
python autonomous_agent_debugger.py --agent my_agent.py --task "Test Task"Source Code
import argparse
import importlib.util
import os
import sys
import traceback
from rich.console import Console
from rich.prompt import Prompt
from prompt_toolkit import PromptSession
from prompt_toolkit.completion import WordCompleter
def load_agent(agent_path):
"""Dynamically load an agent script as a module."""
if not os.path.exists(agent_path):
raise FileNotFoundError(f"Agent script not found: {agent_path}")
spec = importlib.util.spec_from_file_location("agent_module", agent_path)
agent_module = importlib.util.module_from_spec(spec)
sys.modules["agent_module"] = agent_module
spec.loader.exec_module(agent_module)
if not hasattr(agent_module, "run_agent") or not callable(agent_module.run_agent):
raise AttributeError("Agent script must define a callable 'run_agent(task_input)' function.")
return agent_module.run_agent
def debug_agent(agent_function, task_input):
"""Interactively debug an agent's execution."""
console = Console()
session = PromptSession()
console.print("[bold green]Autonomous Agent Debugger[/bold green]")
step = 0
while True:
try:
console.print(f"\n[bold blue]Step {step}: Executing agent...[/bold blue]")
output = agent_function(task_input)
console.print("[bold yellow]Output:[/bold yellow]", output)
action = session.prompt(
"[bold cyan]Enter command ([n]ext, [q]uit): [/bold cyan]",
completer=WordCompleter(["next", "quit"], ignore_case=True),
)
if action.lower() in ["q", "quit"]:
console.print("[bold red]Exiting debugger.[/bold red]")
break
step += 1
except Exception as e:
console.print("[bold red]Error during execution:[/bold red]")
console.print_exception()
break
def main():
parser = argparse.ArgumentParser(
description="Autonomous Agent Debugger: Debug AI agent scripts interactively."
)
parser.add_argument(
"--agent", required=True, help="Path to the Python script containing the agent."
)
parser.add_argument(
"--task", required=True, help="Task input to provide to the agent."
)
args = parser.parse_args()
try:
agent_function = load_agent(args.agent)
debug_agent(agent_function, args.task)
except Exception as e:
console = Console()
console.print("[bold red]An error occurred:[/bold red]")
console.print_exception()
if __name__ == "__main__":
main()Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- autonomous_agent_debugger
- Category
- Autonomous AI Agents
- Generated
- March 18, 2026
- Tests
- Passing โ
- Fix Loops
- 3
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-18/autonomous_agent_debugger cd generated_tools/2026-03-18/autonomous_agent_debugger pip install -r requirements.txt 2>/dev/null || true python autonomous_agent_debugger.py