agent-auditor 0.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. agent_auditor-0.13.0/LICENSE +21 -0
  2. agent_auditor-0.13.0/PKG-INFO +281 -0
  3. agent_auditor-0.13.0/README.md +242 -0
  4. agent_auditor-0.13.0/pyproject.toml +59 -0
  5. agent_auditor-0.13.0/setup.cfg +4 -0
  6. agent_auditor-0.13.0/src/agent_auditor/__init__.py +1 -0
  7. agent_auditor-0.13.0/src/agent_auditor/__main__.py +3 -0
  8. agent_auditor-0.13.0/src/agent_auditor/api/__init__.py +0 -0
  9. agent_auditor-0.13.0/src/agent_auditor/api/app.py +108 -0
  10. agent_auditor-0.13.0/src/agent_auditor/api/assistant_routes.py +118 -0
  11. agent_auditor-0.13.0/src/agent_auditor/api/canary_routes.py +40 -0
  12. agent_auditor-0.13.0/src/agent_auditor/api/canary_schemas.py +78 -0
  13. agent_auditor-0.13.0/src/agent_auditor/api/deps.py +24 -0
  14. agent_auditor-0.13.0/src/agent_auditor/api/drift_routes.py +53 -0
  15. agent_auditor-0.13.0/src/agent_auditor/api/drift_schemas.py +69 -0
  16. agent_auditor-0.13.0/src/agent_auditor/api/evals_routes.py +128 -0
  17. agent_auditor-0.13.0/src/agent_auditor/api/evals_schemas.py +95 -0
  18. agent_auditor-0.13.0/src/agent_auditor/api/fixes_routes.py +81 -0
  19. agent_auditor-0.13.0/src/agent_auditor/api/insight_routes.py +76 -0
  20. agent_auditor-0.13.0/src/agent_auditor/api/main.py +33 -0
  21. agent_auditor-0.13.0/src/agent_auditor/api/regress_routes.py +82 -0
  22. agent_auditor-0.13.0/src/agent_auditor/api/regress_schemas.py +102 -0
  23. agent_auditor-0.13.0/src/agent_auditor/api/release_routes.py +96 -0
  24. agent_auditor-0.13.0/src/agent_auditor/api/release_schemas.py +98 -0
  25. agent_auditor-0.13.0/src/agent_auditor/api/rootcause_routes.py +45 -0
  26. agent_auditor-0.13.0/src/agent_auditor/api/rootcause_schemas.py +75 -0
  27. agent_auditor-0.13.0/src/agent_auditor/api/routes.py +195 -0
  28. agent_auditor-0.13.0/src/agent_auditor/assistant.py +357 -0
  29. agent_auditor-0.13.0/src/agent_auditor/audit.py +23 -0
  30. agent_auditor-0.13.0/src/agent_auditor/canary/__init__.py +10 -0
  31. agent_auditor-0.13.0/src/agent_auditor/canary/checks.py +233 -0
  32. agent_auditor-0.13.0/src/agent_auditor/canary/decide.py +60 -0
  33. agent_auditor-0.13.0/src/agent_auditor/canary/service.py +191 -0
  34. agent_auditor-0.13.0/src/agent_auditor/cli.py +124 -0
  35. agent_auditor-0.13.0/src/agent_auditor/config.py +43 -0
  36. agent_auditor-0.13.0/src/agent_auditor/dashboard/app.css +236 -0
  37. agent_auditor-0.13.0/src/agent_auditor/dashboard/index.html +18 -0
  38. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/00-core.js +206 -0
  39. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/10-drawer.js +78 -0
  40. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/20-overview.js +113 -0
  41. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/30-failures-runs.js +69 -0
  42. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/40-versions-quality.js +75 -0
  43. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/50-diagnose.js +114 -0
  44. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/60-ship.js +80 -0
  45. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/70-improve.js +89 -0
  46. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/80-ops.js +87 -0
  47. agent_auditor-0.13.0/src/agent_auditor/dashboard/js/90-main.js +171 -0
  48. agent_auditor-0.13.0/src/agent_auditor/data/dashboard_guide.md +81 -0
  49. agent_auditor-0.13.0/src/agent_auditor/data/feature_matrix.json +45 -0
  50. agent_auditor-0.13.0/src/agent_auditor/db.py +24 -0
  51. agent_auditor-0.13.0/src/agent_auditor/demo.py +131 -0
  52. agent_auditor-0.13.0/src/agent_auditor/drift/__init__.py +8 -0
  53. agent_auditor-0.13.0/src/agent_auditor/drift/detect.py +223 -0
  54. agent_auditor-0.13.0/src/agent_auditor/drift/service.py +168 -0
  55. agent_auditor-0.13.0/src/agent_auditor/drift/signals.py +72 -0
  56. agent_auditor-0.13.0/src/agent_auditor/drift/stats.py +144 -0
  57. agent_auditor-0.13.0/src/agent_auditor/evals/__init__.py +16 -0
  58. agent_auditor-0.13.0/src/agent_auditor/evals/compare.py +126 -0
  59. agent_auditor-0.13.0/src/agent_auditor/evals/expect.py +79 -0
  60. agent_auditor-0.13.0/src/agent_auditor/evals/scorers.py +296 -0
  61. agent_auditor-0.13.0/src/agent_auditor/evals/service.py +241 -0
  62. agent_auditor-0.13.0/src/agent_auditor/evals/stats.py +43 -0
  63. agent_auditor-0.13.0/src/agent_auditor/evals/types.py +54 -0
  64. agent_auditor-0.13.0/src/agent_auditor/fixes/__init__.py +4 -0
  65. agent_auditor-0.13.0/src/agent_auditor/fixes/judge.py +74 -0
  66. agent_auditor-0.13.0/src/agent_auditor/fixes/propose.py +139 -0
  67. agent_auditor-0.13.0/src/agent_auditor/insights/__init__.py +1 -0
  68. agent_auditor-0.13.0/src/agent_auditor/insights/bench.py +199 -0
  69. agent_auditor-0.13.0/src/agent_auditor/insights/gap.py +43 -0
  70. agent_auditor-0.13.0/src/agent_auditor/insights/service.py +302 -0
  71. agent_auditor-0.13.0/src/agent_auditor/models.py +293 -0
  72. agent_auditor-0.13.0/src/agent_auditor/regress/__init__.py +15 -0
  73. agent_auditor-0.13.0/src/agent_auditor/regress/expectations.py +162 -0
  74. agent_auditor-0.13.0/src/agent_auditor/regress/fingerprint.py +146 -0
  75. agent_auditor-0.13.0/src/agent_auditor/regress/service.py +446 -0
  76. agent_auditor-0.13.0/src/agent_auditor/release/__init__.py +9 -0
  77. agent_auditor-0.13.0/src/agent_auditor/release/gate.py +173 -0
  78. agent_auditor-0.13.0/src/agent_auditor/release/service.py +276 -0
  79. agent_auditor-0.13.0/src/agent_auditor/rootcause/__init__.py +8 -0
  80. agent_auditor-0.13.0/src/agent_auditor/rootcause/benchmark.py +96 -0
  81. agent_auditor-0.13.0/src/agent_auditor/rootcause/change.py +111 -0
  82. agent_auditor-0.13.0/src/agent_auditor/rootcause/classify.py +255 -0
  83. agent_auditor-0.13.0/src/agent_auditor/rootcause/errors.py +83 -0
  84. agent_auditor-0.13.0/src/agent_auditor/rootcause/service.py +202 -0
  85. agent_auditor-0.13.0/src/agent_auditor/rootcause/sources.py +81 -0
  86. agent_auditor-0.13.0/src/agent_auditor/rootcause/summary.py +99 -0
  87. agent_auditor-0.13.0/src/agent_auditor/rootcause/synthetic.py +239 -0
  88. agent_auditor-0.13.0/src/agent_auditor/schemas.py +123 -0
  89. agent_auditor-0.13.0/src/agent_auditor/sdk/__init__.py +5 -0
  90. agent_auditor-0.13.0/src/agent_auditor/sdk/_mapper.py +105 -0
  91. agent_auditor-0.13.0/src/agent_auditor/sdk/canary.py +123 -0
  92. agent_auditor-0.13.0/src/agent_auditor/sdk/fixes.py +109 -0
  93. agent_auditor-0.13.0/src/agent_auditor/sdk/langgraph.py +178 -0
  94. agent_auditor-0.13.0/src/agent_auditor/sdk/serialize.py +71 -0
  95. agent_auditor-0.13.0/src/agent_auditor/sdk/tracer.py +993 -0
  96. agent_auditor-0.13.0/src/agent_auditor/versioning.py +13 -0
  97. agent_auditor-0.13.0/src/agent_auditor/worker.py +93 -0
  98. agent_auditor-0.13.0/src/agent_auditor.egg-info/PKG-INFO +281 -0
  99. agent_auditor-0.13.0/src/agent_auditor.egg-info/SOURCES.txt +146 -0
  100. agent_auditor-0.13.0/src/agent_auditor.egg-info/dependency_links.txt +1 -0
  101. agent_auditor-0.13.0/src/agent_auditor.egg-info/entry_points.txt +3 -0
  102. agent_auditor-0.13.0/src/agent_auditor.egg-info/requires.txt +17 -0
  103. agent_auditor-0.13.0/src/agent_auditor.egg-info/top_level.txt +1 -0
  104. agent_auditor-0.13.0/tests/test_assistant_api.py +80 -0
  105. agent_auditor-0.13.0/tests/test_assistant_core.py +98 -0
  106. agent_auditor-0.13.0/tests/test_bench.py +43 -0
  107. agent_auditor-0.13.0/tests/test_bench_canary.py +33 -0
  108. agent_auditor-0.13.0/tests/test_canary_api.py +150 -0
  109. agent_auditor-0.13.0/tests/test_canary_core.py +177 -0
  110. agent_auditor-0.13.0/tests/test_change_core.py +75 -0
  111. agent_auditor-0.13.0/tests/test_chatbot.py +863 -0
  112. agent_auditor-0.13.0/tests/test_cli.py +48 -0
  113. agent_auditor-0.13.0/tests/test_config.py +36 -0
  114. agent_auditor-0.13.0/tests/test_dashboard.py +51 -0
  115. agent_auditor-0.13.0/tests/test_drift_api.py +123 -0
  116. agent_auditor-0.13.0/tests/test_drift_detect.py +144 -0
  117. agent_auditor-0.13.0/tests/test_drift_stats.py +96 -0
  118. agent_auditor-0.13.0/tests/test_evals_api.py +176 -0
  119. agent_auditor-0.13.0/tests/test_evals_scorers.py +140 -0
  120. agent_auditor-0.13.0/tests/test_evals_stats_compare.py +92 -0
  121. agent_auditor-0.13.0/tests/test_fixes_api.py +84 -0
  122. agent_auditor-0.13.0/tests/test_fixes_core.py +89 -0
  123. agent_auditor-0.13.0/tests/test_ingest.py +58 -0
  124. agent_auditor-0.13.0/tests/test_insights.py +120 -0
  125. agent_auditor-0.13.0/tests/test_langgraph_adapter.py +63 -0
  126. agent_auditor-0.13.0/tests/test_migrations.py +48 -0
  127. agent_auditor-0.13.0/tests/test_realbot.py +105 -0
  128. agent_auditor-0.13.0/tests/test_regress_api.py +237 -0
  129. agent_auditor-0.13.0/tests/test_regress_core.py +141 -0
  130. agent_auditor-0.13.0/tests/test_release_api.py +174 -0
  131. agent_auditor-0.13.0/tests/test_release_core.py +134 -0
  132. agent_auditor-0.13.0/tests/test_rootcause_api.py +147 -0
  133. agent_auditor-0.13.0/tests/test_rootcause_core.py +196 -0
  134. agent_auditor-0.13.0/tests/test_router.py +81 -0
  135. agent_auditor-0.13.0/tests/test_sdk_canary.py +176 -0
  136. agent_auditor-0.13.0/tests/test_sdk_drift_client.py +40 -0
  137. agent_auditor-0.13.0/tests/test_sdk_evals_client.py +66 -0
  138. agent_auditor-0.13.0/tests/test_sdk_fixes.py +100 -0
  139. agent_auditor-0.13.0/tests/test_sdk_integration.py +40 -0
  140. agent_auditor-0.13.0/tests/test_sdk_mapper.py +104 -0
  141. agent_auditor-0.13.0/tests/test_sdk_release.py +86 -0
  142. agent_auditor-0.13.0/tests/test_sdk_replay.py +173 -0
  143. agent_auditor-0.13.0/tests/test_sdk_rootcause_client.py +62 -0
  144. agent_auditor-0.13.0/tests/test_sdk_serialize.py +67 -0
  145. agent_auditor-0.13.0/tests/test_sdk_tracer.py +238 -0
  146. agent_auditor-0.13.0/tests/test_validation_kit.py +103 -0
  147. agent_auditor-0.13.0/tests/test_versions.py +44 -0
  148. agent_auditor-0.13.0/tests/test_worker_health.py +116 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arathi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-auditor
