AgentRx Trace Demo is an interactive debugging and reporting interface for analyzing agent trajectories end to end. It combines a Python backend pipeline with a React dashboard so you can:
The current UI is branded as an OpenAI-backed demo and is designed for internal demos, evaluation workflows, and trace forensics.
Run Demoflash, tau-retail, and magentic-oneAgentRx/
├─ backend/
│ ├─ run.py # Main pipeline runner
│ ├─ reports_server.py # Lightweight local reports/demo server
│ ├─ requirements.txt # Python dependencies
│ ├─ src/
│ │ ├─ ir/ # IR normalization
│ │ ├─ invariants/ # Static + dynamic invariants
│ │ ├─ judge/ # LLM-as-a-Judge
│ │ └─ reports/ # Reporting API layer
│ ├─ trajectories/ # Example input trajectories
│ ├─ uploads/ # Uploaded files from UI runs
│ └─ runs/ # Generated run artifacts
├─ frontend/
│ ├─ src/ # React app
│ ├─ public/
│ └─ package.json
└─ README.md
The project is currently best aligned with the following setup:
3.11agentrx20+10+The backend in your current setup is already using:
3.11.15agentrxBefore starting, make sure you have:
git clone <your-repo-url>
cd AgentRx
If you have not already created the environment:
conda create -n agentrx python=3.11 -y
conda activate agentrx
cd D:\AgentRx
python -m pip install -r backend\requirements.txt
cd D:\AgentRx\frontend
npm install
The frontend lets you choose the provider, but it does not collect secrets. Runtime keys and endpoints are taken from the backend .env file only.
Create:
D:\AgentRx\backend\.env
Example:
# Provider selected by default when running from CLI.
# The UI can override this per run with the provider dropdown.
AGENT_VERIFY_LLM_PROVIDER=openai
# OpenAI
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-5.4-nano
OPENAI_RATE_LIMIT_TIER=tier1
# Optional: custom OpenAI-compatible base URL
# OPENAI_BASE_URL=https://api.openai.com/v1
# Azure OpenAI, only needed if you choose Azure OpenAI in the UI
AGENT_VERIFY_ENDPOINT=https://your-resource-name.openai.azure.com/
AGENT_VERIFY_DEPLOYMENT=your_azure_deployment_name
AGENT_VERIFY_API_VERSION=2025-04-01-preview
AGENT_VERIFY_API_KEY=your_azure_openai_api_key_here
# Optional: token-cost reporting in the reports dashboard
AGENT_VERIFY_INPUT_COST_PER_1K=0.0002
AGENT_VERIFY_OUTPUT_COST_PER_1K=0.00125
OPENAI_API_KEY is required for real pipeline runsOPENAI_MODEL controls the model used when provider is OpenAIOPENAI_RATE_LIMIT_TIER controls GPT-5.4 nano TPM/RPM utilization calculations in the Reports tabOPENAI_BASE_URL is optional and only needed for an OpenAI-compatible gatewayAGENT_VERIFY_ENDPOINT, AGENT_VERIFY_DEPLOYMENT, AGENT_VERIFY_API_VERSION, and AGENT_VERIFY_API_KEY are required when provider is Azure OpenAIAGENT_VERIFY_ENDPOINT should be the base resource URL only, not a full /openai/... routeEstimated Cost card to populateFor OpenAI gpt-5.4-nano, the Reports tab can calculate run utilization against the selected usage tier. Set OPENAI_RATE_LIMIT_TIER in backend/.env to one of tier1, tier2, tier3, tier4, or tier5.
| Tier | RPM | TPM | Batch queue limit |
|---|---|---|---|
| Free | Not supported | Not supported | Not supported |
| Tier 1 | 500 | 200,000 | 2,000,000 |
| Tier 2 | 5,000 | 2,000,000 | 20,000,000 |
| Tier 3 | 5,000 | 4,000,000 | 40,000,000 |
| Tier 4 | 10,000 | 10,000,000 | 1,000,000,000 |
| Tier 5 | 30,000 | 180,000,000 | 15,000,000,000 |
You need two terminals.
conda activate agentrx
cd D:\AgentRx
python backend\reports_server.py
The server runs locally at:
http://127.0.0.1:8000
conda activate agentrx
cd D:\AgentRx\frontend
npm run dev
Open the Vite URL shown in the terminal, typically:
http://localhost:5173
You can start with any of the included examples:
Run DemoChoose either OpenAI or Azure OpenAI from the provider dropdown, then click Run Demo.
This triggers the real backend pipeline:
Trace: end-to-end interaction traceStep Detail: expanded view of a selected stepJudge Output: root-cause output and violationsRaw JSON: normalized/raw trajectory contentReports: plots, metrics, token usage, cost, and CSV exportThe backend supports multiple trajectory shapes and can auto-detect or normalize them.
Currently included examples cover:
flashtau-retailmagentic-oneIf a domain-specific converter produces weak IR, the backend can fall back to an LLM-based IR normalization path.
The Reports tab includes:
Download: downloads plot files such as predicted.pngExport CSV: exports the selected run’s metrics in Excel-friendly CSV formatYou can also run the pipeline directly without the UI.
From D:\AgentRx\backend:
conda activate agentrx
cd D:\AgentRx\backend
python run.py trajectories\test_random_format.json
Examples:
python run.py trajectories\test_random_format.json --stage ir
python run.py trajectories\test_random_format.json --skip-judge
python run.py trajectories\tau-retail\instruction_adherence_failure.json --domain tau
python run.py trajectories\test_random_format.json --endpoint openai
python run.py trajectories\test_random_format.json --endpoint azure
Run artifacts are written under:
D:\AgentRx\backend\runs\<run_name>
No module named 'openai'You are likely not running inside the agentrx conda environment.
Check:
conda activate agentrx
python -c "import sys; print(sys.executable)"
python -c "import openai; print(openai.__version__)"
For OpenAI runs, set your key in D:\AgentRx\backend\.env:
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-5.4-nano
OPENAI_RATE_LIMIT_TIER=tier1
For Azure OpenAI runs, set:
AGENT_VERIFY_ENDPOINT=https://your-resource-name.openai.azure.com/
AGENT_VERIFY_DEPLOYMENT=your_azure_deployment_name
AGENT_VERIFY_API_VERSION=2025-04-01-preview
AGENT_VERIFY_API_KEY=your_azure_openai_api_key_here
Restart Vite:
cd D:\AgentRx\frontend
npm run dev
Then hard-refresh the browser.
The current repo is suitable for local/internal demo use. Some protections have already been added:
Still recommended before wider deployment:
The table below summarizes what has already been tested and fixed, and what is still recommended before taking the project further toward production.
| Severity | Area | What was tested | What was fixed | What is still recommended |
|---|---|---|---|---|
| P1 | Upload abuse / junk payloads | Reviewed the demo upload path and run-launch flow in the backend reports API | Added a request body size limit, validated uploaded content type, and added a concurrent demo-job cap | Add authentication, per-user limits, and durable rate limiting if the app is exposed beyond local/internal use |
| P1 | Model-generated code execution risk | Reviewed the judge flow for synthesized normalizers | Disabled the active synth normalizer route so the runtime no longer proceeds through that high-risk path | Fully remove the legacy synthesized-normalizer helper code from the codebase in a future cleanup pass |
| P2 | Prompt injection / poisoned trajectory content | Reviewed how raw trajectory payloads are inserted into IR and judge prompts | Added explicit prompt framing to treat uploaded trajectory data as untrusted evidence only | Add stricter schema-based sanitization and stronger input validation if you want a more production-ready ingestion path |
| P2 | Cross-origin exposure | Reviewed response headers on the local reports/demo server | Replaced permissive Access-Control-Allow-Origin: * behavior with a localhost-only origin whitelist | Move allowed origins into configuration if the app is hosted in other environments |
| P2 | Reporting consistency | Reviewed run summary generation and CSV export behavior | Normalized the endpoint label to OpenAI in the backend summary and frontend CSV export | If multi-provider support is needed later, replace the current display hardcoding with a formal provider mapping layer |
| P3 | Frontend trace robustness | Reviewed trace rendering and modal/detail views when judge data is missing | Added null-safe handling around judgeResult.index access in the React app | Add more explicit empty states for unusual partial-failure runs |
| P3 | Cost reporting | Verified backend cost calculation using .env pricing values | Enabled estimated cost reporting from AGENT_VERIFY_INPUT_COST_PER_1K and AGENT_VERIFY_OUTPUT_COST_PER_1K | Add provider/model-specific pricing metadata if you want automatic cost lookup instead of .env values |
| P3 | Smoke / syntax validation | Ran Python syntax checks on the touched backend files and direct report-generation checks | Confirmed py_compile passed and verified report summary/cost output through the Python layer | Run a full browser-level smoke test and broader HTTP load test in your local environment before wider release |
If you want to continue hardening the project, the next best steps are:
Created by Vijay Krishnan MR
Contact: vijaykrishnanmr@gmail.com
See LICENSE for repository usage terms.
1 commits
Python
83.7%
JavaScript
11.3%
CSS
5.0%
AgentRx Trace Demo is an interactive debugging and reporting interface for analyzing agent trajectories end to end. It combines a Python backend pipeline with a React dashboard so you can:
The current UI is branded as an OpenAI-backed demo and is designed for internal demos, evaluation workflows, and trace forensics.
Run Demoflash, tau-retail, and magentic-oneAgentRx/
├─ backend/
│ ├─ run.py # Main pipeline runner
│ ├─ reports_server.py # Lightweight local reports/demo server
│ ├─ requirements.txt # Python dependencies
│ ├─ src/
│ │ ├─ ir/ # IR normalization
│ │ ├─ invariants/ # Static + dynamic invariants
│ │ ├─ judge/ # LLM-as-a-Judge
│ │ └─ reports/ # Reporting API layer
│ ├─ trajectories/ # Example input trajectories
│ ├─ uploads/ # Uploaded files from UI runs
│ └─ runs/ # Generated run artifacts
├─ frontend/
│ ├─ src/ # React app
│ ├─ public/
│ └─ package.json
└─ README.md
The project is currently best aligned with the following setup:
3.11agentrx20+10+The backend in your current setup is already using:
3.11.15agentrxBefore starting, make sure you have:
git clone <your-repo-url>
cd AgentRx
If you have not already created the environment:
conda create -n agentrx python=3.11 -y
conda activate agentrx
cd D:\AgentRx
python -m pip install -r backend\requirements.txt
cd D:\AgentRx\frontend
npm install
The frontend lets you choose the provider, but it does not collect secrets. Runtime keys and endpoints are taken from the backend .env file only.
Create:
D:\AgentRx\backend\.env
Example:
# Provider selected by default when running from CLI.
# The UI can override this per run with the provider dropdown.
AGENT_VERIFY_LLM_PROVIDER=openai
# OpenAI
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-5.4-nano
OPENAI_RATE_LIMIT_TIER=tier1
# Optional: custom OpenAI-compatible base URL
# OPENAI_BASE_URL=https://api.openai.com/v1
# Azure OpenAI, only needed if you choose Azure OpenAI in the UI
AGENT_VERIFY_ENDPOINT=https://your-resource-name.openai.azure.com/
AGENT_VERIFY_DEPLOYMENT=your_azure_deployment_name
AGENT_VERIFY_API_VERSION=2025-04-01-preview
AGENT_VERIFY_API_KEY=your_azure_openai_api_key_here
# Optional: token-cost reporting in the reports dashboard
AGENT_VERIFY_INPUT_COST_PER_1K=0.0002
AGENT_VERIFY_OUTPUT_COST_PER_1K=0.00125
OPENAI_API_KEY is required for real pipeline runsOPENAI_MODEL controls the model used when provider is OpenAIOPENAI_RATE_LIMIT_TIER controls GPT-5.4 nano TPM/RPM utilization calculations in the Reports tabOPENAI_BASE_URL is optional and only needed for an OpenAI-compatible gatewayAGENT_VERIFY_ENDPOINT, AGENT_VERIFY_DEPLOYMENT, AGENT_VERIFY_API_VERSION, and AGENT_VERIFY_API_KEY are required when provider is Azure OpenAIAGENT_VERIFY_ENDPOINT should be the base resource URL only, not a full /openai/... routeEstimated Cost card to populateFor OpenAI gpt-5.4-nano, the Reports tab can calculate run utilization against the selected usage tier. Set OPENAI_RATE_LIMIT_TIER in backend/.env to one of tier1, tier2, tier3, tier4, or tier5.
| Tier | RPM | TPM | Batch queue limit |
|---|---|---|---|
| Free | Not supported | Not supported | Not supported |
| Tier 1 | 500 | 200,000 | 2,000,000 |
| Tier 2 | 5,000 | 2,000,000 | 20,000,000 |
| Tier 3 | 5,000 | 4,000,000 | 40,000,000 |
| Tier 4 | 10,000 | 10,000,000 | 1,000,000,000 |
| Tier 5 | 30,000 | 180,000,000 | 15,000,000,000 |
You need two terminals.
conda activate agentrx
cd D:\AgentRx
python backend\reports_server.py
The server runs locally at:
http://127.0.0.1:8000
conda activate agentrx
cd D:\AgentRx\frontend
npm run dev
Open the Vite URL shown in the terminal, typically:
http://localhost:5173
You can start with any of the included examples:
Run DemoChoose either OpenAI or Azure OpenAI from the provider dropdown, then click Run Demo.
This triggers the real backend pipeline:
Trace: end-to-end interaction traceStep Detail: expanded view of a selected stepJudge Output: root-cause output and violationsRaw JSON: normalized/raw trajectory contentReports: plots, metrics, token usage, cost, and CSV exportThe backend supports multiple trajectory shapes and can auto-detect or normalize them.
Currently included examples cover:
flashtau-retailmagentic-oneIf a domain-specific converter produces weak IR, the backend can fall back to an LLM-based IR normalization path.
The Reports tab includes:
Download: downloads plot files such as predicted.pngExport CSV: exports the selected run’s metrics in Excel-friendly CSV formatYou can also run the pipeline directly without the UI.
From D:\AgentRx\backend:
conda activate agentrx
cd D:\AgentRx\backend
python run.py trajectories\test_random_format.json
Examples:
python run.py trajectories\test_random_format.json --stage ir
python run.py trajectories\test_random_format.json --skip-judge
python run.py trajectories\tau-retail\instruction_adherence_failure.json --domain tau
python run.py trajectories\test_random_format.json --endpoint openai
python run.py trajectories\test_random_format.json --endpoint azure
Run artifacts are written under:
D:\AgentRx\backend\runs\<run_name>
No module named 'openai'You are likely not running inside the agentrx conda environment.
Check:
conda activate agentrx
python -c "import sys; print(sys.executable)"
python -c "import openai; print(openai.__version__)"
For OpenAI runs, set your key in D:\AgentRx\backend\.env:
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-5.4-nano
OPENAI_RATE_LIMIT_TIER=tier1
For Azure OpenAI runs, set:
AGENT_VERIFY_ENDPOINT=https://your-resource-name.openai.azure.com/
AGENT_VERIFY_DEPLOYMENT=your_azure_deployment_name
AGENT_VERIFY_API_VERSION=2025-04-01-preview
AGENT_VERIFY_API_KEY=your_azure_openai_api_key_here
Restart Vite:
cd D:\AgentRx\frontend
npm run dev
Then hard-refresh the browser.
The current repo is suitable for local/internal demo use. Some protections have already been added:
Still recommended before wider deployment:
The table below summarizes what has already been tested and fixed, and what is still recommended before taking the project further toward production.
| Severity | Area | What was tested | What was fixed | What is still recommended |
|---|---|---|---|---|
| P1 | Upload abuse / junk payloads | Reviewed the demo upload path and run-launch flow in the backend reports API | Added a request body size limit, validated uploaded content type, and added a concurrent demo-job cap | Add authentication, per-user limits, and durable rate limiting if the app is exposed beyond local/internal use |
| P1 | Model-generated code execution risk | Reviewed the judge flow for synthesized normalizers | Disabled the active synth normalizer route so the runtime no longer proceeds through that high-risk path | Fully remove the legacy synthesized-normalizer helper code from the codebase in a future cleanup pass |
| P2 | Prompt injection / poisoned trajectory content | Reviewed how raw trajectory payloads are inserted into IR and judge prompts | Added explicit prompt framing to treat uploaded trajectory data as untrusted evidence only | Add stricter schema-based sanitization and stronger input validation if you want a more production-ready ingestion path |
| P2 | Cross-origin exposure | Reviewed response headers on the local reports/demo server | Replaced permissive Access-Control-Allow-Origin: * behavior with a localhost-only origin whitelist | Move allowed origins into configuration if the app is hosted in other environments |
| P2 | Reporting consistency | Reviewed run summary generation and CSV export behavior | Normalized the endpoint label to OpenAI in the backend summary and frontend CSV export | If multi-provider support is needed later, replace the current display hardcoding with a formal provider mapping layer |
| P3 | Frontend trace robustness | Reviewed trace rendering and modal/detail views when judge data is missing | Added null-safe handling around judgeResult.index access in the React app | Add more explicit empty states for unusual partial-failure runs |
| P3 | Cost reporting | Verified backend cost calculation using .env pricing values | Enabled estimated cost reporting from AGENT_VERIFY_INPUT_COST_PER_1K and AGENT_VERIFY_OUTPUT_COST_PER_1K | Add provider/model-specific pricing metadata if you want automatic cost lookup instead of .env values |
| P3 | Smoke / syntax validation | Ran Python syntax checks on the touched backend files and direct report-generation checks | Confirmed py_compile passed and verified report summary/cost output through the Python layer | Run a full browser-level smoke test and broader HTTP load test in your local environment before wider release |
If you want to continue hardening the project, the next best steps are:
Created by Vijay Krishnan MR
Contact: vijaykrishnanmr@gmail.com
See LICENSE for repository usage terms.
1 commits
Python
83.7%
JavaScript
11.3%
CSS
5.0%