@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.
- package/README.md +77 -6
- package/cli/dist/index.js +10072 -4502
- package/deployment/cloudformation/agent-health-observability.yaml +762 -0
- package/dist/assets/index-CCQRDlO0.js +243 -0
- package/dist/assets/index-CNHQVbcj.css +1 -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 +431 -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 +390 -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 +577 -0
- package/docs/SKILLS.md +264 -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 +598 -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/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/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/benchmarkVersionUtils.d.ts +37 -0
- package/lib/dist/lib/benchmarkVersionUtils.d.ts.map +1 -0
- package/lib/dist/lib/benchmarkVersionUtils.js +68 -0
- package/lib/dist/lib/benchmarkVersionUtils.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 +258 -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 +231 -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 +70 -0
- package/lib/dist/lib/constants.d.ts.map +1 -0
- package/lib/dist/lib/constants.js +365 -0
- package/lib/dist/lib/constants.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 +73 -0
- package/lib/dist/lib/envCompat.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 +55 -0
- package/lib/dist/lib/matchers/traces.d.ts.map +1 -0
- package/lib/dist/lib/matchers/traces.js +116 -0
- package/lib/dist/lib/matchers/traces.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 +92 -0
- package/lib/dist/lib/runStats.d.ts.map +1 -0
- package/lib/dist/lib/runStats.js +160 -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 +26 -0
- package/lib/dist/lib/testCases/loader.d.ts.map +1 -0
- package/lib/dist/lib/testCases/loader.js +149 -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 +96 -0
- package/lib/dist/lib/utils.d.ts.map +1 -0
- package/lib/dist/lib/utils.js +232 -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 +116 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.d.ts.map +1 -0
- package/lib/dist/services/connectors/claude-code/ClaudeCodeConnector.js +403 -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 +418 -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 +64 -0
- package/lib/dist/services/evaluation/bedrockJudge.d.ts.map +1 -0
- package/lib/dist/services/evaluation/bedrockJudge.js +167 -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 +429 -0
- package/lib/dist/services/storage/asyncBenchmarkStorage.js.map +1 -0
- package/lib/dist/services/storage/asyncRunStorage.d.ts +127 -0
- package/lib/dist/services/storage/asyncRunStorage.d.ts.map +1 -0
- package/lib/dist/services/storage/asyncRunStorage.js +448 -0
- package/lib/dist/services/storage/asyncRunStorage.js.map +1 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.d.ts +156 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.d.ts.map +1 -0
- package/lib/dist/services/storage/asyncTestCaseStorage.js +285 -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 +924 -0
- package/lib/dist/services/storage/opensearchClient.d.ts.map +1 -0
- package/lib/dist/services/storage/opensearchClient.js +435 -0
- package/lib/dist/services/storage/opensearchClient.js.map +1 -0
- package/lib/dist/services/traces/browserRecovery.d.ts +26 -0
- package/lib/dist/services/traces/browserRecovery.d.ts.map +1 -0
- package/lib/dist/services/traces/browserRecovery.js +81 -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 +251 -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 +387 -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 +84 -0
- package/lib/dist/services/traces/tracePoller.d.ts.map +1 -0
- package/lib/dist/services/traces/tracePoller.js +309 -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 +1175 -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 +64 -13
- package/server/dist/app.js +32651 -17637
- package/server/dist/index.js +29875 -14638
- package/tsconfig.lib.json +71 -0
- package/dist/assets/index-EvPLSTAS.js +0 -267
- package/dist/assets/index-RXasQKUs.css +0 -1
- package/lib/dist/config/index.js +0 -404
- package/lib/dist/index.js +0 -1665
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Instrument Your Agent with OpenTelemetry
|
|
7
|
+
|
|
8
|
+
This guide is a prompt you can give to a coding agent (Claude Code, Cursor, Copilot, etc.) to instrument your application with OpenTelemetry and route telemetry to the Agent Health observability stack.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Quick Start: Give This Prompt to Your Coding Agent
|
|
13
|
+
|
|
14
|
+
Copy the prompt below and paste it into your coding agent. It will instrument your application with the correct OTel attributes that Agent Health expects.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## The Prompt
|
|
19
|
+
|
|
20
|
+
````markdown
|
|
21
|
+
# Task: Instrument this application with OpenTelemetry
|
|
22
|
+
|
|
23
|
+
Add OpenTelemetry instrumentation to this application following the GenAI semantic conventions so that traces are compatible with the Agent Health observability dashboard.
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
### 1. Install Dependencies
|
|
28
|
+
|
|
29
|
+
For Python:
|
|
30
|
+
```bash
|
|
31
|
+
pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp-proto-http opentelemetry-semantic-conventions
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For TypeScript/Node.js:
|
|
35
|
+
```bash
|
|
36
|
+
npm install @opentelemetry/api @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-http @opentelemetry/semantic-conventions
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Initialize the Tracer
|
|
40
|
+
|
|
41
|
+
Configure an OTLP exporter that sends traces to the endpoint specified by `OTEL_EXPORTER_OTLP_ENDPOINT`. Use `http/protobuf` protocol.
|
|
42
|
+
|
|
43
|
+
**Python:**
|
|
44
|
+
```python
|
|
45
|
+
from opentelemetry import trace
|
|
46
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
47
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
48
|
+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
|
49
|
+
from opentelemetry.sdk.resources import Resource
|
|
50
|
+
import os
|
|
51
|
+
|
|
52
|
+
resource = Resource.create({
|
|
53
|
+
"service.name": os.getenv("OTEL_SERVICE_NAME", "my-agent"),
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
provider = TracerProvider(resource=resource)
|
|
57
|
+
exporter = OTLPSpanExporter(
|
|
58
|
+
endpoint=os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4318") + "/v1/traces",
|
|
59
|
+
)
|
|
60
|
+
provider.add_span_processor(BatchSpanProcessor(exporter))
|
|
61
|
+
trace.set_tracer_provider(provider)
|
|
62
|
+
tracer = trace.get_tracer("my-agent")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**TypeScript:**
|
|
66
|
+
```typescript
|
|
67
|
+
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
68
|
+
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
69
|
+
import { Resource } from '@opentelemetry/resources';
|
|
70
|
+
|
|
71
|
+
const sdk = new NodeSDK({
|
|
72
|
+
resource: new Resource({
|
|
73
|
+
'service.name': process.env.OTEL_SERVICE_NAME || 'my-agent',
|
|
74
|
+
}),
|
|
75
|
+
traceExporter: new OTLPTraceExporter({
|
|
76
|
+
url: (process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318') + '/v1/traces',
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
sdk.start();
|
|
80
|
+
|
|
81
|
+
import { trace } from '@opentelemetry/api';
|
|
82
|
+
const tracer = trace.getTracer('my-agent');
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 3. Span Structure (Required)
|
|
86
|
+
|
|
87
|
+
Create spans in this hierarchy:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Root span: agent invocation (gen_ai.operation.name = "invoke_agent")
|
|
91
|
+
├── LLM call (gen_ai.operation.name = "chat")
|
|
92
|
+
├── Tool execution (gen_ai.operation.name = "execute_tool")
|
|
93
|
+
├── LLM call (gen_ai.operation.name = "chat")
|
|
94
|
+
└── ...
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 4. Required Span Attributes
|
|
98
|
+
|
|
99
|
+
These attributes MUST be set on spans for Agent Health to correctly categorize and compute metrics.
|
|
100
|
+
|
|
101
|
+
#### Agent Spans (root span)
|
|
102
|
+
|
|
103
|
+
| Attribute | Value | Example |
|
|
104
|
+
|-----------|-------|---------|
|
|
105
|
+
| `gen_ai.operation.name` | `"invoke_agent"` or `"create_agent"` | `"invoke_agent"` |
|
|
106
|
+
| `gen_ai.agent.name` | Your agent's name | `"rca-agent"` |
|
|
107
|
+
| `gen_ai.system` | Provider identifier | `"aws.bedrock"`, `"openai"`, `"anthropic"` |
|
|
108
|
+
| `gen_ai.conversation.id` | Unique run/session ID — links the trace to an Agent Health run | `"run-abc123"` |
|
|
109
|
+
|
|
110
|
+
> **Run correlation.** Agent Health ties a trace to a run with, in order of
|
|
111
|
+
> preference: **(A)** W3C trace context (if you propagate the `traceparent`
|
|
112
|
+
> Agent Health injects, your spans share its `traceId` automatically); **(B)**
|
|
113
|
+
> the OTEL-standard **`gen_ai.conversation.id`** set to the run id (recommended
|
|
114
|
+
> for your own instrumentation — it's also accepted as `agent_health.run.id`);
|
|
115
|
+
> **(C)** `service.name` + the run's time window; **(D)** the OTEL `session.id`
|
|
116
|
+
> if your agent already emits one per run (e.g. Claude Code). You only need one;
|
|
117
|
+
> `gen_ai.conversation.id` is the simplest to add. (`gen_ai.request.id` is **not**
|
|
118
|
+
> a registered attribute — don't use it.)
|
|
119
|
+
|
|
120
|
+
#### LLM Call Spans
|
|
121
|
+
|
|
122
|
+
| Attribute | Value | Example |
|
|
123
|
+
|-----------|-------|---------|
|
|
124
|
+
| `gen_ai.operation.name` | `"chat"`, `"text_completion"`, or `"generate_content"` | `"chat"` |
|
|
125
|
+
| `gen_ai.request.model` | Full model identifier | `"anthropic.claude-sonnet-4-20250514-v1:0"` |
|
|
126
|
+
| `gen_ai.system` | Provider identifier | `"aws.bedrock"` |
|
|
127
|
+
| `gen_ai.usage.input_tokens` | Integer token count | `1234` |
|
|
128
|
+
| `gen_ai.usage.output_tokens` | Integer token count | `567` |
|
|
129
|
+
| `gen_ai.request.temperature` | Float (optional) | `0.7` |
|
|
130
|
+
|
|
131
|
+
#### Tool Execution Spans
|
|
132
|
+
|
|
133
|
+
| Attribute | Value | Example |
|
|
134
|
+
|-----------|-------|---------|
|
|
135
|
+
| `gen_ai.operation.name` | `"execute_tool"` | `"execute_tool"` |
|
|
136
|
+
| `gen_ai.tool.name` | Name of the tool invoked | `"search_logs"` |
|
|
137
|
+
| `gen_ai.tool.call_id` | Unique tool call ID (optional) | `"call_abc123"` |
|
|
138
|
+
|
|
139
|
+
### 5. Implementation Pattern
|
|
140
|
+
|
|
141
|
+
**Python example — wrapping an agent loop:**
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from opentelemetry import trace
|
|
145
|
+
from opentelemetry.trace import StatusCode
|
|
146
|
+
import uuid
|
|
147
|
+
|
|
148
|
+
tracer = trace.get_tracer("my-agent")
|
|
149
|
+
|
|
150
|
+
def run_agent(prompt: str, run_id: str = None):
|
|
151
|
+
run_id = run_id or str(uuid.uuid4())
|
|
152
|
+
|
|
153
|
+
with tracer.start_as_current_span("invoke_agent") as agent_span:
|
|
154
|
+
agent_span.set_attribute("gen_ai.operation.name", "invoke_agent")
|
|
155
|
+
agent_span.set_attribute("gen_ai.agent.name", "my-rca-agent")
|
|
156
|
+
agent_span.set_attribute("gen_ai.system", "aws.bedrock")
|
|
157
|
+
agent_span.set_attribute("gen_ai.conversation.id", run_id) # links the trace to an Agent Health run
|
|
158
|
+
|
|
159
|
+
# LLM call
|
|
160
|
+
with tracer.start_as_current_span("chat") as llm_span:
|
|
161
|
+
llm_span.set_attribute("gen_ai.operation.name", "chat")
|
|
162
|
+
llm_span.set_attribute("gen_ai.request.model", "anthropic.claude-sonnet-4-20250514-v1:0")
|
|
163
|
+
llm_span.set_attribute("gen_ai.system", "aws.bedrock")
|
|
164
|
+
|
|
165
|
+
response = call_llm(prompt)
|
|
166
|
+
|
|
167
|
+
llm_span.set_attribute("gen_ai.usage.input_tokens", response.input_tokens)
|
|
168
|
+
llm_span.set_attribute("gen_ai.usage.output_tokens", response.output_tokens)
|
|
169
|
+
|
|
170
|
+
# Tool execution (if the LLM requested a tool call)
|
|
171
|
+
if response.tool_calls:
|
|
172
|
+
for tool_call in response.tool_calls:
|
|
173
|
+
with tracer.start_as_current_span("execute_tool") as tool_span:
|
|
174
|
+
tool_span.set_attribute("gen_ai.operation.name", "execute_tool")
|
|
175
|
+
tool_span.set_attribute("gen_ai.tool.name", tool_call.name)
|
|
176
|
+
tool_span.set_attribute("gen_ai.tool.call_id", tool_call.id)
|
|
177
|
+
|
|
178
|
+
result = execute_tool(tool_call)
|
|
179
|
+
|
|
180
|
+
if result.error:
|
|
181
|
+
tool_span.set_status(StatusCode.ERROR, result.error)
|
|
182
|
+
|
|
183
|
+
return response
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**TypeScript example:**
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { trace, SpanStatusCode } from '@opentelemetry/api';
|
|
190
|
+
import { v4 as uuid } from 'uuid';
|
|
191
|
+
|
|
192
|
+
const tracer = trace.getTracer('my-agent');
|
|
193
|
+
|
|
194
|
+
async function runAgent(prompt: string, runId?: string) {
|
|
195
|
+
runId = runId || uuid();
|
|
196
|
+
|
|
197
|
+
return tracer.startActiveSpan('invoke_agent', async (agentSpan) => {
|
|
198
|
+
agentSpan.setAttribute('gen_ai.operation.name', 'invoke_agent');
|
|
199
|
+
agentSpan.setAttribute('gen_ai.agent.name', 'my-rca-agent');
|
|
200
|
+
agentSpan.setAttribute('gen_ai.system', 'aws.bedrock');
|
|
201
|
+
agentSpan.setAttribute('gen_ai.conversation.id', runId); // links the trace to an Agent Health run
|
|
202
|
+
|
|
203
|
+
try {
|
|
204
|
+
// LLM call
|
|
205
|
+
const response = await tracer.startActiveSpan('chat', async (llmSpan) => {
|
|
206
|
+
llmSpan.setAttribute('gen_ai.operation.name', 'chat');
|
|
207
|
+
llmSpan.setAttribute('gen_ai.request.model', 'anthropic.claude-sonnet-4-20250514-v1:0');
|
|
208
|
+
llmSpan.setAttribute('gen_ai.system', 'aws.bedrock');
|
|
209
|
+
|
|
210
|
+
const resp = await callLLM(prompt);
|
|
211
|
+
|
|
212
|
+
llmSpan.setAttribute('gen_ai.usage.input_tokens', resp.inputTokens);
|
|
213
|
+
llmSpan.setAttribute('gen_ai.usage.output_tokens', resp.outputTokens);
|
|
214
|
+
llmSpan.end();
|
|
215
|
+
return resp;
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// Tool execution
|
|
219
|
+
for (const toolCall of response.toolCalls || []) {
|
|
220
|
+
await tracer.startActiveSpan('execute_tool', async (toolSpan) => {
|
|
221
|
+
toolSpan.setAttribute('gen_ai.operation.name', 'execute_tool');
|
|
222
|
+
toolSpan.setAttribute('gen_ai.tool.name', toolCall.name);
|
|
223
|
+
toolSpan.setAttribute('gen_ai.tool.call_id', toolCall.id);
|
|
224
|
+
|
|
225
|
+
const result = await executeTool(toolCall);
|
|
226
|
+
if (result.error) {
|
|
227
|
+
toolSpan.setStatus({ code: SpanStatusCode.ERROR, message: result.error });
|
|
228
|
+
}
|
|
229
|
+
toolSpan.end();
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
agentSpan.end();
|
|
234
|
+
return response;
|
|
235
|
+
} catch (err) {
|
|
236
|
+
agentSpan.setStatus({ code: SpanStatusCode.ERROR, message: String(err) });
|
|
237
|
+
agentSpan.end();
|
|
238
|
+
throw err;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### 6. Configure Telemetry Export and Agent Health
|
|
245
|
+
|
|
246
|
+
#### A. Set environment variables to emit traces
|
|
247
|
+
|
|
248
|
+
Set these in your shell or `.env` file to route telemetry from your agent to the OTLP endpoint:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Required: enable OTLP export
|
|
252
|
+
export OTEL_TRACES_EXPORTER=otlp
|
|
253
|
+
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
|
254
|
+
export OTEL_EXPORTER_OTLP_ENDPOINT=<YOUR_OTLP_ENDPOINT>
|
|
255
|
+
|
|
256
|
+
# Recommended: identify your service
|
|
257
|
+
export OTEL_SERVICE_NAME=my-agent
|
|
258
|
+
|
|
259
|
+
# Optional: also export logs and metrics
|
|
260
|
+
export OTEL_METRICS_EXPORTER=otlp
|
|
261
|
+
export OTEL_LOGS_EXPORTER=otlp
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Replace `<YOUR_OTLP_ENDPOINT>` with one of:
|
|
265
|
+
- **Agent Health API Gateway**: `https://<api-gateway-id>.execute-api.<region>.amazonaws.com/prod` (from CloudFormation stack)
|
|
266
|
+
- **Local ADOT collector**: `http://localhost:4318`
|
|
267
|
+
- **Direct OSIS pipeline**: `https://<osis-endpoint>.osis.<region>.amazonaws.com`
|
|
268
|
+
|
|
269
|
+
#### B. Configure Agent Health to read traces from OpenSearch
|
|
270
|
+
|
|
271
|
+
After traces are flowing into your OpenSearch domain, configure Agent Health to access them.
|
|
272
|
+
|
|
273
|
+
**Option 1: CLI setup (recommended)**
|
|
274
|
+
|
|
275
|
+
Run the setup command to configure everything interactively:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
npx @opensearch-project/agent-health setup-telemetry
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
This deploys the telemetry stack and writes the observability config to `agent-health.config.json` automatically.
|
|
282
|
+
|
|
283
|
+
**Option 2: JSON config file (manual)**
|
|
284
|
+
|
|
285
|
+
In your `agent-health.config.json`:
|
|
286
|
+
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"observability": {
|
|
290
|
+
"endpoint": "https://search-my-domain.us-west-2.es.amazonaws.com",
|
|
291
|
+
"authType": "sigv4",
|
|
292
|
+
"awsRegion": "us-west-2",
|
|
293
|
+
"awsService": "es",
|
|
294
|
+
"tracesIndex": "otel-v1-apm-span-*"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
For basic auth:
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"observability": {
|
|
304
|
+
"endpoint": "https://search-my-domain.us-west-2.es.amazonaws.com",
|
|
305
|
+
"authType": "basic",
|
|
306
|
+
"username": "admin",
|
|
307
|
+
"password": "your-password",
|
|
308
|
+
"tracesIndex": "otel-v1-apm-span-*"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
#### C. Verify the connection
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
npx @opensearch-project/agent-health doctor
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Confirm that the "Observability" check shows a connected OpenSearch domain with the correct traces index.
|
|
320
|
+
|
|
321
|
+
### 7. Validation Checklist
|
|
322
|
+
|
|
323
|
+
After instrumenting, verify your spans include:
|
|
324
|
+
|
|
325
|
+
- [ ] Root span has `gen_ai.operation.name` = `"invoke_agent"` and `gen_ai.agent.name`
|
|
326
|
+
- [ ] LLM spans have `gen_ai.operation.name` = `"chat"` and `gen_ai.request.model`
|
|
327
|
+
- [ ] LLM spans report `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`
|
|
328
|
+
- [ ] Tool spans have `gen_ai.operation.name` = `"execute_tool"` and `gen_ai.tool.name`
|
|
329
|
+
- [ ] All spans share the same trace ID (automatic if using `start_as_current_span`)
|
|
330
|
+
- [ ] `gen_ai.conversation.id` on the root span matches the run ID used in Agent Health (or you propagate W3C `traceparent`)
|
|
331
|
+
- [ ] Failed operations set span status to ERROR
|
|
332
|
+
|
|
333
|
+
### 8. What Agent Health Does With Your Traces
|
|
334
|
+
|
|
335
|
+
Agent Health uses these attributes to:
|
|
336
|
+
- **Categorize spans**: `gen_ai.operation.name` determines if a span is AGENT, LLM, TOOL, or OTHER
|
|
337
|
+
- **Calculate cost**: `gen_ai.usage.input_tokens` + `gen_ai.usage.output_tokens` + `gen_ai.request.model` → USD cost
|
|
338
|
+
- **Track tool usage**: `gen_ai.tool.name` populates tool call counts and tool lists
|
|
339
|
+
- **Correlate runs**: `gen_ai.conversation.id` (or W3C trace context / `agent_health.run.id`, with `session.id` as a precise fallback) links traces to benchmark runs
|
|
340
|
+
- **Measure duration**: Span start/end times compute total and per-step latency
|
|
341
|
+
- **Detect errors**: Span status ERROR is surfaced in the trace viewer
|
|
342
|
+
|
|
343
|
+
### 9. Common Mistakes
|
|
344
|
+
|
|
345
|
+
- **Missing `gen_ai.operation.name`**: Spans without this attribute fall into "OTHER" category and won't be counted as LLM/Tool calls
|
|
346
|
+
- **Token counts as strings**: Must be integers, not strings like `"1234"`
|
|
347
|
+
- **Not ending spans**: Always call `span.end()` (or use context manager in Python) — unended spans are never exported
|
|
348
|
+
- **Wrong model ID format**: Use the full model identifier (e.g., `anthropic.claude-sonnet-4-20250514-v1:0`), not just `claude-sonnet`
|
|
349
|
+
````
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Deploying the Telemetry Backend
|
|
354
|
+
|
|
355
|
+
If you haven't set up the observability stack yet, use the Agent Health CLI:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
npx @opensearch-project/agent-health setup-telemetry --deploy
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
This deploys a CloudFormation stack with:
|
|
362
|
+
- API Gateway (OTLP endpoint with Lambda SigV4 proxy)
|
|
363
|
+
- OSIS pipelines (traces + logs)
|
|
364
|
+
- OpenSearch domain (stores spans at `otel-v1-apm-span-*`)
|
|
365
|
+
|
|
366
|
+
After deployment, the CLI prints the `OTEL_EXPORTER_OTLP_ENDPOINT` value to use.
|
|
367
|
+
|
|
368
|
+
## Using as a Claude Code Skill
|
|
369
|
+
|
|
370
|
+
To make this available as a slash command in Claude Code, add to your project's `.claude/skills/instrument-otel.md`:
|
|
371
|
+
|
|
372
|
+
```markdown
|
|
373
|
+
---
|
|
374
|
+
description: Instrument the current application with OpenTelemetry for Agent Health
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
[paste the prompt section above]
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
Then invoke with `/instrument-otel` in any Claude Code session.
|
|
381
|
+
|
|
382
|
+
## Using as an MCP Resource
|
|
383
|
+
|
|
384
|
+
If you run an MCP server, expose this document as a resource at `agent-health://instrumentation-guide` so any connected coding agent can retrieve it on demand.
|
|
385
|
+
|
|
386
|
+
## Reference
|
|
387
|
+
|
|
388
|
+
- [OTel GenAI Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/)
|
|
389
|
+
- [OTel GenAI Agent Spans](https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-agent-spans/)
|
|
390
|
+
- [Agent Health Telemetry Setup](./CLAUDE_CODE_TELEMETRY.md)
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# ML-Commons Agent Setup
|
|
2
|
+
|
|
3
|
+
This guide covers setting up the ML-Commons AG-UI agent for use with Agent Health.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Agent Health --> ML-Commons Agent (9200) --> MCP Server (3030) --> OpenSearch Data Cluster
|
|
9
|
+
|
|
|
10
|
+
Bedrock LLM (Claude)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Components:**
|
|
14
|
+
- **ML-Commons**: OpenSearch plugin providing AG-UI streaming agent
|
|
15
|
+
- **MCP Server**: Provides OpenSearch tools to the agent
|
|
16
|
+
- **Bedrock**: LLM backend for agent reasoning
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
| Requirement | Version | Purpose |
|
|
21
|
+
|-------------|---------|---------|
|
|
22
|
+
| Java | 11+ | OpenSearch and ML-Commons |
|
|
23
|
+
| Python | 3.9+ | MCP server (`pip install uvx`) |
|
|
24
|
+
| AWS CLI | 2.x | Profile-based authentication |
|
|
25
|
+
| AWS Profile | - | Configured profile with Bedrock access |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Option 1: Automated Setup
|
|
30
|
+
|
|
31
|
+
### Prerequisites
|
|
32
|
+
1. ML-Commons must be running on port 9200
|
|
33
|
+
2. `AWS_PROFILE` must be set (in `.env` or environment)
|
|
34
|
+
|
|
35
|
+
### Quick Start
|
|
36
|
+
```bash
|
|
37
|
+
# Set your AWS profile
|
|
38
|
+
export AWS_PROFILE=Bedrock
|
|
39
|
+
|
|
40
|
+
# Run setup
|
|
41
|
+
./scripts/setup.sh
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Script Options
|
|
45
|
+
|
|
46
|
+
| Command | Description |
|
|
47
|
+
|---------|-------------|
|
|
48
|
+
| `./scripts/setup.sh` | Register agent, update .env, start servers |
|
|
49
|
+
| `./scripts/setup.sh --stop` | Stop MCP server and Agent Health (not ML-Commons) |
|
|
50
|
+
| `./scripts/setup.sh --status` | Check which services are running |
|
|
51
|
+
|
|
52
|
+
### What the Script Does
|
|
53
|
+
|
|
54
|
+
1. Validates AWS profile and fetches credentials
|
|
55
|
+
2. Starts MCP server if not running (port 3030)
|
|
56
|
+
3. Registers Bedrock model with credentials from profile
|
|
57
|
+
4. Creates MCP connector pointing to localhost:3030
|
|
58
|
+
5. Registers AG-UI agent with the model and MCP connector
|
|
59
|
+
6. Tests agent execution to verify setup works
|
|
60
|
+
7. Updates `.env` with new agent endpoint
|
|
61
|
+
8. Starts Agent Health server (port 4001)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Option 2: Manual Setup
|
|
66
|
+
|
|
67
|
+
### Step 1: Clone and Build OpenSearch Core
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
mkdir ~/agenteval-workspace && cd ~/agenteval-workspace
|
|
71
|
+
|
|
72
|
+
git clone https://github.com/opensearch-project/OpenSearch
|
|
73
|
+
cd OpenSearch
|
|
74
|
+
|
|
75
|
+
# Build streaming plugins
|
|
76
|
+
./gradlew :plugins:transport-reactor-netty4:assemble
|
|
77
|
+
./gradlew :plugins:arrow-flight-rpc:assemble
|
|
78
|
+
|
|
79
|
+
export OPENSEARCH_CORE_PATH=$(pwd)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Step 2: Clone and Start ML-Commons
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cd ~/agenteval-workspace
|
|
86
|
+
|
|
87
|
+
git clone https://github.com/jiapingzeng/ml-commons
|
|
88
|
+
cd ml-commons
|
|
89
|
+
git switch 3.4-jpz
|
|
90
|
+
|
|
91
|
+
# Start with streaming enabled (keep terminal running)
|
|
92
|
+
./gradlew run -Dstreaming=true
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Step 3: Start MCP Server
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Set credentials for the OpenSearch cluster the agent will query
|
|
99
|
+
OPENSEARCH_URL=https://your-opensearch-cluster.aos.us-west-2.on.aws \
|
|
100
|
+
OPENSEARCH_USERNAME=admin \
|
|
101
|
+
OPENSEARCH_PASSWORD=your_password \
|
|
102
|
+
uvx opensearch-mcp-server-py@0.5.2 --transport stream --port 3030
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Step 4: Configure ML-Commons Settings
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
curl -X PUT 'http://localhost:9200/_cluster/settings' \
|
|
109
|
+
-H 'Content-Type: application/json' \
|
|
110
|
+
-d '{
|
|
111
|
+
"persistent": {
|
|
112
|
+
"plugins.ml_commons.trusted_connector_endpoints_regex": [
|
|
113
|
+
"http://localhost:3030",
|
|
114
|
+
"^https://bedrock-runtime\\..*[a-z0-9-]\\.amazonaws\\.com/.*$"
|
|
115
|
+
],
|
|
116
|
+
"plugins.ml_commons.stream_enabled": true,
|
|
117
|
+
"plugins.ml_commons.mcp_connector_enabled": true,
|
|
118
|
+
"plugins.ml_commons.ag_ui_enabled": true,
|
|
119
|
+
"plugins.ml_commons.mcp_header_passthrough_enabled": true
|
|
120
|
+
}
|
|
121
|
+
}'
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Step 5: Register Bedrock Model
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Ensure your AWS credentials are configured (choose one method):
|
|
128
|
+
# Option 1: Use AWS CLI profile
|
|
129
|
+
export AWS_PROFILE=your-profile-name
|
|
130
|
+
|
|
131
|
+
# Option 2: Set credentials directly
|
|
132
|
+
export AWS_ACCESS_KEY_ID=your_access_key
|
|
133
|
+
export AWS_SECRET_ACCESS_KEY=your_secret_key
|
|
134
|
+
export AWS_SESSION_TOKEN=your_session_token # if using temporary credentials
|
|
135
|
+
|
|
136
|
+
# Register model (save the model_id from response)
|
|
137
|
+
curl 'http://localhost:9200/_plugins/_ml/models/_register?deploy=true' \
|
|
138
|
+
-H 'Content-Type: application/json' \
|
|
139
|
+
-d '{
|
|
140
|
+
"name": "Claude Sonnet",
|
|
141
|
+
"function_name": "remote",
|
|
142
|
+
"connector": {
|
|
143
|
+
"name": "Bedrock Converse Connector",
|
|
144
|
+
"protocol": "aws_sigv4",
|
|
145
|
+
"parameters": {
|
|
146
|
+
"region": "us-east-1",
|
|
147
|
+
"model": "us.anthropic.claude-sonnet-4-20250514-v1:0",
|
|
148
|
+
"service_name": "bedrock"
|
|
149
|
+
},
|
|
150
|
+
"credential": {
|
|
151
|
+
"access_key": "YOUR_AWS_ACCESS_KEY_ID",
|
|
152
|
+
"secret_key": "YOUR_AWS_SECRET_ACCESS_KEY",
|
|
153
|
+
"session_token": "YOUR_AWS_SESSION_TOKEN"
|
|
154
|
+
},
|
|
155
|
+
"actions": [{
|
|
156
|
+
"action_type": "predict",
|
|
157
|
+
"method": "POST",
|
|
158
|
+
"url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model}/converse",
|
|
159
|
+
"request_body": "{\"messages\": [${parameters._chat_history:-}{\"role\":\"user\",\"content\":[{\"text\":\"${parameters.prompt}\"}]}${parameters._interactions:-}]${parameters.tool_configs:-}}"
|
|
160
|
+
}]
|
|
161
|
+
}
|
|
162
|
+
}'
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Step 6: Create MCP Connector
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
curl 'http://localhost:9200/_plugins/_ml/connectors/_create' \
|
|
169
|
+
-H 'Content-Type: application/json' \
|
|
170
|
+
-d '{
|
|
171
|
+
"name": "OpenSearch MCP Server",
|
|
172
|
+
"protocol": "mcp_streamable_http",
|
|
173
|
+
"url": "http://localhost:3030",
|
|
174
|
+
"parameters": { "endpoint": "/mcp/" }
|
|
175
|
+
}'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Step 7: Register AG-UI Agent
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Replace MODEL_ID and MCP_CONNECTOR_ID from previous steps
|
|
182
|
+
curl 'http://localhost:9200/_plugins/_ml/agents/_register' \
|
|
183
|
+
-H 'Content-Type: application/json' \
|
|
184
|
+
-d '{
|
|
185
|
+
"name": "AG-UI chat agent",
|
|
186
|
+
"type": "AG_UI",
|
|
187
|
+
"llm": {
|
|
188
|
+
"model_id": "MODEL_ID",
|
|
189
|
+
"parameters": {
|
|
190
|
+
"max_iteration": 50,
|
|
191
|
+
"system_prompt": "You are a helpful assistant.",
|
|
192
|
+
"prompt": "Context:${parameters.context}\nQuestion:${parameters.question}"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"parameters": {
|
|
196
|
+
"_llm_interface": "bedrock/converse/claude",
|
|
197
|
+
"mcp_connectors": [{ "mcp_connector_id": "MCP_CONNECTOR_ID" }]
|
|
198
|
+
},
|
|
199
|
+
"tools": []
|
|
200
|
+
}'
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Step 8: Configure Agent Health
|
|
204
|
+
|
|
205
|
+
Update `.env` with your agent ID:
|
|
206
|
+
```bash
|
|
207
|
+
MLCOMMONS_ENDPOINT=http://localhost:9200/_plugins/_ml/agents/{agent_id}/_execute/stream
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Environment Variables
|
|
213
|
+
|
|
214
|
+
### ML-Commons Agent Headers
|
|
215
|
+
|
|
216
|
+
These headers allow the ML-Commons agent to access the OpenSearch data cluster:
|
|
217
|
+
|
|
218
|
+
| Variable | Description |
|
|
219
|
+
|----------|-------------|
|
|
220
|
+
| `MLCOMMONS_ENDPOINT` | Agent streaming endpoint (includes agent_id) |
|
|
221
|
+
| `MLCOMMONS_HEADER_OPENSEARCH_URL` | Target OpenSearch cluster URL |
|
|
222
|
+
| `MLCOMMONS_HEADER_AWS_REGION` | AWS region for signing |
|
|
223
|
+
| `MLCOMMONS_HEADER_AWS_SERVICE_NAME` | Service name (`es` or `aoss`) |
|
|
224
|
+
| `MLCOMMONS_HEADER_AWS_ACCESS_KEY_ID` | AWS access key |
|
|
225
|
+
| `MLCOMMONS_HEADER_AWS_SECRET_ACCESS_KEY` | AWS secret key |
|
|
226
|
+
| `MLCOMMONS_HEADER_AWS_SESSION_TOKEN` | AWS session token |
|
|
227
|
+
|
|
228
|
+
### OpenSearch Storage & Observability (AWS SigV4)
|
|
229
|
+
|
|
230
|
+
Agent Health can connect to OpenSearch clusters using AWS SigV4 instead of username/password. This is useful for AWS-managed OpenSearch domains and OpenSearch Serverless.
|
|
231
|
+
|
|
232
|
+
**Storage cluster (for persisting test cases, benchmarks, and results):**
|
|
233
|
+
|
|
234
|
+
| Variable | Description |
|
|
235
|
+
|----------|-------------|
|
|
236
|
+
| `OPENSEARCH_STORAGE_ENDPOINT` | Storage cluster URL |
|
|
237
|
+
| `OPENSEARCH_STORAGE_AUTH_TYPE` | Set to `sigv4` for AWS SigV4 auth |
|
|
238
|
+
| `OPENSEARCH_STORAGE_AWS_REGION` | AWS region (required for SigV4) |
|
|
239
|
+
| `OPENSEARCH_STORAGE_AWS_PROFILE` | AWS profile name (uses default credential chain if omitted) |
|
|
240
|
+
| `OPENSEARCH_STORAGE_AWS_SERVICE` | `es` for managed OpenSearch, `aoss` for Serverless |
|
|
241
|
+
|
|
242
|
+
**Observability cluster (for traces and logs):**
|
|
243
|
+
|
|
244
|
+
| Variable | Description |
|
|
245
|
+
|----------|-------------|
|
|
246
|
+
| `OPENSEARCH_LOGS_ENDPOINT` | Observability cluster URL |
|
|
247
|
+
| `OPENSEARCH_LOGS_AUTH_TYPE` | Set to `sigv4` for AWS SigV4 auth |
|
|
248
|
+
| `OPENSEARCH_LOGS_AWS_REGION` | AWS region (required for SigV4) |
|
|
249
|
+
| `OPENSEARCH_LOGS_AWS_PROFILE` | AWS profile name (uses default credential chain if omitted) |
|
|
250
|
+
| `OPENSEARCH_LOGS_AWS_SERVICE` | `es` for managed OpenSearch, `aoss` for Serverless |
|
|
251
|
+
|
|
252
|
+
SigV4 uses the AWS credential provider chain (`AWS_PROFILE`, `~/.aws/credentials`, IAM role, etc.), so no explicit access keys are needed. You can also configure these settings via the Settings UI (select "AWS SigV4" from the Authentication Type dropdown).
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Services Summary
|
|
257
|
+
|
|
258
|
+
| Service | Port | Command | Purpose |
|
|
259
|
+
|---------|------|---------|---------|
|
|
260
|
+
| ML-Commons | 9200 | `./gradlew run -Dstreaming=true` | AG-UI agent endpoint |
|
|
261
|
+
| MCP Server | 3030 | `uvx opensearch-mcp-server-py@0.5.2` | OpenSearch tools for agent |
|
|
262
|
+
| Agent Health | 4001 | `npm run server` | Evaluation UI and API |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Troubleshooting
|
|
267
|
+
|
|
268
|
+
| Issue | Solution |
|
|
269
|
+
|-------|----------|
|
|
270
|
+
| Agent not responding | Check ML-Commons: `curl http://localhost:9200/_cat/health` |
|
|
271
|
+
| MCP server issues | Verify: `curl http://localhost:3030/health`, check MCP env vars |
|
|
272
|
+
| AWS profile invalid | Ensure profile exists: `aws sts get-caller-identity --profile $AWS_PROFILE` |
|
|
273
|
+
| Port conflicts | Use `./scripts/setup.sh --stop` to stop MCP and Agent Health services |
|
|
274
|
+
|
|
275
|
+
### Check Service Status
|
|
276
|
+
```bash
|
|
277
|
+
./scripts/setup.sh --status
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Stop All Services
|
|
281
|
+
```bash
|
|
282
|
+
./scripts/setup.sh --stop
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Related Documentation
|
|
288
|
+
|
|
289
|
+
- [AG-UI Protocol](https://docs.ag-ui.com/sdk/js/core/types#runagentinput)
|