@cuylabs/agent-a365-observability 4.7.0 → 4.7.1
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 +8 -4
- package/dist/index.d.ts +23 -0
- package/dist/index.js +3 -0
- package/docs/agent-core-otel.md +9 -1
- package/docs/architecture.md +2 -1
- package/docs/microsoft-a365-observability.md +1 -2
- package/docs/microsoft-node-package-comparison.md +3 -3
- package/docs/sdk-and-auth-flow.md +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -179,11 +179,11 @@ resolution, `context/` owns baggage and TurnContext mapping, `runtime/` owns
|
|
|
179
179
|
Microsoft SDK startup and lazy loading, and `tracing/` owns the agent-core
|
|
180
180
|
tracing config adapter.
|
|
181
181
|
|
|
182
|
-
Use agent-core for portable OpenTelemetry spans:
|
|
182
|
+
Use agent-core and AI SDK v7 for portable OpenTelemetry spans:
|
|
183
183
|
|
|
184
184
|
- `invoke_agent` agent spans
|
|
185
|
-
- `
|
|
186
|
-
- AI SDK
|
|
185
|
+
- AI SDK `chat` model spans nested under the agent turn
|
|
186
|
+
- AI SDK `execute_tool` tool spans when tools run
|
|
187
187
|
|
|
188
188
|
Use this package for Agent 365-specific context on those spans:
|
|
189
189
|
|
|
@@ -212,7 +212,7 @@ See [docs/agent-core-otel.md](./docs/agent-core-otel.md) for details.
|
|
|
212
212
|
|
|
213
213
|
Phoenix is a normal OTLP destination. You pass a span processor/exporter into `agent-core` tracing, and `agent-core` owns the tracer provider lifecycle for that example.
|
|
214
214
|
|
|
215
|
-
Agent 365 is different. The Microsoft SDK owns the exporter and adds an Agent 365 span processor that copies baggage into span attributes. `agent-core` still emits the agent
|
|
215
|
+
Agent 365 is different. The Microsoft SDK owns the exporter and adds an Agent 365 span processor that copies baggage into span attributes. `agent-core` still emits the agent and AI SDK spans, while this package starts the Microsoft exporter and wraps each request with the tenant, agent, conversation, channel, and caller baggage that Agent 365 expects.
|
|
216
216
|
|
|
217
217
|
## AI SDK Telemetry
|
|
218
218
|
|
|
@@ -220,6 +220,8 @@ Agent 365 is different. The Microsoft SDK owns the exporter and adds an Agent 36
|
|
|
220
220
|
|
|
221
221
|
This package does not replace that model telemetry. It adds the Microsoft Agent 365 layer: exporter startup, token resolution, and baggage that flows `microsoft.tenant.id`, `gen_ai.agent.id`, conversation, channel, and caller identity onto the spans.
|
|
222
222
|
|
|
223
|
+
`createA365TracingConfig()` defaults `emitToolSpans` to `false`. AI SDK v7 already emits `execute_tool` spans with the Agent 365 GenAI tool keys, including `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.tool.call.arguments`, and `gen_ai.tool.call.result` when content recording is enabled. Disabling agent-core's extra tool-span layer avoids duplicate `execute_tool` spans for one tool call while preserving model and tool observability from the AI SDK integration.
|
|
224
|
+
|
|
223
225
|
If you need to plug in another AI SDK telemetry integration, pass it through `createA365TracingConfig()`:
|
|
224
226
|
|
|
225
227
|
```typescript
|
|
@@ -235,6 +237,8 @@ const agent = createAgent({
|
|
|
235
237
|
|
|
236
238
|
Set `useGenAIOpenTelemetry: false` only when you intentionally want to use global AI SDK telemetry integrations or another model-span integration.
|
|
237
239
|
|
|
240
|
+
Set `emitToolSpans: true` only when your agent execution path does not use AI SDK v7 tool telemetry and you need agent-core to emit tool spans itself.
|
|
241
|
+
|
|
238
242
|
## TurnContext Mapping
|
|
239
243
|
|
|
240
244
|
`runWithA365TurnContext(...)` follows Microsoft's
|
package/dist/index.d.ts
CHANGED
|
@@ -126,6 +126,26 @@ type A365TracingConfigOptions = {
|
|
|
126
126
|
agentId?: string;
|
|
127
127
|
agentDescription?: string;
|
|
128
128
|
agentVersion?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Whether to record prompts/tool arguments in GenAI spans.
|
|
131
|
+
*
|
|
132
|
+
* Defaults to agent-core's tracing default.
|
|
133
|
+
*/
|
|
134
|
+
recordInputs?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether to record responses/tool results in GenAI spans.
|
|
137
|
+
*
|
|
138
|
+
* Defaults to agent-core's tracing default.
|
|
139
|
+
*/
|
|
140
|
+
recordOutputs?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Whether agent-core should emit its own `execute_tool` spans.
|
|
143
|
+
*
|
|
144
|
+
* Agent 365 defaults this to `false` because AI SDK v7's
|
|
145
|
+
* `GenAIOpenTelemetry` already emits A365-compatible tool spans. Keeping both
|
|
146
|
+
* enabled can produce duplicate `execute_tool` spans for one tool call.
|
|
147
|
+
*/
|
|
148
|
+
emitToolSpans?: boolean;
|
|
129
149
|
/**
|
|
130
150
|
* Include tenant as a static span attribute. Prefer `runWithA365Context`
|
|
131
151
|
* when tenant varies per request.
|
|
@@ -140,6 +160,9 @@ type A365TracingConfig = {
|
|
|
140
160
|
agentId?: string;
|
|
141
161
|
agentDescription?: string;
|
|
142
162
|
agentVersion?: string;
|
|
163
|
+
recordInputs?: boolean;
|
|
164
|
+
recordOutputs?: boolean;
|
|
165
|
+
emitToolSpans?: boolean;
|
|
143
166
|
useGenAIOpenTelemetry?: boolean;
|
|
144
167
|
telemetryIntegrations?: TelemetryOptions["integrations"];
|
|
145
168
|
useGlobalTelemetryIntegrations?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1003,6 +1003,9 @@ function createA365TracingConfig(options = {}) {
|
|
|
1003
1003
|
...isNonEmpty(options.agentId) ? { agentId: options.agentId.trim() } : {},
|
|
1004
1004
|
...isNonEmpty(options.agentDescription) ? { agentDescription: options.agentDescription.trim() } : {},
|
|
1005
1005
|
...isNonEmpty(options.agentVersion) ? { agentVersion: options.agentVersion.trim() } : {},
|
|
1006
|
+
...options.recordInputs !== void 0 ? { recordInputs: options.recordInputs } : {},
|
|
1007
|
+
...options.recordOutputs !== void 0 ? { recordOutputs: options.recordOutputs } : {},
|
|
1008
|
+
emitToolSpans: options.emitToolSpans ?? false,
|
|
1006
1009
|
...options.useGenAIOpenTelemetry !== void 0 ? { useGenAIOpenTelemetry: options.useGenAIOpenTelemetry } : {},
|
|
1007
1010
|
...options.telemetryIntegrations ? { telemetryIntegrations: options.telemetryIntegrations } : {},
|
|
1008
1011
|
...options.useGlobalTelemetryIntegrations !== void 0 ? {
|
package/docs/agent-core-otel.md
CHANGED
|
@@ -8,7 +8,7 @@ replace agent-core telemetry and it does not create agent-core spans itself.
|
|
|
8
8
|
agent-core's OpenTelemetry middleware emits:
|
|
9
9
|
|
|
10
10
|
- `invoke_agent` spans for agent turns;
|
|
11
|
-
- `execute_tool` spans for tool calls;
|
|
11
|
+
- optional `execute_tool` spans for tool calls when `emitToolSpans` is enabled;
|
|
12
12
|
- AI SDK GenAI spans for model calls when AI SDK telemetry is enabled.
|
|
13
13
|
|
|
14
14
|
The root agent span includes common GenAI attributes such as:
|
|
@@ -27,6 +27,14 @@ The root agent span includes common GenAI attributes such as:
|
|
|
27
27
|
stable agent metadata. Per-request metadata belongs in baggage via
|
|
28
28
|
`runWithA365Context(...)`.
|
|
29
29
|
|
|
30
|
+
The A365 tracing adapter intentionally defaults `emitToolSpans` to `false`.
|
|
31
|
+
AI SDK v7's `GenAIOpenTelemetry` integration already emits `execute_tool`
|
|
32
|
+
spans for tool executions, and Microsoft's Agent 365 exporter recognizes those
|
|
33
|
+
spans. Keeping both the AI SDK tool span and the agent-core tool span enabled
|
|
34
|
+
can create duplicate `execute_tool` records for one tool call. Override
|
|
35
|
+
`emitToolSpans: true` only for execution paths that do not use AI SDK v7 tool
|
|
36
|
+
telemetry.
|
|
37
|
+
|
|
30
38
|
## What This Package Adds
|
|
31
39
|
|
|
32
40
|
This package wraps the turn in Agent 365 baggage before agent-core starts its
|
package/docs/architecture.md
CHANGED
|
@@ -31,7 +31,8 @@ Per agent:
|
|
|
31
31
|
|
|
32
32
|
1. the host calls `createAgent({ tracing: createA365TracingConfig(...) })`;
|
|
33
33
|
2. agent-core installs its normal OpenTelemetry middleware;
|
|
34
|
-
3. agent-core emits `invoke_agent
|
|
34
|
+
3. agent-core emits `invoke_agent` spans and AI SDK v7 emits model and
|
|
35
|
+
`execute_tool` spans.
|
|
35
36
|
|
|
36
37
|
Per turn:
|
|
37
38
|
|
|
@@ -47,8 +47,7 @@ are documented in [sdk-and-auth-flow.md](./sdk-and-auth-flow.md).
|
|
|
47
47
|
## Scope Classes
|
|
48
48
|
|
|
49
49
|
Microsoft exposes explicit scope classes for several span shapes. agent-core
|
|
50
|
-
already emits
|
|
51
|
-
spans.
|
|
50
|
+
already emits the agent span, and AI SDK telemetry covers model and tool spans.
|
|
52
51
|
|
|
53
52
|
The main shape difference is `OutputScope`, which creates a separate
|
|
54
53
|
`output_messages` span. agent-core currently records output messages on the
|
|
@@ -18,8 +18,8 @@ Microsoft's Node observability packages have three practical layers:
|
|
|
18
18
|
The cuylabs adapter sits beside those framework extensions. OpenAI Agents and
|
|
19
19
|
LangChain need extension packages because their framework callbacks must be
|
|
20
20
|
converted into Agent 365-shaped OpenTelemetry spans. agent-core already emits
|
|
21
|
-
agent
|
|
22
|
-
resolution, and Agent 365 baggage.
|
|
21
|
+
agent spans and AI SDK v7 already emits model/tool spans, so this adapter
|
|
22
|
+
focuses on startup, token resolution, and Agent 365 baggage.
|
|
23
23
|
|
|
24
24
|
## What We Use
|
|
25
25
|
|
|
@@ -45,7 +45,7 @@ resolution, and Agent 365 baggage.
|
|
|
45
45
|
| Microsoft capability | Status | Reason |
|
|
46
46
|
| ----------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
47
47
|
| `InvokeAgentScope` | Not used by default. | agent-core already emits the agent turn span. Creating another scope would duplicate `invoke_agent` telemetry. |
|
|
48
|
-
| `ExecuteToolScope` | Not used by default. |
|
|
48
|
+
| `ExecuteToolScope` | Not used by default. | AI SDK v7 already emits Agent 365-shaped tool spans for agent-core tool calls. |
|
|
49
49
|
| `InferenceScope` | Not used by default. | AI SDK telemetry already emits model spans under the agent turn. |
|
|
50
50
|
| OpenAI Agents extension | Not used by default. | It patches `@openai/agents`; agent-core is the harness we adapt. |
|
|
51
51
|
| LangChain extension | Not used by default. | It patches LangChain callbacks; agent-core already owns the turn and tool lifecycle. |
|
|
@@ -33,7 +33,9 @@ processor and an export processor. The baggage processor copies current Agent
|
|
|
33
33
|
|
|
34
34
|
Per agent, the host passes `createA365TracingConfig(...)` into
|
|
35
35
|
`createAgent({ tracing })`. agent-core still owns the real agent telemetry. It
|
|
36
|
-
emits agent turn spans
|
|
36
|
+
emits agent turn spans and AI SDK v7 emits model/tool spans. The A365 adapter
|
|
37
|
+
defaults agent-core's extra `execute_tool` span layer off so one tool execution
|
|
38
|
+
does not produce duplicate Agent 365 tool records.
|
|
37
39
|
|
|
38
40
|
Per turn, the host or channel adapter calls `runWithA365Context(...)` or
|
|
39
41
|
`runWithA365TurnContext(...)` before running `agent.chat(...)`. The adapter
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuylabs/agent-a365-observability",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "Microsoft Agent 365 observability adapter for @cuylabs/agent-core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typescript": "^5.7.0",
|
|
27
27
|
"vitest": "^4.0.18",
|
|
28
28
|
"zod": "^3.25.76 || ^4.1.8",
|
|
29
|
-
"@cuylabs/agent-core": "^4.7.
|
|
29
|
+
"@cuylabs/agent-core": "^4.7.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@cuylabs/agent-core": "^4.0.0",
|