@cloudbase/agent-observability 0.0.16 → 0.0.18

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 CHANGED
@@ -1,9 +1,11 @@
1
- # AG-Kit TypeScript Observability
1
+ # TypeScript Observability
2
2
 
3
- OpenTelemetry-based observability for AG-Kit with OpenInference semantic conventions.
3
+ OpenTelemetry-based observability for the TypeScript SDK with OpenInference semantic conventions.
4
4
 
5
5
  ## Installation
6
6
 
7
+ ### Standalone Usage
8
+
7
9
  ```bash
8
10
  # Core package
9
11
  npm install @cloudbase/agent-observability
@@ -12,6 +14,20 @@ npm install @cloudbase/agent-observability
12
14
  npm install @cloudbase/agent-observability @langchain/core
13
15
  ```
14
16
 
17
+ ### With AG-Kit Server (Optional)
18
+
19
+ When using `@cloudbase/agent-server` or `@cloudbase/agent-adapter-langgraph`, observability is an **optional peer dependency**. You need to explicitly install it if you want tracing capabilities:
20
+
21
+ ```bash
22
+ # Using with @cloudbase/agent-server
23
+ npm install @cloudbase/agent-server @cloudbase/agent-observability
24
+
25
+ # Using with @cloudbase/agent-adapter-langgraph
26
+ npm install @cloudbase/agent-adapter-langgraph @cloudbase/agent-observability
27
+ ```
28
+
29
+ Without installing `@cloudbase/agent-observability`, the packages will work normally but no traces will be generated.
30
+
15
31
  ## Architecture Overview
16
32
 
17
33
  This package provides a callback-based observability system that integrates with LangChain/LangGraph through the standard `BaseCallbackHandler` mechanism.
@@ -20,7 +36,7 @@ This package provides a callback-based observability system that integrates with
20
36
 
21
37
  ```
22
38
  ┌─────────────────────────────────────────────────────────────────┐
23
- AG-Kit Application
39
+ │ Application
24
40
  ├─────────────────────────────────────────────────────────────────┤
25
41
  │ │
26
42
  │ ┌──────────────────────────────────────────────────────────┐ │
@@ -134,7 +150,7 @@ const agent = new LangGraphAgent({ graph: workflow });
134
150
 
135
151
  ## Span Hierarchy Example
136
152
 
137
- When using LangGraph with AG-Kit server:
153
+ When using LangGraph with the server:
138
154
 
139
155
  ```
140
156
  AG-UI.Server (Request entry point)
