# AI Action Monitor ## Description The AI Action Monitor is a CLI tool designed to track and log actions generated by AI agents in real-time. It monitors for potentially risky operations, such as file deletions or database modifications, and flags or halts them based on a customizable ruleset. This tool is ideal for ensuring safer deployments of AI agents in production environments. ## Features - **Real-time monitoring** of AI agent actions. - **Customizable rules** to flag or halt risky operations. - **Detailed audit logs** for traceability. ## Installation 1. Clone the repository: ```bash git clone cd ai_action_monitor ``` 2. Install the required dependencies: ```bash pip install -r requirements.txt ``` ## Usage Run the tool with the following command: ```bash python ai_action_monitor.py --log_file agent_logs.txt --rules_file safety_rules.json --output_file audit_log.txt ``` ### Arguments - `--log_file`: Path to the AI agent action log file (required). - `--rules_file`: Path to the JSON ruleset file (required). - `--output_file`: Path to the output log file where flagged actions will be recorded (required). ### Example Suppose you have an AI agent log file `agent_logs.txt` and a ruleset file `safety_rules.json`: **agent_logs.txt**: ```json {"type": "file", "operation": "delete", "details": "important_file.txt"} {"type": "database", "operation": "update", "details": "user_records"} ``` **safety_rules.json**: ```json [ {"type": "file", "operation": "delete"}, {"type": "database", "operation": "drop"} ] ``` Run the tool: ```bash python ai_action_monitor.py --log_file agent_logs.txt --rules_file safety_rules.json --output_file audit_log.txt ``` Output: ``` Flagged risky action: {'type': 'file', 'operation': 'delete', 'details': 'important_file.txt'} ``` The flagged action will also be logged in `audit_log.txt`. ## License MIT