@opensearch-project/agent-health 0.3.0 → 0.5.2

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 (518) hide show
  1. package/README.md +77 -6
  2. package/cli/dist/index.js +10072 -4502
  3. package/deployment/cloudformation/agent-health-observability.yaml +762 -0
  4. package/dist/assets/index-CCQRDlO0.js +243 -0
  5. package/dist/assets/index-CNHQVbcj.css +1 -0
  6. package/dist/index.html +2 -2
  7. package/docs/ARCHITECTURE.md +450 -0
  8. package/docs/BACKEND_JOB_QUEUE.md +405 -0
  9. package/docs/CLAUDE_CODE_TELEMETRY.md +283 -0
  10. package/docs/CLI.md +431 -0
  11. package/docs/CODING_AGENT_ANALYTICS.md +298 -0
  12. package/docs/CONFIGURATION.md +388 -0
  13. package/docs/CONNECTORS.md +536 -0
  14. package/docs/INSTRUMENT_WITH_OTEL.md +390 -0
  15. package/docs/ML-COMMONS-SETUP.md +289 -0
  16. package/docs/NPX_PACKAGING.md +195 -0
  17. package/docs/PERFORMANCE-MONITORING.md +200 -0
  18. package/docs/PERFORMANCE.md +390 -0
  19. package/docs/PI_PROFILING.md +169 -0
  20. package/docs/PLAN-non-agui-agent-support.md +525 -0
  21. package/docs/SDK.md +577 -0
  22. package/docs/SKILLS.md +264 -0
  23. package/docs/blogs/2026-02-28-opensearch-agent-health.md +200 -0
  24. package/docs/blogs/getting-started-blog.md +608 -0
  25. package/docs/diagrams/Agent-health.excalidraw +5656 -0
  26. package/docs/diagrams/architecture.png +0 -0
  27. package/docs/plans/field-redesign.md +468 -0
  28. package/docs/rfcs/001-coding-agent-analytics.md +374 -0
  29. package/docs/rfcs/002-enterprise-leaderboard.md +267 -0
  30. package/docs/rfcs/003-remote-aggregation.md +146 -0
  31. package/docs/rfcs/004-test-sdk-v2.md +599 -0
  32. package/docs/skills/AGENT_HEALTH.md +598 -0
  33. package/docs/skills/AGENT_PROFILE.md +191 -0
  34. package/docs/skills/add-connector/SKILL.md +68 -0
  35. package/docs/skills/agent-health-profile/SKILL.md +40 -0
  36. package/docs/skills/config-auth/SKILL.md +194 -0
  37. package/docs/skills/config-auth/evals/evals.json +35 -0
  38. package/docs/skills/create-pr/SKILL.md +73 -0
  39. package/docs/skills/instrument-otel/SKILL.md +84 -0
  40. package/docs/skills/write-test/SKILL.md +124 -0
  41. package/docs/ui prd.md +376 -0
  42. package/examples/README.md +53 -0
  43. package/examples/config/agent-health.config.example.ts +155 -0
  44. package/examples/connectors/echo-connector.ts +131 -0
  45. package/examples/eval-files/demo.eval.js +128 -0
  46. package/examples/eval-files/sdk-hooks-demo.eval.js +99 -0
  47. package/examples/pi-profiling/README.md +77 -0
  48. package/examples/pi-profiling/agent-health-profile.ts +417 -0
  49. package/lib/dist/lib/agentUtils.d.ts +29 -0
  50. package/lib/dist/lib/agentUtils.d.ts.map +1 -0
  51. package/lib/dist/lib/agentUtils.js +43 -0
  52. package/lib/dist/lib/agentUtils.js.map +1 -0
  53. package/lib/dist/lib/benchmarkExport.d.ts +14 -0
  54. package/lib/dist/lib/benchmarkExport.d.ts.map +1 -0
  55. package/lib/dist/lib/benchmarkExport.js +41 -0
  56. package/lib/dist/lib/benchmarkExport.js.map +1 -0
  57. package/lib/dist/lib/benchmarkVersionUtils.d.ts +37 -0
  58. package/lib/dist/lib/benchmarkVersionUtils.d.ts.map +1 -0
  59. package/lib/dist/lib/benchmarkVersionUtils.js +68 -0
  60. package/lib/dist/lib/benchmarkVersionUtils.js.map +1 -0
  61. package/lib/dist/lib/config/defineConfig.d.ts +27 -0
  62. package/lib/dist/lib/config/defineConfig.d.ts.map +1 -0
  63. package/lib/dist/lib/config/defineConfig.js +28 -0
  64. package/lib/dist/lib/config/defineConfig.js.map +1 -0
  65. package/lib/dist/lib/config/index.d.ts +9 -0
  66. package/lib/dist/lib/config/index.d.ts.map +1 -0
  67. package/lib/dist/lib/config/index.js +8 -0
  68. package/lib/dist/lib/config/index.js.map +1 -0
  69. package/lib/dist/lib/config/loader.d.ts +39 -0
  70. package/lib/dist/lib/config/loader.d.ts.map +1 -0
  71. package/lib/dist/lib/config/loader.js +258 -0
  72. package/lib/dist/lib/config/loader.js.map +1 -0
  73. package/lib/dist/lib/config/statePaths.d.ts +61 -0
  74. package/lib/dist/lib/config/statePaths.d.ts.map +1 -0
  75. package/lib/dist/lib/config/statePaths.js +188 -0
  76. package/lib/dist/lib/config/statePaths.js.map +1 -0
  77. package/lib/dist/lib/config/types.d.ts +231 -0
  78. package/lib/dist/lib/config/types.d.ts.map +1 -0
  79. package/lib/dist/lib/config/types.js +6 -0
  80. package/lib/dist/lib/config/types.js.map +1 -0
  81. package/lib/dist/lib/config.d.ts +39 -0
  82. package/lib/dist/lib/config.d.ts.map +1 -0
  83. package/lib/dist/lib/config.js +118 -0
  84. package/lib/dist/lib/config.js.map +1 -0
  85. package/lib/dist/lib/constants.d.ts +70 -0
  86. package/lib/dist/lib/constants.d.ts.map +1 -0
  87. package/lib/dist/lib/constants.js +365 -0
  88. package/lib/dist/lib/constants.js.map +1 -0
  89. package/lib/dist/lib/contextUtilization.d.ts +23 -0
  90. package/lib/dist/lib/contextUtilization.d.ts.map +1 -0
  91. package/lib/dist/lib/contextUtilization.js +72 -0
  92. package/lib/dist/lib/contextUtilization.js.map +1 -0
  93. package/lib/dist/lib/dashboardMetrics.d.ts +87 -0
  94. package/lib/dist/lib/dashboardMetrics.d.ts.map +1 -0
  95. package/lib/dist/lib/dashboardMetrics.js +242 -0
  96. package/lib/dist/lib/dashboardMetrics.js.map +1 -0
  97. package/lib/dist/lib/dataSourceConfig.d.ts +108 -0
  98. package/lib/dist/lib/dataSourceConfig.d.ts.map +1 -0
  99. package/lib/dist/lib/dataSourceConfig.js +166 -0
  100. package/lib/dist/lib/dataSourceConfig.js.map +1 -0
  101. package/lib/dist/lib/debug.d.ts +26 -0
  102. package/lib/dist/lib/debug.d.ts.map +1 -0
  103. package/lib/dist/lib/debug.js +132 -0
  104. package/lib/dist/lib/debug.js.map +1 -0
  105. package/lib/dist/lib/diagnostics.d.ts +28 -0
  106. package/lib/dist/lib/diagnostics.d.ts.map +1 -0
  107. package/lib/dist/lib/diagnostics.js +65 -0
  108. package/lib/dist/lib/diagnostics.js.map +1 -0
  109. package/lib/dist/lib/envCompat.d.ts +27 -0
  110. package/lib/dist/lib/envCompat.d.ts.map +1 -0
  111. package/lib/dist/lib/envCompat.js +73 -0
  112. package/lib/dist/lib/envCompat.js.map +1 -0
  113. package/lib/dist/lib/findPackageRoot.d.ts +7 -0
  114. package/lib/dist/lib/findPackageRoot.d.ts.map +1 -0
  115. package/lib/dist/lib/findPackageRoot.js +57 -0
  116. package/lib/dist/lib/findPackageRoot.js.map +1 -0
  117. package/lib/dist/lib/hooks.d.ts +36 -0
  118. package/lib/dist/lib/hooks.d.ts.map +1 -0
  119. package/lib/dist/lib/hooks.js +112 -0
  120. package/lib/dist/lib/hooks.js.map +1 -0
  121. package/lib/dist/lib/index.d.ts +47 -0
  122. package/lib/dist/lib/index.d.ts.map +1 -0
  123. package/lib/dist/lib/index.js +62 -0
  124. package/lib/dist/lib/index.js.map +1 -0
  125. package/lib/dist/lib/labels.d.ts +90 -0
  126. package/lib/dist/lib/labels.d.ts.map +1 -0
  127. package/lib/dist/lib/labels.js +158 -0
  128. package/lib/dist/lib/labels.js.map +1 -0
  129. package/lib/dist/lib/markdown.d.ts +16 -0
  130. package/lib/dist/lib/markdown.d.ts.map +1 -0
  131. package/lib/dist/lib/markdown.js +42 -0
  132. package/lib/dist/lib/markdown.js.map +1 -0
  133. package/lib/dist/lib/matchers/expect.d.ts +3 -0
  134. package/lib/dist/lib/matchers/expect.d.ts.map +1 -0
  135. package/lib/dist/lib/matchers/expect.js +225 -0
  136. package/lib/dist/lib/matchers/expect.js.map +1 -0
  137. package/lib/dist/lib/matchers/index.d.ts +8 -0
  138. package/lib/dist/lib/matchers/index.d.ts.map +1 -0
  139. package/lib/dist/lib/matchers/index.js +9 -0
  140. package/lib/dist/lib/matchers/index.js.map +1 -0
  141. package/lib/dist/lib/matchers/judgeAccessor.d.ts +113 -0
  142. package/lib/dist/lib/matchers/judgeAccessor.d.ts.map +1 -0
  143. package/lib/dist/lib/matchers/judgeAccessor.js +183 -0
  144. package/lib/dist/lib/matchers/judgeAccessor.js.map +1 -0
  145. package/lib/dist/lib/matchers/session.d.ts +39 -0
  146. package/lib/dist/lib/matchers/session.d.ts.map +1 -0
  147. package/lib/dist/lib/matchers/session.js +116 -0
  148. package/lib/dist/lib/matchers/session.js.map +1 -0
  149. package/lib/dist/lib/matchers/traces.d.ts +55 -0
  150. package/lib/dist/lib/matchers/traces.d.ts.map +1 -0
  151. package/lib/dist/lib/matchers/traces.js +116 -0
  152. package/lib/dist/lib/matchers/traces.js.map +1 -0
  153. package/lib/dist/lib/matchers/types.d.ts +75 -0
  154. package/lib/dist/lib/matchers/types.d.ts.map +1 -0
  155. package/lib/dist/lib/matchers/types.js +6 -0
  156. package/lib/dist/lib/matchers/types.js.map +1 -0
  157. package/lib/dist/lib/packagePaths.d.ts +29 -0
  158. package/lib/dist/lib/packagePaths.d.ts.map +1 -0
  159. package/lib/dist/lib/packagePaths.js +63 -0
  160. package/lib/dist/lib/packagePaths.js.map +1 -0
  161. package/lib/dist/lib/performance.d.ts +51 -0
  162. package/lib/dist/lib/performance.d.ts.map +1 -0
  163. package/lib/dist/lib/performance.js +159 -0
  164. package/lib/dist/lib/performance.js.map +1 -0
  165. package/lib/dist/lib/portConfig.d.ts +29 -0
  166. package/lib/dist/lib/portConfig.d.ts.map +1 -0
  167. package/lib/dist/lib/portConfig.js +64 -0
  168. package/lib/dist/lib/portConfig.js.map +1 -0
  169. package/lib/dist/lib/preferences.d.ts +63 -0
  170. package/lib/dist/lib/preferences.d.ts.map +1 -0
  171. package/lib/dist/lib/preferences.js +117 -0
  172. package/lib/dist/lib/preferences.js.map +1 -0
  173. package/lib/dist/lib/resolveAgentModel.d.ts +22 -0
  174. package/lib/dist/lib/resolveAgentModel.d.ts.map +1 -0
  175. package/lib/dist/lib/resolveAgentModel.js +37 -0
  176. package/lib/dist/lib/resolveAgentModel.js.map +1 -0
  177. package/lib/dist/lib/runStats.d.ts +92 -0
  178. package/lib/dist/lib/runStats.d.ts.map +1 -0
  179. package/lib/dist/lib/runStats.js +160 -0
  180. package/lib/dist/lib/runStats.js.map +1 -0
  181. package/lib/dist/lib/telemetry/constants.d.ts +60 -0
  182. package/lib/dist/lib/telemetry/constants.d.ts.map +1 -0
  183. package/lib/dist/lib/telemetry/constants.js +87 -0
  184. package/lib/dist/lib/telemetry/constants.js.map +1 -0
  185. package/lib/dist/lib/telemetry/evalSpans.d.ts +61 -0
  186. package/lib/dist/lib/telemetry/evalSpans.d.ts.map +1 -0
  187. package/lib/dist/lib/telemetry/evalSpans.js +254 -0
  188. package/lib/dist/lib/telemetry/evalSpans.js.map +1 -0
  189. package/lib/dist/lib/telemetry/index.d.ts +11 -0
  190. package/lib/dist/lib/telemetry/index.d.ts.map +1 -0
  191. package/lib/dist/lib/telemetry/index.js +15 -0
  192. package/lib/dist/lib/telemetry/index.js.map +1 -0
  193. package/lib/dist/lib/telemetry/opensearchExporter.d.ts +43 -0
  194. package/lib/dist/lib/telemetry/opensearchExporter.d.ts.map +1 -0
  195. package/lib/dist/lib/telemetry/opensearchExporter.js +217 -0
  196. package/lib/dist/lib/telemetry/opensearchExporter.js.map +1 -0
  197. package/lib/dist/lib/telemetry/provider.d.ts +55 -0
  198. package/lib/dist/lib/telemetry/provider.d.ts.map +1 -0
  199. package/lib/dist/lib/telemetry/provider.js +140 -0
  200. package/lib/dist/lib/telemetry/provider.js.map +1 -0
  201. package/lib/dist/lib/testCaseLabels.d.ts +34 -0
  202. package/lib/dist/lib/testCaseLabels.d.ts.map +1 -0
  203. package/lib/dist/lib/testCaseLabels.js +88 -0
  204. package/lib/dist/lib/testCaseLabels.js.map +1 -0
  205. package/lib/dist/lib/testCaseValidation.d.ts +140 -0
  206. package/lib/dist/lib/testCaseValidation.d.ts.map +1 -0
  207. package/lib/dist/lib/testCaseValidation.js +162 -0
  208. package/lib/dist/lib/testCaseValidation.js.map +1 -0
  209. package/lib/dist/lib/testCases/agentFixture.d.ts +80 -0
  210. package/lib/dist/lib/testCases/agentFixture.d.ts.map +1 -0
  211. package/lib/dist/lib/testCases/agentFixture.js +43 -0
  212. package/lib/dist/lib/testCases/agentFixture.js.map +1 -0
  213. package/lib/dist/lib/testCases/authoringSurface.d.ts +10 -0
  214. package/lib/dist/lib/testCases/authoringSurface.d.ts.map +1 -0
  215. package/lib/dist/lib/testCases/authoringSurface.js +54 -0
  216. package/lib/dist/lib/testCases/authoringSurface.js.map +1 -0
  217. package/lib/dist/lib/testCases/codemod.d.ts +13 -0
  218. package/lib/dist/lib/testCases/codemod.d.ts.map +1 -0
  219. package/lib/dist/lib/testCases/codemod.js +169 -0
  220. package/lib/dist/lib/testCases/codemod.js.map +1 -0
  221. package/lib/dist/lib/testCases/define.d.ts +114 -0
  222. package/lib/dist/lib/testCases/define.d.ts.map +1 -0
  223. package/lib/dist/lib/testCases/define.js +253 -0
  224. package/lib/dist/lib/testCases/define.js.map +1 -0
  225. package/lib/dist/lib/testCases/evaluators.d.ts +80 -0
  226. package/lib/dist/lib/testCases/evaluators.d.ts.map +1 -0
  227. package/lib/dist/lib/testCases/evaluators.js +105 -0
  228. package/lib/dist/lib/testCases/evaluators.js.map +1 -0
  229. package/lib/dist/lib/testCases/index.d.ts +14 -0
  230. package/lib/dist/lib/testCases/index.d.ts.map +1 -0
  231. package/lib/dist/lib/testCases/index.js +12 -0
  232. package/lib/dist/lib/testCases/index.js.map +1 -0
  233. package/lib/dist/lib/testCases/judge.d.ts +165 -0
  234. package/lib/dist/lib/testCases/judge.d.ts.map +1 -0
  235. package/lib/dist/lib/testCases/judge.js +359 -0
  236. package/lib/dist/lib/testCases/judge.js.map +1 -0
  237. package/lib/dist/lib/testCases/loader.d.ts +26 -0
  238. package/lib/dist/lib/testCases/loader.d.ts.map +1 -0
  239. package/lib/dist/lib/testCases/loader.js +149 -0
  240. package/lib/dist/lib/testCases/loader.js.map +1 -0
  241. package/lib/dist/lib/testCases/types.d.ts +242 -0
  242. package/lib/dist/lib/testCases/types.d.ts.map +1 -0
  243. package/lib/dist/lib/testCases/types.js +6 -0
  244. package/lib/dist/lib/testCases/types.js.map +1 -0
  245. package/lib/dist/lib/theme.d.ts +6 -0
  246. package/lib/dist/lib/theme.d.ts.map +1 -0
  247. package/lib/dist/lib/theme.js +36 -0
  248. package/lib/dist/lib/theme.js.map +1 -0
  249. package/lib/dist/lib/uiTelemetry.d.ts +7 -0
  250. package/lib/dist/lib/uiTelemetry.d.ts.map +1 -0
  251. package/lib/dist/lib/uiTelemetry.js +25 -0
  252. package/lib/dist/lib/uiTelemetry.js.map +1 -0
  253. package/lib/dist/lib/utils.d.ts +96 -0
  254. package/lib/dist/lib/utils.d.ts.map +1 -0
  255. package/lib/dist/lib/utils.js +232 -0
  256. package/lib/dist/lib/utils.js.map +1 -0
  257. package/lib/dist/lib/workflow/consolidate.d.ts +12 -0
  258. package/lib/dist/lib/workflow/consolidate.d.ts.map +1 -0
  259. package/lib/dist/lib/workflow/consolidate.js +33 -0
  260. package/lib/dist/lib/workflow/consolidate.js.map +1 -0
  261. package/lib/dist/lib/workflow/index.d.ts +13 -0
  262. package/lib/dist/lib/workflow/index.d.ts.map +1 -0
  263. package/lib/dist/lib/workflow/index.js +12 -0
  264. package/lib/dist/lib/workflow/index.js.map +1 -0
  265. package/lib/dist/lib/workflow/ledger.d.ts +30 -0
  266. package/lib/dist/lib/workflow/ledger.d.ts.map +1 -0
  267. package/lib/dist/lib/workflow/ledger.js +41 -0
  268. package/lib/dist/lib/workflow/ledger.js.map +1 -0
  269. package/lib/dist/lib/workflow/pool.d.ts +13 -0
  270. package/lib/dist/lib/workflow/pool.d.ts.map +1 -0
  271. package/lib/dist/lib/workflow/pool.js +44 -0
  272. package/lib/dist/lib/workflow/pool.js.map +1 -0
  273. package/lib/dist/lib/workflow/source.d.ts +22 -0
  274. package/lib/dist/lib/workflow/source.d.ts.map +1 -0
  275. package/lib/dist/lib/workflow/source.js +29 -0
  276. package/lib/dist/lib/workflow/source.js.map +1 -0
  277. package/lib/dist/lib/workflow/stepB.d.ts +71 -0
  278. package/lib/dist/lib/workflow/stepB.d.ts.map +1 -0
  279. package/lib/dist/lib/workflow/stepB.js +99 -0
  280. package/lib/dist/lib/workflow/stepB.js.map +1 -0
  281. package/lib/dist/lib/workflow/types.d.ts +86 -0
  282. package/lib/dist/lib/workflow/types.d.ts.map +1 -0
  283. package/lib/dist/lib/workflow/types.js +6 -0
  284. package/lib/dist/lib/workflow/types.js.map +1 -0
  285. package/lib/dist/lib/workflow/workflow.d.ts +119 -0
  286. package/lib/dist/lib/workflow/workflow.d.ts.map +1 -0
  287. package/lib/dist/lib/workflow/workflow.js +195 -0
  288. package/lib/dist/lib/workflow/workflow.js.map +1 -0
  289. package/lib/dist/services/agent/aguiConverter.d.ts +50 -0
  290. package/lib/dist/services/agent/aguiConverter.d.ts.map +1 -0
  291. package/lib/dist/services/agent/aguiConverter.js +449 -0
  292. package/lib/dist/services/agent/aguiConverter.js.map +1 -0
  293. package/lib/dist/services/agent/index.d.ts +10 -0
  294. package/lib/dist/services/agent/index.d.ts.map +1 -0
  295. package/lib/dist/services/agent/index.js +12 -0
  296. package/lib/dist/services/agent/index.js.map +1 -0
  297. package/lib/dist/services/agent/payloadBuilder.d.ts +33 -0
  298. package/lib/dist/services/agent/payloadBuilder.d.ts.map +1 -0
  299. package/lib/dist/services/agent/payloadBuilder.js +75 -0
  300. package/lib/dist/services/agent/payloadBuilder.js.map +1 -0
  301. package/lib/dist/services/agent/sseStream.d.ts +43 -0
  302. package/lib/dist/services/agent/sseStream.d.ts.map +1 -0
  303. package/lib/dist/services/agent/sseStream.js +223 -0
  304. package/lib/dist/services/agent/sseStream.js.map +1 -0
  305. package/lib/dist/services/connectors/agui/AGUIStreamingConnector.d.ts +44 -0
  306. package/lib/dist/services/connectors/agui/AGUIStreamingConnector.d.ts.map +1 -0
  307. package/lib/dist/services/connectors/agui/AGUIStreamingConnector.js +95 -0
  308. package/lib/dist/services/connectors/agui/AGUIStreamingConnector.js.map +1 -0
  309. package/lib/dist/services/connectors/base/BaseConnector.d.ts +81 -0
  310. package/lib/dist/services/connectors/base/BaseConnector.d.ts.map +1 -0
  311. package/lib/dist/services/connectors/base/BaseConnector.js +170 -0
  312. package/lib/dist/services/connectors/base/BaseConnector.js.map +1 -0
  313. package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts +116 -0
  314. package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts.map +1 -0
  315. package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js +403 -0
  316. package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js.map +1 -0
  317. package/lib/dist/services/connectors/index.d.ts +13 -0
  318. package/lib/dist/services/connectors/index.d.ts.map +1 -0
  319. package/lib/dist/services/connectors/index.js +32 -0
  320. package/lib/dist/services/connectors/index.js.map +1 -0
  321. package/lib/dist/services/connectors/kiro/KiroConnector.d.ts +48 -0
  322. package/lib/dist/services/connectors/kiro/KiroConnector.d.ts.map +1 -0
  323. package/lib/dist/services/connectors/kiro/KiroConnector.js +158 -0
  324. package/lib/dist/services/connectors/kiro/KiroConnector.js.map +1 -0
  325. package/lib/dist/services/connectors/langgraph/LangGraphConnector.d.ts +36 -0
  326. package/lib/dist/services/connectors/langgraph/LangGraphConnector.d.ts.map +1 -0
  327. package/lib/dist/services/connectors/langgraph/LangGraphConnector.js +175 -0
  328. package/lib/dist/services/connectors/langgraph/LangGraphConnector.js.map +1 -0
  329. package/lib/dist/services/connectors/mock/MockConnector.d.ts +37 -0
  330. package/lib/dist/services/connectors/mock/MockConnector.d.ts.map +1 -0
  331. package/lib/dist/services/connectors/mock/MockConnector.js +120 -0
  332. package/lib/dist/services/connectors/mock/MockConnector.js.map +1 -0
  333. package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.d.ts +42 -0
  334. package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.d.ts.map +1 -0
  335. package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.js +133 -0
  336. package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.js.map +1 -0
  337. package/lib/dist/services/connectors/pi/PiConnector.d.ts +87 -0
  338. package/lib/dist/services/connectors/pi/PiConnector.d.ts.map +1 -0
  339. package/lib/dist/services/connectors/pi/PiConnector.js +274 -0
  340. package/lib/dist/services/connectors/pi/PiConnector.js.map +1 -0
  341. package/lib/dist/services/connectors/registry.d.ts +57 -0
  342. package/lib/dist/services/connectors/registry.d.ts.map +1 -0
  343. package/lib/dist/services/connectors/registry.js +106 -0
  344. package/lib/dist/services/connectors/registry.js.map +1 -0
  345. package/lib/dist/services/connectors/rest/RESTConnector.d.ts +38 -0
  346. package/lib/dist/services/connectors/rest/RESTConnector.d.ts.map +1 -0
  347. package/lib/dist/services/connectors/rest/RESTConnector.js +117 -0
  348. package/lib/dist/services/connectors/rest/RESTConnector.js.map +1 -0
  349. package/lib/dist/services/connectors/server.d.ts +13 -0
  350. package/lib/dist/services/connectors/server.d.ts.map +1 -0
  351. package/lib/dist/services/connectors/server.js +34 -0
  352. package/lib/dist/services/connectors/server.js.map +1 -0
  353. package/lib/dist/services/connectors/strands/StrandsConnector.d.ts +48 -0
  354. package/lib/dist/services/connectors/strands/StrandsConnector.d.ts.map +1 -0
  355. package/lib/dist/services/connectors/strands/StrandsConnector.js +221 -0
  356. package/lib/dist/services/connectors/strands/StrandsConnector.js.map +1 -0
  357. package/lib/dist/services/connectors/subprocess/SubprocessConnector.d.ts +88 -0
  358. package/lib/dist/services/connectors/subprocess/SubprocessConnector.d.ts.map +1 -0
  359. package/lib/dist/services/connectors/subprocess/SubprocessConnector.js +418 -0
  360. package/lib/dist/services/connectors/subprocess/SubprocessConnector.js.map +1 -0
  361. package/lib/dist/services/connectors/types.d.ts +213 -0
  362. package/lib/dist/services/connectors/types.d.ts.map +1 -0
  363. package/lib/dist/services/connectors/types.js +6 -0
  364. package/lib/dist/services/connectors/types.js.map +1 -0
  365. package/lib/dist/services/evaluation/bedrockJudge.d.ts +64 -0
  366. package/lib/dist/services/evaluation/bedrockJudge.d.ts.map +1 -0
  367. package/lib/dist/services/evaluation/bedrockJudge.js +167 -0
  368. package/lib/dist/services/evaluation/bedrockJudge.js.map +1 -0
  369. package/lib/dist/services/evaluation/evaluatorError.d.ts +56 -0
  370. package/lib/dist/services/evaluation/evaluatorError.d.ts.map +1 -0
  371. package/lib/dist/services/evaluation/evaluatorError.js +56 -0
  372. package/lib/dist/services/evaluation/evaluatorError.js.map +1 -0
  373. package/lib/dist/services/evaluation/index.d.ts +106 -0
  374. package/lib/dist/services/evaluation/index.d.ts.map +1 -0
  375. package/lib/dist/services/evaluation/index.js +684 -0
  376. package/lib/dist/services/evaluation/index.js.map +1 -0
  377. package/lib/dist/services/evaluation/mockTrajectory.d.ts +3 -0
  378. package/lib/dist/services/evaluation/mockTrajectory.d.ts.map +1 -0
  379. package/lib/dist/services/evaluation/mockTrajectory.js +72 -0
  380. package/lib/dist/services/evaluation/mockTrajectory.js.map +1 -0
  381. package/lib/dist/services/opensearch/client.d.ts +26 -0
  382. package/lib/dist/services/opensearch/client.d.ts.map +1 -0
  383. package/lib/dist/services/opensearch/client.js +131 -0
  384. package/lib/dist/services/opensearch/client.js.map +1 -0
  385. package/lib/dist/services/opensearch/index.d.ts +16 -0
  386. package/lib/dist/services/opensearch/index.d.ts.map +1 -0
  387. package/lib/dist/services/opensearch/index.js +25 -0
  388. package/lib/dist/services/opensearch/index.js.map +1 -0
  389. package/lib/dist/services/storage/asyncBenchmarkStorage.d.ts +123 -0
  390. package/lib/dist/services/storage/asyncBenchmarkStorage.d.ts.map +1 -0
  391. package/lib/dist/services/storage/asyncBenchmarkStorage.js +429 -0
  392. package/lib/dist/services/storage/asyncBenchmarkStorage.js.map +1 -0
  393. package/lib/dist/services/storage/asyncRunStorage.d.ts +127 -0
  394. package/lib/dist/services/storage/asyncRunStorage.d.ts.map +1 -0
  395. package/lib/dist/services/storage/asyncRunStorage.js +448 -0
  396. package/lib/dist/services/storage/asyncRunStorage.js.map +1 -0
  397. package/lib/dist/services/storage/asyncTestCaseStorage.d.ts +156 -0
  398. package/lib/dist/services/storage/asyncTestCaseStorage.d.ts.map +1 -0
  399. package/lib/dist/services/storage/asyncTestCaseStorage.js +285 -0
  400. package/lib/dist/services/storage/asyncTestCaseStorage.js.map +1 -0
  401. package/lib/dist/services/storage/index.d.ts +17 -0
  402. package/lib/dist/services/storage/index.d.ts.map +1 -0
  403. package/lib/dist/services/storage/index.js +20 -0
  404. package/lib/dist/services/storage/index.js.map +1 -0
  405. package/lib/dist/services/storage/migration.d.ts +54 -0
  406. package/lib/dist/services/storage/migration.d.ts.map +1 -0
  407. package/lib/dist/services/storage/migration.js +296 -0
  408. package/lib/dist/services/storage/migration.js.map +1 -0
  409. package/lib/dist/services/storage/opensearchClient.d.ts +924 -0
  410. package/lib/dist/services/storage/opensearchClient.d.ts.map +1 -0
  411. package/lib/dist/services/storage/opensearchClient.js +435 -0
  412. package/lib/dist/services/storage/opensearchClient.js.map +1 -0
  413. package/lib/dist/services/traces/browserRecovery.d.ts +26 -0
  414. package/lib/dist/services/traces/browserRecovery.d.ts.map +1 -0
  415. package/lib/dist/services/traces/browserRecovery.js +81 -0
  416. package/lib/dist/services/traces/browserRecovery.js.map +1 -0
  417. package/lib/dist/services/traces/categoryStyles.d.ts +21 -0
  418. package/lib/dist/services/traces/categoryStyles.d.ts.map +1 -0
  419. package/lib/dist/services/traces/categoryStyles.js +56 -0
  420. package/lib/dist/services/traces/categoryStyles.js.map +1 -0
  421. package/lib/dist/services/traces/executionOrderTransform.d.ts +35 -0
  422. package/lib/dist/services/traces/executionOrderTransform.d.ts.map +1 -0
  423. package/lib/dist/services/traces/executionOrderTransform.js +313 -0
  424. package/lib/dist/services/traces/executionOrderTransform.js.map +1 -0
  425. package/lib/dist/services/traces/fetchSpansForRun.d.ts +86 -0
  426. package/lib/dist/services/traces/fetchSpansForRun.d.ts.map +1 -0
  427. package/lib/dist/services/traces/fetchSpansForRun.js +69 -0
  428. package/lib/dist/services/traces/fetchSpansForRun.js.map +1 -0
  429. package/lib/dist/services/traces/flowTransform.d.ts +24 -0
  430. package/lib/dist/services/traces/flowTransform.d.ts.map +1 -0
  431. package/lib/dist/services/traces/flowTransform.js +228 -0
  432. package/lib/dist/services/traces/flowTransform.js.map +1 -0
  433. package/lib/dist/services/traces/index.d.ts +121 -0
  434. package/lib/dist/services/traces/index.d.ts.map +1 -0
  435. package/lib/dist/services/traces/index.js +255 -0
  436. package/lib/dist/services/traces/index.js.map +1 -0
  437. package/lib/dist/services/traces/intentTransform.d.ts +20 -0
  438. package/lib/dist/services/traces/intentTransform.d.ts.map +1 -0
  439. package/lib/dist/services/traces/intentTransform.js +131 -0
  440. package/lib/dist/services/traces/intentTransform.js.map +1 -0
  441. package/lib/dist/services/traces/judgeAgentsHints.d.ts +63 -0
  442. package/lib/dist/services/traces/judgeAgentsHints.d.ts.map +1 -0
  443. package/lib/dist/services/traces/judgeAgentsHints.js +89 -0
  444. package/lib/dist/services/traces/judgeAgentsHints.js.map +1 -0
  445. package/lib/dist/services/traces/messageExtraction.d.ts +15 -0
  446. package/lib/dist/services/traces/messageExtraction.d.ts.map +1 -0
  447. package/lib/dist/services/traces/messageExtraction.js +251 -0
  448. package/lib/dist/services/traces/messageExtraction.js.map +1 -0
  449. package/lib/dist/services/traces/spanCategorization.d.ts +63 -0
  450. package/lib/dist/services/traces/spanCategorization.d.ts.map +1 -0
  451. package/lib/dist/services/traces/spanCategorization.js +276 -0
  452. package/lib/dist/services/traces/spanCategorization.js.map +1 -0
  453. package/lib/dist/services/traces/spanPreprocessing.d.ts +37 -0
  454. package/lib/dist/services/traces/spanPreprocessing.d.ts.map +1 -0
  455. package/lib/dist/services/traces/spanPreprocessing.js +102 -0
  456. package/lib/dist/services/traces/spanPreprocessing.js.map +1 -0
  457. package/lib/dist/services/traces/spansToTrajectory.d.ts +36 -0
  458. package/lib/dist/services/traces/spansToTrajectory.d.ts.map +1 -0
  459. package/lib/dist/services/traces/spansToTrajectory.js +387 -0
  460. package/lib/dist/services/traces/spansToTrajectory.js.map +1 -0
  461. package/lib/dist/services/traces/toolSimilarity.d.ts +35 -0
  462. package/lib/dist/services/traces/toolSimilarity.d.ts.map +1 -0
  463. package/lib/dist/services/traces/toolSimilarity.js +203 -0
  464. package/lib/dist/services/traces/toolSimilarity.js.map +1 -0
  465. package/lib/dist/services/traces/traceComparison.d.ts +31 -0
  466. package/lib/dist/services/traces/traceComparison.d.ts.map +1 -0
  467. package/lib/dist/services/traces/traceComparison.js +318 -0
  468. package/lib/dist/services/traces/traceComparison.js.map +1 -0
  469. package/lib/dist/services/traces/traceGrouping.d.ts +19 -0
  470. package/lib/dist/services/traces/traceGrouping.d.ts.map +1 -0
  471. package/lib/dist/services/traces/traceGrouping.js +107 -0
  472. package/lib/dist/services/traces/traceGrouping.js.map +1 -0
  473. package/lib/dist/services/traces/tracePoller.d.ts +84 -0
  474. package/lib/dist/services/traces/tracePoller.d.ts.map +1 -0
  475. package/lib/dist/services/traces/tracePoller.js +309 -0
  476. package/lib/dist/services/traces/tracePoller.js.map +1 -0
  477. package/lib/dist/services/traces/traceStats.d.ts +45 -0
  478. package/lib/dist/services/traces/traceStats.d.ts.map +1 -0
  479. package/lib/dist/services/traces/traceStats.js +114 -0
  480. package/lib/dist/services/traces/traceStats.js.map +1 -0
  481. package/lib/dist/services/traces/traceSummary.d.ts +47 -0
  482. package/lib/dist/services/traces/traceSummary.d.ts.map +1 -0
  483. package/lib/dist/services/traces/traceSummary.js +68 -0
  484. package/lib/dist/services/traces/traceSummary.js.map +1 -0
  485. package/lib/dist/services/traces/utils.d.ts +33 -0
  486. package/lib/dist/services/traces/utils.d.ts.map +1 -0
  487. package/lib/dist/services/traces/utils.js +114 -0
  488. package/lib/dist/services/traces/utils.js.map +1 -0
  489. package/lib/dist/types/agui.d.ts +13 -0
  490. package/lib/dist/types/agui.d.ts.map +1 -0
  491. package/lib/dist/types/agui.js +16 -0
  492. package/lib/dist/types/agui.js.map +1 -0
  493. package/lib/dist/types/index.d.ts +1175 -0
  494. package/lib/dist/types/index.d.ts.map +1 -0
  495. package/lib/dist/types/index.js +12 -0
  496. package/lib/dist/types/index.js.map +1 -0
  497. package/lib/dist/types/skills.d.ts +146 -0
  498. package/lib/dist/types/skills.d.ts.map +1 -0
  499. package/lib/dist/types/skills.js +6 -0
  500. package/lib/dist/types/skills.js.map +1 -0
  501. package/observio-sample-agent/pi-package/README.md +112 -0
  502. package/observio-sample-agent/pi-package/extensions/agent-health.ts +373 -0
  503. package/observio-sample-agent/pi-package/package.json +17 -0
  504. package/observio-sample-agent/pi-package/prompts/agent-health.md +37 -0
  505. package/observio-sample-agent/pi-package/skills/create-pr/SKILL.md +88 -0
  506. package/observio-sample-agent/pi-package/skills/fix-bug/SKILL.md +71 -0
  507. package/observio-sample-agent/pi-package/skills/implement-feature/SKILL.md +156 -0
  508. package/observio-sample-agent/pi-package/skills/instrument-otel/SKILL.md +208 -0
  509. package/observio-sample-agent/pi-package/skills/setup-collector/SKILL.md +146 -0
  510. package/observio-sample-agent/pi-package/skills/write-test/SKILL.md +115 -0
  511. package/package.json +64 -13
  512. package/server/dist/app.js +32651 -17637
  513. package/server/dist/index.js +29875 -14638
  514. package/tsconfig.lib.json +71 -0
  515. package/dist/assets/index-EvPLSTAS.js +0 -267
  516. package/dist/assets/index-RXasQKUs.css +0 -1
  517. package/lib/dist/config/index.js +0 -404
  518. package/lib/dist/index.js +0 -1665
