{"_id":"@automatalabs/agentprism-otel","_rev":"3-4e2a2a4cbadef880fef18dfff64dbc66","name":"@automatalabs/agentprism-otel","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@automatalabs/agentprism-otel","version":"0.1.0","license":"Apache-2.0","_id":"@automatalabs/agentprism-otel@0.1.0","maintainers":[{"name":"automatalabsteam","email":"packages@automatalabs.io"}],"homepage":"https://github.com/VikashLoomba/agentprism-workflows#readme","bugs":{"url":"https://github.com/VikashLoomba/agentprism-workflows/issues"},"dist":{"shasum":"1cbe622ceb57fb1c23bb98ef5126349f3d133b3f","tarball":"https://registry.npmjs.org/@automatalabs/agentprism-otel/-/agentprism-otel-0.1.0.tgz","fileCount":15,"integrity":"sha512-VBeiXlpNdLbBJOLfsDKq0k08ehfDtfofuJPy5G706r4cqwHtp8jZVavqEqIoCcjYvx2r7MHe2HlG4tf2EZdqNg==","signatures":[{"sig":"MEQCIAZpF0TJuJ25gh+IcAI0k/EBd4kj6Fif6Jxb5vkdl6ZRAiAEFgx3CfQK13pd/mV9Wpe+y8nMNDv7zCh3/9Q7hThsHQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55479},"main":"./dist/index.js","type":"module","_from":"file:automatalabs-agentprism-otel-0.1.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"test":"tsx --test \"test/**/*.test.ts\"","build":"tsc -b","typecheck":"tsc --noEmit"},"_npmUser":{"name":"automatalabsteam","email":"packages@automatalabs.io"},"_resolved":"/tmp/4d082a7ad0c60a128388e78e65171726/automatalabs-agentprism-otel-0.1.0.tgz","_integrity":"sha512-VBeiXlpNdLbBJOLfsDKq0k08ehfDtfofuJPy5G706r4cqwHtp8jZVavqEqIoCcjYvx2r7MHe2HlG4tf2EZdqNg==","repository":{"url":"git+https://github.com/VikashLoomba/agentprism-workflows.git","type":"git","directory":"packages/agentprism-otel"},"_npmVersion":"11.12.1","description":"OpenTelemetry tracing and metrics for AgentPrism workflow runs. The package attaches to any `WorkflowManager`-compatible event emitter and maps workflow events to spans and counters using `@opentelemetry/api` only.","directories":{},"_nodeVersion":"24.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@opentelemetry/api":"1.9.1","@automatalabs/workflows":"^0.20.2","@automatalabs/shared-types":"^0.12.1","@opentelemetry/sdk-metrics":"^2.9.0","@automatalabs/workflow-engine":"^0.9.1","@opentelemetry/sdk-trace-base":"^2.9.0"},"peerDependencies":{"@opentelemetry/api":"^1.9.0"},"_npmOperationalInternal":{"tmp":"tmp/agentprism-otel_0.1.0_1783464105498_0.20141894328467558","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@automatalabs/agentprism-otel","version":"0.1.1","license":"Apache-2.0","_id":"@automatalabs/agentprism-otel@0.1.1","maintainers":[{"name":"automatalabsteam","email":"packages@automatalabs.io"}],"homepage":"https://github.com/VikashLoomba/agentprism-workflows#readme","bugs":{"url":"https://github.com/VikashLoomba/agentprism-workflows/issues"},"dist":{"shasum":"9358479a3ff54986943253fece29f251f924b52b","tarball":"https://registry.npmjs.org/@automatalabs/agentprism-otel/-/agentprism-otel-0.1.1.tgz","fileCount":15,"integrity":"sha512-j1L1laFc7Elp5x+MLWkBM2++ZVxCiUAkMl4i8hN1jcnYw0Pm+Q7wBkj8DYfSi5meZU2BCMrAyb/Jqs/b5LLl6A==","signatures":[{"sig":"MEUCIQDcX3qdpyOgebZalVEciBuHiRu/TETBOOoiVi+I9q78LQIgZZQM0v5eE0vOdWPD+7o6ztFrdQV2jiYqIxpfZYWv3Vk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@automatalabs%2fagentprism-otel@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56558},"main":"./dist/index.js","type":"module","_from":"file:automatalabs-agentprism-otel-0.1.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"test":"tsx --test \"test/**/*.test.ts\"","build":"tsc -b","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:17079676-9732-4da0-b8c8-1183f63542c7"}},"_resolved":"/tmp/27a85bfe480afa6166a0db3c5213b8b8/automatalabs-agentprism-otel-0.1.1.tgz","_integrity":"sha512-j1L1laFc7Elp5x+MLWkBM2++ZVxCiUAkMl4i8hN1jcnYw0Pm+Q7wBkj8DYfSi5meZU2BCMrAyb/Jqs/b5LLl6A==","repository":{"url":"git+https://github.com/VikashLoomba/agentprism-workflows.git","type":"git","directory":"packages/agentprism-otel"},"_npmVersion":"11.16.0","description":"OpenTelemetry tracing and metrics for AgentPrism workflow runs. The package attaches to any `WorkflowManager`-compatible event emitter and maps workflow events to spans and counters using `@opentelemetry/api` only.","directories":{},"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@opentelemetry/api":"1.9.1","@automatalabs/workflows":"^0.34.0","@automatalabs/shared-types":"^0.22.0","@opentelemetry/sdk-metrics":"^2.9.0","@automatalabs/workflow-engine":"^0.23.0","@opentelemetry/sdk-trace-base":"^2.9.0"},"peerDependencies":{"@opentelemetry/api":"^1.9.0"},"_npmOperationalInternal":{"tmp":"tmp/agentprism-otel_0.1.1_1784138073512_0.500941315437355","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@automatalabs/agentprism-otel","version":"0.1.2","license":"Apache-2.0","engines":{"node":">=22"},"repository":{"type":"git","url":"git+https://github.com/agentprism/agentprism-workflows.git","directory":"packages/agentprism-otel"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"publishConfig":{"access":"public"},"peerDependencies":{"@opentelemetry/api":"^1.9.0"},"devDependencies":{"@opentelemetry/api":"1.9.1","@opentelemetry/sdk-metrics":"^2.9.0","@opentelemetry/sdk-trace-base":"^2.9.0","@automatalabs/shared-types":"^0.29.1","@automatalabs/workflow-engine":"^0.35.1","@automatalabs/workflows":"^0.45.7"},"scripts":{"build":"tsc -b","typecheck":"tsc --noEmit","test":"tsx --test \"test/**/*.test.ts\""},"_id":"@automatalabs/agentprism-otel@0.1.2","description":"OpenTelemetry tracing and metrics for AgentPrism workflow runs. The package attaches to any `WorkflowManager`-compatible event emitter and maps workflow events to spans and counters using `@opentelemetry/api` only.","bugs":{"url":"https://github.com/agentprism/agentprism-workflows/issues"},"homepage":"https://github.com/agentprism/agentprism-workflows#readme","_integrity":"sha512-pGr/cPX93xs4+dgVzcTd+g78KixWFYxFomDUvboYsHEaHNJ/SMWZb7XD05M+JoWOBynE5H6ghMqU8bLv7h/5Bg==","_resolved":"/tmp/bcbfe9622c256b68719e73b557941f43/automatalabs-agentprism-otel-0.1.2.tgz","_from":"file:automatalabs-agentprism-otel-0.1.2.tgz","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-pGr/cPX93xs4+dgVzcTd+g78KixWFYxFomDUvboYsHEaHNJ/SMWZb7XD05M+JoWOBynE5H6ghMqU8bLv7h/5Bg==","shasum":"0ed1b38ec24fb932c89dc63dc02ccf2cb12b17f2","tarball":"https://registry.npmjs.org/@automatalabs/agentprism-otel/-/agentprism-otel-0.1.2.tgz","fileCount":15,"unpackedSize":56556,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@automatalabs%2fagentprism-otel@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDlU/akhA6++VukhQutnM8uRoxYD6d6vMDBxLpdo8gAkAiEA2vi4Yd61Wc3fvhF0DAnBqa+2ghAxbVvO3u8PGlSUwPo="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:43b33df3-df2e-499c-b89d-0ed99c731565"}},"directories":{},"maintainers":[{"name":"automatalabsteam","email":"packages@automatalabs.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agentprism-otel_0.1.2_1785219523191_0.5875891631729424"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-07T22:41:45.353Z","modified":"2026-07-28T06:18:43.704Z","0.1.0":"2026-07-07T22:41:45.635Z","0.1.1":"2026-07-15T17:54:33.692Z","0.1.2":"2026-07-28T06:18:43.353Z"},"bugs":{"url":"https://github.com/agentprism/agentprism-workflows/issues"},"license":"Apache-2.0","homepage":"https://github.com/agentprism/agentprism-workflows#readme","repository":{"type":"git","url":"git+https://github.com/agentprism/agentprism-workflows.git","directory":"packages/agentprism-otel"},"description":"OpenTelemetry tracing and metrics for AgentPrism workflow runs. The package attaches to any `WorkflowManager`-compatible event emitter and maps workflow events to spans and counters using `@opentelemetry/api` only.","maintainers":[{"name":"automatalabsteam","email":"packages@automatalabs.io"}],"readme":"# @automatalabs/agentprism-otel\n\nOpenTelemetry tracing and metrics for AgentPrism workflow runs. The package attaches to any `WorkflowManager`-compatible event emitter and maps workflow events to spans and counters using `@opentelemetry/api` only.\n\nWith no OpenTelemetry SDK registered by the host, calls are no-ops by design. Attaching is safe in libraries and CLIs that do not own telemetry setup.\n\n## Quickstart\n\nConfigure your SDK in the host process, then attach the bridge to the manager:\n\n```ts\nimport { NodeSDK } from \"@opentelemetry/sdk-node\";\nimport { WorkflowManager, createAcpRunner } from \"@automatalabs/workflows\";\nimport { attachOtel } from \"@automatalabs/agentprism-otel\";\n\nconst sdk = new NodeSDK({\n  // traceExporter, metricReader, resource, etc.\n});\nawait sdk.start();\n\nconst manager = new WorkflowManager({ agent: createAcpRunner() });\nconst telemetry = attachOtel(manager, {\n  captureContent: false,\n});\n\nconst result = await manager.runSync(script);\ntelemetry.detach();\n```\n\nCalling `attachOtel()` twice on the same manager creates two independent attachments and two independent sets of subscriptions. Call each returned `detach()` when that observer is no longer needed.\n\n## API\n\n```ts\nexport interface AgentPrismOtelOptions {\n  tracerProvider?: TracerProvider;\n  meterProvider?: MeterProvider;\n  captureContent?: boolean;\n  contentLimit?: number;\n}\n\nexport interface OtelAttachment {\n  detach(): void;\n}\n\nexport function attachOtel(manager: WorkflowManagerLike, options?: AgentPrismOtelOptions): OtelAttachment;\n```\n\n`WorkflowManagerLike` intentionally remains the two-method structural attachment seam (`on` and\n`removeListener`), so hosts may attach the bridge to the SDK manager or any compatible emitter\nwithout a runtime AgentPrism dependency. Internally, the bridge's exported payload aliases consume\n`EngineRunEventPayloadMap` and the shared `RunAgentEventPayload` contract through type-only imports;\nthe published runtime dependency remains `@opentelemetry/api` alone. Existing exported names such as\n`LogPayload`, `AgentEndPayload`, `PausedPayload`, and `ToolCallEventLike` are retained.\n\n| Option | Default | Effect |\n|---|---:|---|\n| `tracerProvider` | `trace.getTracerProvider()` | Provider used to create the `@automatalabs/agentprism-otel` tracer. |\n| `meterProvider` | `metrics.getMeterProvider()` | Provider used to create the `@automatalabs/agentprism-otel` meter. |\n| `captureContent` | `false` | When true, captures prompts, results, tool input, and terminal tool output as span attributes. |\n| `contentLimit` | `8192` | Maximum characters kept per captured content attribute before `…[truncated]` is appended. |\n\n`detach()` removes all subscriptions created by that attachment, then force-ends any still-open tool, agent, and workflow spans with `agentprism.detached = true`.\n\n## Span Model\n\n| Span | Created from | Parent | Ended by |\n|---|---|---|---|\n| `workflow` | First handled event with a new `runId` | Current context | `complete`, `paused`, `error`, `stopped`, or `detach()` |\n| `workflow <name>` | `complete` with `result.meta.name` | Current context | Same root span, renamed before end |\n| `invoke_agent <label>` | `agentStart` | Workflow root | Matching FIFO `agentEnd`, terminal run cleanup, or `detach()` |\n| `execute_tool <title\\|kind\\|tool>` | `agentEvent` `tool_call` | Most recent open agent for `label`, else workflow root | Terminal `tool_call_update`, agent cleanup, terminal run cleanup, or `detach()` |\n\nRepeated agent labels are matched FIFO on `agentEnd`. Tool calls parent to the most recent still-open agent with that label.\n\n## Attribute Reference\n\n| Attribute | Spans | Notes |\n|---|---|---|\n| `agentprism.run_id` | workflow, agent, tool | Per-run trace attribution. |\n| `agentprism.resumed` | workflow | Set on roots created by `resumed`. |\n| `agentprism.status` | workflow | Terminal `WorkflowRunResult.status`, when present. |\n| `agentprism.agent_count` | workflow | Terminal agent count, when present. |\n| `agentprism.paused`, `agentprism.pause_reason` | workflow | Set on paused runs. |\n| `agentprism.stopped` | workflow | Set on stopped runs. |\n| `agentprism.detached` | workflow, agent, tool | Set when `detach()` force-ends open spans. |\n| `agentprism.dangling` | agent, tool | Set when a terminal run or agent end force-closes children. |\n| `agentprism.phase`, `agentprism.last_phase` | workflow, agent | Phase events and agent phase attribution. |\n| `agentprism.prompt`, `agentprism.result` | agent | Only when `captureContent` is true. |\n| `agentprism.tokens`, `agentprism.worktree` | agent | From `agentEnd`. |\n| `agentprism.error_code`, `agentprism.recoverable` | agent | From failed `agentEnd`. |\n| `agentprism.backend_id`, `agentprism.session_id`, `agentprism.label` | tool | ACP context repeated on tool spans. |\n| `agentprism.tool_kind`, `agentprism.tool_status` | tool | Tool kind and non-terminal status updates. |\n| `agentprism.tool_input`, `agentprism.tool_output` | tool | Only when `captureContent` is true; output is terminal updates only. |\n| `log.message` | workflow log events | Workflow `log()` narration is always added as a span event. |\n| `gen_ai.operation.name` | agent, tool | `invoke_agent` or `execute_tool`. |\n| `gen_ai.agent.name` | agent | Agent label. |\n| `gen_ai.request.model`, `gen_ai.response.model` | agent | Requested/resolved model when available. |\n| `gen_ai.tool.name`, `gen_ai.tool.call.id` | tool | Tool title and call id. |\n\nWorkflow `log` events are always attached to the root span, even when `captureContent` is false. `log()` is author-intended narration; prompts, results, and tool payloads remain gated by `captureContent`.\n\n## Metric Reference\n\n| Metric | Instrument | Unit | Attributes | Notes |\n|---|---|---|---|---|\n| `agentprism.tokens` | Counter | `{token}` | `agentprism.token_type` = `input`, `output`, `total`, `cache_read`, `cache_write` | Records positive deltas from cumulative `tokenUsage` snapshots. |\n| `agentprism.cost` | Counter | `usd` | none | Records positive cost deltas from cumulative snapshots. |\n| `agentprism.agents` | Counter | `{agent}` | `agentprism.status` = `ok` or `error` | Increments on every `agentEnd`, including unmatched endings. |\n| `agentprism.agent.duration` | Histogram | `s` | `agentprism.status` = `ok` or `error` | Recorded only when `agentEnd` matches an open `agentStart`. |\n\nMetrics intentionally do not carry `runId` to avoid high-cardinality time series. Use trace attributes for per-run attribution.\n\n## Privacy\n\n`captureContent` defaults to false. When enabled, prompts, results, tool inputs, and terminal tool outputs are serialized into span attributes and truncated to `contentLimit`. Keep it disabled for production telemetry unless your exporter and backend are approved for that data.\n\n## Event Surface\n\nThe bridge subscribes to `log`, `phase`, `agentStart`, `agentEnd`, `tokenUsage`, `complete`, `paused`, `error`, `stopped`, `resumed`, and facade `agentEvent` tool-call updates. It does not subscribe to `journal` or `agentHistory`.\n\nEngine handlers use the shared typed run-event payload map directly. Tool correlation prefers the\nevent contract's `(scope, callIndex)` key when present, then retains label-based compatibility for\nolder or direct runner events that omit `callIndex`.\n\nEvery handler is wrapped and reports failures through OpenTelemetry diagnostics, so malformed payloads or exporter behavior cannot throw into the manager.\n","readmeFilename":"README.md"}