@@ -213,7 +229,6 @@ interface CallbackHandlerOptions {
213
229
 
214
230
  ### Span Types
215
231
 
216
- - `ObservationSpan`: General spans
217
232
  - `ObservationLLM`: LLM generation spans
218
233
  - `ObservationTool`: Tool invocation spans
219
234
  - `ObservationChain`: Chain/workflow spans
@@ -0,0 +1,60 @@
1
+ import {
2
+ __esm
3
+ } from "./chunk-NFEGQTCC.mjs";
4
+
5
+ // src/core/constants.ts
6
+ import {
7
+ SemanticConventions,
8
+ OpenInferenceSpanKind
9
+ } from "@arizeai/openinference-semantic-conventions";
10
+ var OBSERVABILITY_TRACER_NAME, OBSERVABILITY_SDK_NAME, OBSERVABILITY_SDK_VERSION, OtelSpanAttributes;
11
+ var init_constants = __esm({
12
+ "src/core/constants.ts"() {
13
+ "use strict";
14
+ OBSERVABILITY_TRACER_NAME = "agui-tracer";
15
+ OBSERVABILITY_SDK_NAME = "observability";
16
+ OBSERVABILITY_SDK_VERSION = "0.1.0";
17
+ OtelSpanAttributes = {
18
+ // OpenInference - re-export all standard conventions
19
+ ...SemanticConventions,
20
+ // Trace attributes (non-standard)
21
+ TRACE_NAME: "trace.name",
22
+ TRACE_TAGS: "trace.tags",
23
+ TRACE_PUBLIC: "trace.public",
24
+ TRACE_METADATA: "trace.metadata",
25
+ TRACE_INPUT: "trace.input",
26
+ TRACE_OUTPUT: "trace.output",
27
+ // Observation attributes (non-standard)
28
+ OBSERVATION_TYPE: "observation.type",
29
+ OBSERVATION_LEVEL: "observation.level",
30
+ OBSERVATION_STATUS_MESSAGE: "observation.status_message",
31
+ OBSERVATION_INPUT: "observation.input",
32
+ OBSERVATION_OUTPUT: "observation.output",
33
+ OBSERVATION_METADATA: "observation.metadata",
34
+ // LLM-specific (non-standard)
35
+ LLM_COMPLETION_START_TIME: "llm.completion_start_time",
36
+ LLM_MODEL_PARAMETERS: "llm.model_parameters",
37
+ LLM_USAGE_DETAILS: "llm.usage_details",
38
+ LLM_COST_DETAILS: "llm.cost_details",
39
+ // Retriever-specific (non-standard)
40
+ RETRIEVER_NAME: "retriever.name",
41
+ RETRIEVER_QUERY: "retriever.query",
42
+ RETRIEVER_INDEX_ID: "retriever.index_id",
43
+ RETRIEVER_TOP_K: "retriever.top_k",
44
+ // General (non-standard)
45
+ ENVIRONMENT: "environment",
46
+ RELEASE: "release",
47
+ VERSION: "version"
48
+ };
49
+ }
50
+ });
51
+
52
+ export {
53
+ OpenInferenceSpanKind,
54
+ OBSERVABILITY_TRACER_NAME,
55
+ OBSERVABILITY_SDK_NAME,
56
+ OBSERVABILITY_SDK_VERSION,
57
+ OtelSpanAttributes,
58
+ init_constants
59
+ };
60
+ //# sourceMappingURL=chunk-5EXUNUGP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/constants.ts"],"sourcesContent":["/**\n * OTEL attribute constants for observability.\n *\n * Uses OpenInference semantic conventions where applicable:\n * https://github.com/Arize-ai/openinference/tree/main/spec\n *\n * Falls back to non-standard attributes where OpenInference\n * doesn't define a standard.\n *\n * @module\n */\n\nimport {\n SemanticConventions,\n OpenInferenceSpanKind,\n} from \"@arizeai/openinference-semantic-conventions\";\n\n// Re-export OpenInference types for convenience\nexport { OpenInferenceSpanKind };\n\n/**\n * SDK information\n */\n// Brandless defaults: avoid emitting project-specific identifiers into traces.\n// Users can still override service.name via OTEL_SERVICE_NAME.\nexport const OBSERVABILITY_TRACER_NAME = \"agui-tracer\";\nexport const OBSERVABILITY_SDK_NAME = \"observability\";\nexport const OBSERVABILITY_SDK_VERSION = \"0.1.0\";\n\n/**\n * Combined attribute namespace for internal use\n * Provides a single namespace for all OTEL attributes used internally.\n *\n * Combines OpenInference SemanticConventions with non-standard attributes\n */\nexport const OtelSpanAttributes = {\n // OpenInference - re-export all standard conventions\n ...SemanticConventions,\n\n // Trace attributes (non-standard)\n TRACE_NAME: \"trace.name\",\n TRACE_TAGS: \"trace.tags\",\n TRACE_PUBLIC: \"trace.public\",\n TRACE_METADATA: \"trace.metadata\",\n TRACE_INPUT: \"trace.input\",\n TRACE_OUTPUT: \"trace.output\",\n\n // Observation attributes (non-standard)\n OBSERVATION_TYPE: \"observation.type\",\n OBSERVATION_LEVEL: \"observation.level\",\n OBSERVATION_STATUS_MESSAGE: \"observation.status_message\",\n OBSERVATION_INPUT: \"observation.input\",\n OBSERVATION_OUTPUT: \"observation.output\",\n OBSERVATION_METADATA: \"observation.metadata\",\n\n // LLM-specific (non-standard)\n LLM_COMPLETION_START_TIME: \"llm.completion_start_time\",\n LLM_MODEL_PARAMETERS: \"llm.model_parameters\",\n LLM_USAGE_DETAILS: \"llm.usage_details\",\n LLM_COST_DETAILS: \"llm.cost_details\",\n\n // Retriever-specific (non-standard)\n RETRIEVER_NAME: \"retriever.name\",\n RETRIEVER_QUERY: \"retriever.query\",\n RETRIEVER_INDEX_ID: \"retriever.index_id\",\n RETRIEVER_TOP_K: \"retriever.top_k\",\n\n // General (non-standard)\n ENVIRONMENT: \"environment\",\n RELEASE: \"release\",\n VERSION: \"version\",\n} as const;\n\n"],"mappings":";;;;;AAYA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAfP,IAyBa,2BACA,wBACA,2BAQA;AAnCb;AAAA;AAAA;AAyBO,IAAM,4BAA4B;AAClC,IAAM,yBAAyB;AAC/B,IAAM,4BAA4B;AAQlC,IAAM,qBAAqB;AAAA;AAAA,MAEhC,GAAG;AAAA;AAAA,MAGH,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,cAAc;AAAA;AAAA,MAGd,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,4BAA4B;AAAA,MAC5B,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,sBAAsB;AAAA;AAAA,MAGtB,2BAA2B;AAAA,MAC3B,sBAAsB;AAAA,MACtB,mBAAmB;AAAA,MACnB,kBAAkB;AAAA;AAAA,MAGlB,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,MACjB,oBAAoB;AAAA,MACpB,iBAAiB;AAAA;AAAA,MAGjB,aAAa;AAAA,MACb,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA;AAAA;","names":[]}