@@ -0,0 +1,598 @@
1
+ # Agent Health - AI Assistant Instructions
2
+
3
+ Use these instructions to evaluate and improve your agent using the agent-health CLI and server APIs.
4
+
5
+ ---
6
+
7
+ ## Setup By AI Assistant
8
+
9
+ Copy this file into your project so your AI coding assistant auto-loads it —
10
+ either from a local checkout or straight from GitHub.
11
+
12
+ ### Claude Code
13
+ ```bash
14
+ mkdir -p .claude/skills
15
+ curl -o .claude/skills/agent-health.md \
16
+ https://raw.githubusercontent.com/opensearch-project/agent-health/main/docs/skills/AGENT_HEALTH.md
17
+ # or, from a checkout: cp docs/skills/AGENT_HEALTH.md .claude/skills/
18
+ ```
19
+ Auto-discovered as a skill.
20
+
21
+ ### Kiro
22
+ ```bash
23
+ mkdir -p .kiro/steering
24
+ curl -o .kiro/steering/agent-health.md \
25
+ https://raw.githubusercontent.com/opensearch-project/agent-health/main/docs/skills/AGENT_HEALTH.md
26
+ ```
27
+ Auto-loaded as a steering file.
28
+
29
+ ### Cursor / Windsurf / Others
30
+ Copy to project root, then tell your assistant: "Read AGENT_HEALTH.md and follow it"
31
+
32
+ ---
33
+
34
+ ## Quick start — what to ask your assistant
35
+
36
+ Once this file is loaded, just ask:
37
+
38
+ ```
39
+ "Evaluate my agent using agent-health and fix any failures"
40
+ ```
41
+
42
+ Or step by step:
43
+
44
+ ```
45
+ "Run an agent-health benchmark against my agent"
46
+ "What failed and why?"
47
+ "Fix the high-priority issues"
48
+ "Re-run to verify"
49
+ ```
50
+
51
+ What happens under the hood:
52
+
53
+ ```
54
+ 1. Assistant runs: npx agent-health benchmark ...
55
+ ↓
56
+ 2. Gets JSON with failures + judge feedback (matcherResults + improvementStrategies)
57
+ ↓
58
+ 3. Reads your agent code
59
+ ↓
60
+ 4. Makes fixes based on the improvement strategies
61
+ ↓
62
+ 5. Re-runs the benchmark to verify
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Prerequisites
68
+
69
+ ### Storage (file-based by default; OpenSearch optional)
70
+
71
+ Agent Health uses **file-based storage by default** — results are written to a
72
+ local `.agent-health/data/` directory and `run` / `benchmark` work with **no
73
+ OpenSearch cluster required**. Point at OpenSearch only when you want shared,
74
+ production-grade persistence (multiple machines / a team dashboard).
75
+
76
+ To use OpenSearch instead of file storage, set:
77
+
78
+ | Variable | Description |
79
+ |---|---|
80
+ | `OPENSEARCH_STORAGE_ENDPOINT` | OpenSearch cluster URL (e.g. `https://search-my-cluster.us-west-2.es.amazonaws.com`) |
81
+ | `OPENSEARCH_STORAGE_USERNAME` | OpenSearch username (basic auth) |
82
+ | `OPENSEARCH_STORAGE_PASSWORD` | OpenSearch password (basic auth) |
83
+
84
+ SigV4 auth (AWS profile **or** the default credential chain; `es` domains or
85
+ `aoss` Serverless collections), `none` (no auth), and basic auth are all
86
+ supported, configurable via env vars, `agent-health.config.json`, or the
87
+ Settings UI — see [docs/CONFIGURATION.md](https://github.com/opensearch-project/agent-health/blob/main/docs/CONFIGURATION.md).
88
+
89
+ ### AWS Credentials for LLM Judge (Required)
90
+
91
+ The Bedrock LLM judge scores evaluation results and needs AWS credentials to call Bedrock.
92
+
93
+ | Variable | Description |
94
+ |---|---|
95
+ | `AWS_PROFILE` | AWS profile with Bedrock access |
96
+ | `AWS_REGION` | AWS region for Bedrock (e.g. `us-west-2`) |
97
+ | `BEDROCK_MODEL_ID` | *(Optional)* Default judge model ID. Default: `us.anthropic.claude-sonnet-4-5-20250929-v1:0` |
98
+
99
+ ### `.env` File
100
+
101
+ The CLI automatically loads a `.env` file from the current working directory (the folder where commands are run). Create a `.env` file with all required variables:
102
+
103
+ ```bash
104
+ # OpenSearch Storage
105
+ OPENSEARCH_STORAGE_ENDPOINT=https://search-my-cluster.us-west-2.es.amazonaws.com
106
+ OPENSEARCH_STORAGE_USERNAME=admin
107
+ OPENSEARCH_STORAGE_PASSWORD=your-password
108
+
109
+ # AWS / Bedrock
110
+ AWS_PROFILE=your-aws-profile
111
+ AWS_REGION=us-west-2
112
+ # BEDROCK_MODEL_ID=us.anthropic.claude-sonnet-4-5-20250929-v1:0 # optional, this is the default
113
+ ```
114
+
115
+ Alternatively, pass `--env-file <path>` to load a `.env` file from a different location.
116
+
117
+ ### Doctor Check
118
+
119
+ After configuring your environment, verify everything is set up correctly:
120
+
121
+ ```bash
122
+ npx @opensearch-project/agent-health doctor
123
+ ```
124
+
125
+ This checks OpenSearch connectivity, AWS credentials, and Bedrock access. Fix any reported issues before proceeding.
126
+
127
+ ---
128
+
129
+ ## Commands
130
+
131
+ ```bash
132
+ # Verify setup
133
+ npx @opensearch-project/agent-health doctor --output json
134
+
135
+ # Generate config files
136
+ npx @opensearch-project/agent-health init
137
+
138
+ # List available resources
139
+ npx @opensearch-project/agent-health list agents --output json
140
+ npx @opensearch-project/agent-health list test-cases --output json
141
+ npx @opensearch-project/agent-health list benchmarks --output json
142
+
143
+ # Run single test case
144
+ npx @opensearch-project/agent-health run -t <test-case-id> -a <agent-key> --output json
145
+
146
+ # Run full benchmark with export
147
+ npx @opensearch-project/agent-health benchmark -n <benchmark-name> -a <agent-key> --export results.json
148
+
149
+ # Import test cases from JSON file and run benchmark
150
+ npx @opensearch-project/agent-health benchmark -f ./test-cases.json -a <agent-key>
151
+
152
+ # Import with a custom benchmark name
153
+ npx @opensearch-project/agent-health benchmark -f ./test-cases.json -n "My Benchmark" -a <agent-key>
154
+
155
+ # Export test cases from a benchmark (produces import-compatible JSON)
156
+ npx @opensearch-project/agent-health export -b <benchmark-name> -o test-cases.json
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Code-based test SDK (write tests as files)
162
+
163
+ Besides JSON test cases, Agent Health has an **experimental code-based SDK** for
164
+ writing tests as `.eval.js` / `.eval.ts` files (Playwright-style `test()` /
165
+ `expect()` / fixtures / `judge()` / lifecycle hooks). Run them the same way you
166
+ run a JSON file:
167
+
168
+ ```bash
169
+ # `-f` accepts BOTH JSON test-case files and code SDK (.eval.js / .eval.ts) files
170
+ npx @opensearch-project/agent-health benchmark -f ./evals/demo.eval.js -a my-agent
171
+ ```
172
+
173
+ They produce **per-matcher results** (`matcherResults[]`) instead of a single
174
+ pass/fail. Full guide: [docs/SDK.md](https://github.com/opensearch-project/agent-health/blob/main/docs/SDK.md).
175
+
176
+ ---
177
+
178
+ ## Improvement Workflow
179
+
180
+ ### Step 0: Verify Setup
181
+ ```bash
182
+ npx @opensearch-project/agent-health doctor --output json
183
+ ```
184
+ Confirm all checks pass before proceeding. Fix any issues reported.
185
+
186
+ ### Step 1: Baseline Evaluation
187
+ ```bash
188
+ npx @opensearch-project/agent-health benchmark -n "My Benchmark" -a my-agent --export baseline.json
189
+ ```
190
+
191
+ ### Step 2: Analyze Failures
192
+ Read `baseline.json` and find entries where `passFailStatus: "failed"`.
193
+
194
+ Key fields to examine:
195
+ - `matcherResults[*].reasoning` - the canonical judge verdict + reasoning per matcher (`llmJudgeReasoning` is a legacy, deprecated shim carrying the same text)
196
+ - `improvementStrategies` - Specific recommendations with priority
197
+ - `trajectory` - Step-by-step agent execution
198
+
199
+ > Distinguish **`failed`** (the agent answered, judge scored it below threshold)
200
+ > from **errored** (`metricsStatus: "error"` — the *evaluator itself* could not
201
+ > run, e.g. a judge validation error). Errored runs are **excluded** from
202
+ > pass-rate aggregation; don't treat them as agent misses.
203
+
204
+ ### Step 3: Fix Based on Strategies
205
+ Focus on `priority: "high"` issues first:
206
+ ```json
207
+ {
208
+ "category": "Tool Usage",
209
+ "issue": "Agent called search without time filter",
210
+ "recommendation": "Always include start_time and end_time parameters",
211
+ "priority": "high"
212
+ }
213
+ ```
214
+
215
+ Read the agent's code and implement the recommendation.
216
+
217
+ ### Step 4: Verify Fix
218
+ ```bash
219
+ npx @opensearch-project/agent-health benchmark -n "My Benchmark" -a my-agent --export after-fix.json
220
+ ```
221
+
222
+ Compare `passRate` between baseline and after-fix.
223
+
224
+ ### Step 5: Iterate
225
+ Repeat until all high-priority issues are resolved.
226
+
227
+ ---
228
+
229
+ ## Output Reference
230
+
231
+ ### Benchmark Export Structure
232
+ ```json
233
+ {
234
+ "benchmark": { "id": "...", "name": "...", "testCaseCount": 10 },
235
+ "runs": [{
236
+ "agent": { "key": "my-agent", "name": "My Agent" },
237
+ "passed": 7,
238
+ "failed": 3,
239
+ "passRate": 70,
240
+ "reports": [{
241
+ "testCaseId": "tc-001",
242
+ "passFailStatus": "failed",
243
+ "metricsStatus": "ready",
244
+ "metrics": { "accuracy": 45 },
245
+ "matcherResults": [
246
+ { "method": "llm-judge", "description": "identifies the root cause", "pass": false, "score": 0.45, "reasoning": "The agent failed because..." }
247
+ ],
248
+ "llmJudgeReasoning": "The agent failed because...",
249
+ "improvementStrategies": [{
250
+ "category": "Tool Usage | Reasoning | Completeness",
251
+ "issue": "What went wrong",
252
+ "recommendation": "How to fix it",
253
+ "priority": "high | medium | low"
254
+ }],
255
+ "trajectory": [
256
+ { "type": "thinking", "content": "Agent's reasoning..." },
257
+ { "type": "action", "toolName": "search", "toolArgs": {} },
258
+ { "type": "tool_result", "content": "...", "status": "SUCCESS" },
259
+ { "type": "response", "content": "Final answer..." }
260
+ ]
261
+ }]
262
+ }]
263
+ }
264
+ ```
265
+
266
+ ### Metrics, scoring, and run status
267
+
268
+ - **Metrics are evaluator-defined and heterogeneous.** Only the *RCA Default*
269
+ evaluator emits a metric named `accuracy`. Other evaluators emit their own
270
+ metric names (`tool_selection_accuracy`, `reasoning_coherence`,
271
+ `bias_detection`, …) and custom evaluators emit whatever their
272
+ `scoringConfig` defines. Don't assume `metrics.accuracy` exists.
273
+ - **A run's overall score** is the rounded mean of whatever numeric metrics the
274
+ run's evaluator emitted (`null`/`—` when none), not a single "accuracy".
275
+ - **`matcherResults[]` is the canonical judge surface.** Read the judge verdict
276
+ + reasoning from `matcherResults` entries (`method: 'llm-judge'`). Each entry
277
+ is a `MatcherResult`: `{ description, pass (boolean), score? (0–1), method,
278
+ reasoning?, durationMs? }`. `llmJudgeReasoning` is still populated as a
279
+ backward-compatible shim but is deprecated.
280
+ - **Run status:** `passed` / `failed` come from `passFailStatus`; a separate
281
+ **`errored`** state (`metricsStatus: 'error'`) means the evaluator could not
282
+ run and is excluded from pass-rate denominators.
283
+
284
+ ---
285
+
286
+ ## Tips
287
+
288
+ 1. **Always use `--output json`** for reliable parsing
289
+ 2. **Use `--export`** to get full reports with improvement strategies
290
+ 3. **Fix high-priority issues first** - they cause actual failures
291
+ 4. **Compare trajectories** between passing and failing cases
292
+ 5. **Make incremental changes** - one fix, then re-test
293
+ 6. **Don't over-engineer** - fix the specific issue identified
294
+
295
+ ---
296
+
297
+ ## Troubleshooting
298
+
299
+ | Symptom | Fix |
300
+ |---|---|
301
+ | `npx agent-health` not found | `npm install -g @opensearch-project/agent-health` |
302
+ | "No agents configured" | `npx agent-health init` (creates config with sample agents) |
303
+ | Server / config issues | `npx agent-health doctor` (checks config + connectivity) |
304
+ | "OpenSearch storage not configured" | Fine for local use — file-based storage is the default. Set `OPENSEARCH_STORAGE_*` only for shared / production persistence. |
305
+
306
+ ---
307
+
308
+ ## Server API Reference
309
+
310
+ The Agent Health server runs on port 4001 and exposes the following REST APIs. All endpoints return JSON unless noted (SSE endpoints return `text/event-stream`).
311
+
312
+ ### Health & Configuration
313
+
314
+ | Method | Path | Description |
315
+ |---|---|---|
316
+ | GET | `/health` | Health check → `{ status: 'ok', version, service: 'agent-health' }` |
317
+ | GET | `/api/agents` | List all agents → `{ agents: AgentConfig[], total }` |
318
+ | POST | `/api/agents/custom` | Add custom agent → `{ name, endpoint, connectorType?, useTraces? }` |
319
+ | DELETE | `/api/agents/custom/:id` | Remove custom agent |
320
+ | GET | `/api/models` | List all models → `{ models: ModelConfig[], total }` |
321
+ | GET | `/api/debug` | Debug status → `{ enabled: boolean }` |
322
+ | POST | `/api/debug` | Toggle debug → `{ enabled: boolean }` |
323
+
324
+ ### Agent Execution & Evaluation
325
+
326
+ | Method | Path | Description |
327
+ |---|---|---|
328
+ | POST | `/api/agent` | Proxy agent request (SSE) → `{ endpoint, payload, headers?, agentKey? }` |
329
+ | POST | `/api/evaluate` | Run evaluation (SSE) → `{ testCaseId?, testCase?, agentKey, modelId }` |
330
+
331
+ ### Judge
332
+
333
+ | Method | Path | Description |
334
+ |---|---|---|
335
+ | POST | `/api/judge` | Evaluate a captured trajectory → `{ trajectory, expectedOutcomes? \| expectedTrajectory?, modelId?, evaluatorId?, runId?, logs?, agents? }` → `JudgeResponse` `{ passFailStatus, metrics, llmJudgeReasoning, improvementStrategies }` |
336
+ | GET | `/api/judge/bedrock-models` | Discover Bedrock judge models (`ListInferenceProfiles`) |
337
+ | GET | `/api/judge/openai-compatible-models` | List OpenAI-compatible models → `{ models, endpoint, configured }` (renamed from `/api/judge/litellm-models`) |
338
+ | GET | `/api/judge/anthropic-models` | Discover Anthropic-direct models (needs `ANTHROPIC_API_KEY`) |
339
+ | GET | `/api/judge/github-models` | Discover GitHub Models / Copilot models (needs `GITHUB_TOKEN`) |
340
+
341
+ **On `/api/judge`, `modelId` is the *judge* model** — the trajectory is already
342
+ captured, so there is no agent invocation here, and `/api/judge` does **not**
343
+ take a `judgeModelId`. The agent-vs-judge model distinction (where `modelId`
344
+ is the *agent's* LLM and `judgeModelId` is the *judge's*) applies to the run
345
+ endpoints — `POST /api/evaluate` and `POST /api/storage/evaluation-runs` — and
346
+ the CLI (`-m` / `--judge-model`). Agentic-provider judges (`pi` / `agent` /
347
+ `agentic` / `claude-code`) pick their own model and ignore the judge model id.
348
+ The run-level `matcherResults[]` are assembled by the runner from the judge's
349
+ response (see [Output Reference](#output-reference)); the raw `/api/judge`
350
+ primitive returns `llmJudgeReasoning`.
351
+
352
+ ### Traces & Metrics
353
+
354
+ | Method | Path | Description |
355
+ |---|---|---|
356
+ | POST | `/api/traces` | Fetch traces → `{ traceId?, runIds?, startTime?, endTime?, size? }` → `{ spans, total, hasMore }` |
357
+ | GET | `/api/traces/health` | Traces health → `{ status: 'ok' \| 'error' }` |
358
+ | GET | `/api/metrics/:runId` | Run metrics → `{ totalTokens, costUsd, durationMs, llmCalls, toolCalls }` |
359
+ | POST | `/api/metrics/batch` | Batch metrics → `{ runIds: string[] }` → `{ metrics[], aggregate }` |
360
+
361
+ ### Logs
362
+
363
+ | Method | Path | Description |
364
+ |---|---|---|
365
+ | POST | `/api/logs` | Fetch logs → `{ runId?, query?, startTime?, endTime?, size? }` → `{ logs[], total }` |
366
+
367
+ ### Observability
368
+
369
+ | Method | Path | Description |
370
+ |---|---|---|
371
+ | GET | `/api/observability/health` | Check observability data source health |
372
+ | POST | `/api/observability/test-connection` | Test connection to observability cluster |
373
+ | GET | `/api/observability/defaults` | Get default OTEL index patterns |
374
+
375
+ ### Storage: Test Cases
376
+
377
+ | Method | Path | Description |
378
+ |---|---|---|
379
+ | GET | `/api/storage/test-cases` | List test cases (latest versions). Query: `ids?`, `fields?`, `size?`, `after?` |
380
+ | GET | `/api/storage/test-cases/:id` | Get latest version of test case |
381
+ | GET | `/api/storage/test-cases/:id/versions` | Get all versions |
382
+ | GET | `/api/storage/test-cases/:id/versions/:version` | Get specific version |
383
+ | POST | `/api/storage/test-cases` | Create test case (v1) |
384
+ | PUT | `/api/storage/test-cases/:id` | Update (creates new version) |
385
+ | DELETE | `/api/storage/test-cases/:id` | Delete all versions |
386
+ | POST | `/api/storage/test-cases/bulk` | Bulk create |
387
+
388
+ ### Storage: Benchmarks
389
+
390
+ | Method | Path | Description |
391
+ |---|---|---|
392
+ | GET | `/api/storage/benchmarks` | List benchmarks. Query: `fields?`, `size?` |
393
+ | GET | `/api/storage/benchmarks/:id` | Get by ID. Query: `fields?`, `runsSize?`, `runsOffset?` |
394
+ | GET | `/api/storage/benchmarks/:id/export` | Export test cases as JSON |
395
+ | POST | `/api/storage/benchmarks` | Create → `{ name, description?, testCaseIds }` |
396
+ | PUT | `/api/storage/benchmarks/:id` | Update |
397
+ | PATCH | `/api/storage/benchmarks/:id/metadata` | Update metadata |
398
+ | DELETE | `/api/storage/benchmarks/:id` | Delete |
399
+ | POST | `/api/storage/benchmarks/:id/execute` | Execute benchmark (SSE) → `{ runConfig: RunConfigInput }` |
400
+ | DELETE | `/api/storage/benchmarks/:id/runs/:runId` | Delete specific run |
401
+ | POST | `/api/storage/benchmarks/:id/cancel` | Cancel execution |
402
+ | POST | `/api/storage/benchmarks/:id/refresh-all-stats` | Recompute all run stats |
403
+
404
+ ### Storage: Runs (TestCaseRun)
405
+
406
+ | Method | Path | Description |
407
+ |---|---|---|
408
+ | GET | `/api/storage/runs` | List runs. Query: `size?`, `from?`, `fields?` |
409
+ | GET | `/api/storage/runs/:id` | Get run by ID |
410
+ | POST | `/api/storage/runs` | Create run |
411
+ | PATCH | `/api/storage/runs/:id` | Update run |
412
+ | DELETE | `/api/storage/runs/:id` | Delete run |
413
+ | POST | `/api/storage/runs/search` | Search with filters |
414
+ | GET | `/api/storage/runs/by-test-case/:testCaseId` | Runs for test case |
415
+ | GET | `/api/storage/runs/by-benchmark/:benchmarkId` | Runs for benchmark |
416
+ | GET | `/api/storage/runs/by-benchmark-run/:benchmarkId/:runId` | Results for benchmark run |
417
+ | GET | `/api/storage/runs/iterations/:benchmarkId/:testCaseId` | Iterations for test case in benchmark |
418
+ | POST | `/api/storage/runs/:id/annotations` | Add annotation |
419
+
420
+ ### Storage: Analytics
421
+
422
+ | Method | Path | Description |
423
+ |---|---|---|
424
+ | GET | `/api/storage/analytics` | Query analytics. Filters: `experimentId?`, `testCaseId?`, `agentId?`, `modelId?` |
425
+ | GET | `/api/storage/analytics/aggregations` | Aggregated metrics |
426
+ | POST | `/api/storage/analytics/search` | Complex search with aggregations |
427
+
428
+ ### Storage: Reports
429
+
430
+ | Method | Path | Description |
431
+ |---|---|---|
432
+ | GET | `/api/storage/benchmarks/:id/report` | Download report. Query: `format?` ('json'\|'html'\|'pdf') |
433
+
434
+ ### Storage: Evaluators
435
+
436
+ | Method | Path | Description |
437
+ |---|---|---|
438
+ | GET | `/api/storage/evaluators` | List evaluators (5 built-in system + custom) |
439
+ | GET | `/api/storage/evaluators/:id` | Get evaluator (latest version) |
440
+ | GET | `/api/storage/evaluators/:id/versions` | List all versions (newest first) |
441
+ | GET | `/api/storage/evaluators/:id/versions/:version` | Get a specific version snapshot |
442
+ | POST | `/api/storage/evaluators` | Create custom evaluator |
443
+ | PUT | `/api/storage/evaluators/:id` | Update (creates a new immutable version) |
444
+ | DELETE | `/api/storage/evaluators/:id` | Delete custom evaluator (system evaluators are protected) |
445
+
446
+ ### Storage: Evaluation Runs (code-based SDK)
447
+
448
+ | Method | Path | Description |
449
+ |---|---|---|
450
+ | GET | `/api/storage/evaluation-runs` | List evaluation runs |
451
+ | GET | `/api/storage/evaluation-runs/:id` | Get evaluation run |
452
+ | POST | `/api/storage/evaluation-runs` | Start a run (SSE). Accepts `sources: [{ type: 'code-import', filenames }]` for `.eval.js` / `.eval.ts` SDK files, plus `agentKey`, `modelId`, `judgeModelId?`, `evaluatorId?` |
453
+ | POST | `/api/storage/evaluation-runs/:id/cancel` | Cancel a run |
454
+ | POST | `/api/storage/evaluation-runs/:id/promote` | Promote a run |
455
+
456
+ ### Comparison
457
+
458
+ | Method | Path | Description |
459
+ |---|---|---|
460
+ | POST | `/api/comparison/cluster-failures` | Cluster regressed cases into named failure patterns (`knowledge` / `tool_gap` / `reasoning` / `other`) |
461
+ | GET | `/api/comparison/clusters/:clusterId` | Fetch a previously computed cluster by id |
462
+
463
+ ### Storage: Admin
464
+
465
+ | Method | Path | Description |
466
+ |---|---|---|
467
+ | GET | `/api/storage/health` | Storage backend health |
468
+ | POST | `/api/storage/test-connection` | Test storage connection |
469
+ | POST | `/api/storage/init` | Initialize indexes |
470
+ | GET | `/api/storage/config/status` | Config status |
471
+ | POST | `/api/storage/config/storage` | Update storage config |
472
+ | POST | `/api/storage/config/observability` | Update observability config |
473
+
474
+ ### Assistant (NEW)
475
+
476
+ | Method | Path | Description |
477
+ |---|---|---|
478
+ | POST | `/api/assistant/chat` | Chat with AI assistant (SSE) → `{ sessionId, message, context }` → `{ type: 'delta'\|'done', content }` |
479
+ | DELETE | `/api/assistant/session/:sessionId` | Clear session |
480
+ | GET | `/api/assistant/health` | Check assistant availability |
481
+
482
+ ---
483
+
484
+ ## UI Pages
485
+
486
+ The evaluation surface lives under `/evaluations/*`. The app uses
487
+ `BrowserRouter` — plain paths, no `#` prefix.
488
+
489
+ | Page | Route | Description |
490
+ |---|---|---|
491
+ | Dashboard | `/` | Overview with agent stats, recent runs, system health |
492
+ | Benchmarks | `/evaluations/benchmarks` | List benchmarks with pass rates, run counts, version badges |
493
+ | Benchmark Runs | `/evaluations/benchmarks/:id/runs` | Runs for a benchmark (split / tabs layout) |
494
+ | Run Inspector | `/evaluations/benchmarks/:id/runs/:runId/inspect` | Per-test-case results, trajectory, judge, traces |
495
+ | Test Cases | `/evaluations/test-cases` | List / create / edit / version test cases |
496
+ | Test Case Detail | `/evaluations/test-cases/:id` | Definition + runs with an inline live-run panel |
497
+ | Eval Runs | `/evaluations/runs` · `/evaluations/runs/:id` | Code-import (SDK) and ad-hoc run results |
498
+ | Evaluators | `/evaluators` · `/evaluators/:id` | Manage evaluators; version history + Git-style diff |
499
+ | Compare | `/compare/:benchmarkId?runs=a,b` | Diagnosis surface: verdict strip, first-divergence, failure clusters |
500
+ | Agent Traces | `/agent-traces` | OpenTelemetry trace explorer (timeline / flow) |
501
+ | Coding Agents | `/coding-agents` | Coding Agent Analytics (Claude Code / Kiro / Codex) |
502
+ | Settings | `/settings` | Configure agents, models, storage, observability connections |
503
+ | Assistant | `/assistant` | Full-page AI chat interface for help and analysis |
504
+
505
+ ---
506
+
507
+ ## Common Tasks
508
+
509
+ ### Ask about a benchmark's results
510
+ "What's the pass rate for benchmark bench-xxx? Which test cases are failing and why?"
511
+ → The assistant will query `/api/storage/benchmarks/:id` and `/api/storage/runs/by-benchmark/:id`
512
+
513
+ ### Interpret judge reasoning
514
+ "Why did test case tc-xxx fail in run run-xxx? What should I fix?"
515
+ → The assistant reads `llmJudgeReasoning` and `improvementStrategies` from the run
516
+
517
+ ### Write a test case
518
+ "Help me write a test case for testing log search with time filters"
519
+ → The assistant creates a test case with prompt, context, expectedOutcomes, and labels
520
+
521
+ ### Analyze traces
522
+ "What are the most expensive LLM calls in run run-xxx?"
523
+ → The assistant queries `/api/traces` and `/api/metrics/:runId` to find token-heavy spans
524
+
525
+ ### Compare runs
526
+ "Compare the results of run A vs run B in benchmark bench-xxx"
527
+ → The assistant fetches both runs and diffs pass/fail status, accuracy, and strategies
528
+
529
+ ### Diagnose eval-vs-reality gaps
530
+ "My agent passes 8/9 in evals but fails in real life — why?"
531
+ → The assistant investigates: fetches the runs and test cases, examines judge reasoning and expectedOutcomes, checks whether the evaluator is appropriate for the domain, and recommends tightening outcomes or creating a custom evaluator
532
+
533
+ ---
534
+
535
+ ## Evaluator System
536
+
537
+ ### How Evaluation Works
538
+
539
+ 1. Agent runs against a test case → produces a **trajectory** (thinking, action, tool_result, response steps)
540
+ 2. The **judge** (LLM) receives the trajectory + expectedOutcomes and scores each outcome
541
+ 3. Each outcome: Fully achieved = 1.0, Partially = 0.5, Not achieved = 0.0
542
+ 4. `accuracy = (sum of scores / total outcomes) × 100`
543
+ 5. Pass/Fail determined by evaluator's `passThreshold` + critical failure checks
544
+
545
+ ### Built-in Evaluators
546
+
547
+ | ID | Name | Threshold | Key Metrics |
548
+ |---|---|---|---|
549
+ | `system-rca-default` | RCA Default | 70% | accuracy |
550
+ | `system-factuality` | Factuality | 80% | factual_accuracy, hallucination_rate, source_grounding |
551
+ | `system-tool-usage` | Tool Usage | 80% | tool_selection_accuracy, redundant_calls, tool_ordering |
552
+ | `system-reasoning-depth` | Reasoning Depth | 75% | reasoning_coherence, step_completeness, logical_validity |
553
+ | `system-safety` | Safety | 90% | safety_score, bias_detection, guardrail_adherence |
554
+
555
+ ### Custom Evaluators
556
+
557
+ Create custom evaluators via the UI or API for domain-specific scoring:
558
+
559
+ ```json
560
+ {
561
+ "name": "My Domain Evaluator",
562
+ "systemPrompt": "You are evaluating an agent for [domain]. CRITICAL CRITERIA: ...",
563
+ "scoringConfig": {
564
+ "metrics": [
565
+ { "name": "routing_accuracy", "weight": 0.4, "scale": 100 },
566
+ { "name": "tool_correctness", "weight": 0.4, "scale": 100 },
567
+ { "name": "diagnostic_completeness", "weight": 0.2, "scale": 100 }
568
+ ],
569
+ "passThreshold": 85,
570
+ "scale": 100
571
+ }
572
+ }
573
+ ```
574
+
575
+ Assign to a benchmark run via `evaluatorId` in the run config.
576
+
577
+ ### When to Recommend Custom Evaluators
578
+
579
+ - **Domain has hard correctness rules**: specific CLI commands, valid syntax, routing tables, API formats
580
+ - **Default judge is too charitable**: agents pass evals but fail in real-world usage (eval-vs-reality gap)
581
+ - **Multiple independent dimensions**: routing correctness AND tool syntax AND diagnostic completeness all matter
582
+ - **70% threshold is too low**: critical domains (oncall, security, compliance) need 85%+
583
+
584
+ ### Common Eval-vs-Reality Gap Causes
585
+
586
+ 1. **expectedOutcomes describe results, not procedures**: Judge rewards "got the right answer" without verifying "used the right method"
587
+ 2. **70% threshold too permissive**: Missing 30% of steps may be catastrophic in practice
588
+ 3. **No tool-correctness validation**: Generic judge can't verify domain-specific tool syntax
589
+ 4. **Trajectory compaction hides details**: toolOutput truncated to 1000 chars, content to 500 chars — wrong commands may be invisible to judge
590
+ 5. **Test cases cleaner than reality**: Hand-authored prompts include hints that real incidents don't
591
+ 6. **Single-turn evaluation**: Real work is iterative; test cases may compress multi-step workflows
592
+
593
+ ### Fix Strategies (in order)
594
+
595
+ 1. **Tighten expectedOutcomes**: Add negative constraints ("do NOT use X"), require specific tool names, specify correct syntax
596
+ 2. **Raise passThreshold**: Set to 85%+ for critical domains
597
+ 3. **Use `system-tool-usage` as secondary evaluator**: Catches redundant/wrong tool calls
598
+ 4. **Create domain-specific custom evaluator**: Include explicit rubric criteria the generic judge can't verify