๐ง AI Agent Debugging ToolsJune 24, 2026โ
Tests passing
Decision Diff Checker
This tool allows developers to compare the decision-making paths of an AI agent across different versions or configurations. By highlighting differences in decisions, it enables developers to pinpoint where and why an agent's behavior diverges, making regression analysis and debugging more efficient.
What It Does
- Compare two JSON files containing AI decision-making logs.
- Highlight differences in a human-readable format using the
richlibrary. - Handle edge cases such as missing files or invalid JSON formats.
Installation
To use this tool, you need Python 3.7 or later. Install the required dependency using pip:
pip install richUsage
Run the tool from the command line with the following arguments:
python decision_diff_checker.py --old_run <path_to_old_run.json> --new_run <path_to_new_run.json>Arguments
--old_run: Path to the JSON file containing the old AI decision-making log.--new_run: Path to the JSON file containing the new AI decision-making log.
Example
python decision_diff_checker.py --old_run old_run.json --new_run new_run.jsonIf there are differences between the two files, they will be displayed in a color-coded format:
- Lines added in the new file are shown in green.
- Lines removed from the old file are shown in red.
If there are no differences, the tool will display a message indicating that no differences were found.
Source Code
import argparse
import json
from difflib import unified_diff
from rich.console import Console
from rich.text import Text
def load_json_file(file_path):
"""Load a JSON file and return its content."""
try:
with open(file_path, 'r') as file:
return json.load(file)
except FileNotFoundError:
raise ValueError(f"File not found: {file_path}")
except json.JSONDecodeError:
raise ValueError(f"Invalid JSON format in file: {file_path}")
def generate_diff(old_data, new_data):
"""Generate a unified diff between two JSON objects."""
old_lines = json.dumps(old_data, indent=4).splitlines(keepends=True)
new_lines = json.dumps(new_data, indent=4).splitlines(keepends=True)
diff = unified_diff(old_lines, new_lines, fromfile='old_run', tofile='new_run', lineterm='')
return list(diff)
def display_diff(diff):
"""Display the diff using rich for better readability."""
console = Console()
if not diff:
console.print("[green]No differences found![/green]")
else:
for line in diff:
if line.startswith('+') and not line.startswith('+++'):
console.print(Text(line, style="green"))
elif line.startswith('-') and not line.startswith('---'):
console.print(Text(line, style="red"))
else:
console.print(Text(line))
def main():
parser = argparse.ArgumentParser(description="Decision Diff Checker: Compare AI decision-making logs.")
parser.add_argument('--old_run', required=True, help="Path to the old run JSON file.")
parser.add_argument('--new_run', required=True, help="Path to the new run JSON file.")
args = parser.parse_args()
try:
old_data = load_json_file(args.old_run)
new_data = load_json_file(args.new_run)
diff = generate_diff(old_data, new_data)
display_diff(diff)
except ValueError as e:
Console().print(f"[red]Error:[/red] {e}")
if __name__ == "__main__":
main()
Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- decision_diff_checker
- Category
- AI Agent Debugging Tools
- Generated
- June 24, 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-06-24/decision_diff_checker cd generated_tools/2026-06-24/decision_diff_checker pip install -r requirements.txt 2>/dev/null || true python decision_diff_checker.py