agent-inspect 1.8.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/CHANGELOG.md +14 -0
- package/README.md +146 -23
- package/docs/ADAPTER-CONFORMANCE.md +1 -1
- package/docs/ADAPTERS.md +41 -6
- package/docs/API.md +123 -36
- package/docs/CLI.md +75 -11
- package/docs/EXPORTS.md +1 -1
- package/docs/GETTING-STARTED.md +72 -16
- package/docs/KNOWN-ISSUES.md +8 -3
- package/docs/LIMITATIONS.md +6 -6
- package/docs/LOG-TO-TREE-QUICKSTART.md +1 -2
- package/docs/MIGRATION.md +67 -0
- package/docs/SCHEMA.md +29 -12
- package/package.json +2 -2
- package/packages/cli/dist/index.cjs +7604 -7660
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +7604 -7660
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/core/dist/advanced.cjs +2047 -26
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +346 -196
- package/packages/core/dist/advanced.d.ts +346 -196
- package/packages/core/dist/advanced.mjs +628 -5
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.d.cts +1 -1
- package/packages/core/dist/checks.d.ts +1 -1
- package/packages/core/dist/chunk-2ZXEMWGK.mjs +549 -0
- package/packages/core/dist/chunk-2ZXEMWGK.mjs.map +1 -0
- package/packages/core/dist/{chunk-57S5D6HR.mjs → chunk-4JVGFNQH.mjs} +50 -6
- package/packages/core/dist/chunk-4JVGFNQH.mjs.map +1 -0
- package/packages/core/dist/{chunk-6QSLZCBJ.mjs → chunk-A4V2H3YU.mjs} +329 -163
- package/packages/core/dist/chunk-A4V2H3YU.mjs.map +1 -0
- package/packages/core/dist/{chunk-74XZ6N7Q.mjs → chunk-IZBJAZGF.mjs} +12 -4
- package/packages/core/dist/chunk-IZBJAZGF.mjs.map +1 -0
- package/packages/core/dist/{chunk-VTIB5MDK.mjs → chunk-NQZPZ2FN.mjs} +15 -10
- package/packages/core/dist/chunk-NQZPZ2FN.mjs.map +1 -0
- package/packages/core/dist/{chunk-TZISEVLQ.mjs → chunk-XUNJMAPD.mjs} +3 -3
- package/packages/core/dist/{chunk-TZISEVLQ.mjs.map → chunk-XUNJMAPD.mjs.map} +1 -1
- package/packages/core/dist/context-CSKnzpXR.d.cts +177 -0
- package/packages/core/dist/context-yv2VSDQF.d.ts +177 -0
- package/packages/core/dist/diff.d.cts +2 -2
- package/packages/core/dist/diff.d.ts +2 -2
- package/packages/core/dist/diff.mjs +473 -3
- package/packages/core/dist/diff.mjs.map +1 -1
- package/packages/core/dist/exporters.cjs +691 -0
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.d.cts +24 -3
- package/packages/core/dist/exporters.d.ts +24 -3
- package/packages/core/dist/exporters.mjs +1113 -3
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/index.cjs +1385 -8022
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.d.cts +8 -313
- package/packages/core/dist/index.d.ts +8 -313
- package/packages/core/dist/index.mjs +18 -1331
- package/packages/core/dist/index.mjs.map +1 -1
- package/packages/core/dist/{log-config-DanPV3P9.d.cts → log-config-8aE5Kxtr.d.cts} +1 -1
- package/packages/core/dist/{log-config-BPHS4Sds.d.ts → log-config-DVimQJho.d.ts} +1 -1
- package/packages/core/dist/logs.d.cts +2 -2
- package/packages/core/dist/logs.d.ts +2 -2
- package/packages/core/dist/logs.mjs +785 -2
- package/packages/core/dist/logs.mjs.map +1 -1
- package/packages/core/dist/{persisted-inspect-event-Cw7TeYGr.d.ts → persisted-inspect-event-D-WpXeZX.d.ts} +14 -5
- package/packages/core/dist/{persisted-inspect-event-DHPfzUd8.d.cts → persisted-inspect-event-DHcHPUKv.d.cts} +14 -5
- package/packages/core/dist/persisted.cjs +11 -1
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.d.cts +4 -4
- package/packages/core/dist/persisted.d.ts +4 -4
- package/packages/core/dist/persisted.mjs +150 -3
- package/packages/core/dist/persisted.mjs.map +1 -1
- package/packages/core/dist/readers.cjs +27 -10
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.d.cts +1 -1
- package/packages/core/dist/readers.d.ts +1 -1
- package/packages/core/dist/readers.mjs +1580 -4
- package/packages/core/dist/readers.mjs.map +1 -1
- package/packages/core/dist/{types-Ap9uMdx_.d.ts → types-D-Y1kOU-.d.ts} +2 -2
- package/packages/core/dist/{types-B2-BU5CS.d.cts → types-DgMN3qow.d.cts} +2 -2
- package/packages/core/dist/writers.cjs +49 -3
- package/packages/core/dist/writers.cjs.map +1 -1
- package/packages/core/dist/writers.d.cts +1 -1
- package/packages/core/dist/writers.d.ts +1 -1
- package/packages/core/dist/writers.mjs +341 -4
- package/packages/core/dist/writers.mjs.map +1 -1
- package/packages/core/dist/chunk-57S5D6HR.mjs.map +0 -1
- package/packages/core/dist/chunk-6QSLZCBJ.mjs.map +0 -1
- package/packages/core/dist/chunk-6SZPTECC.mjs +0 -342
- package/packages/core/dist/chunk-6SZPTECC.mjs.map +0 -1
- package/packages/core/dist/chunk-74XZ6N7Q.mjs.map +0 -1
- package/packages/core/dist/chunk-HR7G62IE.mjs +0 -785
- package/packages/core/dist/chunk-HR7G62IE.mjs.map +0 -1
- package/packages/core/dist/chunk-TFLPUZ56.mjs +0 -1571
- package/packages/core/dist/chunk-TFLPUZ56.mjs.map +0 -1
- package/packages/core/dist/chunk-U2BGPESY.mjs +0 -150
- package/packages/core/dist/chunk-U2BGPESY.mjs.map +0 -1
- package/packages/core/dist/chunk-VTIB5MDK.mjs.map +0 -1
- package/packages/core/dist/chunk-Y56BPA3B.mjs +0 -990
- package/packages/core/dist/chunk-Y56BPA3B.mjs.map +0 -1
- package/packages/core/dist/chunk-YWAOOXLR.mjs +0 -475
- package/packages/core/dist/chunk-YWAOOXLR.mjs.map +0 -1
package/docs/GETTING-STARTED.md
CHANGED
|
@@ -25,7 +25,36 @@ pnpm build
|
|
|
25
25
|
node packages/cli/dist/index.cjs --help
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
## 2.
|
|
28
|
+
## 2. Observe an existing object/class first
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { observe } from "agent-inspect";
|
|
32
|
+
|
|
33
|
+
class SupportAgent {
|
|
34
|
+
async run(input: { question: string }) {
|
|
35
|
+
return {
|
|
36
|
+
answer: `Answering: ${input.question}`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const agent = observe(new SupportAgent(), {
|
|
42
|
+
traceDir: "./.agent-inspect",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
await agent.run({
|
|
46
|
+
question: "How do refunds work?",
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This writes a local JSONL trace with stable event names (`schemaVersion: "0.1"`) when the observed `run` method is called:
|
|
51
|
+
|
|
52
|
+
- `run_started`, `run_completed`
|
|
53
|
+
- `step_started`, `step_completed`
|
|
54
|
+
|
|
55
|
+
## 3. Manually instrument custom flows
|
|
56
|
+
|
|
57
|
+
Use `inspectRun` and `step` when you want explicit step names, custom nesting, or a flow that is not shaped like an object/class method.
|
|
29
58
|
|
|
30
59
|
```ts
|
|
31
60
|
import { inspectRun, step } from "agent-inspect";
|
|
@@ -37,10 +66,31 @@ await inspectRun("demo-agent", async () => {
|
|
|
37
66
|
});
|
|
38
67
|
```
|
|
39
68
|
|
|
40
|
-
|
|
69
|
+
Use the root import for stable beginner APIs:
|
|
41
70
|
|
|
42
|
-
|
|
43
|
-
|
|
71
|
+
```ts
|
|
72
|
+
import {
|
|
73
|
+
createInspector,
|
|
74
|
+
observe,
|
|
75
|
+
inspectRun,
|
|
76
|
+
maybeInspectRun,
|
|
77
|
+
step,
|
|
78
|
+
getCurrentCorrelationMetadata,
|
|
79
|
+
} from "agent-inspect";
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Use subpaths for advanced, experimental, or lower-level workflows:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { openTrace } from "agent-inspect/readers";
|
|
86
|
+
import { memoryWriter } from "agent-inspect/writers";
|
|
87
|
+
import { runTraceChecks } from "agent-inspect/checks";
|
|
88
|
+
import { diffTraceEvents } from "agent-inspect/diff";
|
|
89
|
+
import { exportMarkdown } from "agent-inspect/exporters";
|
|
90
|
+
import { parseLogsToTrees } from "agent-inspect/logs";
|
|
91
|
+
import { traceEventsToPersistedInspectEvents } from "agent-inspect/persisted";
|
|
92
|
+
import { createInspectorRuntime } from "agent-inspect/advanced";
|
|
93
|
+
```
|
|
44
94
|
|
|
45
95
|
### Always trace vs env-gated tracing
|
|
46
96
|
|
|
@@ -90,14 +140,14 @@ If `import` or `require` fails after install, see [KNOWN-ISSUES.md — Common in
|
|
|
90
140
|
|
|
91
141
|
To skip tracing in code without env vars: `inspectRun(name, fn, { enabled: false })`.
|
|
92
142
|
|
|
93
|
-
##
|
|
143
|
+
## 4. View runs
|
|
94
144
|
|
|
95
145
|
```bash
|
|
96
146
|
agent-inspect list
|
|
97
147
|
agent-inspect view <runId>
|
|
98
148
|
```
|
|
99
149
|
|
|
100
|
-
##
|
|
150
|
+
## 5. Clean old runs (safely)
|
|
101
151
|
|
|
102
152
|
Always start with `--dry-run`:
|
|
103
153
|
|
|
@@ -106,7 +156,7 @@ agent-inspect clean --older-than 7d --dry-run
|
|
|
106
156
|
agent-inspect clean --older-than 7d --yes
|
|
107
157
|
```
|
|
108
158
|
|
|
109
|
-
##
|
|
159
|
+
## 6. Advanced ingestion: parse existing structured logs
|
|
110
160
|
|
|
111
161
|
```bash
|
|
112
162
|
agent-inspect logs fixtures/logs/proactive-json.log \
|
|
@@ -114,7 +164,7 @@ agent-inspect logs fixtures/logs/proactive-json.log \
|
|
|
114
164
|
--config fixtures/configs/proactive-agent-inspect.logs.json
|
|
115
165
|
```
|
|
116
166
|
|
|
117
|
-
##
|
|
167
|
+
## 7. Tail logs
|
|
118
168
|
|
|
119
169
|
For scripting/CI-style usage, `--once` reads and exits:
|
|
120
170
|
|
|
@@ -126,7 +176,7 @@ agent-inspect tail \
|
|
|
126
176
|
--once
|
|
127
177
|
```
|
|
128
178
|
|
|
129
|
-
##
|
|
179
|
+
## 8. Export a run
|
|
130
180
|
|
|
131
181
|
```bash
|
|
132
182
|
agent-inspect export minimal-success --dir fixtures/traces --format markdown
|
|
@@ -142,7 +192,7 @@ agent-inspect export minimal-success --dir fixtures/traces \
|
|
|
142
192
|
|
|
143
193
|
Exports are **local-only** and do not upload anywhere. Review output before sharing — see [SAFE-TRACE-SHARING.md](./SAFE-TRACE-SHARING.md).
|
|
144
194
|
|
|
145
|
-
##
|
|
195
|
+
## 9. Local observability (v1.4.0+)
|
|
146
196
|
|
|
147
197
|
After traces exist under a directory:
|
|
148
198
|
|
|
@@ -154,17 +204,21 @@ agent-inspect search --dir ./.agent-inspect --status error --limit 10
|
|
|
154
204
|
|
|
155
205
|
For CI artifact workflows, see [CI-ARTIFACTS.md](./CI-ARTIFACTS.md) and [github-actions-artifact recipe](../examples/recipes/github-actions-artifact/).
|
|
156
206
|
|
|
157
|
-
##
|
|
207
|
+
## 10. Diff two runs
|
|
158
208
|
|
|
159
209
|
```bash
|
|
160
210
|
agent-inspect diff minimal-success minimal-error --dir fixtures/traces
|
|
161
211
|
```
|
|
162
212
|
|
|
163
|
-
##
|
|
213
|
+
## 11. Try recipes
|
|
164
214
|
|
|
165
215
|
See `examples/recipes/README.md`.
|
|
166
216
|
|
|
167
|
-
##
|
|
217
|
+
## 12. Optional framework adapters
|
|
218
|
+
|
|
219
|
+
See [ADAPTERS.md](./ADAPTERS.md) for AI SDK local telemetry, OpenAI Agents local-only processing, and LangChain callbacks.
|
|
220
|
+
|
|
221
|
+
### LangChain
|
|
168
222
|
|
|
169
223
|
`@agent-inspect/langchain` is optional and **experimental**. Events are **in-memory by default**; pass `persist: true` to write local JSONL traces inspectable by the CLI.
|
|
170
224
|
|
|
@@ -174,7 +228,7 @@ pnpm add @agent-inspect/langchain
|
|
|
174
228
|
|
|
175
229
|
See [examples/08-langchain-adapter](../examples/08-langchain-adapter/README.md) and [docs/ADAPTERS.md](./ADAPTERS.md).
|
|
176
230
|
|
|
177
|
-
##
|
|
231
|
+
## 13. Optional TUI
|
|
178
232
|
|
|
179
233
|
`@agent-inspect/tui` is optional and **experimental**. The CLI can invoke it with:
|
|
180
234
|
|
|
@@ -182,14 +236,16 @@ See [examples/08-langchain-adapter](../examples/08-langchain-adapter/README.md)
|
|
|
182
236
|
agent-inspect view <runId> --tui
|
|
183
237
|
```
|
|
184
238
|
|
|
185
|
-
##
|
|
239
|
+
## 14. Safety notes
|
|
186
240
|
|
|
241
|
+
- Nothing uploads by default; core tracing, readers, checks, and exports are local-first.
|
|
187
242
|
- Redaction is on by default for log-derived attributes, **manual trace metadata (before disk)**, and exports. Pass `redact: false` to opt out of manual metadata redaction.
|
|
243
|
+
- Export redaction shapes a local copy and does not mutate the source trace; review exported files before sharing.
|
|
188
244
|
- Persisted events are size-bounded by default (see `docs/API.md`).
|
|
189
245
|
- Confidence labels are required to keep attribution honest.
|
|
190
246
|
- AgentInspect is for local debugging, not production monitoring.
|
|
191
247
|
|
|
192
|
-
##
|
|
248
|
+
## 15. Next docs
|
|
193
249
|
|
|
194
250
|
- [docs/API.md](./API.md)
|
|
195
251
|
- [docs/CLI.md](./CLI.md)
|
package/docs/KNOWN-ISSUES.md
CHANGED
|
@@ -23,7 +23,7 @@ AgentInspect is **local-first** and **CLI-first**. These behaviors are intention
|
|
|
23
23
|
|
|
24
24
|
- **Vendor sinks** (hosted dashboards, Langfuse/Braintrust/New Relic/Datadog native uploads, OTLP gRPC streaming, etc.) are **not implemented** in the core packages described here.
|
|
25
25
|
- **AI SDK adapter** (`@agent-inspect/ai-sdk`) is experimental and metadata-first. It depends on explicit AI SDK telemetry configuration and requires `recordInputs: false` / `recordOutputs: false` for the documented safe path.
|
|
26
|
-
- **OpenAI Agents JS adapter** (`@agent-inspect/openai-agents`) is experimental and
|
|
26
|
+
- **OpenAI Agents JS adapter** (`@agent-inspect/openai-agents`) is experimental and metadata-first. Runtime metadata mapping is local-only; the safe install path is `setTraceProcessors()` rather than `addTraceProcessor()`. The v1.9 package publication retry is pending maintainer-side npm auto-publish setup and is separate from v2 contract work.
|
|
27
27
|
- **LangGraph support** is currently a documented boundary through `@agent-inspect/langchain`, not a dedicated package.
|
|
28
28
|
- **LangChain adapter** captures **metadata-oriented** signals by default; it does not replace full framework observability.
|
|
29
29
|
- **LangChain `stream: true`** records chunk counts and timing only — not a full token replay. Per-token JSONL events are not emitted.
|
|
@@ -93,9 +93,14 @@ pnpm compat:smoke
|
|
|
93
93
|
- Fixture pattern: [test/consumer-fixtures/jest-cjs/](../../test/consumer-fixtures/jest-cjs/).
|
|
94
94
|
- Full Jest runner smoke in CI is a documented follow-up — root package does not ship Jest as a devDependency.
|
|
95
95
|
|
|
96
|
-
##
|
|
96
|
+
## v2 migration notes
|
|
97
|
+
|
|
98
|
+
- Advanced APIs no longer live on the root import in the v2 contract. Use `agent-inspect/readers`, `/writers`, `/checks`, `/diff`, `/exporters`, `/logs`, `/persisted`, and `/advanced`.
|
|
99
|
+
- The small root value API is `createInspector`, `inspectRun`, `maybeInspectRun`, `step`, `observe`, and `getCurrentCorrelationMetadata`.
|
|
100
|
+
- Use `agent-inspect migrate <trace.jsonl> --to 1.0 --dry-run` before writing migrated output. The command does not rewrite input files.
|
|
101
|
+
|
|
102
|
+
## v1.8/v1.9 adoption notes
|
|
97
103
|
|
|
98
|
-
- `@agent-inspect/vitest` and `@agent-inspect/jest` are private/unpublished until the v1.8 release-readiness gate completes. The [test reporter artifact recipe](../examples/recipes/test-reporter-artifacts/README.md) documents the intended config shape without requiring those packages.
|
|
99
104
|
- `agent-inspect artifacts --github-summary` writes a local step-summary file only. It does not call GitHub APIs, open PR comments, upload artifacts, or mutate repository state.
|
|
100
105
|
- Baseline checks compare normalized structural facts from explicit candidate and baseline inputs. They are useful for CI regression evidence, not replay or semantic eval scoring.
|
|
101
106
|
|
package/docs/LIMITATIONS.md
CHANGED
|
@@ -15,13 +15,13 @@ This document states what AgentInspect **does not** provide today. It complement
|
|
|
15
15
|
|
|
16
16
|
## Persisted event model (v1.2.0 foundation)
|
|
17
17
|
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
18
|
+
- **Manual global tracing remains v0.1.** `inspectRun()` / `step()` still write `schemaVersion: "0.1"` JSONL for compatibility.
|
|
19
|
+
- **Persisted writer/runtime output targets schema 1.0.** `createInspector()` with built-in writers emits schema 1.0 persisted rows; v0.2 remains a readable compatibility foundation.
|
|
20
|
+
- **Migration is explicit, not automatic.** `agent-inspect migrate <input> --to 1.0 --dry-run` reports what would change, and `--output <file>` writes a separate file. AgentInspect does not rewrite old traces in place.
|
|
21
21
|
|
|
22
22
|
## Runtime writers and universal readers (v1.6)
|
|
23
23
|
|
|
24
|
-
- **
|
|
24
|
+
- **Subpath APIs:** `agent-inspect/writers`, `agent-inspect/readers`, and advanced helpers are available for local adoption from their owning subpaths. `createInspector()` is part of the small root API.
|
|
25
25
|
- **Explicit writer ownership:** `createInspector()` does not print terminal lifecycle output or implicitly choose a disk writer. Use `fileWriter()` / `bufferedFileWriter()` / custom writers when persistence is desired.
|
|
26
26
|
- **No standards upload:** OpenInference and OTLP JSON support is local read/export compatibility only. There is no OTLP gRPC/HTTP streaming sink, collector client, or hosted ingestion behavior.
|
|
27
27
|
- **Conservative detection:** `agent-inspect open` does not silently accept arbitrary JSON. Unsupported or ambiguous inputs produce errors/warnings rather than guessed traces.
|
|
@@ -31,7 +31,7 @@ This document states what AgentInspect **does not** provide today. It complement
|
|
|
31
31
|
|
|
32
32
|
- **AI SDK integration is explicit telemetry wiring.** Use `@agent-inspect/ai-sdk` through AI SDK `experimental_telemetry.integrations`; AgentInspect does not wrap providers, patch fetch, or enable telemetry globally.
|
|
33
33
|
- **AI SDK privacy settings are caller-owned.** Examples set `recordInputs: false` and `recordOutputs: false`; leaving those enabled in user code can cause the AI SDK telemetry layer to include richer data before AgentInspect receives events.
|
|
34
|
-
- **OpenAI Agents JS support is experimental
|
|
34
|
+
- **OpenAI Agents JS support is experimental.** `@agent-inspect/openai-agents` maps metadata-only runtime spans through the safe `setTraceProcessors()` boundary and does not capture raw payloads by default. The v1.9 package publication retry is a separate maintainer npm automation task, not part of the v2 contract work.
|
|
35
35
|
- **LangGraph support is a boundary decision, not a separate package.** Initial support is expected through `@agent-inspect/langchain` callbacks unless no-network fixtures prove a separate package is needed.
|
|
36
36
|
- **No root/core adapter dependencies.** AI SDK, OpenAI Agents, LangGraph, OpenTelemetry, and LangChain remain outside the root/core runtime dependency graph.
|
|
37
37
|
|
|
@@ -58,7 +58,7 @@ This document states what AgentInspect **does not** provide today. It complement
|
|
|
58
58
|
|
|
59
59
|
- **Checks are deterministic local rules, not compliance certification.** `check`, `scan`, and `verify-safe` surface bounded findings and diagnostics over supported local inputs; they do not prove a trace is safe for every sharing context.
|
|
60
60
|
- **Safe CI artifacts are structural summaries.** They avoid raw prompt/output/request/response/header/tool payload content by default, but teams should still review generated files before sharing.
|
|
61
|
-
- **Vitest/Jest reporters are optional
|
|
61
|
+
- **Vitest/Jest reporters are optional package surfaces.** Recipes document config patterns and explicit associations; package publication is controlled by release readiness and maintainer authorization.
|
|
62
62
|
|
|
63
63
|
## Execution semantics
|
|
64
64
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Log-to-tree quickstart
|
|
2
2
|
|
|
3
|
-
AgentInspect can inspect
|
|
3
|
+
Advanced ingestion: use this when your app already emits structured logs. AgentInspect can inspect those logs and render a local execution tree without requiring you to wrap every function in manual tracing.
|
|
4
4
|
|
|
5
5
|
## Example JSON log lines
|
|
6
6
|
|
|
@@ -53,4 +53,3 @@ See also:
|
|
|
53
53
|
- `docs/LOGGING-PLAYBOOK.md` (pino / log4js / NestJS examples + fixtures)
|
|
54
54
|
- `docs/SCHEMA.md` (log ingest config types + confidence)
|
|
55
55
|
- `examples/recipes/pino-json-logs/`, `log4js-json-layout/`, `nestjs-json-logging/`
|
|
56
|
-
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Migration
|
|
2
|
+
|
|
3
|
+
AgentInspect keeps stable global APIs and published imports working within each major version. Manual trace writing remains `schemaVersion: "0.1"` where documented, and v0.1/v0.2 traces remain readable.
|
|
4
|
+
|
|
5
|
+
## From older 1.x docs
|
|
6
|
+
|
|
7
|
+
Prefer the current adoption order:
|
|
8
|
+
|
|
9
|
+
1. Use `observe()` for an existing object/class.
|
|
10
|
+
2. Use framework adapters when you already run AI SDK, OpenAI Agents, or LangChain.
|
|
11
|
+
3. Use `inspectRun` and `step` when you need explicit custom spans.
|
|
12
|
+
4. Use structured log parsing as advanced ingestion when your app already emits structured logs.
|
|
13
|
+
|
|
14
|
+
## Imports
|
|
15
|
+
|
|
16
|
+
Use the root import for stable beginner APIs:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import {
|
|
20
|
+
createInspector,
|
|
21
|
+
observe,
|
|
22
|
+
inspectRun,
|
|
23
|
+
maybeInspectRun,
|
|
24
|
+
step,
|
|
25
|
+
getCurrentCorrelationMetadata,
|
|
26
|
+
} from "agent-inspect";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use subpaths for advanced, experimental, or lower-level workflows:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { openTrace } from "agent-inspect/readers";
|
|
33
|
+
import { memoryWriter } from "agent-inspect/writers";
|
|
34
|
+
import { runTraceChecks } from "agent-inspect/checks";
|
|
35
|
+
import { diffTraceEvents } from "agent-inspect/diff";
|
|
36
|
+
import { exportMarkdown } from "agent-inspect/exporters";
|
|
37
|
+
import { parseLogsToTrees } from "agent-inspect/logs";
|
|
38
|
+
import { traceEventsToPersistedInspectEvents } from "agent-inspect/persisted";
|
|
39
|
+
import { createInspectorRuntime } from "agent-inspect/advanced";
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Root and subpath imports
|
|
43
|
+
|
|
44
|
+
Keep beginner workflow APIs at the root and move advanced usage to subpaths.
|
|
45
|
+
|
|
46
|
+
| API area | Preferred import | Direction |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| `inspectRun`, `maybeInspectRun`, `step`, `observe`, `getCurrentCorrelationMetadata`, `createInspector` | `agent-inspect` | stays root |
|
|
49
|
+
| `createInspectorRuntime` | `agent-inspect/advanced` | `/advanced` |
|
|
50
|
+
| `openTrace`, `readTrace`, `detectTraceFormat` | `agent-inspect/readers` | `/readers` |
|
|
51
|
+
| `memoryWriter`, `fileWriter`, `bufferedFileWriter`, `compositeWriter`, `nullWriter` | `agent-inspect/writers` | `/writers` |
|
|
52
|
+
| `runTraceChecks` and check types | `agent-inspect/checks` | `/checks` |
|
|
53
|
+
| `diffTraceEvents`, `diffRuns`, `renderRunDiff` | `agent-inspect/diff` | `/diff` |
|
|
54
|
+
| `exportMarkdown`, `exportHtml`, `exportOpenInference`, `exportOtlpJson` | `agent-inspect/exporters` | `/exporters` |
|
|
55
|
+
| `parseLogsToTrees`, log parsers, tree builders | `agent-inspect/logs` | `/logs` |
|
|
56
|
+
| persisted conversion helpers | `agent-inspect/persisted` | `/persisted` |
|
|
57
|
+
|
|
58
|
+
## Safety
|
|
59
|
+
|
|
60
|
+
Nothing uploads by default. Manual metadata is redacted before disk by default, and export redaction applies to a local copy before you share it. Review traces and exports before posting them in issues, PRs, chats, or public docs.
|
|
61
|
+
|
|
62
|
+
## Compatibility notes
|
|
63
|
+
|
|
64
|
+
- Existing `inspectRun`, `maybeInspectRun`, `step`, `step.llm`, `step.tool`, `observe`, `getCurrentCorrelationMetadata`, and `createInspector` imports remain valid.
|
|
65
|
+
- Root/core does not require optional adapter dependencies.
|
|
66
|
+
- Optional adapter APIs are experimental and package-scoped.
|
|
67
|
+
- No destructive migration is required for existing trace directories.
|
package/docs/SCHEMA.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
# Schema
|
|
1
|
+
# Schema
|
|
2
2
|
|
|
3
|
-
This document describes the **persisted
|
|
3
|
+
This document describes the **persisted AgentInspect JSONL schemas** and the **log-derived normalized model** used by AgentInspect.
|
|
4
4
|
|
|
5
5
|
## 1. Overview
|
|
6
6
|
|
|
7
7
|
AgentInspect has two related (but distinct) data models:
|
|
8
8
|
|
|
9
9
|
1. **Manual trace JSONL** (persisted): lines of `TraceEvent` written by `inspectRun()` / `step()`.
|
|
10
|
-
2. **
|
|
10
|
+
2. **Persisted InspectEvent JSONL** (persisted): schema 1.0 rows written by `createInspector()` / built-in writers and produced by explicit migration.
|
|
11
|
+
3. **Log-derived normalized model** (in-memory): `InspectEvent` / `InspectRunTree` built from structured logs or adapters.
|
|
11
12
|
|
|
12
13
|
Important: log-derived trees are **normalized views**, not the same persisted JSONL schema.
|
|
13
14
|
|
|
@@ -25,7 +26,7 @@ Manual trace events use:
|
|
|
25
26
|
|
|
26
27
|
- **`schemaVersion: "0.1"`**
|
|
27
28
|
|
|
28
|
-
Existing `0.1` traces remain readable across AgentInspect
|
|
29
|
+
Existing `0.1` traces remain readable across AgentInspect major versions covered by this migration path.
|
|
29
30
|
|
|
30
31
|
### 2.3 TraceEvent union
|
|
31
32
|
|
|
@@ -153,13 +154,13 @@ Manual trace reading:
|
|
|
153
154
|
|
|
154
155
|
## 9. Backward compatibility
|
|
155
156
|
|
|
156
|
-
- v0.1 JSONL traces remain readable
|
|
157
|
-
- No automatic migrations or rewriting of old files.
|
|
157
|
+
- v0.1, v0.2, and v1.0 AgentInspect JSONL traces remain readable.
|
|
158
|
+
- No automatic migrations or rewriting of old files. Use `agent-inspect migrate <input> --to 1.0 --dry-run` first, then `--output <file>` for explicit conversion.
|
|
158
159
|
|
|
159
160
|
## 10. Breaking change policy
|
|
160
161
|
|
|
161
162
|
- Breaking changes require a major version.
|
|
162
|
-
- Stable
|
|
163
|
+
- Stable policy: avoid removing stable fields/events within a major version; prefer additive extensions.
|
|
163
164
|
|
|
164
165
|
## 11. Log-derived InspectEvent model
|
|
165
166
|
|
|
@@ -241,18 +242,34 @@ Canonical samples: `fixtures/traces-v0.2/*.jsonl` (validated by `pnpm fixtures:c
|
|
|
241
242
|
|
|
242
243
|
Programmatic helpers: see [API.md](./API.md) §13 (experimental persisted-event foundation).
|
|
243
244
|
|
|
244
|
-
## 15.
|
|
245
|
+
## 15. Stable persisted InspectEvent schemaVersion "1.0"
|
|
245
246
|
|
|
246
|
-
|
|
247
|
+
Schema 1.0 is the v2 persisted InspectEvent contract. It evolves the v0.2 shape in place rather than introducing a third unrelated model.
|
|
248
|
+
|
|
249
|
+
| Topic | Rule |
|
|
250
|
+
| ----- | ---- |
|
|
251
|
+
| `schemaVersion` | `"1.0"` |
|
|
252
|
+
| Default writer target | `createInspector()` and built-in persisted writers emit schema 1.0 rows by default. |
|
|
253
|
+
| Manual helper compatibility | `inspectRun()` / `step()` global/manual tracing continues to write `schemaVersion: "0.1"` for compatibility. |
|
|
254
|
+
| Reader compatibility | AgentInspect readers accept v0.1, v0.2, v1.0, and mixed AgentInspect JSONL where safe, with warnings. |
|
|
255
|
+
| Unknown optional fields | Safe unknown optional fields on v1.0 rows are preserved where possible; unsupported fields are surfaced through warnings/diagnostics rather than fabricated into relationships. |
|
|
256
|
+
| Migration | `agent-inspect migrate <input> --to 1.0 --dry-run` is non-mutating; `--output <file>` writes a separate migrated file and refuses input overwrite. |
|
|
257
|
+
|
|
258
|
+
Canonical samples: `fixtures/traces-v1.0/*.jsonl` (validated by `pnpm fixtures:check`).
|
|
259
|
+
|
|
260
|
+
## 16. Local reader/writer compatibility
|
|
261
|
+
|
|
262
|
+
Local writer and reader surfaces do not change the stable manual trace schema:
|
|
247
263
|
|
|
248
264
|
- `inspectRun()` / `step()` continue to write `schemaVersion: "0.1"` JSONL by default.
|
|
249
|
-
- `createInspector()`
|
|
265
|
+
- `createInspector()` writes schema 1.0 `PersistedInspectEvent` rows when configured with a writer such as `fileWriter()` or `bufferedFileWriter()`.
|
|
250
266
|
- `agent-inspect/readers` and `agent-inspect open` read local AgentInspect JSONL, OpenInference JSON, and OTLP JSON inputs through compatibility adapters.
|
|
251
267
|
- OpenInference and OTLP JSON inputs are **not** a third AgentInspect persisted schema. They are local read formats normalized into inspection trees with warnings and unsupported-field reporting.
|
|
252
268
|
- Reader and writer APIs perform no network upload and do not mutate source files.
|
|
253
269
|
- v1.8 checks, safety verification, baseline comparison, safe CI artifacts, and reporter artifacts are report layers over existing trace inputs. They do not change manual trace writing, introduce a third persisted trace model, or embed raw prompt/output/request/response/header/tool payload content in their default structural outputs.
|
|
254
270
|
|
|
255
|
-
##
|
|
271
|
+
## 17. Migration notes
|
|
256
272
|
|
|
257
273
|
- Minor releases may add optional fields/events, but must keep existing v0.1 traces readable.
|
|
258
|
-
- v0.1 →
|
|
274
|
+
- v0.1/v0.2 → v1.0 migration is explicit and local-only through `agent-inspect migrate`; automatic in-place rewrite remains out of scope.
|
|
275
|
+
- The default manual writer remains v0.1; the persisted writer/runtime path targets schema 1.0.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-inspect",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local-first execution-tree debugger for TypeScript AI agents",
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
},
|
|
169
169
|
"scripts": {
|
|
170
170
|
"clean": "pnpm -r exec -- rm -rf dist",
|
|
171
|
-
"build": "pnpm exec tsup --config tsup.core.config.ts && pnpm exec tsup --config tsup.cli.config.ts && pnpm exec tsup --config tsup.langchain.config.ts && pnpm exec tsup --config tsup.tui.config.ts && pnpm exec tsup --config tsup.ai-sdk.config.ts && pnpm exec tsup --config tsup.vitest.config.ts && pnpm exec tsup --config tsup.jest.config.ts && pnpm exec tsup --config tsup.openai-agents.config.ts",
|
|
171
|
+
"build": "pnpm exec tsup --config tsup.core.config.ts && pnpm exec tsup --config tsup.cli.config.ts && pnpm exec tsup --config tsup.langchain.config.ts && pnpm exec tsup --config tsup.tui.config.ts && pnpm exec tsup --config tsup.ai-sdk.config.ts && pnpm exec tsup --config tsup.vitest.config.ts && pnpm exec tsup --config tsup.jest.config.ts && pnpm exec tsup --config tsup.openai-agents.config.ts && pnpm exec tsup --config tsup.harness.config.ts",
|
|
172
172
|
"typecheck": "tsc --noEmit",
|
|
173
173
|
"test": "vitest run",
|
|
174
174
|
"test:watch": "vitest",
|