3
+ Version: 0.13.0
4
+ Summary: Open-source reliability layer for AI agents: traces, evals, drift, failure-to-test, root cause, canaries, rollback.
5
+ Author: Arathi
6
+ License: MIT
7
+ Project-URL: Homepage, https://arathis1.github.io/agent-auditor/
8
+ Project-URL: Documentation, https://arathis1.github.io/agent-auditor/docs/
9
+ Project-URL: Repository, https://github.com/ArathiS1/agent-auditor
10
+ Project-URL: Issues, https://github.com/ArathiS1/agent-auditor/issues
11
+ Keywords: ai-agents,llm,evaluation,observability,regression-testing,canary,mlops
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Classifier: Topic :: Software Development :: Testing
20
+ Classifier: Framework :: FastAPI
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: fastapi>=0.110
25
+ Requires-Dist: uvicorn[standard]>=0.29
26
+ Requires-Dist: sqlalchemy>=2.0
27
+ Requires-Dist: pydantic>=2.6
28
+ Requires-Dist: httpx>=0.27
29
+ Requires-Dist: alembic>=1.13
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8; extra == "dev"
32
+ Requires-Dist: ruff>=0.5; extra == "dev"
33
+ Provides-Extra: postgres
34
+ Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
35
+ Provides-Extra: langgraph
36
+ Requires-Dist: langgraph>=0.2; extra == "langgraph"
37
+ Requires-Dist: langchain-core>=0.3; extra == "langgraph"
38
+ Dynamic: license-file
39
+
40
+ <h1 align="center">Agent Auditor</h1>
41
+
42
+ <p align="center"><b>Find out why your AI agent fails, and prove the fix works before you ship it.</b></p>
43
+
44
+ <p align="center">
45
+ <img alt="status" src="https://img.shields.io/badge/status-alpha-orange">
46
+ <img alt="python" src="https://img.shields.io/badge/python-3.11%2B-blue">
47
+ <img alt="license" src="https://img.shields.io/badge/license-MIT-green">
48
+ <img alt="tests" src="https://img.shields.io/badge/tests-418%20passing-brightgreen">
49
+ <img alt="no api key needed" src="https://img.shields.io/badge/core-no%20API%20key%20needed-lightgrey">
50
+ </p>
51
+
52
+ Agent Auditor is an open-source reliability layer for AI agents. It records every agent run, scores it, explains why
53
+ failures happen, turns real failures into regression tests, and only lets a new version go live after a canary check
54
+ and a human approval. Everything lands in an audit log.
55
+
56
+ > **Status: alpha (0.12).** All planned phases are written and tested: tracing, evals, drift, failure-to-test, root
57
+ > causes, canary, release gate, change attribution and verified fixes, plus a plain-language dashboard and a working
58
+ > demo agent. It has been used on one developer's machine, not in production. See [Known limitations](#known-limitations).
59
+
60
+ <!-- Add your demo here: record 60-90 s of the dashboard (failed run -> root cause -> regression test -> canary -> release)
61
+ and save it as docs/assets/demo.gif, then replace this comment with: ![Demo](docs/assets/demo.gif) -->
62
+
63
+ ## Why this exists
64
+
65
+ Tracing tools show you what an agent did. When it breaks in production you still have to work out why, write the test
66
+ by hand, change something, and hope the change did not break something else. Agent Auditor closes that loop:
67
+
68
+ ```
69
+ run -> score -> root cause -> regression test -> proposed fix -> replay the tests -> canary -> approved release -> rollback
70
+ ```
71
+
72
+ | Step | What you get |
73
+ |---|---|
74
+ | **Trace** | Every run with its steps (model calls, tools, retrieval) from a small Python SDK |
75
+ | **Evaluate** | Built-in checks that need no API key (errors, latency, empty answers, grounding), plus your own judge |
76
+ | **Explain** | A root-cause label per failure (rate limit, tool error, bad retrieval, slow run...) and which change likely caused it |
77
+ | **Remember** | One click turns a failed run into a regression test that is replayed against every new version |
78
+ | **Compare** | Drift detection and a canary that rolls back a version that is measurably worse |
79
+ | **Ship safely** | Release gate with approvals (you cannot approve your own), rollback, and a full audit trail |
80
+
81
+ ### How it fits together
82
+
83
+ ```mermaid
84
+ flowchart LR
85
+ A[Your agent<br/>+ Python SDK] -->|runs and steps| B[Auditor API<br/>FastAPI + SQL]
86
+ B --> C[Evals<br/>built-in + your judge]
87
+ C --> D[Root causes<br/>+ change attribution]
88
+ D --> E[Regression tests<br/>from real failures]
89
+ E --> F[Fix candidates<br/>replayed on the tests]
90
+ F --> G[Canary<br/>vs the live version]
91
+ G --> H{Release gate<br/>approvals}
92
+ H -->|promote| I[Active version]
93
+ H -->|rollback| I
94
+ B --> J[(Audit log)]
95
+ B --> K[Dashboard<br/>15 pages]
96
+ ```
97
+
98
+ ## Try it in 5 minutes
99
+
100
+ Needs Python 3.11 or newer. The core runs offline with no API key. Keys are only needed for the optional chat demo and AI helper.
101
+
102
+ ```bash
103
+ git clone https://github.com/ArathiS1/agent-auditor
104
+ cd agent-auditor
105
+ python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
106
+ pip install -e ".[dev]"
107
+ uvicorn agent_auditor.api.main:app # API and dashboard on http://127.0.0.1:8000
108
+ ```
109
+
110
+ In a second terminal, fill it with demo data and open `http://127.0.0.1:8000/dashboard`:
111
+
112
+ ```bash
113
+ python examples/release_demo.py
114
+ ```
115
+
116
+ **Windows, one command:** `powershell -ExecutionPolicy Bypass -File .\run-all.ps1` starts the Auditor and the chat app
117
+ together, connected, and opens the dashboard. Add `-Check` to run a 23-point self-check afterwards.
118
+
119
+ **Docker (API, worker, PostgreSQL):** `cp .env.example .env`, set the two secrets, `docker compose up --build`.
120
+ See [docs/deployment.md](docs/deployment.md).
121
+
122
+ ## Use it with your own agent
123
+
124
+ ```python
125
+ from agent_auditor.sdk import Auditor
126
+
127
+ auditor = Auditor("http://127.0.0.1:8000", agent="support-bot")
128
+ auditor.register_version("v1", prompt=PROMPT, config={"top_k": 4})
129
+
130
+ @auditor.observe(kind="retrieval")
131
+ def kb_search(q): ...
132
+
133
+ @auditor.observe_run()
134
+ def answer(question): ...
135
+ ```
136
+
137
+ Plain Python and LangGraph/LangChain are supported. See `examples/quickstart_plain.py` and `examples/langgraph_demo.py`.
138
+
139
+ ## The dashboard
140
+
141
+ Open `/dashboard`. Fifteen pages, grouped by what you are trying to do:
142
+
143
+ | Group | Pages |
144
+ |---|---|
145
+ | Watch | Overview (health verdict, one tick per run), Failures, Runs |
146
+ | Understand | Quality, Root causes, Drift |
147
+ | Improve | Versions, Regression tests, Fixes, Benchmark, Gap analysis |
148
+ | Ship safely | Canary, Releases |
149
+ | Govern | Audit log, Setup |
150
+
151
+ Every chart has a table view, and "Ask for help" answers questions from beginner to advanced (it works without a key
152
+ from a built-in guide, and uses an AI provider when one is configured).
153
+
154
+ ## Auditor Chat: a real agent to watch
155
+
156
+ `chatbot/` is a ChatGPT-style app that runs on your machine and reports every turn to Agent Auditor, so you always
157
+ have a real agent to inspect. It streams answers, remembers conversations, reads files and images, searches the web,
158
+ runs deep research, and compares models side by side.
159
+
160
+ - **Many providers:** Gemini, Groq, OpenRouter, Mistral, Cerebras, DeepSeek, xAI, Perplexity, OpenAI, Claude, Ollama,
161
+ and any OpenAI-compatible service you describe in `.env` (`NAME_API_KEY`, `NAME_BASE_URL`, `NAME_MODEL`).
162
+ - **Auto-routing:** the chat remembers which models are slow or rate limited and tries healthy, quick ones first
163
+ (`CHAT_AUTOROUTE=off` to disable). `GET /api/health` shows what it has learned.
164
+ - **Key doctor:** `python chatbot/check_keys.py` says plainly whether each key works, is out of credit, or is busy.
165
+
166
+ Details: [chatbot/README.md](chatbot/README.md).
167
+
168
+ ## What it found on a real agent
169
+
170
+ Running the chat app as a live agent for a few days, the Overview reported most runs as problems. The cause was not a
171
+ bug in the code: slow free or reasoning models tripped the latency check, and free tiers returned rate limits. That
172
+ finding led directly to the auto-routing above. The point of the tool is that it showed this with evidence, per version
173
+ and per cause, instead of leaving it as a feeling that "the bot is flaky".
174
+
175
+ ## How well does it work?
176
+
177
+ `validation/` tests the tool against a support bot whose faults are planted, so the right answer is known.
178
+ On the included sample run:
179
+
180
+ - 3 of 5 planted faults were rolled back by the canary every time.
181
+ - Half-missing search results were caught 3 times in 5.
182
+ - **Out-of-date facts were never caught.** The built-in checks look at symptoms, not facts.
183
+
184
+ Run it yourself: `python validation/run_validation.py --dry-run`. Report and method: [validation/README.md](validation/README.md).
185
+
186
+ ## Design choices
187
+
188
+ - **Fixes are proposals, not automatic edits.** Rule-based candidates come from the root-cause report. A person registers
189
+ one, the regression suite replays against it, a canary compares it, and a different person approves the release.
190
+ Many failures (slow runs, rate limits) are infrastructure problems that no prompt change fixes.
191
+ - **Cheap checks first.** Built-in scorers need no API key, so the system works offline and costs nothing to run.
192
+ - **Plain HTML dashboard.** No build step and no CDN, served by the API itself.
193
+
194
+ ## A failure, start to finish
195
+
196
+ What the loop looks like on a real incident (numbers are illustrative):
197
+
198
+ 1. **Overview** turns red: *"31 of 52 runs had problems."*
199
+ 2. **Root causes** says why: *slow run (25 runs), rate limit (14 runs), tool error (3 runs)*, and in which version it began.
200
+ 3. **Failures** lists each run. One click turns a bad run into a **regression test**.
201
+ 4. **Fixes** proposes small candidates. Each is registered as a separate, inactive version and replayed on every
202
+ regression test. Only candidates that pass are recommended.
203
+ 5. **Canary** sends a slice of live traffic to the candidate and compares pass rate, latency and causes with the live version.
204
+ 6. **Releases**: a different person approves, you promote, and if it goes wrong you roll back with a written reason.
205
+ Every step, including refusals, is in the audit log.
206
+
207
+ ## What is built
208
+
209
+ | Area | Contents | State |
210
+ |---|---|---|
211
+ | Core | Data model, FastAPI ingestion, versioned prompts and configs, audit events, Python SDK, LangGraph adapter | done |
212
+ | Evals | 7 built-in scorers, your own judge, version-to-version regression verdicts | done |
213
+ | Drift | Numeric, rate and term-mix signals with significance tests | done |
214
+ | Failure to test | Failed runs become deduplicated regression cases; replay against any version | done |
215
+ | Root causes | 11 cause types with sub-causes, suspect documents, change attribution | done |
216
+ | Canary and releases | Five checks, approval gate, rollback, audit trail | done |
217
+ | Fixes | Rule-based and optional AI candidates, verified on the regression suite | done, human-approved |
218
+ | Dashboard | 15 pages, plain HTML/CSS/JS, dark mode, built-in help chatbot | done |
219
+ | Auditor Chat | Multi-provider demo agent with auto-routing and key checks | done |
220
+ | Ops | Docker Compose, PostgreSQL, Alembic migrations, CI, background worker | done, PostgreSQL experimental |
221
+
222
+ ## Roadmap
223
+
224
+ Planned, in rough order. None of it exists yet.
225
+
226
+ - [ ] One-click "apply and verify" for fix candidates (register, replay and canary in one step)
227
+ - [ ] Real user authentication, so approvers are verified and not typed names
228
+ - [ ] Row locking for several operators on one release
229
+ - [ ] Fact-checking scorers that compare answers with source documents, not just symptoms
230
+ - [ ] A green PostgreSQL CI job, then promote PostgreSQL to supported
231
+ - [ ] Published package on PyPI
232
+
233
+ ## FAQ
234
+
235
+ **Is this an observability tool like LangSmith or Langfuse?** Partly. Those show what happened. Agent Auditor adds the
236
+ steps after that: diagnosing the cause, writing the test, checking the fix and gating the release. It is much younger
237
+ and smaller than they are, so pick it for the closed loop, not for scale.
238
+
239
+ **Does it need an API key?** No. Tracing, evals, root causes, drift, canary and releases run offline. Keys are only for
240
+ the optional AI helper, AI-written fixes and the demo chat app.
241
+
242
+ **Will it fix my agent automatically?** No, by design. It proposes and proves fixes; a person approves the release.
243
+ Many failures, such as slow runs and rate limits, come from the model or provider, and no prompt edit fixes them.
244
+
245
+ **Can I use it with my own agent?** Yes. Add the SDK decorators shown above to any Python agent.
246
+
247
+ ## Documentation
248
+
249
+ | | |
250
+ |---|---|
251
+ | [docs/reference.md](docs/reference.md) | Every phase in detail: evals, drift, failure-to-test, root causes, canary, releases, attribution |
252
+ | [docs/architecture.md](docs/architecture.md) | How the pieces fit |
253
+ | [docs/deployment.md](docs/deployment.md) | Docker, PostgreSQL, secrets |
254
+ | [docs/case-study.md](docs/case-study.md) | A worked example: Agent Auditor watching its own chat agent, including what did not work |
255
+
256
+ ## Known limitations
257
+
258
+ - Alpha software. It has been run on one machine and is not yet proven under production load.
259
+ - Built-in scorers detect symptoms (errors, latency, empty answers), not whether an answer is factually right.
260
+ - Approver names are self-asserted behind one shared API key. Promotion marks a version active; it deploys nothing.
261
+ - Replay needs an agent that can be called again with the stored inputs. Agents that depend on live sessions or
262
+ external state cannot be replayed faithfully.
263
+ - The AI helper can be wrong, so decisions stay with a person. With a provider configured, dashboard figures and your
264
+ question are sent to that provider.
265
+ - The feature comparison in Gap analysis is kept by hand and may be out of date.
266
+ - The PostgreSQL CI job is experimental; SQLite is the tested backend.
267
+ - More in [docs/reference.md](docs/reference.md#known-limitations).
268
+
269
+ ## Development
270
+
271
+ ```bash
272
+ pip install -e ".[dev]"
273
+ ruff check src tests examples chatbot
274
+ pytest -q
275
+ ```
276
+
277
+ Contributions are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md). Never commit `.env` or `chat.db`.
278
+
279
+ ## License
280
+
281
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,242 @@
1
+ <h1 align="center">Agent Auditor</h1>
2
+
3
+ <p align="center"><b>Find out why your AI agent fails, and prove the fix works before you ship it.</b></p>
4
+
5
+ <p align="center">
6
+ <img alt="status" src="https://img.shields.io/badge/status-alpha-orange">
7
+ <img alt="python" src="https://img.shields.io/badge/python-3.11%2B-blue">
8
+ <img alt="license" src="https://img.shields.io/badge/license-MIT-green">
9
+ <img alt="tests" src="https://img.shields.io/badge/tests-418%20passing-brightgreen">
10
+ <img alt="no api key needed" src="https://img.shields.io/badge/core-no%20API%20key%20needed-lightgrey">
11
+ </p>
12
+
13
+ Agent Auditor is an open-source reliability layer for AI agents. It records every agent run, scores it, explains why
14
+ failures happen, turns real failures into regression tests, and only lets a new version go live after a canary check
15
+ and a human approval. Everything lands in an audit log.
16
+
17
+ > **Status: alpha (0.12).** All planned phases are written and tested: tracing, evals, drift, failure-to-test, root
18
+ > causes, canary, release gate, change attribution and verified fixes, plus a plain-language dashboard and a working
19
+ > demo agent. It has been used on one developer's machine, not in production. See [Known limitations](#known-limitations).
20
+
21
+ <!-- Add your demo here: record 60-90 s of the dashboard (failed run -> root cause -> regression test -> canary -> release)
22
+ and save it as docs/assets/demo.gif, then replace this comment with: ![Demo](docs/assets/demo.gif) -->
23
+
24
+ ## Why this exists
25
+
26
+ Tracing tools show you what an agent did. When it breaks in production you still have to work out why, write the test
27
+ by hand, change something, and hope the change did not break something else. Agent Auditor closes that loop:
28
+
29
+ ```
30
+ run -> score -> root cause -> regression test -> proposed fix -> replay the tests -> canary -> approved release -> rollback
31
+ ```
32
+
33
+ | Step | What you get |
34
+ |---|---|
35
+ | **Trace** | Every run with its steps (model calls, tools, retrieval) from a small Python SDK |
36
+ | **Evaluate** | Built-in checks that need no API key (errors, latency, empty answers, grounding), plus your own judge |
37
+ | **Explain** | A root-cause label per failure (rate limit, tool error, bad retrieval, slow run...) and which change likely caused it |
38
+ | **Remember** | One click turns a failed run into a regression test that is replayed against every new version |
39
+ | **Compare** | Drift detection and a canary that rolls back a version that is measurably worse |
40
+ | **Ship safely** | Release gate with approvals (you cannot approve your own), rollback, and a full audit trail |
41
+
42
+ ### How it fits together
43
+
44
+ ```mermaid
45
+ flowchart LR
46
+ A[Your agent<br/>+ Python SDK] -->|runs and steps| B[Auditor API<br/>FastAPI + SQL]
47
+ B --> C[Evals<br/>built-in + your judge]
48
+ C --> D[Root causes<br/>+ change attribution]
49
+ D --> E[Regression tests<br/>from real failures]
50
+ E --> F[Fix candidates<br/>replayed on the tests]
51
+ F --> G[Canary<br/>vs the live version]
52
+ G --> H{Release gate<br/>approvals}
53
+ H -->|promote| I[Active version]
54
+ H -->|rollback| I
55
+ B --> J[(Audit log)]
56
+ B --> K[Dashboard<br/>15 pages]
57
+ ```
58
+
59
+ ## Try it in 5 minutes
60
+
61
+ Needs Python 3.11 or newer. The core runs offline with no API key. Keys are only needed for the optional chat demo and AI helper.
62
+
63
+ ```bash
64
+ git clone https://github.com/ArathiS1/agent-auditor
65
+ cd agent-auditor
66
+ python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
67
+ pip install -e ".[dev]"
68
+ uvicorn agent_auditor.api.main:app # API and dashboard on http://127.0.0.1:8000
69
+ ```
70
+
71
+ In a second terminal, fill it with demo data and open `http://127.0.0.1:8000/dashboard`:
72
+
73
+ ```bash
74
+ python examples/release_demo.py
75
+ ```
76
+
77
+ **Windows, one command:** `powershell -ExecutionPolicy Bypass -File .\run-all.ps1` starts the Auditor and the chat app
78
+ together, connected, and opens the dashboard. Add `-Check` to run a 23-point self-check afterwards.
79
+
80
+ **Docker (API, worker, PostgreSQL):** `cp .env.example .env`, set the two secrets, `docker compose up --build`.
81
+ See [docs/deployment.md](docs/deployment.md).
82
+
83
+ ## Use it with your own agent
84
+
85
+ ```python
86
+ from agent_auditor.sdk import Auditor
87
+
88
+ auditor = Auditor("http://127.0.0.1:8000", agent="support-bot")
89
+ auditor.register_version("v1", prompt=PROMPT, config={"top_k": 4})
90
+
91
+ @auditor.observe(kind="retrieval")
92
+ def kb_search(q): ...
93
+
94
+ @auditor.observe_run()
95
+ def answer(question): ...
96
+ ```
97
+
98
+ Plain Python and LangGraph/LangChain are supported. See `examples/quickstart_plain.py` and `examples/langgraph_demo.py`.
99
+
100
+ ## The dashboard
101
+
102
+ Open `/dashboard`. Fifteen pages, grouped by what you are trying to do:
103
+
104
+ | Group | Pages |
105
+ |---|---|
106
+ | Watch | Overview (health verdict, one tick per run), Failures, Runs |
107
+ | Understand | Quality, Root causes, Drift |
108
+ | Improve | Versions, Regression tests, Fixes, Benchmark, Gap analysis |
109
+ | Ship safely | Canary, Releases |
110
+ | Govern | Audit log, Setup |
111
+
112
+ Every chart has a table view, and "Ask for help" answers questions from beginner to advanced (it works without a key
113
+ from a built-in guide, and uses an AI provider when one is configured).
114
+
115
+ ## Auditor Chat: a real agent to watch
116
+
117
+ `chatbot/` is a ChatGPT-style app that runs on your machine and reports every turn to Agent Auditor, so you always
118
+ have a real agent to inspect. It streams answers, remembers conversations, reads files and images, searches the web,
119
+ runs deep research, and compares models side by side.
120
+
121
+ - **Many providers:** Gemini, Groq, OpenRouter, Mistral, Cerebras, DeepSeek, xAI, Perplexity, OpenAI, Claude, Ollama,
122
+ and any OpenAI-compatible service you describe in `.env` (`NAME_API_KEY`, `NAME_BASE_URL`, `NAME_MODEL`).
123
+ - **Auto-routing:** the chat remembers which models are slow or rate limited and tries healthy, quick ones first
124
+ (`CHAT_AUTOROUTE=off` to disable). `GET /api/health` shows what it has learned.
125
+ - **Key doctor:** `python chatbot/check_keys.py` says plainly whether each key works, is out of credit, or is busy.
126
+
127
+ Details: [chatbot/README.md](chatbot/README.md).
128
+
129
+ ## What it found on a real agent
130
+
131
+ Running the chat app as a live agent for a few days, the Overview reported most runs as problems. The cause was not a
132
+ bug in the code: slow free or reasoning models tripped the latency check, and free tiers returned rate limits. That
133
+ finding led directly to the auto-routing above. The point of the tool is that it showed this with evidence, per version
134
+ and per cause, instead of leaving it as a feeling that "the bot is flaky".
135
+
136
+ ## How well does it work?
137
+
138
+ `validation/` tests the tool against a support bot whose faults are planted, so the right answer is known.
139
+ On the included sample run:
140
+
141
+ - 3 of 5 planted faults were rolled back by the canary every time.
142
+ - Half-missing search results were caught 3 times in 5.
143
+ - **Out-of-date facts were never caught.** The built-in checks look at symptoms, not facts.
144
+
145
+ Run it yourself: `python validation/run_validation.py --dry-run`. Report and method: [validation/README.md](validation/README.md).
146
+
147
+ ## Design choices
148
+
149
+ - **Fixes are proposals, not automatic edits.** Rule-based candidates come from the root-cause report. A person registers
150
+ one, the regression suite replays against it, a canary compares it, and a different person approves the release.
151
+ Many failures (slow runs, rate limits) are infrastructure problems that no prompt change fixes.
152
+ - **Cheap checks first.** Built-in scorers need no API key, so the system works offline and costs nothing to run.
153
+ - **Plain HTML dashboard.** No build step and no CDN, served by the API itself.
154
+
155
+ ## A failure, start to finish
156
+
157
+ What the loop looks like on a real incident (numbers are illustrative):
158
+
159
+ 1. **Overview** turns red: *"31 of 52 runs had problems."*
160
+ 2. **Root causes** says why: *slow run (25 runs), rate limit (14 runs), tool error (3 runs)*, and in which version it began.
161
+ 3. **Failures** lists each run. One click turns a bad run into a **regression test**.
162
+ 4. **Fixes** proposes small candidates. Each is registered as a separate, inactive version and replayed on every
163
+ regression test. Only candidates that pass are recommended.
164
+ 5. **Canary** sends a slice of live traffic to the candidate and compares pass rate, latency and causes with the live version.
165
+ 6. **Releases**: a different person approves, you promote, and if it goes wrong you roll back with a written reason.
166
+ Every step, including refusals, is in the audit log.
167
+
168
+ ## What is built
169
+
170
+ | Area | Contents | State |
171
+ |---|---|---|
172
+ | Core | Data model, FastAPI ingestion, versioned prompts and configs, audit events, Python SDK, LangGraph adapter | done |
173
+ | Evals | 7 built-in scorers, your own judge, version-to-version regression verdicts | done |
174
+ | Drift | Numeric, rate and term-mix signals with significance tests | done |
175
+ | Failure to test | Failed runs become deduplicated regression cases; replay against any version | done |
176
+ | Root causes | 11 cause types with sub-causes, suspect documents, change attribution | done |
177
+ | Canary and releases | Five checks, approval gate, rollback, audit trail | done |
178
+ | Fixes | Rule-based and optional AI candidates, verified on the regression suite | done, human-approved |
179
+ | Dashboard | 15 pages, plain HTML/CSS/JS, dark mode, built-in help chatbot | done |
180
+ | Auditor Chat | Multi-provider demo agent with auto-routing and key checks | done |
181
+ | Ops | Docker Compose, PostgreSQL, Alembic migrations, CI, background worker | done, PostgreSQL experimental |
182
+
183
+ ## Roadmap
184
+
185
+ Planned, in rough order. None of it exists yet.
186
+
187
+ - [ ] One-click "apply and verify" for fix candidates (register, replay and canary in one step)
188
+ - [ ] Real user authentication, so approvers are verified and not typed names
189
+ - [ ] Row locking for several operators on one release
190
+ - [ ] Fact-checking scorers that compare answers with source documents, not just symptoms
191
+ - [ ] A green PostgreSQL CI job, then promote PostgreSQL to supported
192
+ - [ ] Published package on PyPI
193
+
194
+ ## FAQ
195
+
196
+ **Is this an observability tool like LangSmith or Langfuse?** Partly. Those show what happened. Agent Auditor adds the
197
+ steps after that: diagnosing the cause, writing the test, checking the fix and gating the release. It is much younger
198
+ and smaller than they are, so pick it for the closed loop, not for scale.
199
+
200
+ **Does it need an API key?** No. Tracing, evals, root causes, drift, canary and releases run offline. Keys are only for
201
+ the optional AI helper, AI-written fixes and the demo chat app.
202
+
203
+ **Will it fix my agent automatically?** No, by design. It proposes and proves fixes; a person approves the release.
204
+ Many failures, such as slow runs and rate limits, come from the model or provider, and no prompt edit fixes them.
205
+
206
+ **Can I use it with my own agent?** Yes. Add the SDK decorators shown above to any Python agent.
207
+
208
+ ## Documentation
209
+
210
+ | | |
211
+ |---|---|
212
+ | [docs/reference.md](docs/reference.md) | Every phase in detail: evals, drift, failure-to-test, root causes, canary, releases, attribution |
213
+ | [docs/architecture.md](docs/architecture.md) | How the pieces fit |
214
+ | [docs/deployment.md](docs/deployment.md) | Docker, PostgreSQL, secrets |
215
+ | [docs/case-study.md](docs/case-study.md) | A worked example: Agent Auditor watching its own chat agent, including what did not work |
216
+
217
+ ## Known limitations
218
+
219
+ - Alpha software. It has been run on one machine and is not yet proven under production load.
220
+ - Built-in scorers detect symptoms (errors, latency, empty answers), not whether an answer is factually right.
221
+ - Approver names are self-asserted behind one shared API key. Promotion marks a version active; it deploys nothing.
222
+ - Replay needs an agent that can be called again with the stored inputs. Agents that depend on live sessions or
223
+ external state cannot be replayed faithfully.
224
+ - The AI helper can be wrong, so decisions stay with a person. With a provider configured, dashboard figures and your
225
+ question are sent to that provider.
226
+ - The feature comparison in Gap analysis is kept by hand and may be out of date.
227
+ - The PostgreSQL CI job is experimental; SQLite is the tested backend.
228
+ - More in [docs/reference.md](docs/reference.md#known-limitations).
229
+
230
+ ## Development
231
+
232
+ ```bash
233
+ pip install -e ".[dev]"
234
+ ruff check src tests examples chatbot
235
+ pytest -q
236
+ ```
237
+
238
+ Contributions are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md). Never commit `.env` or `chat.db`.
239
+
240
+ ## License
241
+
242
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,59 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agent-auditor"
7
+ version = "0.13.0"
8
+ license = { text = "MIT" }
9
+ readme = "README.md"
10
+ authors = [{ name = "Arathi" }]
11
+ keywords = ["ai-agents", "llm", "evaluation", "observability", "regression-testing", "canary", "mlops"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Topic :: Software Development :: Quality Assurance",
20
+ "Topic :: Software Development :: Testing",
21
+ "Framework :: FastAPI",
22
+ ]
23
+ description = "Open-source reliability layer for AI agents: traces, evals, drift, failure-to-test, root cause, canaries, rollback."
24
+ requires-python = ">=3.11"
25
+ dependencies = [
26
+ "fastapi>=0.110",
27
+ "uvicorn[standard]>=0.29",
28
+ "sqlalchemy>=2.0",
29
+ "pydantic>=2.6",
30
+ "httpx>=0.27",
31
+ "alembic>=1.13",
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://arathis1.github.io/agent-auditor/"
36
+ Documentation = "https://arathis1.github.io/agent-auditor/docs/"
37
+ Repository = "https://github.com/ArathiS1/agent-auditor"
38
+ Issues = "https://github.com/ArathiS1/agent-auditor/issues"
39
+
40
+ [project.optional-dependencies]
41
+ dev = ["pytest>=8", "ruff>=0.5"]
42
+ postgres = ["psycopg[binary]>=3.1"]
43
+ langgraph = ["langgraph>=0.2", "langchain-core>=0.3"]
44
+
45
+ [project.scripts]
46
+ agent-auditor = "agent_auditor.cli:main"
47
+ agent-auditor-worker = "agent_auditor.worker:main"
48
+
49
+ [tool.setuptools.packages.find]
50
+ where = ["src"]
51
+
52
+ [tool.setuptools.package-data]
53
+ agent_auditor = ["dashboard/*.html", "dashboard/*.js", "dashboard/js/*.js", "dashboard/*.css", "data/*.json", "data/*.md"]
54
+
55
+ [tool.pytest.ini_options]
56
+ testpaths = ["tests"]
57
+
58
+ [tool.ruff.lint]
59
+ select = ["F", "E9"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = "0.13.0"
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
File without changes