@cuylabs/agent-runtime-dapr 0.16.0 → 2.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.
- package/dist/{chunk-EJBODJQR.js → chunk-26RCP3L3.js} +1 -1
- package/dist/{chunk-VKPTE4J6.js → chunk-J3IJLF6U.js} +15 -6
- package/dist/execution/index.d.ts +20 -4
- package/dist/execution/index.js +1 -1
- package/dist/host/index.js +2 -2
- package/dist/index.js +2 -2
- package/dist/team/index.js +2 -2
- package/package.json +5 -5
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
* └─
|
|
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
|
-
* └─
|
|
81
|
-
*
|
|
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
|
-
* └─
|
|
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
|
package/dist/execution/index.js
CHANGED
package/dist/host/index.js
CHANGED
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
startDaprAgentWorkflowTurn,
|
|
18
18
|
startDaprHostHttpServer,
|
|
19
19
|
startDaprHttpServer
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-26RCP3L3.js";
|
|
21
21
|
import {
|
|
22
22
|
DaprServiceInvoker,
|
|
23
23
|
invokeRemoteAgentRun
|
|
24
24
|
} from "../chunk-6BLY7B7U.js";
|
|
25
|
-
import "../chunk-
|
|
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-
|
|
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-
|
|
57
|
+
} from "./chunk-J3IJLF6U.js";
|
|
58
58
|
import {
|
|
59
59
|
DaprWorkflowClient,
|
|
60
60
|
createDaprAgentTurnApprovalCheckActivity,
|
package/dist/team/index.js
CHANGED
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
createDaprTeamHttpHandler,
|
|
11
11
|
createDaprTeamRunner,
|
|
12
12
|
createPrepareExternalTasksActivity
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-26RCP3L3.js";
|
|
14
14
|
import "../chunk-6BLY7B7U.js";
|
|
15
|
-
import "../chunk-
|
|
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.
|
|
3
|
+
"version": "2.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.
|
|
46
|
-
"@cuylabs/agent-runtime": "^0.
|
|
45
|
+
"@cuylabs/agent-core": "^2.0.0",
|
|
46
|
+
"@cuylabs/agent-runtime": "^2.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": "
|
|
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.
|
|
78
|
+
"@cuylabs/agent-code": "^2.0.0"
|
|
79
79
|
},
|
|
80
80
|
"keywords": [
|
|
81
81
|
"agent",
|