How akshat33-spec/ai-agent-firewall works
This repository is an experimental AI-agent runtime-security monitor, with scenarios for detecting unauthorized data export and PII exposure. A user runs an experiment or Scenario 2 pilot; the runner builds observable action histories, obtains deterministic ground truth, generates context as needed, calls the monitor, and records predictions and trial results. Calibration and token accounting support evaluation. The top-level README provides little architectural detail, so the graph follows the sampled source and SOURCE INDEX; unsampled implementation links are omitted where their call paths are unclear.
Main entry points: run_experiment.py Experiment runner · run_scenario2_pilot.py Scenario 2 pilot · monitor.py LLM monitor · generator.py Context generator
Components 13
Experiment runners
- Experiment runner
runtime-risk-experiment/experiments/run_experiment.py - Scenario 2 pilot
runtime-risk-experiment/run_scenario2_pilot.py - Calibration sweep
runtime-risk-experiment/experiments/run_calibration.py
Risk scenarios
- Data export
runtime-risk-experiment/scenarios/data_exposure.py - Audit pipeline
runtime-risk-experiment/scenarios/audit_pipeline.py
Security runtime
- LLM monitor
runtime-risk-experiment/detector/monitor.py - Context generator
runtime-risk-experiment/context/generator.py
Evaluation support
- Scenario 1 tools
runtime-risk-experiment/environment/tools.py - Scenario 1 state
runtime-risk-experiment/environment/state.py - Ground truth
runtime-risk-experiment/environment/evaluator.py - Audit state and evaluator
runtime-risk-experiment/scenarios/audit_pipeline.py
Other components
- Researcher
- OpenAI service
Connections 17
- Researcher → Experiment runner: runs
runtime-risk-experiment/experiments/run_experiment.py - Researcher → Scenario 2 pilot: runs
runtime-risk-experiment/run_scenario2_pilot.py - Experiment runner → Data export: builds trajectories
runtime-risk-experiment/experiments/run_experiment.py - Experiment runner → Scenario 1 state: initializes state
runtime-risk-experiment/experiments/run_experiment.py - Experiment runner → Ground truth: evaluates ground truth
runtime-risk-experiment/experiments/run_experiment.py - Experiment runner → Context generator: formats actions
runtime-risk-experiment/experiments/run_experiment.py - Data export → Scenario 1 tools: invokes tools
runtime-risk-experiment/scenarios/data_exposure.py - Data export → Ground truth: checks violations
runtime-risk-experiment/scenarios/data_exposure.py - Scenario 1 tools → Scenario 1 state: updates state
runtime-risk-experiment/environment/tools.py - Ground truth → Scenario 1 state: reads state
runtime-risk-experiment/environment/evaluator.py - Scenario 2 pilot → Audit pipeline: builds trajectories
runtime-risk-experiment/run_scenario2_pilot.py - Scenario 2 pilot → LLM monitor: requests decisions
runtime-risk-experiment/run_scenario2_pilot.py - Scenario 2 pilot → Context generator: generates context
runtime-risk-experiment/run_scenario2_pilot.py - LLM monitor → Context generator: formats prompts
runtime-risk-experiment/detector/monitor.py - LLM monitor → OpenAI service: requests classification
runtime-risk-experiment/detector/monitor.py - Calibration sweep → LLM monitor: uses prompt builder
runtime-risk-experiment/experiments/run_calibration.py - Calibration sweep → Context generator: uses token encoder
runtime-risk-experiment/experiments/run_calibration.py