@opensearch-project/agent-health 0.4.0 → 0.6.0
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.
- package/README.md +36 -5
- package/cli/dist/index.js +8292 -2938
- package/deployment/cloudformation/agent-health-observability.yaml +223 -32
- package/dist/assets/index-BfxtxmKc.css +1 -0
- package/dist/assets/index-CrjAfDHu.js +243 -0
- package/dist/index.html +2 -2
- package/docs/ARCHITECTURE.md +450 -0
- package/docs/BACKEND_JOB_QUEUE.md +405 -0
- package/docs/CLAUDE_CODE_TELEMETRY.md +283 -0
- package/docs/CLI.md +474 -0
- package/docs/CODING_AGENT_ANALYTICS.md +298 -0
- package/docs/CONFIGURATION.md +388 -0
- package/docs/CONNECTORS.md +536 -0
- package/docs/INSTRUMENT_WITH_OTEL.md +397 -0
- package/docs/ML-COMMONS-SETUP.md +289 -0
- package/docs/NPX_PACKAGING.md +195 -0
- package/docs/PERFORMANCE-MONITORING.md +200 -0
- package/docs/PERFORMANCE.md +390 -0
- package/docs/PI_PROFILING.md +169 -0
- package/docs/PLAN-non-agui-agent-support.md +525 -0
- package/docs/SDK.md +626 -0
- package/docs/SKILLS.md +264 -0
- package/docs/STORAGE_INDEX_FIELD_LIMITS.md +216 -0
- package/docs/blogs/2026-02-28-opensearch-agent-health.md +200 -0
- package/docs/blogs/getting-started-blog.md +608 -0
- package/docs/diagrams/Agent-health.excalidraw +5656 -0
- package/docs/diagrams/architecture.png +0 -0
- package/docs/plans/field-redesign.md +468 -0
- package/docs/rfcs/001-coding-agent-analytics.md +374 -0
- package/docs/rfcs/002-enterprise-leaderboard.md +267 -0
- package/docs/rfcs/003-remote-aggregation.md +146 -0
- package/docs/rfcs/004-test-sdk-v2.md +599 -0
- package/docs/skills/AGENT_HEALTH.md +652 -0
- package/docs/skills/AGENT_PROFILE.md +191 -0
- package/docs/skills/add-connector/SKILL.md +68 -0
- package/docs/skills/agent-health-profile/SKILL.md +40 -0
- package/docs/skills/config-auth/SKILL.md +194 -0
- package/docs/skills/config-auth/evals/evals.json +35 -0
- package/docs/skills/create-pr/SKILL.md +73 -0
- package/docs/skills/instrument-otel/SKILL.md +84 -0
- package/docs/skills/write-test/SKILL.md +124 -0
- package/docs/ui prd.md +376 -0
- package/examples/README.md +53 -0
- package/examples/config/agent-health.config.example.ts +155 -0
- package/examples/connectors/echo-connector.ts +131 -0
- package/examples/eval-files/demo.eval.js +128 -0
- package/examples/eval-files/ops-rca-classification.eval.js +71 -0
- package/examples/eval-files/ops-rca-evaluator.json +15 -0
- package/examples/eval-files/sdk-demo.eval.js +72 -0
- package/examples/eval-files/sdk-describe-demo.eval.js +50 -0
- package/examples/eval-files/sdk-hooks-demo.eval.js +99 -0
- package/examples/pi-profiling/README.md +77 -0
- package/examples/pi-profiling/agent-health-profile.ts +417 -0
- package/lib/dist/lib/agentUtils.d.ts +29 -0
- package/lib/dist/lib/agentUtils.d.ts.map +1 -0
- package/lib/dist/lib/agentUtils.js +43 -0
- package/lib/dist/lib/agentUtils.js.map +1 -0
- package/lib/dist/lib/bedrockCompat.d.ts +27 -0
- package/lib/dist/lib/bedrockCompat.d.ts.map +1 -0
- package/lib/dist/lib/bedrockCompat.js +83 -0
- package/lib/dist/lib/bedrockCompat.js.map +1 -0
- package/lib/dist/lib/benchmarkExport.d.ts +14 -0
- package/lib/dist/lib/benchmarkExport.d.ts.map +1 -0
- package/lib/dist/lib/benchmarkExport.js +41 -0
- package/lib/dist/lib/benchmarkExport.js.map +1 -0
- package/lib/dist/lib/benchmarkImage.d.ts +52 -0
- package/lib/dist/lib/benchmarkImage.d.ts.map +1 -0
- package/lib/dist/lib/benchmarkImage.js +113 -0
- package/lib/dist/lib/benchmarkImage.js.map +1 -0
- package/lib/dist/lib/benchmarkVersionUtils.d.ts +50 -0
- package/lib/dist/lib/benchmarkVersionUtils.d.ts.map +1 -0
- package/lib/dist/lib/benchmarkVersionUtils.js +89 -0
- package/lib/dist/lib/benchmarkVersionUtils.js.map +1 -0
- package/lib/dist/lib/chunkedFetch.d.ts +18 -0
- package/lib/dist/lib/chunkedFetch.d.ts.map +1 -0
- package/lib/dist/lib/chunkedFetch.js +40 -0
- package/lib/dist/lib/chunkedFetch.js.map +1 -0
- package/lib/dist/lib/comparisonInsights.d.ts +104 -0
- package/lib/dist/lib/comparisonInsights.d.ts.map +1 -0
- package/lib/dist/lib/comparisonInsights.js +212 -0
- package/lib/dist/lib/comparisonInsights.js.map +1 -0
- package/lib/dist/lib/config/defineConfig.d.ts +27 -0
- package/lib/dist/lib/config/defineConfig.d.ts.map +1 -0
- package/lib/dist/lib/config/defineConfig.js +28 -0
- package/lib/dist/lib/config/defineConfig.js.map +1 -0
- package/lib/dist/lib/config/index.d.ts +9 -0
- package/lib/dist/lib/config/index.d.ts.map +1 -0
- package/lib/dist/lib/config/index.js +8 -0
- package/lib/dist/lib/config/index.js.map +1 -0
- package/lib/dist/lib/config/loader.d.ts +39 -0
- package/lib/dist/lib/config/loader.d.ts.map +1 -0
- package/lib/dist/lib/config/loader.js +263 -0
- package/lib/dist/lib/config/loader.js.map +1 -0
- package/lib/dist/lib/config/statePaths.d.ts +61 -0
- package/lib/dist/lib/config/statePaths.d.ts.map +1 -0
- package/lib/dist/lib/config/statePaths.js +188 -0
- package/lib/dist/lib/config/statePaths.js.map +1 -0
- package/lib/dist/lib/config/types.d.ts +245 -0
- package/lib/dist/lib/config/types.d.ts.map +1 -0
- package/lib/dist/lib/config/types.js +6 -0
- package/lib/dist/lib/config/types.js.map +1 -0
- package/lib/dist/lib/config.d.ts +39 -0
- package/lib/dist/lib/config.d.ts.map +1 -0
- package/lib/dist/lib/config.js +118 -0
- package/lib/dist/lib/config.js.map +1 -0
- package/lib/dist/lib/constants.d.ts +81 -0
- package/lib/dist/lib/constants.d.ts.map +1 -0
- package/lib/dist/lib/constants.js +374 -0
- package/lib/dist/lib/constants.js.map +1 -0
- package/lib/dist/lib/contextFormat.d.ts +26 -0
- package/lib/dist/lib/contextFormat.d.ts.map +1 -0
- package/lib/dist/lib/contextFormat.js +28 -0
- package/lib/dist/lib/contextFormat.js.map +1 -0
- package/lib/dist/lib/contextUtilization.d.ts +23 -0
- package/lib/dist/lib/contextUtilization.d.ts.map +1 -0
- package/lib/dist/lib/contextUtilization.js +72 -0
- package/lib/dist/lib/contextUtilization.js.map +1 -0
- package/lib/dist/lib/dashboardMetrics.d.ts +87 -0
- package/lib/dist/lib/dashboardMetrics.d.ts.map +1 -0
- package/lib/dist/lib/dashboardMetrics.js +242 -0
- package/lib/dist/lib/dashboardMetrics.js.map +1 -0
- package/lib/dist/lib/dataSourceConfig.d.ts +108 -0
- package/lib/dist/lib/dataSourceConfig.d.ts.map +1 -0
- package/lib/dist/lib/dataSourceConfig.js +166 -0
- package/lib/dist/lib/dataSourceConfig.js.map +1 -0
- package/lib/dist/lib/debug.d.ts +26 -0
- package/lib/dist/lib/debug.d.ts.map +1 -0
- package/lib/dist/lib/debug.js +132 -0
- package/lib/dist/lib/debug.js.map +1 -0
- package/lib/dist/lib/diagnostics.d.ts +28 -0
- package/lib/dist/lib/diagnostics.d.ts.map +1 -0
- package/lib/dist/lib/diagnostics.js +65 -0
- package/lib/dist/lib/diagnostics.js.map +1 -0
- package/lib/dist/lib/envCompat.d.ts +27 -0
- package/lib/dist/lib/envCompat.d.ts.map +1 -0
- package/lib/dist/lib/envCompat.js +82 -0
- package/lib/dist/lib/envCompat.js.map +1 -0
- package/lib/dist/lib/evaluationRerun.d.ts +63 -0
- package/lib/dist/lib/evaluationRerun.d.ts.map +1 -0
- package/lib/dist/lib/evaluationRerun.js +85 -0
- package/lib/dist/lib/evaluationRerun.js.map +1 -0
- package/lib/dist/lib/findPackageRoot.d.ts +7 -0
- package/lib/dist/lib/findPackageRoot.d.ts.map +1 -0
- package/lib/dist/lib/findPackageRoot.js +57 -0
- package/lib/dist/lib/findPackageRoot.js.map +1 -0
- package/lib/dist/lib/hooks.d.ts +36 -0
- package/lib/dist/lib/hooks.d.ts.map +1 -0
- package/lib/dist/lib/hooks.js +112 -0
- package/lib/dist/lib/hooks.js.map +1 -0
- package/lib/dist/lib/index.d.ts +47 -0
- package/lib/dist/lib/index.d.ts.map +1 -0
- package/lib/dist/lib/index.js +62 -0
- package/lib/dist/lib/index.js.map +1 -0
- package/lib/dist/lib/labels.d.ts +90 -0
- package/lib/dist/lib/labels.d.ts.map +1 -0
- package/lib/dist/lib/labels.js +158 -0
- package/lib/dist/lib/labels.js.map +1 -0
- package/lib/dist/lib/markdown.d.ts +16 -0
- package/lib/dist/lib/markdown.d.ts.map +1 -0
- package/lib/dist/lib/markdown.js +42 -0
- package/lib/dist/lib/markdown.js.map +1 -0
- package/lib/dist/lib/matchers/expect.d.ts +3 -0
- package/lib/dist/lib/matchers/expect.d.ts.map +1 -0
- package/lib/dist/lib/matchers/expect.js +225 -0
- package/lib/dist/lib/matchers/expect.js.map +1 -0
- package/lib/dist/lib/matchers/index.d.ts +8 -0
- package/lib/dist/lib/matchers/index.d.ts.map +1 -0
- package/lib/dist/lib/matchers/index.js +9 -0
- package/lib/dist/lib/matchers/index.js.map +1 -0
- package/lib/dist/lib/matchers/judgeAccessor.d.ts +113 -0
- package/lib/dist/lib/matchers/judgeAccessor.d.ts.map +1 -0
- package/lib/dist/lib/matchers/judgeAccessor.js +183 -0
- package/lib/dist/lib/matchers/judgeAccessor.js.map +1 -0
- package/lib/dist/lib/matchers/session.d.ts +39 -0
- package/lib/dist/lib/matchers/session.d.ts.map +1 -0
- package/lib/dist/lib/matchers/session.js +116 -0
- package/lib/dist/lib/matchers/session.js.map +1 -0
- package/lib/dist/lib/matchers/traces.d.ts +70 -0
- package/lib/dist/lib/matchers/traces.d.ts.map +1 -0
- package/lib/dist/lib/matchers/traces.js +236 -0
- package/lib/dist/lib/matchers/traces.js.map +1 -0
- package/lib/dist/lib/matchers/tracesPricing.d.ts +38 -0
- package/lib/dist/lib/matchers/tracesPricing.d.ts.map +1 -0
- package/lib/dist/lib/matchers/tracesPricing.js +64 -0
- package/lib/dist/lib/matchers/tracesPricing.js.map +1 -0
- package/lib/dist/lib/matchers/types.d.ts +75 -0
- package/lib/dist/lib/matchers/types.d.ts.map +1 -0
- package/lib/dist/lib/matchers/types.js +6 -0
- package/lib/dist/lib/matchers/types.js.map +1 -0
- package/lib/dist/lib/packagePaths.d.ts +29 -0
- package/lib/dist/lib/packagePaths.d.ts.map +1 -0
- package/lib/dist/lib/packagePaths.js +63 -0
- package/lib/dist/lib/packagePaths.js.map +1 -0
- package/lib/dist/lib/performance.d.ts +51 -0
- package/lib/dist/lib/performance.d.ts.map +1 -0
- package/lib/dist/lib/performance.js +159 -0
- package/lib/dist/lib/performance.js.map +1 -0
- package/lib/dist/lib/portConfig.d.ts +29 -0
- package/lib/dist/lib/portConfig.d.ts.map +1 -0
- package/lib/dist/lib/portConfig.js +64 -0
- package/lib/dist/lib/portConfig.js.map +1 -0
- package/lib/dist/lib/preferences.d.ts +63 -0
- package/lib/dist/lib/preferences.d.ts.map +1 -0
- package/lib/dist/lib/preferences.js +117 -0
- package/lib/dist/lib/preferences.js.map +1 -0
- package/lib/dist/lib/resolveAgentModel.d.ts +22 -0
- package/lib/dist/lib/resolveAgentModel.d.ts.map +1 -0
- package/lib/dist/lib/resolveAgentModel.js +37 -0
- package/lib/dist/lib/resolveAgentModel.js.map +1 -0
- package/lib/dist/lib/runStats.d.ts +116 -0
- package/lib/dist/lib/runStats.d.ts.map +1 -0
- package/lib/dist/lib/runStats.js +192 -0
- package/lib/dist/lib/runStats.js.map +1 -0
- package/lib/dist/lib/telemetry/constants.d.ts +60 -0
- package/lib/dist/lib/telemetry/constants.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/constants.js +87 -0
- package/lib/dist/lib/telemetry/constants.js.map +1 -0
- package/lib/dist/lib/telemetry/evalSpans.d.ts +61 -0
- package/lib/dist/lib/telemetry/evalSpans.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/evalSpans.js +254 -0
- package/lib/dist/lib/telemetry/evalSpans.js.map +1 -0
- package/lib/dist/lib/telemetry/index.d.ts +11 -0
- package/lib/dist/lib/telemetry/index.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/index.js +15 -0
- package/lib/dist/lib/telemetry/index.js.map +1 -0
- package/lib/dist/lib/telemetry/opensearchExporter.d.ts +43 -0
- package/lib/dist/lib/telemetry/opensearchExporter.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/opensearchExporter.js +217 -0
- package/lib/dist/lib/telemetry/opensearchExporter.js.map +1 -0
- package/lib/dist/lib/telemetry/provider.d.ts +55 -0
- package/lib/dist/lib/telemetry/provider.d.ts.map +1 -0
- package/lib/dist/lib/telemetry/provider.js +140 -0
- package/lib/dist/lib/telemetry/provider.js.map +1 -0
- package/lib/dist/lib/testCaseLabels.d.ts +34 -0
- package/lib/dist/lib/testCaseLabels.d.ts.map +1 -0
- package/lib/dist/lib/testCaseLabels.js +88 -0
- package/lib/dist/lib/testCaseLabels.js.map +1 -0
- package/lib/dist/lib/testCaseValidation.d.ts +140 -0
- package/lib/dist/lib/testCaseValidation.d.ts.map +1 -0
- package/lib/dist/lib/testCaseValidation.js +162 -0
- package/lib/dist/lib/testCaseValidation.js.map +1 -0
- package/lib/dist/lib/testCases/agentFixture.d.ts +80 -0
- package/lib/dist/lib/testCases/agentFixture.d.ts.map +1 -0
- package/lib/dist/lib/testCases/agentFixture.js +43 -0
- package/lib/dist/lib/testCases/agentFixture.js.map +1 -0
- package/lib/dist/lib/testCases/authoringSurface.d.ts +10 -0
- package/lib/dist/lib/testCases/authoringSurface.d.ts.map +1 -0
- package/lib/dist/lib/testCases/authoringSurface.js +54 -0
- package/lib/dist/lib/testCases/authoringSurface.js.map +1 -0
- package/lib/dist/lib/testCases/codemod.d.ts +13 -0
- package/lib/dist/lib/testCases/codemod.d.ts.map +1 -0
- package/lib/dist/lib/testCases/codemod.js +169 -0
- package/lib/dist/lib/testCases/codemod.js.map +1 -0
- package/lib/dist/lib/testCases/define.d.ts +114 -0
- package/lib/dist/lib/testCases/define.d.ts.map +1 -0
- package/lib/dist/lib/testCases/define.js +253 -0
- package/lib/dist/lib/testCases/define.js.map +1 -0
- package/lib/dist/lib/testCases/evaluators.d.ts +80 -0
- package/lib/dist/lib/testCases/evaluators.d.ts.map +1 -0
- package/lib/dist/lib/testCases/evaluators.js +105 -0
- package/lib/dist/lib/testCases/evaluators.js.map +1 -0
- package/lib/dist/lib/testCases/index.d.ts +14 -0
- package/lib/dist/lib/testCases/index.d.ts.map +1 -0
- package/lib/dist/lib/testCases/index.js +12 -0
- package/lib/dist/lib/testCases/index.js.map +1 -0
- package/lib/dist/lib/testCases/judge.d.ts +165 -0
- package/lib/dist/lib/testCases/judge.d.ts.map +1 -0
- package/lib/dist/lib/testCases/judge.js +359 -0
- package/lib/dist/lib/testCases/judge.js.map +1 -0
- package/lib/dist/lib/testCases/loader.d.ts +36 -0
- package/lib/dist/lib/testCases/loader.d.ts.map +1 -0
- package/lib/dist/lib/testCases/loader.js +179 -0
- package/lib/dist/lib/testCases/loader.js.map +1 -0
- package/lib/dist/lib/testCases/types.d.ts +242 -0
- package/lib/dist/lib/testCases/types.d.ts.map +1 -0
- package/lib/dist/lib/testCases/types.js +6 -0
- package/lib/dist/lib/testCases/types.js.map +1 -0
- package/lib/dist/lib/theme.d.ts +6 -0
- package/lib/dist/lib/theme.d.ts.map +1 -0
- package/lib/dist/lib/theme.js +36 -0
- package/lib/dist/lib/theme.js.map +1 -0
- package/lib/dist/lib/uiTelemetry.d.ts +7 -0
- package/lib/dist/lib/uiTelemetry.d.ts.map +1 -0
- package/lib/dist/lib/uiTelemetry.js +25 -0
- package/lib/dist/lib/uiTelemetry.js.map +1 -0
- package/lib/dist/lib/utils.d.ts +111 -0
- package/lib/dist/lib/utils.d.ts.map +1 -0
- package/lib/dist/lib/utils.js +254 -0
- package/lib/dist/lib/utils.js.map +1 -0
- package/lib/dist/lib/workflow/consolidate.d.ts +12 -0
- package/lib/dist/lib/workflow/consolidate.d.ts.map +1 -0
- package/lib/dist/lib/workflow/consolidate.js +33 -0
- package/lib/dist/lib/workflow/consolidate.js.map +1 -0
- package/lib/dist/lib/workflow/index.d.ts +13 -0
- package/lib/dist/lib/workflow/index.d.ts.map +1 -0
- package/lib/dist/lib/workflow/index.js +12 -0
- package/lib/dist/lib/workflow/index.js.map +1 -0
- package/lib/dist/lib/workflow/ledger.d.ts +30 -0
- package/lib/dist/lib/workflow/ledger.d.ts.map +1 -0
- package/lib/dist/lib/workflow/ledger.js +41 -0
- package/lib/dist/lib/workflow/ledger.js.map +1 -0
- package/lib/dist/lib/workflow/pool.d.ts +13 -0
- package/lib/dist/lib/workflow/pool.d.ts.map +1 -0
- package/lib/dist/lib/workflow/pool.js +44 -0
- package/lib/dist/lib/workflow/pool.js.map +1 -0
- package/lib/dist/lib/workflow/source.d.ts +22 -0
- package/lib/dist/lib/workflow/source.d.ts.map +1 -0
- package/lib/dist/lib/workflow/source.js +29 -0
- package/lib/dist/lib/workflow/source.js.map +1 -0
- package/lib/dist/lib/workflow/stepB.d.ts +71 -0
- package/lib/dist/lib/workflow/stepB.d.ts.map +1 -0
- package/lib/dist/lib/workflow/stepB.js +99 -0
- package/lib/dist/lib/workflow/stepB.js.map +1 -0
- package/lib/dist/lib/workflow/types.d.ts +86 -0
- package/lib/dist/lib/workflow/types.d.ts.map +1 -0
- package/lib/dist/lib/workflow/types.js +6 -0
- package/lib/dist/lib/workflow/types.js.map +1 -0
- package/lib/dist/lib/workflow/workflow.d.ts +119 -0
- package/lib/dist/lib/workflow/workflow.d.ts.map +1 -0
- package/lib/dist/lib/workflow/workflow.js +195 -0
- package/lib/dist/lib/workflow/workflow.js.map +1 -0
- package/lib/dist/services/agent/aguiConverter.d.ts +50 -0
- package/lib/dist/services/agent/aguiConverter.d.ts.map +1 -0
- package/lib/dist/services/agent/aguiConverter.js +449 -0
- package/lib/dist/services/agent/aguiConverter.js.map +1 -0
- package/lib/dist/services/agent/index.d.ts +10 -0
- package/lib/dist/services/agent/index.d.ts.map +1 -0
- package/lib/dist/services/agent/index.js +12 -0
- package/lib/dist/services/agent/index.js.map +1 -0
- package/lib/dist/services/agent/payloadBuilder.d.ts +33 -0
- package/lib/dist/services/agent/payloadBuilder.d.ts.map +1 -0
- package/lib/dist/services/agent/payloadBuilder.js +75 -0
- package/lib/dist/services/agent/payloadBuilder.js.map +1 -0
- package/lib/dist/services/agent/sseStream.d.ts +43 -0
- package/lib/dist/services/agent/sseStream.d.ts.map +1 -0
- package/lib/dist/services/agent/sseStream.js +223 -0
- package/lib/dist/services/agent/sseStream.js.map +1 -0
- package/lib/dist/services/connectors/agui/AGUIStreamingConnector.d.ts +44 -0
- package/lib/dist/services/connectors/agui/AGUIStreamingConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/agui/AGUIStreamingConnector.js +95 -0
- package/lib/dist/services/connectors/agui/AGUIStreamingConnector.js.map +1 -0
- package/lib/dist/services/connectors/base/BaseConnector.d.ts +81 -0
- package/lib/dist/services/connectors/base/BaseConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/base/BaseConnector.js +170 -0
- package/lib/dist/services/connectors/base/BaseConnector.js.map +1 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts +126 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js +417 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js.map +1 -0
- package/lib/dist/services/connectors/index.d.ts +13 -0
- package/lib/dist/services/connectors/index.d.ts.map +1 -0
- package/lib/dist/services/connectors/index.js +32 -0
- package/lib/dist/services/connectors/index.js.map +1 -0
- package/lib/dist/services/connectors/kiro/KiroConnector.d.ts +48 -0
- package/lib/dist/services/connectors/kiro/KiroConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/kiro/KiroConnector.js +158 -0
- package/lib/dist/services/connectors/kiro/KiroConnector.js.map +1 -0
- package/lib/dist/services/connectors/langgraph/LangGraphConnector.d.ts +36 -0
- package/lib/dist/services/connectors/langgraph/LangGraphConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/langgraph/LangGraphConnector.js +175 -0
- package/lib/dist/services/connectors/langgraph/LangGraphConnector.js.map +1 -0
- package/lib/dist/services/connectors/mock/MockConnector.d.ts +37 -0
- package/lib/dist/services/connectors/mock/MockConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/mock/MockConnector.js +120 -0
- package/lib/dist/services/connectors/mock/MockConnector.js.map +1 -0
- package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.d.ts +42 -0
- package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.js +133 -0
- package/lib/dist/services/connectors/openai-compatible/OpenAICompatibleConnector.js.map +1 -0
- package/lib/dist/services/connectors/pi/PiConnector.d.ts +87 -0
- package/lib/dist/services/connectors/pi/PiConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/pi/PiConnector.js +274 -0
- package/lib/dist/services/connectors/pi/PiConnector.js.map +1 -0
- package/lib/dist/services/connectors/registry.d.ts +57 -0
- package/lib/dist/services/connectors/registry.d.ts.map +1 -0
- package/lib/dist/services/connectors/registry.js +106 -0
- package/lib/dist/services/connectors/registry.js.map +1 -0
- package/lib/dist/services/connectors/rest/RESTConnector.d.ts +38 -0
- package/lib/dist/services/connectors/rest/RESTConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/rest/RESTConnector.js +117 -0
- package/lib/dist/services/connectors/rest/RESTConnector.js.map +1 -0
- package/lib/dist/services/connectors/server.d.ts +13 -0
- package/lib/dist/services/connectors/server.d.ts.map +1 -0
- package/lib/dist/services/connectors/server.js +34 -0
- package/lib/dist/services/connectors/server.js.map +1 -0
- package/lib/dist/services/connectors/strands/StrandsConnector.d.ts +48 -0
- package/lib/dist/services/connectors/strands/StrandsConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/strands/StrandsConnector.js +221 -0
- package/lib/dist/services/connectors/strands/StrandsConnector.js.map +1 -0
- package/lib/dist/services/connectors/subprocess/SubprocessConnector.d.ts +88 -0
- package/lib/dist/services/connectors/subprocess/SubprocessConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/subprocess/SubprocessConnector.js +426 -0
- package/lib/dist/services/connectors/subprocess/SubprocessConnector.js.map +1 -0
- package/lib/dist/services/connectors/types.d.ts +213 -0
- package/lib/dist/services/connectors/types.d.ts.map +1 -0
- package/lib/dist/services/connectors/types.js +6 -0
- package/lib/dist/services/connectors/types.js.map +1 -0
- package/lib/dist/services/evaluation/bedrockJudge.d.ts +71 -0
- package/lib/dist/services/evaluation/bedrockJudge.d.ts.map +1 -0
- package/lib/dist/services/evaluation/bedrockJudge.js +169 -0
- package/lib/dist/services/evaluation/bedrockJudge.js.map +1 -0
- package/lib/dist/services/evaluation/evaluatorError.d.ts +56 -0
- package/lib/dist/services/evaluation/evaluatorError.d.ts.map +1 -0
- package/lib/dist/services/evaluation/evaluatorError.js +56 -0
- package/lib/dist/services/evaluation/evaluatorError.js.map +1 -0
- package/lib/dist/services/evaluation/index.d.ts +106 -0
- package/lib/dist/services/evaluation/index.d.ts.map +1 -0
- package/lib/dist/services/evaluation/index.js +684 -0
- package/lib/dist/services/evaluation/index.js.map +1 -0
- package/lib/dist/services/evaluation/mockTrajectory.d.ts +3 -0
- package/lib/dist/services/evaluation/mockTrajectory.d.ts.map +1 -0
- package/lib/dist/services/evaluation/mockTrajectory.js +72 -0
- package/lib/dist/services/evaluation/mockTrajectory.js.map +1 -0
- package/lib/dist/services/opensearch/client.d.ts +26 -0
- package/lib/dist/services/opensearch/client.d.ts.map +1 -0
- package/lib/dist/services/opensearch/client.js +131 -0
- package/lib/dist/services/opensearch/client.js.map +1 -0
- package/lib/dist/services/opensearch/index.d.ts +16 -0
- package/lib/dist/services/opensearch/index.d.ts.map +1 -0
- package/lib/dist/services/opensearch/index.js +25 -0
- package/lib/dist/services/opensearch/index.js.map +1 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.d.ts +123 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.d.ts.map +1 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.js +440 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.js.map +1 -0
- package/lib/dist/services/storage/asyncRunStorage.d.ts +135 -0
- package/lib/dist/services/storage/asyncRunStorage.d.ts.map +1 -0
- package/lib/dist/services/storage/asyncRunStorage.js +524 -0
- package/lib/dist/services/storage/asyncRunStorage.js.map +1 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.d.ts +170 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.d.ts.map +1 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.js +301 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.js.map +1 -0
- package/lib/dist/services/storage/index.d.ts +17 -0
- package/lib/dist/services/storage/index.d.ts.map +1 -0
- package/lib/dist/services/storage/index.js +20 -0
- package/lib/dist/services/storage/index.js.map +1 -0
- package/lib/dist/services/storage/migration.d.ts +54 -0
- package/lib/dist/services/storage/migration.d.ts.map +1 -0
- package/lib/dist/services/storage/migration.js +296 -0
- package/lib/dist/services/storage/migration.js.map +1 -0
- package/lib/dist/services/storage/opensearchClient.d.ts +947 -0
- package/lib/dist/services/storage/opensearchClient.d.ts.map +1 -0
- package/lib/dist/services/storage/opensearchClient.js +442 -0
- package/lib/dist/services/storage/opensearchClient.js.map +1 -0
- package/lib/dist/services/traces/browserRecovery.d.ts +37 -0
- package/lib/dist/services/traces/browserRecovery.d.ts.map +1 -0
- package/lib/dist/services/traces/browserRecovery.js +108 -0
- package/lib/dist/services/traces/browserRecovery.js.map +1 -0
- package/lib/dist/services/traces/categoryStyles.d.ts +21 -0
- package/lib/dist/services/traces/categoryStyles.d.ts.map +1 -0
- package/lib/dist/services/traces/categoryStyles.js +56 -0
- package/lib/dist/services/traces/categoryStyles.js.map +1 -0
- package/lib/dist/services/traces/executionOrderTransform.d.ts +35 -0
- package/lib/dist/services/traces/executionOrderTransform.d.ts.map +1 -0
- package/lib/dist/services/traces/executionOrderTransform.js +313 -0
- package/lib/dist/services/traces/executionOrderTransform.js.map +1 -0
- package/lib/dist/services/traces/fetchSpansForRun.d.ts +86 -0
- package/lib/dist/services/traces/fetchSpansForRun.d.ts.map +1 -0
- package/lib/dist/services/traces/fetchSpansForRun.js +69 -0
- package/lib/dist/services/traces/fetchSpansForRun.js.map +1 -0
- package/lib/dist/services/traces/flowTransform.d.ts +24 -0
- package/lib/dist/services/traces/flowTransform.d.ts.map +1 -0
- package/lib/dist/services/traces/flowTransform.js +228 -0
- package/lib/dist/services/traces/flowTransform.js.map +1 -0
- package/lib/dist/services/traces/index.d.ts +121 -0
- package/lib/dist/services/traces/index.d.ts.map +1 -0
- package/lib/dist/services/traces/index.js +255 -0
- package/lib/dist/services/traces/index.js.map +1 -0
- package/lib/dist/services/traces/intentTransform.d.ts +20 -0
- package/lib/dist/services/traces/intentTransform.d.ts.map +1 -0
- package/lib/dist/services/traces/intentTransform.js +131 -0
- package/lib/dist/services/traces/intentTransform.js.map +1 -0
- package/lib/dist/services/traces/judgeAgentsHints.d.ts +63 -0
- package/lib/dist/services/traces/judgeAgentsHints.d.ts.map +1 -0
- package/lib/dist/services/traces/judgeAgentsHints.js +89 -0
- package/lib/dist/services/traces/judgeAgentsHints.js.map +1 -0
- package/lib/dist/services/traces/messageExtraction.d.ts +15 -0
- package/lib/dist/services/traces/messageExtraction.d.ts.map +1 -0
- package/lib/dist/services/traces/messageExtraction.js +313 -0
- package/lib/dist/services/traces/messageExtraction.js.map +1 -0
- package/lib/dist/services/traces/spanCategorization.d.ts +63 -0
- package/lib/dist/services/traces/spanCategorization.d.ts.map +1 -0
- package/lib/dist/services/traces/spanCategorization.js +276 -0
- package/lib/dist/services/traces/spanCategorization.js.map +1 -0
- package/lib/dist/services/traces/spanPreprocessing.d.ts +37 -0
- package/lib/dist/services/traces/spanPreprocessing.d.ts.map +1 -0
- package/lib/dist/services/traces/spanPreprocessing.js +102 -0
- package/lib/dist/services/traces/spanPreprocessing.js.map +1 -0
- package/lib/dist/services/traces/spansToTrajectory.d.ts +36 -0
- package/lib/dist/services/traces/spansToTrajectory.d.ts.map +1 -0
- package/lib/dist/services/traces/spansToTrajectory.js +425 -0
- package/lib/dist/services/traces/spansToTrajectory.js.map +1 -0
- package/lib/dist/services/traces/toolSimilarity.d.ts +35 -0
- package/lib/dist/services/traces/toolSimilarity.d.ts.map +1 -0
- package/lib/dist/services/traces/toolSimilarity.js +203 -0
- package/lib/dist/services/traces/toolSimilarity.js.map +1 -0
- package/lib/dist/services/traces/traceComparison.d.ts +31 -0
- package/lib/dist/services/traces/traceComparison.d.ts.map +1 -0
- package/lib/dist/services/traces/traceComparison.js +318 -0
- package/lib/dist/services/traces/traceComparison.js.map +1 -0
- package/lib/dist/services/traces/traceGrouping.d.ts +19 -0
- package/lib/dist/services/traces/traceGrouping.d.ts.map +1 -0
- package/lib/dist/services/traces/traceGrouping.js +107 -0
- package/lib/dist/services/traces/traceGrouping.js.map +1 -0
- package/lib/dist/services/traces/tracePoller.d.ts +108 -0
- package/lib/dist/services/traces/tracePoller.d.ts.map +1 -0
- package/lib/dist/services/traces/tracePoller.js +475 -0
- package/lib/dist/services/traces/tracePoller.js.map +1 -0
- package/lib/dist/services/traces/traceStats.d.ts +45 -0
- package/lib/dist/services/traces/traceStats.d.ts.map +1 -0
- package/lib/dist/services/traces/traceStats.js +114 -0
- package/lib/dist/services/traces/traceStats.js.map +1 -0
- package/lib/dist/services/traces/traceSummary.d.ts +47 -0
- package/lib/dist/services/traces/traceSummary.d.ts.map +1 -0
- package/lib/dist/services/traces/traceSummary.js +68 -0
- package/lib/dist/services/traces/traceSummary.js.map +1 -0
- package/lib/dist/services/traces/utils.d.ts +33 -0
- package/lib/dist/services/traces/utils.d.ts.map +1 -0
- package/lib/dist/services/traces/utils.js +114 -0
- package/lib/dist/services/traces/utils.js.map +1 -0
- package/lib/dist/types/agui.d.ts +13 -0
- package/lib/dist/types/agui.d.ts.map +1 -0
- package/lib/dist/types/agui.js +16 -0
- package/lib/dist/types/agui.js.map +1 -0
- package/lib/dist/types/index.d.ts +1229 -0
- package/lib/dist/types/index.d.ts.map +1 -0
- package/lib/dist/types/index.js +12 -0
- package/lib/dist/types/index.js.map +1 -0
- package/lib/dist/types/skills.d.ts +146 -0
- package/lib/dist/types/skills.d.ts.map +1 -0
- package/lib/dist/types/skills.js +6 -0
- package/lib/dist/types/skills.js.map +1 -0
- package/observio-sample-agent/pi-package/README.md +112 -0
- package/observio-sample-agent/pi-package/extensions/agent-health.ts +373 -0
- package/observio-sample-agent/pi-package/package.json +17 -0
- package/observio-sample-agent/pi-package/prompts/agent-health.md +37 -0
- package/observio-sample-agent/pi-package/skills/create-pr/SKILL.md +88 -0
- package/observio-sample-agent/pi-package/skills/fix-bug/SKILL.md +71 -0
- package/observio-sample-agent/pi-package/skills/implement-feature/SKILL.md +156 -0
- package/observio-sample-agent/pi-package/skills/instrument-otel/SKILL.md +208 -0
- package/observio-sample-agent/pi-package/skills/setup-collector/SKILL.md +146 -0
- package/observio-sample-agent/pi-package/skills/write-test/SKILL.md +115 -0
- package/package.json +45 -9
- package/server/dist/app.js +34031 -18731
- package/server/dist/index.js +30737 -15338
- package/tsconfig.lib.json +71 -0
- package/dist/assets/index-BOIP5L7h.js +0 -246
- package/dist/assets/index-CU9YKpAL.css +0 -1
- package/lib/dist/config/index.js +0 -452
- package/lib/dist/index.js +0 -1725
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Agent Health Configuration
|
|
8
|
+
*
|
|
9
|
+
* Copy this file to `agent-health.config.ts` and customize for your environment.
|
|
10
|
+
* The config file is automatically detected in the current working directory.
|
|
11
|
+
*
|
|
12
|
+
* By default, user-defined agents and models are merged with the built-in defaults.
|
|
13
|
+
* Set `extends: false` to use only your agents and models.
|
|
14
|
+
*
|
|
15
|
+
* Supported config file names (in priority order):
|
|
16
|
+
* - agent-health.config.ts
|
|
17
|
+
* - agent-health.config.js
|
|
18
|
+
* - agent-health.config.mjs
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
// Custom agents are merged with built-in agents by default.
|
|
23
|
+
// Each agent `key` must be unique — if it matches a built-in key,
|
|
24
|
+
// it will override that built-in agent.
|
|
25
|
+
agents: [
|
|
26
|
+
// Example 1: REST connector (synchronous JSON response)
|
|
27
|
+
{
|
|
28
|
+
key: "my-rest-agent",
|
|
29
|
+
name: "My REST Agent",
|
|
30
|
+
endpoint: "http://localhost:8000/api/agent",
|
|
31
|
+
connectorType: "rest",
|
|
32
|
+
useTraces: true, // Enable OpenTelemetry trace collection
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
// Example 2: Streaming connector (Server-Sent Events)
|
|
36
|
+
{
|
|
37
|
+
key: "my-streaming-agent",
|
|
38
|
+
name: "My Streaming Agent",
|
|
39
|
+
endpoint: "http://localhost:9000/agent/stream",
|
|
40
|
+
connectorType: "agui-streaming",
|
|
41
|
+
useTraces: false,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// Example 3: CLI tool connector
|
|
45
|
+
// {
|
|
46
|
+
// key: "my-cli-agent",
|
|
47
|
+
// name: "My CLI Agent",
|
|
48
|
+
// endpoint: "/usr/local/bin/my-agent",
|
|
49
|
+
// connectorType: "subprocess",
|
|
50
|
+
// useTraces: false,
|
|
51
|
+
// },
|
|
52
|
+
|
|
53
|
+
// Example 4: LangGraph REST connector (non-streaming invoke)
|
|
54
|
+
// {
|
|
55
|
+
// key: "my-langgraph-agent",
|
|
56
|
+
// name: "My LangGraph Agent",
|
|
57
|
+
// endpoint: "http://localhost:8123",
|
|
58
|
+
// connectorType: "langgraph",
|
|
59
|
+
// connectorConfig: {
|
|
60
|
+
// graphId: "agent", // Assistant/graph ID (defaults to "agent")
|
|
61
|
+
// // threadId: "...", // Optional thread ID for multi-turn
|
|
62
|
+
// },
|
|
63
|
+
// useTraces: true,
|
|
64
|
+
// },
|
|
65
|
+
|
|
66
|
+
// Example 5: Amazon Strands connector (Bedrock Agent Runtime)
|
|
67
|
+
// {
|
|
68
|
+
// key: "my-strands-agent",
|
|
69
|
+
// name: "My Strands Agent",
|
|
70
|
+
// endpoint: "ABCDEF1234", // Bedrock Agent ID
|
|
71
|
+
// connectorType: "strands",
|
|
72
|
+
// connectorConfig: {
|
|
73
|
+
// agentAliasId: "TSTALIASID", // Agent alias ID
|
|
74
|
+
// region: "us-west-2", // AWS region (defaults to AWS_REGION)
|
|
75
|
+
// },
|
|
76
|
+
// useTraces: false,
|
|
77
|
+
// },
|
|
78
|
+
|
|
79
|
+
// Example 6: Agent with authentication hook
|
|
80
|
+
// {
|
|
81
|
+
// key: "authenticated-agent",
|
|
82
|
+
// name: "Authenticated Agent",
|
|
83
|
+
// endpoint: "https://api.example.com/agent",
|
|
84
|
+
// connectorType: "rest",
|
|
85
|
+
// useTraces: true,
|
|
86
|
+
// hooks: {
|
|
87
|
+
// beforeRequest: async ({ endpoint, payload, headers }) => {
|
|
88
|
+
// return {
|
|
89
|
+
// endpoint,
|
|
90
|
+
// payload,
|
|
91
|
+
// headers: {
|
|
92
|
+
// ...headers,
|
|
93
|
+
// 'Authorization': `Bearer ${process.env.API_TOKEN}`,
|
|
94
|
+
// },
|
|
95
|
+
// };
|
|
96
|
+
// },
|
|
97
|
+
// },
|
|
98
|
+
// },
|
|
99
|
+
|
|
100
|
+
// Example 7: Claude Code with MCP servers (competitive evaluation)
|
|
101
|
+
// Uses a standard MCP config JSON file (same format as ~/.claude.json mcpServers)
|
|
102
|
+
// {
|
|
103
|
+
// key: "claude-code-eval",
|
|
104
|
+
// name: "Claude Code (Eval)",
|
|
105
|
+
// endpoint: "claude",
|
|
106
|
+
// connectorType: "claude-code",
|
|
107
|
+
// useTraces: true,
|
|
108
|
+
// connectorConfig: {
|
|
109
|
+
// dangerouslySkipPermissions: true,
|
|
110
|
+
// appendSystemPrompt: "You are an observability agent...",
|
|
111
|
+
// allowedTools: ["mcp__aws-prometheus__*", "mcp__aws-cloudwatch__*", "Bash"],
|
|
112
|
+
// mcpConfigPath: "./mcp-config.json", // standard MCP config file
|
|
113
|
+
// strictMcpConfig: true,
|
|
114
|
+
// env: { CLAUDE_CODE_USE_BEDROCK: "1", AWS_PROFILE: "Bedrock" },
|
|
115
|
+
// },
|
|
116
|
+
// },
|
|
117
|
+
],
|
|
118
|
+
|
|
119
|
+
// --- Data sources (OpenSearch clusters) ----------------------------------
|
|
120
|
+
// storage: where eval results are persisted (omit for file-based).
|
|
121
|
+
// observability: where agent traces/logs are read from (Traces tab).
|
|
122
|
+
// Precedence: agent-health.config.json (Settings UI) -> these TS fields ->
|
|
123
|
+
// OPENSEARCH_STORAGE_*/OPENSEARCH_LOGS_* env -> file-based fallback.
|
|
124
|
+
// Read secrets from process.env so this committed file carries none.
|
|
125
|
+
//
|
|
126
|
+
// storage: {
|
|
127
|
+
// endpoint: process.env.OPENSEARCH_STORAGE_ENDPOINT,
|
|
128
|
+
// authType: 'sigv4', // 'none' | 'basic' | 'sigv4'
|
|
129
|
+
// awsRegion: 'us-east-1',
|
|
130
|
+
// awsService: 'es', // 'es' (managed) | 'aoss' (serverless)
|
|
131
|
+
// awsProfile: process.env.AWS_PROFILE,
|
|
132
|
+
// },
|
|
133
|
+
//
|
|
134
|
+
// observability: {
|
|
135
|
+
// endpoint: process.env.OPENSEARCH_LOGS_ENDPOINT,
|
|
136
|
+
// authType: 'sigv4',
|
|
137
|
+
// awsRegion: 'us-east-1',
|
|
138
|
+
// indexes: { traces: 'otel-v1-apm-span-*', logs: 'ml-commons-logs-*' },
|
|
139
|
+
// },
|
|
140
|
+
|
|
141
|
+
// Custom models (merged with built-in models by default)
|
|
142
|
+
// models: [
|
|
143
|
+
// {
|
|
144
|
+
// key: "my-model",
|
|
145
|
+
// model_id: "us.anthropic.claude-sonnet-4-20250514-v1:0",
|
|
146
|
+
// display_name: "My Model",
|
|
147
|
+
// provider: "bedrock", // "bedrock" | "openai-compatible" | "demo"
|
|
148
|
+
// context_window: 200000,
|
|
149
|
+
// max_output_tokens: 4096,
|
|
150
|
+
// },
|
|
151
|
+
// ],
|
|
152
|
+
|
|
153
|
+
// Set to false to ignore all built-in agents and models
|
|
154
|
+
// extends: false,
|
|
155
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Example: a custom connector that wraps a simple HTTP echo agent.
|
|
8
|
+
*
|
|
9
|
+
* This is the smallest realistic shape of a connector. It implements the
|
|
10
|
+
* three abstract members of `BaseConnector` (`buildPayload`, `execute`,
|
|
11
|
+
* `parseResponse`) plus the three readonly identity fields (`type`,
|
|
12
|
+
* `name`, `supportsStreaming`).
|
|
13
|
+
*
|
|
14
|
+
* Drop this file at `connectors/echo.ts` in your project and register it
|
|
15
|
+
* from your `agent-health.config.ts`:
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { defineConfig, registerConnector } from '@opensearch-project/agent-health';
|
|
20
|
+
* import { EchoConnector } from './connectors/echo';
|
|
21
|
+
*
|
|
22
|
+
* registerConnector(new EchoConnector());
|
|
23
|
+
*
|
|
24
|
+
* export default defineConfig({
|
|
25
|
+
* agents: [
|
|
26
|
+
* {
|
|
27
|
+
* key: 'echo',
|
|
28
|
+
* name: 'Echo Agent',
|
|
29
|
+
* endpoint: 'http://localhost:8080/echo',
|
|
30
|
+
* connectorType: 'rest', // or any registered protocol
|
|
31
|
+
* },
|
|
32
|
+
* ],
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* To understand the lifecycle this connector plugs into — abort signal
|
|
37
|
+
* handling, progress callbacks, trajectory shape, raw-event replay —
|
|
38
|
+
* read the base class and types directly in the installed package:
|
|
39
|
+
*
|
|
40
|
+
* node_modules/@opensearch-project/agent-health/lib/dist/services/connectors/base/BaseConnector.js
|
|
41
|
+
* node_modules/@opensearch-project/agent-health/lib/dist/services/connectors/types.d.ts
|
|
42
|
+
*
|
|
43
|
+
* The compiled `.js` preserves the original JSDoc, and the matching
|
|
44
|
+
* `.d.ts` next to it gives you the precise type contract — no need to
|
|
45
|
+
* cross-reference an arbitrary GitHub commit, you're reading exactly
|
|
46
|
+
* the version your `package.json` resolved to.
|
|
47
|
+
*
|
|
48
|
+
* NOTE: `ConnectorProtocol` is a closed string-literal union of the
|
|
49
|
+
* built-in protocol ids ('rest', 'agui-streaming', 'subprocess', ...).
|
|
50
|
+
* The simplest path for a custom connector is to reuse one of those ids
|
|
51
|
+
* (e.g. 'rest' for HTTP-JSON agents) and replace the built-in connector
|
|
52
|
+
* via `registerConnector(new EchoConnector())`. If you need a brand-new
|
|
53
|
+
* protocol id, fork this repo and widen the `ConnectorProtocol` union
|
|
54
|
+
* in `services/connectors/types.ts`.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
import {
|
|
58
|
+
BaseConnector,
|
|
59
|
+
type ConnectorAuth,
|
|
60
|
+
type ConnectorRequest,
|
|
61
|
+
type ConnectorResponse,
|
|
62
|
+
type ConnectorProgressCallback,
|
|
63
|
+
type ConnectorRawEventCallback,
|
|
64
|
+
} from '@opensearch-project/agent-health';
|
|
65
|
+
|
|
66
|
+
import type { TrajectoryStep } from '@opensearch-project/agent-health';
|
|
67
|
+
|
|
68
|
+
export class EchoConnector extends BaseConnector {
|
|
69
|
+
// Replaces the built-in 'rest' connector when registered. Pick a
|
|
70
|
+
// different id (and widen ConnectorProtocol in your fork) if you
|
|
71
|
+
// want to coexist with the default REST connector.
|
|
72
|
+
readonly type = 'rest' as const;
|
|
73
|
+
readonly name = 'Echo Agent';
|
|
74
|
+
readonly supportsStreaming = false;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Build the JSON payload sent to the agent's HTTP endpoint.
|
|
78
|
+
* Called by `execute()` and also when re-processing stored raw events
|
|
79
|
+
* during trace replay (see `parseResponse`).
|
|
80
|
+
*/
|
|
81
|
+
buildPayload(request: ConnectorRequest): { message: string } {
|
|
82
|
+
return { message: request.testCase.initialPrompt };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Single-turn HTTP call → single response.
|
|
87
|
+
*/
|
|
88
|
+
async execute(
|
|
89
|
+
endpoint: string,
|
|
90
|
+
request: ConnectorRequest,
|
|
91
|
+
_auth: ConnectorAuth,
|
|
92
|
+
onProgress?: ConnectorProgressCallback,
|
|
93
|
+
_onRawEvent?: ConnectorRawEventCallback,
|
|
94
|
+
): Promise<ConnectorResponse> {
|
|
95
|
+
const startedAt = Date.now();
|
|
96
|
+
|
|
97
|
+
const res = await fetch(endpoint, {
|
|
98
|
+
method: 'POST',
|
|
99
|
+
headers: { 'Content-Type': 'application/json' },
|
|
100
|
+
body: JSON.stringify(this.buildPayload(request)),
|
|
101
|
+
});
|
|
102
|
+
if (!res.ok) {
|
|
103
|
+
throw new Error(`Echo agent failed: ${res.status} ${res.statusText}`);
|
|
104
|
+
}
|
|
105
|
+
const json = (await res.json()) as { reply: string };
|
|
106
|
+
|
|
107
|
+
// Build a single-step trajectory and emit progress for live UIs.
|
|
108
|
+
const step = this.createStep('response', json.reply);
|
|
109
|
+
onProgress?.(step);
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
success: true,
|
|
113
|
+
response: json.reply,
|
|
114
|
+
trajectory: [step],
|
|
115
|
+
rawEvents: [{ type: 'ECHO_REPLY', reply: json.reply }],
|
|
116
|
+
durationMs: Date.now() - startedAt,
|
|
117
|
+
runId: `echo-${startedAt}`,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Re-derive trajectory from previously stored raw events. Used by
|
|
123
|
+
* the run replayer / trace recovery path.
|
|
124
|
+
*/
|
|
125
|
+
parseResponse(rawResponse: unknown): TrajectoryStep[] {
|
|
126
|
+
const events = Array.isArray(rawResponse) ? rawResponse : [];
|
|
127
|
+
return events
|
|
128
|
+
.filter((e: { type?: string }) => e?.type === 'ECHO_REPLY')
|
|
129
|
+
.map((e: { reply: string }) => this.createStep('response', e.reply));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Demo eval — five test cases that show off the SDK end-to-end against
|
|
8
|
+
* the live Observio agent.
|
|
9
|
+
*
|
|
10
|
+
* 1. observio-says-hello Pure deterministic, no LLM (free, fast)
|
|
11
|
+
* 2. observio-uses-a-tool Trajectory inspection — must invoke at least one tool
|
|
12
|
+
* 3. observio-rca-is-coherent Hybrid — deterministic + LLM judge
|
|
13
|
+
* 4. labels-only-no-prompt No agent invocation at all (data-only test)
|
|
14
|
+
* 5. budget-aware Uses traces fixture for token-budget assertion
|
|
15
|
+
*
|
|
16
|
+
* Run with:
|
|
17
|
+
* curl -sN -X POST http://localhost:4002/api/storage/evaluation-runs \
|
|
18
|
+
* -H 'Content-Type: application/json' \
|
|
19
|
+
* -d '{
|
|
20
|
+
* "name":"SDK Demo",
|
|
21
|
+
* "sources":[{"type":"code-import","filenames":["examples/eval-files/demo.eval.js"],"testCaseIds":[]}],
|
|
22
|
+
* "agentKey":"observio",
|
|
23
|
+
* "modelId":"claude-sonnet"
|
|
24
|
+
* }'
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const { test, expect } = require('@opensearch-project/agent-health');
|
|
28
|
+
|
|
29
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
30
|
+
// Test 1: Pure deterministic — no LLM, $0, fully reproducible
|
|
31
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
test('observio-says-hello', {
|
|
34
|
+
prompt: 'Say hello to me in one short sentence.',
|
|
35
|
+
description: 'Smoke test: agent produces a non-trivial response',
|
|
36
|
+
labels: ['category:Smoke', 'difficulty:Easy', 'demo', 'agent:observio'],
|
|
37
|
+
}, function ({ result }) {
|
|
38
|
+
// Trajectory must exist
|
|
39
|
+
expect(result.trajectory).to.have.length.greaterThan(0);
|
|
40
|
+
|
|
41
|
+
// Final output is non-empty
|
|
42
|
+
expect(result.agentOutput.trim()).to.have.length.greaterThan(0);
|
|
43
|
+
|
|
44
|
+
// Reasonable timing budget
|
|
45
|
+
expect(result).to.haveCompletedWithin(60_000);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
49
|
+
// Test 2: Trajectory inspection — proves the agent actually investigates
|
|
50
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
test('observio-uses-a-tool', {
|
|
53
|
+
prompt: 'Find the source of the most recent error log entry.',
|
|
54
|
+
description: 'Agent must call at least one tool, not just answer from memory',
|
|
55
|
+
labels: ['category:Tool Use', 'difficulty:Medium', 'demo', 'agent:observio'],
|
|
56
|
+
}, function ({ result }) {
|
|
57
|
+
// At least one action step (tool invocation)
|
|
58
|
+
expect(result.trajectory).to.haveStepsOfType('action');
|
|
59
|
+
|
|
60
|
+
// The trajectory accessor sugar makes the assertion read like prose
|
|
61
|
+
const tools = result.trajectory.toolCalls();
|
|
62
|
+
expect(tools).to.have.length.greaterThan(0);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
66
|
+
// Test 3: Hybrid — deterministic preflight + targeted LLM judge
|
|
67
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
test('observio-rca-is-coherent', {
|
|
70
|
+
prompt: 'Diagnose why the payment service is failing and explain the root cause.',
|
|
71
|
+
description: 'Hybrid: cheap structural checks first, then LLM judge for semantic correctness',
|
|
72
|
+
context: [
|
|
73
|
+
{
|
|
74
|
+
description: 'Error log',
|
|
75
|
+
value: 'ERROR 2024-01-15 10:31:22 [payment-service] Connection refused to database-primary:5432',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
labels: ['category:RCA', 'difficulty:Hard', 'demo', 'agent:observio', 'hybrid'],
|
|
79
|
+
}, async function ({ result, judge }) {
|
|
80
|
+
// Cheap deterministic preflight — fail fast, never spend $ on the judge
|
|
81
|
+
expect(result.trajectory).to.have.length.greaterThan(0);
|
|
82
|
+
expect(result).to.haveCompletedWithin(120_000);
|
|
83
|
+
expect(result.agentOutput).to.haveOutputMatching(/payment[- ]service/i);
|
|
84
|
+
|
|
85
|
+
// Now invoke the LLM judge for the semantic claim. This produces a
|
|
86
|
+
// 'hybrid' evaluation method on the resulting report.
|
|
87
|
+
await judge(result, 'Correctly identifies that the payment-service cannot connect to its database');
|
|
88
|
+
await judge(result, 'Provides a plausible root-cause hypothesis (e.g. database down, network issue)');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
92
|
+
// Test 4: No prompt at all — pure data-only test, agent never invoked
|
|
93
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
94
|
+
//
|
|
95
|
+
// Useful for tests that assert against external state, fixtures, or static
|
|
96
|
+
// data without needing any agent involvement.
|
|
97
|
+
|
|
98
|
+
test('labels-only-no-prompt', {
|
|
99
|
+
description: 'Verify a fixture file matches a baseline (no agent involvement)',
|
|
100
|
+
labels: ['category:Data Quality', 'difficulty:Easy', 'demo'],
|
|
101
|
+
}, function ({ result }) {
|
|
102
|
+
// No agent ran — durationMs is 0, trajectory empty
|
|
103
|
+
expect(result.durationMs).to.equal(0);
|
|
104
|
+
expect(result.trajectory).to.have.length(0);
|
|
105
|
+
|
|
106
|
+
// The actual deterministic check (could load a JSON file, compute, etc.)
|
|
107
|
+
const baseline = { name: 'demo', version: 1 };
|
|
108
|
+
expect(baseline.version).to.equal(1);
|
|
109
|
+
expect(baseline.name).to.equal('demo');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
113
|
+
// Test 5: Budget-aware — uses the traces fixture for token / span timing checks
|
|
114
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
115
|
+
//
|
|
116
|
+
// `traces` is pre-loaded by the runner when the agent emits OTel spans. When
|
|
117
|
+
// no traces are available the accessor returns 0 / empty for all helpers,
|
|
118
|
+
// so this test still passes (vacuously) on agents without instrumentation.
|
|
119
|
+
|
|
120
|
+
test('budget-aware', {
|
|
121
|
+
prompt: 'Summarize the system in one paragraph.',
|
|
122
|
+
description: 'Token budget + span-timing assertions via the traces fixture',
|
|
123
|
+
labels: ['category:Budget', 'difficulty:Easy', 'demo', 'agent:observio'],
|
|
124
|
+
}, function ({ result, traces }) {
|
|
125
|
+
expect(result.agentOutput.length).to.be.greaterThan(0);
|
|
126
|
+
// Cheap budget cap — fails if the agent burned more than 50k tokens
|
|
127
|
+
expect(traces.totalTokens).to.be.lessThan(50_000);
|
|
128
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Worked example — evaluating an ops / RCA agent that triages a ticket.
|
|
8
|
+
*
|
|
9
|
+
* The agent under test reads a ticket and emits a structured classification:
|
|
10
|
+
* - ticketType: "latency" | "fault" (deterministic — exact match)
|
|
11
|
+
* - rootCause: one of a fixed category set (deterministic — exact match)
|
|
12
|
+
* - sop: a recommended runbook (non-deterministic — LLM judge)
|
|
13
|
+
*
|
|
14
|
+
* This shows the two check styles side by side:
|
|
15
|
+
* • deterministic → expect(...).to.equal(...) on the parsed output
|
|
16
|
+
* • non-deterministic → judge(result, '<natural-language claim>')
|
|
17
|
+
*
|
|
18
|
+
* WEIGHTED SCORING (root-cause 60%, SOP, metrics, latency 10%):
|
|
19
|
+
* per-matcher pass/fail lives here, but the *single weighted aggregate score*
|
|
20
|
+
* across criteria is defined once in a custom EVALUATOR, not in the test body.
|
|
21
|
+
* Attach it at run time with `evaluatorId` — see ops-rca-evaluator.json next to
|
|
22
|
+
* this file. Run:
|
|
23
|
+
*
|
|
24
|
+
* npx @opensearch-project/agent-health benchmark \
|
|
25
|
+
* -f ./examples/eval-files/ops-rca-classification.eval.js -a my-ops-agent
|
|
26
|
+
*
|
|
27
|
+
* Docs: ../../docs/SDK.md Instrumentation: ../../docs/INSTRUMENT_WITH_OTEL.md
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const { test, expect } = require('@opensearch-project/agent-health');
|
|
31
|
+
|
|
32
|
+
// The agent's allowed root-cause categories — deterministic ground truth.
|
|
33
|
+
const ROOT_CAUSE_CATEGORIES = [
|
|
34
|
+
'dependency_outage',
|
|
35
|
+
'resource_exhaustion',
|
|
36
|
+
'config_error',
|
|
37
|
+
'code_regression',
|
|
38
|
+
'network',
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
test('ticket-123-db-outage', {
|
|
42
|
+
prompt: 'Triage ticket TICKET-123 and return your classification table.',
|
|
43
|
+
description: 'DB dependency outage — must classify as fault + dependency_outage',
|
|
44
|
+
context: [
|
|
45
|
+
{
|
|
46
|
+
description: 'Ticket body',
|
|
47
|
+
value:
|
|
48
|
+
'TICKET-123: payment-service returning 500s since 10:30. ' +
|
|
49
|
+
'Logs: "Connection refused to database-primary:5432". p99 latency normal until errors began.',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
labels: ['category:RCA', 'difficulty:Medium', 'agent:ops', 'type:fault'],
|
|
53
|
+
}, async function ({ agent, judge }) {
|
|
54
|
+
const result = await agent.run();
|
|
55
|
+
|
|
56
|
+
// ── Deterministic checks — exact classification, no LLM, $0 ──────────────
|
|
57
|
+
const out = result.parsedOutput() || {}; // agent emits JSON classification
|
|
58
|
+
expect(out.ticketType).to.equal('fault');
|
|
59
|
+
expect(ROOT_CAUSE_CATEGORIES).to.include(out.rootCause);
|
|
60
|
+
expect(out.rootCause).to.equal('dependency_outage');
|
|
61
|
+
|
|
62
|
+
// Prove it actually investigated rather than guessing.
|
|
63
|
+
expect(result.trajectory).to.haveStepsOfType('action');
|
|
64
|
+
|
|
65
|
+
// ── Non-deterministic checks — LLM judge on the free-text SOP ────────────
|
|
66
|
+
await judge(result, 'Recommends a runbook appropriate for a database dependency outage');
|
|
67
|
+
await judge(result, 'Explains that payment-service cannot reach database-primary as the root cause');
|
|
68
|
+
|
|
69
|
+
// ── Budget guard (feeds the "latency 10%" weight via the evaluator) ──────
|
|
70
|
+
expect(result).to.haveCompletedWithin(120_000);
|
|
71
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Ops RCA (weighted)",
|
|
3
|
+
"description": "Weighted scoring for a ticket-triage / RCA ops agent. Root-cause accuracy dominates; latency is a small tie-breaker. Attach to a run via evaluatorId.",
|
|
4
|
+
"systemPrompt": "You are evaluating an ops agent that triages a support ticket. The agent must (1) classify the ticket type (latency vs fault), (2) identify the root cause from a fixed category set, (3) recommend an appropriate SOP/runbook, and (4) check the relevant metrics. Score each metric from 0 to 100.\n\nCRITICAL CRITERIA:\n- root_cause_accuracy is the PRIMARY metric. A wrong root cause is a failed triage regardless of everything else.\n- sop_selection: did the agent recommend a runbook appropriate for the identified root cause?\n- relevant_metrics: did the agent inspect the metrics/logs that actually matter for this failure mode?\n- latency: score higher when the agent reaches a correct answer in fewer steps / less wall-clock time.\n\nReturn pass_fail_status, reasoning, a metrics object with the four numeric scores, and improvement_strategies.",
|
|
5
|
+
"scoringConfig": {
|
|
6
|
+
"metrics": [
|
|
7
|
+
{ "name": "root_cause_accuracy", "weight": 0.6, "scale": 100 },
|
|
8
|
+
{ "name": "sop_selection", "weight": 0.2, "scale": 100 },
|
|
9
|
+
{ "name": "relevant_metrics", "weight": 0.1, "scale": 100 },
|
|
10
|
+
{ "name": "latency", "weight": 0.1, "scale": 100 }
|
|
11
|
+
],
|
|
12
|
+
"passThreshold": 80,
|
|
13
|
+
"scale": 100
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SDK demo eval — three test cases that show the spectrum of evaluation
|
|
8
|
+
* methods the code-based SDK supports:
|
|
9
|
+
*
|
|
10
|
+
* 1. mock-says-hello (deterministic) — agent invoked, only chai matchers
|
|
11
|
+
* 2. mock-rca-judged (agentic) — agent invoked + LLM judge matcher
|
|
12
|
+
* 3. data-only-no-prompt (deterministic) — no agent call at all
|
|
13
|
+
*
|
|
14
|
+
* Run with:
|
|
15
|
+
* AH_PORT=4002 npx @opensearch-project/agent-health benchmark \
|
|
16
|
+
* -f examples/eval-files/sdk-demo.eval.js -a demo
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const { test, expect } = require('@opensearch-project/agent-health');
|
|
20
|
+
|
|
21
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
22
|
+
// 1. Deterministic — agent runs, all assertions are local chai matchers
|
|
23
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
test('mock-says-hello', {
|
|
26
|
+
prompt: 'Say hello in one short sentence.',
|
|
27
|
+
description: 'Mock agent must produce a non-empty response within 30s',
|
|
28
|
+
labels: ['category:Smoke', 'difficulty:Easy', 'method:deterministic'],
|
|
29
|
+
}, async function ({ agent }) {
|
|
30
|
+
const result = await agent.run();
|
|
31
|
+
expect(result.trajectory).to.have.length.greaterThan(0);
|
|
32
|
+
expect(result.agentOutput.trim()).to.have.length.greaterThan(0);
|
|
33
|
+
expect(result).to.haveCompletedWithin(30_000);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
37
|
+
// 2. Agentic (hybrid) — deterministic preflight + LLM judge for semantic claim
|
|
38
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
test('mock-rca-judged', {
|
|
41
|
+
prompt: 'Diagnose why the payment service is failing and explain the root cause.',
|
|
42
|
+
description: 'Hybrid: structural checks first, then LLM judge for semantic correctness',
|
|
43
|
+
context: [
|
|
44
|
+
{
|
|
45
|
+
description: 'Error log',
|
|
46
|
+
value: 'ERROR 2026-05-20 10:31:22 [payment-service] Connection refused to db-primary:5432',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
labels: ['category:RCA', 'difficulty:Medium', 'method:agentic'],
|
|
50
|
+
}, async function ({ agent, judge }) {
|
|
51
|
+
const result = await agent.run();
|
|
52
|
+
|
|
53
|
+
// Cheap deterministic preflight — fail fast before spending $ on the judge
|
|
54
|
+
expect(result.trajectory).to.have.length.greaterThan(0);
|
|
55
|
+
expect(result).to.haveCompletedWithin(60_000);
|
|
56
|
+
|
|
57
|
+
// LLM judge — produces a structured matcher verdict with score + reasoning
|
|
58
|
+
await judge(result, 'Mentions the payment service or its database connection failure');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
62
|
+
// 3. Deterministic, no prompt — agent never invoked, $0 / 0ms agent step
|
|
63
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
test('data-only-no-prompt', {
|
|
66
|
+
description: 'Pure data check; agent invocation skipped entirely',
|
|
67
|
+
labels: ['category:Data Quality', 'difficulty:Easy', 'method:deterministic'],
|
|
68
|
+
}, function ({ result }) {
|
|
69
|
+
expect(result.durationMs).to.equal(0);
|
|
70
|
+
expect(result.trajectory).to.have.length(0);
|
|
71
|
+
expect(2 + 2).to.equal(4);
|
|
72
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SDK demo with describe() grouping. Each describe() block declares a
|
|
8
|
+
* benchmark; CLI auto-creates one benchmark per group and runs them.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { describe, test, expect } = require('@opensearch-project/agent-health');
|
|
12
|
+
|
|
13
|
+
describe('RCA Suite', () => {
|
|
14
|
+
test('payment service is the root cause', {
|
|
15
|
+
prompt: 'Diagnose why the payment service is failing.',
|
|
16
|
+
context: [{ description: 'Error log', value: 'ERROR [payment-service] Connection refused to db-primary:5432' }],
|
|
17
|
+
labels: ['category:RCA', 'difficulty:Medium'],
|
|
18
|
+
}, async function ({ agent, judge }) {
|
|
19
|
+
const result = await agent.run();
|
|
20
|
+
expect(result.trajectory).to.have.length.greaterThan(0);
|
|
21
|
+
expect(result).to.haveCompletedWithin(60_000);
|
|
22
|
+
await judge(result, 'Mentions the payment service or its database connection failure');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('budget cap', {
|
|
26
|
+
prompt: 'Summarize the system in one paragraph.',
|
|
27
|
+
labels: ['category:Budget', 'difficulty:Easy'],
|
|
28
|
+
}, async function ({ agent, traces }) {
|
|
29
|
+
const result = await agent.run();
|
|
30
|
+
expect(result.agentOutput.length).to.be.greaterThan(0);
|
|
31
|
+
expect(traces.totalTokens).to.be.lessThan(50_000);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('Smoke', () => {
|
|
36
|
+
test('says hello', {
|
|
37
|
+
prompt: 'Say hello in one short sentence.',
|
|
38
|
+
labels: ['category:Smoke', 'difficulty:Easy'],
|
|
39
|
+
}, async function ({ agent }) {
|
|
40
|
+
const result = await agent.run();
|
|
41
|
+
expect(result.trajectory).to.have.length.greaterThan(0);
|
|
42
|
+
expect(result.agentOutput.trim()).to.have.length.greaterThan(0);
|
|
43
|
+
expect(result).to.haveCompletedWithin(30_000);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Tests outside any describe() — go to the file-default benchmark
|
|
48
|
+
test('orphan-deterministic', function () {
|
|
49
|
+
expect(2 + 2).to.equal(4);
|
|
50
|
+
});
|