@agent-inspect/ai-sdk 6.31.6 → 6.31.8

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.
Files changed (2) hide show
  1. package/README.md +33 -19
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -21,7 +21,7 @@ Vercel AI SDK telemetry → local AgentInspect traces (metadata-only by default)
21
21
  npm install agent-inspect @agent-inspect/ai-sdk ai
22
22
  ```
23
23
 
24
- **Peer:** `ai@^6.0.0`
24
+ **Peer:** `ai@^6.0.0` — tested with **`ai@6.0.210`**. Do not assume AI SDK 7 compatibility.
25
25
 
26
26
  ## Example
27
27
 
@@ -29,24 +29,37 @@ npm install agent-inspect @agent-inspect/ai-sdk ai
29
29
  import { generateText } from "ai";
30
30
  import { agentInspect } from "@agent-inspect/ai-sdk";
31
31
 
32
- const integration = agentInspect({ traceDir: ".agent-inspect" });
33
-
34
- const result = await generateText({
35
- model: yourModel,
36
- prompt: "Hello",
37
- experimental_telemetry: {
38
- isEnabled: true,
39
- recordInputs: false,
40
- recordOutputs: false,
41
- functionId: "my-agent",
42
- metadata: integration.getTelemetryMetadata(),
43
- },
44
- ...integration.getTelemetryHandlers(),
32
+ const integration = agentInspect({
33
+ traceDir: ".agent-inspect",
34
+ runName: "my-agent",
45
35
  });
36
+
37
+ try {
38
+ const result = await generateText({
39
+ model: yourModel,
40
+ prompt: "Hello",
41
+ experimental_telemetry: {
42
+ isEnabled: true,
43
+ recordInputs: false,
44
+ recordOutputs: false,
45
+ integrations: [integration],
46
+ },
47
+ });
48
+ console.log(result.text);
49
+ } finally {
50
+ await integration.flush();
51
+ await integration.close();
52
+ }
46
53
  ```
47
54
 
48
55
  **Required:** `recordInputs: false` and `recordOutputs: false` — AgentInspect does not upload to Vercel; traces stay local.
49
56
 
57
+ Pass the integration only through `experimental_telemetry.integrations`. There are no `getTelemetryMetadata()` / `getTelemetryHandlers()` helpers.
58
+
59
+ ## Concurrent generations
60
+
61
+ Use a **separate** `agentInspect()` instance per concurrent `generateText` / `streamText` call. Sharing one integration across overlapping generations can mix lifecycle rows.
62
+
50
63
  ## Privacy
51
64
 
52
65
  - Writes JSONL under `.agent-inspect/` only
@@ -59,10 +72,11 @@ const result = await generateText({
59
72
 
60
73
  | Export | Purpose |
61
74
  | ------ | ------- |
62
- | `agentInspect(options)` | Telemetry integration factory |
63
- | `getTelemetryHandlers()` | Spread into AI SDK call |
64
- | `getTelemetryMetadata()` | Safe metadata for telemetry block |
65
- | `getDiagnostics()` | Local warnings plus resolved capture mode and preview counters |
75
+ | `agentInspect(options)` | Returns an AI SDK `TelemetryIntegration` plus local helpers |
76
+ | `integration.flush()` | Flush pending writes (safe to call more than once) |
77
+ | `integration.close()` | Terminalize open rows and close the writer |
78
+ | `integration.getDiagnostics()` | Local warnings plus resolved capture mode and preview counters |
79
+ | `integration.getWriterStats()` | Optional writer stats when a writer is active |
66
80
 
67
81
  ## CLI
68
82
 
@@ -76,7 +90,7 @@ const result = await generateText({
76
90
 
77
91
  ## Troubleshooting
78
92
 
79
- - **No trace events:** Ensure `experimental_telemetry.isEnabled: true` and handlers are spread
93
+ - **No trace events:** Ensure `experimental_telemetry.isEnabled: true` and `integrations: [integration]`
80
94
  - **Empty previews in preview mode:** the AI SDK did not provide the field for that step. AgentInspect reports `AI_CAPTURE_FIELD_UNAVAILABLE` through `onDiagnostic` and `getDiagnostics().capture`
81
95
  - **Previews look cut off:** they are bounded by `maxPreviewChars`, which the `share` and `strict` redaction profiles cap further
82
96
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-inspect/ai-sdk",
3
- "version": "6.31.6",
3
+ "version": "6.31.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Vercel AI SDK telemetry integration for AgentInspect local traces and trajectory tests",
@@ -38,7 +38,7 @@
38
38
  "ai": "^6.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "agent-inspect": "6.31.6"
41
+ "agent-inspect": "6.31.8"
42
42
  },
43
43
  "devDependencies": {
44
44
  "ai": "^6.0.210"