@cuylabs/agent-runtime-dapr 0.15.0 → 1.0.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.
@@ -11,7 +11,7 @@ import {
11
11
  createDaprExecutionObserver,
12
12
  createDaprLoggingObserver,
13
13
  createWorkflowObserverBridge
14
- } from "./chunk-VKPTE4J6.js";
14
+ } from "./chunk-J3IJLF6U.js";
15
15
  import {
16
16
  DaprWorkflowClient,
17
17
  createDaprAgentTurnWorkflowKit,
@@ -832,6 +832,7 @@ async function getOtel() {
832
832
  function createOtelObserver(config = {}) {
833
833
  const agentName = config.agentName ?? DEFAULT_AGENT_NAME;
834
834
  const spanTimeoutMs = config.spanTimeoutMs ?? 5 * 60 * 1e3;
835
+ const configuredSpanAttributes = config.spanAttributes ?? {};
835
836
  const turnSpans = /* @__PURE__ */ new Map();
836
837
  let otel = null;
837
838
  let tracer = null;
@@ -852,6 +853,18 @@ function createOtelObserver(config = {}) {
852
853
  function makeSpanKey(sessionId, executionId) {
853
854
  return executionId ?? sessionId;
854
855
  }
856
+ function buildAgentAttributes(sessionId) {
857
+ return {
858
+ ...configuredSpanAttributes,
859
+ "openinference.span.kind": "AGENT",
860
+ "gen_ai.agent.name": agentName,
861
+ "gen_ai.agent.session_id": sessionId,
862
+ "gen_ai.conversation.id": sessionId,
863
+ ...config.agentId ? { "gen_ai.agent.id": config.agentId } : {},
864
+ ...config.agentDescription ? { "gen_ai.agent.description": config.agentDescription } : {},
865
+ ...config.agentVersion ? { "gen_ai.agent.version": config.agentVersion } : {}
866
+ };
867
+ }
855
868
  return {
856
869
  async onTaskStart(run, _snapshot) {
857
870
  const key = makeSpanKey(run.sessionId, run.executionId);
@@ -859,9 +872,7 @@ function createOtelObserver(config = {}) {
859
872
  if (existing) {
860
873
  const inputVal2 = run.payload.message.slice(0, 4096);
861
874
  existing.span.setAttributes({
862
- "openinference.span.kind": "AGENT",
863
- "gen_ai.agent.name": agentName,
864
- "gen_ai.agent.session_id": run.sessionId,
875
+ ...buildAgentAttributes(run.sessionId),
865
876
  "agent.trigger": run.context.trigger ?? "unknown",
866
877
  "input.value": inputVal2,
867
878
  "input.mime_type": oiMime(inputVal2)
@@ -873,10 +884,8 @@ function createOtelObserver(config = {}) {
873
884
  const inputVal = run.payload.message.slice(0, 4096);
874
885
  const span = t.startSpan("agent.turn", {
875
886
  attributes: {
876
- "openinference.span.kind": "AGENT",
887
+ ...buildAgentAttributes(run.sessionId),
877
888
  "gen_ai.operation.name": "invoke_agent",
878
- "gen_ai.agent.name": agentName,
879
- "gen_ai.agent.session_id": run.sessionId,
880
889
  "agent.trigger": run.context.trigger ?? "unknown",
881
890
  "input.value": inputVal,
882
891
  "input.mime_type": oiMime(inputVal)
@@ -69,7 +69,8 @@ declare function createDaprLoggingObserver<TPayload extends AgentTaskPayload = A
69
69
  * ```
70
70
  * agent.turn ← this observer
71
71
  * └─ invoke_agent my-agent ← otelMiddleware (via activateContext)
72
- * └─ ai.streamText ← AI SDK
72
+ * └─ invoke_agent gpt-4o ← AI SDK v7 / @ai-sdk/otel
73
+ * └─ chat gpt-4o
73
74
  * └─ execute_tool greet ← otelMiddleware
74
75
  * ```
75
76
  *
@@ -77,11 +78,13 @@ declare function createDaprLoggingObserver<TPayload extends AgentTaskPayload = A
77
78
  * ```
78
79
  * agent.turn ← this observer
79
80
  * └─ invoke_agent my-agent ← otelMiddleware (via runChatStart/End)
80
- * └─ ai.streamText ← AI SDK
81
- * └─ ai.toolCall AI SDK
81
+ * └─ invoke_agent gpt-4o ← AI SDK v7 / @ai-sdk/otel
82
+ * ├─ agent_step
83
+ * └─ chat gpt-4o
82
84
  * └─ execute_tool greet ← otelMiddleware (via beforeToolCall)
83
85
  * └─ invoke_agent my-agent ← otelMiddleware (step 2)
84
- * └─ ai.streamText ← AI SDK
86
+ * └─ invoke_agent gpt-4o ← AI SDK v7 / @ai-sdk/otel
87
+ * └─ chat gpt-4o
85
88
  * ```
86
89
  *
87
90
  * @example
@@ -108,6 +111,19 @@ interface OtelObserverConfig {
108
111
  * Required for Phoenix/OpenInference to classify the span as AGENT kind.
109
112
  */
110
113
  agentName?: string;
114
+ /** Stable agent identifier — recorded as `gen_ai.agent.id` when provided. */
115
+ agentId?: string;
116
+ /** Agent description — recorded as `gen_ai.agent.description` when provided. */
117
+ agentDescription?: string;
118
+ /** Agent version — recorded as `gen_ai.agent.version` when provided. */
119
+ agentVersion?: string;
120
+ /**
121
+ * Additional attributes applied to the `agent.turn` span.
122
+ *
123
+ * Use this for deployment, tenant, or runtime-specific dimensions that
124
+ * should appear on the Dapr root span. Built-in attributes take precedence.
125
+ */
126
+ spanAttributes?: Record<string, string | number | boolean>;
111
127
  /**
112
128
  * TTL in milliseconds for orphaned spans.
113
129
  * If `onTaskComplete`/`onTaskError` is never called, the span is
@@ -5,7 +5,7 @@ import {
5
5
  createDaprLoggingObserver,
6
6
  createOtelObserver,
7
7
  createWorkflowObserverBridge
8
- } from "../chunk-VKPTE4J6.js";
8
+ } from "../chunk-J3IJLF6U.js";
9
9
  import "../chunk-HQLQRXU5.js";
10
10
  export {
11
11
  DaprExecutionObserver,
@@ -17,12 +17,12 @@ import {
17
17
  startDaprAgentWorkflowTurn,
18
18
  startDaprHostHttpServer,
19
19
  startDaprHttpServer
20
- } from "../chunk-EJBODJQR.js";
20
+ } from "../chunk-26RCP3L3.js";
21
21
  import {
22
22
  DaprServiceInvoker,
23
23
  invokeRemoteAgentRun
24
24
  } from "../chunk-6BLY7B7U.js";
25
- import "../chunk-VKPTE4J6.js";
25
+ import "../chunk-J3IJLF6U.js";
26
26
  import "../chunk-2TBZCBXE.js";
27
27
  import "../chunk-HQLQRXU5.js";
28
28
  export {
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  installDaprSubAgents,
37
37
  startDaprAgentWorkflowTurn,
38
38
  startDaprHostHttpServer
39
- } from "./chunk-EJBODJQR.js";
39
+ } from "./chunk-26RCP3L3.js";
40
40
  import {
41
41
  DaprServiceInvoker,
42
42
  createDaprAppDispatchExecutor,
@@ -54,7 +54,7 @@ import {
54
54
  createDaprLoggingObserver,
55
55
  createOtelObserver,
56
56
  createWorkflowObserverBridge
57
- } from "./chunk-VKPTE4J6.js";
57
+ } from "./chunk-J3IJLF6U.js";
58
58
  import {
59
59
  DaprWorkflowClient,
60
60
  createDaprAgentTurnApprovalCheckActivity,
@@ -10,9 +10,9 @@ import {
10
10
  createDaprTeamHttpHandler,
11
11
  createDaprTeamRunner,
12
12
  createPrepareExternalTasksActivity
13
- } from "../chunk-EJBODJQR.js";
13
+ } from "../chunk-26RCP3L3.js";
14
14
  import "../chunk-6BLY7B7U.js";
15
- import "../chunk-VKPTE4J6.js";
15
+ import "../chunk-J3IJLF6U.js";
16
16
  import "../chunk-2TBZCBXE.js";
17
17
  import "../chunk-HQLQRXU5.js";
18
18
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuylabs/agent-runtime-dapr",
3
- "version": "0.15.0",
3
+ "version": "1.0.0",
4
4
  "description": "Dapr-backed workload runtime and host adapters for @cuylabs/agent-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,8 +42,8 @@
42
42
  "README.md"
43
43
  ],
44
44
  "dependencies": {
45
- "@cuylabs/agent-core": "^0.15.0",
46
- "@cuylabs/agent-runtime": "^0.15.0"
45
+ "@cuylabs/agent-core": "^1.0.0",
46
+ "@cuylabs/agent-runtime": "^1.0.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@dapr/dapr": "^3.6.1",
@@ -58,7 +58,7 @@
58
58
  }
59
59
  },
60
60
  "devDependencies": {
61
- "@ai-sdk/openai": "^3.0.41",
61
+ "@ai-sdk/openai": "4.0.0-beta.38",
62
62
  "@arizeai/openinference-vercel": "^2.7.1",
63
63
  "@dapr/dapr": "^3.6.1",
64
64
  "@opentelemetry/api": "^1.9.0",
@@ -75,7 +75,7 @@
75
75
  "typescript": "^5.7.0",
76
76
  "vitest": "^4.0.18",
77
77
  "zod": "^3.24.0",
78
- "@cuylabs/agent-code": "^0.15.0"
78
+ "@cuylabs/agent-code": "^1.0.0"
79
79
  },
80
80
  "keywords": [
81
81
  "agent",