agent-inspect 3.4.0 → 3.5.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 CHANGED
@@ -1,584 +1,129 @@
1
1
  # agent-inspect
2
2
 
3
- **Trace, check, and safely share TypeScript AI agent runs locally.**
3
+ **Local-first TypeScript toolkit: trace what happened, check what should have happened, redact what must not leave your machine.**
4
4
 
5
- agent-inspect helps you understand what happened inside an AI agent run without sending traces to a hosted service. It turns framework events, observed objects/classes, manual steps, tool calls, LLM calls, structured logs, failures, durations, and run metadata into readable local execution trees.
5
+ No account · no upload · no hosted dashboard · metadata-only by default
6
6
 
7
- It is built for TypeScript/Node.js developers and teams shipping real agentic products — not just toy demos. Use it for **local TypeScript agent debugging**, **eval iteration**, and **CI trace artifacts**. It **complements** production observability platforms; it does **not** replace them.
7
+ [![npm version](https://img.shields.io/npm/v/agent-inspect.svg)](https://www.npmjs.com/package/agent-inspect)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
9
 
9
- The default loop is local-first: capture a trace, inspect/report/diff it, run deterministic checks in CI, then export a redacted copy only when you choose to share.
10
-
11
- **No account. No cloud upload. No dashboard required.**
12
-
13
- **Visual demos:** [docs/SCREENSHOTS.md](docs/SCREENSHOTS.md) — curated terminal recordings (synthetic fixtures only).
14
-
15
- ## Why agent-inspect exists
16
-
17
- AI agents are no longer single function calls. They plan, call tools, invoke LLMs, branch, retry, fail, and run work in parallel. **Console logs are flat**; reconstructing causality from a wall of lines is slow and error-prone.
18
-
19
- **Hosted observability** is valuable in production, but it can be heavy for the **inner loop**: local runs, fast iteration, and debugging before anything reaches a collector or dashboard.
20
-
21
- agent-inspect gives those runs **structure**: an **execution tree** you can read and diff on disk, with a **CLI-first** workflow and **no vendor lock-in**.
22
-
23
- ## Install
24
-
25
- Current npm release line: **3.3.0** for the linked public packages (`agent-inspect`, adapters, reporters, redact, eval, mcp, guardrails, circuit, viewer, mcp-server, adapter-sdk, harness). **v3.0.0** adds extension contracts and **`@agent-inspect/adapter-sdk`** for third-party adapter authoring; persisted trace schema remains **1.0**.
26
-
27
- **v3.1 adoption path (in progress):**
28
-
29
- 1. `npx agent-inspect init` — local config + demo (no auto-install)
30
- 2. `observe()` or a framework adapter
31
- 3. `@agent-inspect/harness` for real project runners
32
- 4. `npx agent-inspect doctor` when setup fails
33
- 5. `check` / `eval` / `redact` / `report` for CI and safe sharing
34
-
35
- See [examples/starters/](examples/starters/README.md) and [docs/GETTING-STARTED.md](docs/GETTING-STARTED.md).
36
-
37
- ```bash
38
- npm install agent-inspect
39
- ```
40
-
41
- ```bash
42
- pnpm add agent-inspect
43
- ```
44
-
45
- Verify the CLI is available:
46
-
47
- ```bash
48
- npx agent-inspect --help
49
- ```
50
-
51
- For a clean npm/pnpm install checklist with ESM, CJS, and CLI checks, see [Clean install smoke test](docs/INSTALL-SMOKE-TEST.md).
52
-
53
- ## Three adoption paths
54
-
55
- Already using AI SDK, OpenAI Agents JS, LangChain, or LangGraph-through-LangChain? Start with **Path B** for framework-native local traces before adding manual instrumentation.
56
-
57
- ### Path A — Observe an existing object/class
58
-
59
- Use `observe()` when you already have an agent-like object with a `run`, `execute`, or `invoke` method.
60
-
61
- Create `demo.mjs`:
62
-
63
- ```js
64
- import { observe } from "agent-inspect";
65
-
66
- class SupportAgent {
67
- async run(input) {
68
- return {
69
- answer: `Answering: ${input.question}`,
70
- };
71
- }
72
- }
73
-
74
- const agent = observe(new SupportAgent(), {
75
- traceDir: "./.agent-inspect",
76
- });
77
-
78
- await agent.run({
79
- question: "How do refunds work?",
80
- });
81
- ```
82
-
83
- Run it, then inspect the trace:
84
-
85
- ```bash
86
- node demo.mjs
87
- npx agent-inspect list --dir ./.agent-inspect
88
- npx agent-inspect view <run-id> --dir ./.agent-inspect
89
- ```
90
-
91
- ### Path B — Use a framework adapter
92
-
93
- Optional adapters keep framework dependencies out of the root package and write local traces only when configured.
94
-
95
- AI SDK local telemetry:
96
-
97
- ```ts
98
- import { generateText } from "ai";
99
- import { agentInspect } from "@agent-inspect/ai-sdk";
100
-
101
- await generateText({
102
- model,
103
- prompt,
104
- experimental_telemetry: {
105
- isEnabled: true,
106
- recordInputs: false,
107
- recordOutputs: false,
108
- integrations: [
109
- agentInspect({
110
- traceDir: "./.agent-inspect",
111
- runName: "support-agent",
112
- capture: "metadata-only",
113
- }),
114
- ],
115
- },
116
- });
117
- ```
118
-
119
- OpenAI Agents local-only processor:
120
-
121
- ```ts
122
- import { setTraceProcessors } from "@openai/agents";
123
- import { agentInspectProcessor } from "@agent-inspect/openai-agents";
124
-
125
- setTraceProcessors([
126
- agentInspectProcessor({
127
- traceDir: "./.agent-inspect",
128
- workflowName: "support-agent",
129
- capture: "metadata-only",
130
- }),
131
- ]);
132
- ```
133
-
134
- LangChain callback adapter:
135
-
136
- ```ts
137
- import { AgentInspectCallback } from "@agent-inspect/langchain";
138
-
139
- const callback = new AgentInspectCallback({
140
- runName: "support-agent",
141
- traceDir: "./.agent-inspect",
142
- persist: true,
143
- capture: "metadata-only",
144
- });
145
-
146
- await agent.invoke(input, { callbacks: [callback] });
147
- ```
148
-
149
- See [docs/ADAPTERS.md](docs/ADAPTERS.md).
150
-
151
- No-network recipes: [ai-sdk-local-telemetry](examples/recipes/ai-sdk-local-telemetry/), [openai-agents-local-tracing](examples/recipes/openai-agents-local-tracing/), and [langgraph-callback-local](examples/recipes/langgraph-callback-local/).
152
-
153
- ### Path C — Manually instrument custom flows
154
-
155
- Use `inspectRun` and `step` when you want explicit names, custom nesting, or flows that are not object/class shaped.
156
-
157
- ```js
158
- import { inspectRun, step } from "agent-inspect";
159
-
160
- const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
161
-
162
- await inspectRun(
163
- "support-agent",
164
- async () => {
165
- const plan = await step("plan", async () => {
166
- await delay(40);
167
- return { intent: "refund-policy", needsPolicy: true };
168
- });
169
-
170
- const policy = await step.tool("retrieve-policy", async () => {
171
- await delay(60);
172
- return { text: "Refunds are available within 30 days of purchase." };
173
- });
174
-
175
- return step.llm("generate-answer", async () => {
176
- await delay(80);
177
- return `Policy: ${policy.text} (intent: ${plan.intent})`;
178
- });
179
- },
180
- { traceDir: "./.agent-inspect" }
181
- );
182
- ```
183
-
184
- Full flow:
10
+ ![AgentInspect loop: trace check redact](docs/assets/agent-inspect-loop.svg)
185
11
 
186
12
  ```bash
187
13
  npm install agent-inspect
188
- node demo.mjs
189
- npx agent-inspect list --dir ./.agent-inspect
190
- ```
191
-
192
- **Simplified example output** (actual CLI formatting may differ slightly):
193
-
194
- ```text
195
- support-agent
196
- ✔ plan
197
- ✔ tool:retrieve-policy
198
- ✔ llm:generate-answer
199
14
  ```
200
15
 
201
- A runnable copy lives in [examples/00-quickstart-demo](examples/00-quickstart-demo/README.md).
202
-
203
- Use the root import for stable beginner APIs:
204
-
205
- ```ts
206
- import {
207
- createInspector,
208
- observe,
209
- inspectRun,
210
- maybeInspectRun,
211
- step,
212
- getCurrentCorrelationMetadata,
213
- } from "agent-inspect";
214
- ```
215
-
216
- Use subpaths for advanced, experimental, or lower-level workflows:
217
-
218
- ```ts
219
- import { openTrace } from "agent-inspect/readers";
220
- import { memoryWriter } from "agent-inspect/writers";
221
- import { runTraceChecks } from "agent-inspect/checks";
222
- import { diffTraceEvents } from "agent-inspect/diff";
223
- import { exportMarkdown } from "agent-inspect/exporters";
224
- import { parseLogsToTrees } from "agent-inspect/logs";
225
- import { traceEventsToPersistedInspectEvents } from "agent-inspect/persisted";
226
- import { createInspectorRuntime } from "agent-inspect/advanced";
227
- ```
228
-
229
- **Env-gated tracing** (eval harnesses, CI): use `maybeInspectRun` and set `AGENT_INSPECT=1` when you want a trace — otherwise no files are written.
230
-
231
- ```ts
232
- import { maybeInspectRun } from "agent-inspect";
233
-
234
- await maybeInspectRun("eval-case-42", async () => runAgent());
235
- ```
236
-
237
- ```bash
238
- AGENT_INSPECT=1 node eval-runner.mjs
239
- ```
240
-
241
- ## What you can do today
242
-
243
- - **Trace manually** with `inspectRun`, `step`, `step.llm`, `step.tool`, and `observe` — local JSONL under `.agent-inspect/` by default.
244
- - **Toggle tracing** with `maybeInspectRun` and `AGENT_INSPECT=1` in eval harnesses or CI.
245
- - **Use an isolated inspector** with `createInspector()` and explicit local writers for tests/adapters.
246
- - **Correlate runs** with optional `correlationId`, `requestId`, `decisionId`, and `groupId` on `run_started` metadata.
247
- - **Redact before disk** with default key-based redaction, or choose `redactionProfile`: `local`, `share`, or `strict`.
248
- - **Inspect from the CLI** — `list`, `view`, `clean`, `logs`, `tail`, `export`, `open`, `migrate`, `eval`, `redact`, `diff`, `timeline`, `stats`, `search`, `what`, `report`.
249
- - **Run local evals** with `agent-inspect eval` or `@agent-inspect/eval`; built-in checks are deterministic heuristics over local traces, not model judges.
250
- - **Redact local files** with `agent-inspect redact` or `@agent-inspect/redact` before creating shareable copies.
251
- - **Migrate explicitly** with `agent-inspect migrate <trace.jsonl> --to 1.0 --dry-run` or `--output <file>`; originals are never overwritten by default.
252
- - **Export share-safe copies** — `export --redaction-profile share` (or `strict`) writes local Markdown/HTML/OpenInference/OTLP JSON only.
253
- - **Create local CI artifacts** with `agent-inspect artifacts`, and summarize local test-reporter manifests with `agent-inspect ci-summary`.
254
- - **Parse structured logs** you already emit (JSON first-class; log4js best-effort).
255
- - **Optional LangChain adapter** — metadata-only by default; optional `persist: true` and `stream: true` streaming metadata (no full token capture by default).
256
- - **Optional AI SDK adapter** — experimental `@agent-inspect/ai-sdk` telemetry integration for AI SDK v6; metadata-only by default with `recordInputs: false` and `recordOutputs: false`.
257
- - **Optional OpenAI Agents adapter** — experimental `@agent-inspect/openai-agents` trace processor for local OpenAI Agents JS trace processing.
258
- - **Optional TUI** — `view --tui` when `@agent-inspect/tui` is installed.
259
- - **Persisted-event foundation** — v0.1/v0.2/v1.0 AgentInspect JSONL remains readable; `createInspector()` and built-in writers use the schema 1.0 persisted path.
260
- - **Experimental subpaths** — `agent-inspect/readers`, `/writers`, `/checks`, `/diff`, `/exporters`, `/logs`, `/persisted`, and `/advanced` for advanced local workflows.
261
-
262
- Nothing uploads traces by default. Review exports before sharing — see [safe trace sharing](docs/SAFE-TRACE-SHARING.md).
263
-
264
- ## What the trace shows
265
-
266
- Each run produces a **JSONL** trace: `run_started` / `run_completed`, `step_started` / `step_completed`, with **nested steps**, **tool/LLM** types where you use `step.tool` / `step.llm`, and **durations** on completed steps. Failures are recorded on `step_completed` with `status: "error"` (there is no separate `step_failed` event). See [docs/SCHEMA.md](docs/SCHEMA.md).
267
-
268
- ![Nested execution tree from a local JSONL trace](https://raw.githubusercontent.com/rajudandigam/agent-inspect/main/docs/assets/demos/execution-tree.gif)
269
-
270
- *Synthetic demo — [examples/02-nested-steps](examples/02-nested-steps/README.md). More visuals: [SCREENSHOTS.md](docs/SCREENSHOTS.md).*
271
-
272
- ## Advanced ingestion: use this when your app already emits structured logs
273
-
274
- Many production systems already emit **line-delimited JSON** or text logs with embedded JSON (e.g. via **pino**, **winston**, **log4js**, **NestJS** loggers, job runners, or custom event streams). agent-inspect can turn those into **local grouped timelines/trees** without wrapping every function.
16
+ ## 60-second quickstart
275
17
 
276
18
  ```bash
277
- npx agent-inspect logs ./agent.log \
278
- --format json \
279
- --run-id-key requestId \
280
- --event-key event \
281
- --timestamp-key timestamp
282
- ```
283
-
284
- With a reusable ingest config:
285
-
286
- ```bash
287
- npx agent-inspect logs ./agent.log --config agent-inspect.logs.json
288
- ```
289
-
290
- - **JSON logs** are first-class.
291
- - **log4js-style** lines are **best-effort** when a recoverable JSON payload is present.
292
- - **No `eval`**, no JavaScript object-literal parsing as a log interchange format.
293
- - **Flat timeline by default**; nesting when parent relationships are explicit or configured.
294
- - **Confidence labels** (`explicit`, `correlated`, `heuristic`, `unknown`) describe how attribution was inferred.
19
+ npx agent-inspect init --yes
20
+ node examples/agent-inspect-demo.mjs
21
+ npx agent-inspect list --dir .agent-inspect
22
+ npx agent-inspect view <run-id> --dir .agent-inspect
23
+ npx agent-inspect report <run-id> --dir .agent-inspect
24
+ npx agent-inspect verify-safe --dir .agent-inspect
25
+ ```
26
+
27
+ **North star:** install → one trace → one failure check → one share-safe artifact in under five minutes. See [First trace in 5 minutes](docs/FIRST-TRACE-IN-5-MINUTES.md).
28
+
29
+ ## Choose your path
30
+
31
+ | Path | When | Start here |
32
+ | ---- | ---- | ---------- |
33
+ | **AI SDK** | Vercel AI SDK `generateText` / `streamText` | [`@agent-inspect/ai-sdk`](packages/ai-sdk/README.md) · [guide](docs/AI-SDK-ADOPTION.md) |
34
+ | **OpenAI Agents** | OpenAI Agents JS local tracing | [`@agent-inspect/openai-agents`](packages/openai-agents/README.md) · [guide](docs/OPENAI-AGENTS-LOCAL.md) |
35
+ | **LangChain** | Callback adapter, LangGraph-via-LangChain | [`@agent-inspect/langchain`](packages/langchain/README.md) |
36
+ | **Observe** | Existing class with `run` / `execute` | [Getting started § observe](docs/GETTING-STARTED.md) |
37
+ | **Manual** | Custom control flow | `inspectRun` + `step` in [API](docs/API.md) |
38
+ | **Logs** | Structured logs already emitted | [Log-to-tree](docs/LOG-TO-TREE-QUICKSTART.md) |
39
+ | **CI / tests** | Failed test artifacts | [`@agent-inspect/vitest`](packages/vitest/README.md) · [`@agent-inspect/jest`](packages/jest/README.md) |
40
+ | **Real projects** | Fixture harness | [`@agent-inspect/harness`](packages/harness/README.md) |
41
+
42
+ Blessed starters (no API keys): [examples/starters](https://github.com/rajudandigam/agent-inspect/tree/main/examples/starters)
43
+
44
+ ## What it helps with
45
+
46
+ - **Wrong tool call** — see tool steps, args metadata, and parent run in the tree
47
+ - **Baseline vs candidate** — `diff` two runs locally
48
+ - **Eval / test failures** — `check`, `eval`, Vitest/Jest reporters
49
+ - **PR artifacts** — [CI artifacts](docs/CI-ARTIFACTS.md) + `redact --profile share`
50
+ - **Multi-agent / sessions** — `sessions`, `search`, handoff metadata
51
+ - **MCP tools** — [`@agent-inspect/mcp`](packages/mcp/README.md) client tracing
52
+ - **VS Code** — in-repo extension (`packages/vscode`); [dev guide](docs/VSCODE.md) — Marketplace listing manual
53
+
54
+ ## Real-world scenarios
55
+
56
+ | Scenario | Doc |
57
+ | -------- | --- |
58
+ | Local debugging | [USE-CASES.md](docs/USE-CASES.md) |
59
+ | CI failure review | [REAL-WORLD-SCENARIOS.md](docs/REAL-WORLD-SCENARIOS.md) |
60
+ | Team adoption | [TEAM-WORKFLOWS.md](docs/TEAM-WORKFLOWS.md) · [Design partners](docs/DESIGN-PARTNER-GUIDE.md) |
61
+
62
+ ## Package map
63
+
64
+ | Package | Purpose |
65
+ | ------- | ------- |
66
+ | [`agent-inspect`](https://www.npmjs.com/package/agent-inspect) | Core + CLI |
67
+ | [`@agent-inspect/ai-sdk`](packages/ai-sdk/README.md) | AI SDK telemetry |
68
+ | [`@agent-inspect/openai-agents`](packages/openai-agents/README.md) | OpenAI Agents processor |
69
+ | [`@agent-inspect/langchain`](packages/langchain/README.md) | LangChain callbacks |
70
+ | [`@agent-inspect/harness`](packages/harness/README.md) | Fixture runner for real projects |
71
+ | [`@agent-inspect/redact`](packages/redact/README.md) | Deterministic redaction |
72
+ | [`@agent-inspect/eval`](packages/eval/README.md) | Local eval heuristics |
73
+ | [`@agent-inspect/vitest`](packages/vitest/README.md) | Vitest reporter |
74
+ | [`@agent-inspect/jest`](packages/jest/README.md) | Jest reporter |
75
+ | [`@agent-inspect/mcp`](packages/mcp/README.md) | MCP client tracing |
76
+ | [`@agent-inspect/mcp-server`](packages/mcp-server/README.md) | Read-only trace MCP server |
77
+ | [`@agent-inspect/guardrails`](packages/guardrails/README.md) | Deterministic guardrail rules |
78
+ | [`@agent-inspect/circuit`](packages/circuit/README.md) | Loop/retry/timeout analyzers |
79
+ | [`@agent-inspect/viewer`](packages/viewer/README.md) | Localhost viewer |
80
+ | [`@agent-inspect/adapter-sdk`](packages/adapter-sdk/README.md) | Third-party adapters |
81
+ | [`@agent-inspect/tui`](packages/tui/README.md) | Optional terminal UI |
82
+ | `agent-inspect-vscode` | VS Code extension (in-repo, not on Marketplace yet) |
83
+
84
+ ## Safety model
85
+
86
+ - Traces are **local JSONL files** under `.agent-inspect/` (or `AGENT_INSPECT_TRACE_DIR`)
87
+ - **Metadata-only by default** — no raw prompts/outputs unless you opt in
88
+ - **No hidden upload** — AgentInspect does not send traces to the cloud
89
+ - **Redaction profiles** — `local` / `share` / `strict` via [`@agent-inspect/redact`](packages/redact/README.md) or CLI
90
+ - **`scan` / `verify-safe`** — check artifacts before sharing
91
+ - **Not** a chain-of-thought recorder or compliance engine
92
+
93
+ Details: [Safe trace sharing](docs/SAFE-TRACE-SHARING.md) · [Security](SECURITY.md)
295
94
 
296
- **Visual:** JSON log → tree recording is [documented in SCREENSHOTS.md](docs/SCREENSHOTS.md#json-logs--tree) (re-record pending; command above is the canonical flow).
297
-
298
- More detail: [docs/LOGS.md](docs/LOGS.md) · [docs/LOG-TO-TREE-QUICKSTART.md](docs/LOG-TO-TREE-QUICKSTART.md) · [docs/LOGGING-PLAYBOOK.md](docs/LOGGING-PLAYBOOK.md) (pino, log4js, NestJS).
299
-
300
- ## CLI at a glance
301
-
302
- | Command | Use it for |
303
- | -------- | ---------- |
304
- | `list` | Find recent runs |
305
- | `view` | Inspect one run as a tree |
306
- | `clean` | Safely remove old trace files |
307
- | `logs` | Turn existing structured logs into a local tree/timeline |
308
- | `tail` | Watch structured logs while the app runs |
309
- | `export` | Write Markdown / HTML / OpenInference-compatible JSON / OTLP JSON **locally** |
310
- | `open` | Read AgentInspect JSONL, OpenInference JSON, or OTLP JSON locally |
311
- | `migrate` | Convert a local AgentInspect JSONL file to schema 1.0 with dry-run or explicit output |
312
- | `eval` | Deterministic local evals over existing traces |
313
- | `redact` | Redact a local JSON/JSONL file or trace copy |
314
- | `diff` | Compare two local runs (read-only) |
315
- | `timeline` | Chronological view of one run |
316
- | `stats` | Local aggregates over a trace directory |
317
- | `search` | Deterministic search over local traces |
318
- | `what` | Concise summary of one run |
319
- | `report` | Markdown/HTML inspection report (what + timeline + tree) |
320
- | `check` / `scan` / `verify-safe` | Deterministic local trace checks and best-effort safety verification |
321
- | `artifacts` | Safe local CI artifact bundles and optional step-summary file output |
322
- | `ci-summary` | Summarize local Vitest/Jest reporter artifact manifests for CI |
323
-
324
- ![Timeline with slow-step focus for one run](https://raw.githubusercontent.com/rajudandigam/agent-inspect/main/docs/assets/demos/timeline.gif)
325
-
326
- *Synthetic demo — `agent-inspect timeline` on [fixtures/traces](fixtures/traces). Gallery: [SCREENSHOTS.md](docs/SCREENSHOTS.md).*
327
-
328
- Full flags and behavior: [docs/CLI.md](docs/CLI.md).
329
-
330
- ## Real-world workflows
331
-
332
- - Debug a **failed tool call** or thrown error in a support or ops agent.
333
- - See **which step dominated latency** in a multi-step planner or RAG pipeline.
334
- - **Diff two runs** after a prompt, model, or routing change (see [diff examples](docs/DIFF.md)).
335
- - Run **local eval checks** over a trace before sharing or creating CI artifacts.
336
- - **Redact** a local trace/file before attaching it to a PR, issue, or support thread.
337
- - Point **`logs`** / **`tail`** at existing job or service logs to get a **local execution view** without shipping data upstream.
338
- - **Export** a run to Markdown for a PR, postmortem, or internal thread — use `--redaction-profile share` for share-safe copies, then review before sharing.
339
- - Keep traces **on disk** while still using enterprise observability elsewhere.
340
-
341
- ## Stable foundation
342
-
343
- AgentInspect is the **local-first trace workbench** for TypeScript AI agents:
344
-
345
- - Instrument runs with `inspectRun` and `step`
346
- - Write and read **local JSONL traces** (`schemaVersion: "0.1"` manual traces remain readable; schema 1.0 persisted rows are the v2 writer target)
347
- - Inspect with **`list`**, **`view`**, **`clean`**, **`logs`**, **`tail`**, **`export`**, **`diff`**, **`timeline`**, **`stats`**, **`search`**, **`sessions`**, **`session`**
348
-
349
- **Stable root APIs:** `createInspector()`, `inspectRun()`, `maybeInspectRun()`, `step()`, `step.llm()`, `step.tool()`, `observe()`, `getCurrentCorrelationMetadata()`.
350
-
351
- Pass `enabled: false` to `inspectRun` for a no-trace passthrough. Use `maybeInspectRun` with `AGENT_INSPECT=1` to toggle tracing in eval or CI — see [docs/API.md](docs/API.md).
352
-
353
- **v2.4 shipped:** sessions/MCP client telemetry on `main@2.4.0`. All ten linked packages published at `2.4.0` including `@agent-inspect/mcp`.
354
-
355
- **v2.3 shipped:** adapter hardening for AI SDK, OpenAI Agents JS, and LangChain/LangGraph with no-network recipes and executable conformance coverage. Mastra and NestJS framework packages remain demand-gated; NestJS is covered through structured-log ingestion.
356
-
357
- **Shipped in 2.2.0:** public optional Vitest/Jest reporter packages, shared `agent-inspect/reporters` helpers, and `agent-inspect ci-summary` for deterministic local reporter artifact summaries. Linked release aligns `agent-inspect`, `@agent-inspect/ai-sdk`, `@agent-inspect/langchain`, `@agent-inspect/tui`, `@agent-inspect/openai-agents`, `@agent-inspect/redact`, `@agent-inspect/eval`, `@agent-inspect/vitest`, and `@agent-inspect/jest` at **2.2.0**.
358
-
359
- **Shipped in 2.1.0:** deterministic local eval and redaction utilities. Linked release aligns `agent-inspect`, `@agent-inspect/ai-sdk`, `@agent-inspect/langchain`, `@agent-inspect/tui`, `@agent-inspect/openai-agents`, `@agent-inspect/redact`, and `@agent-inspect/eval` at **2.1.0**.
360
-
361
- **Shipped in 2.0.0:** stable root API contract, schema 1.0 persisted writer path, v0.1/v0.2/v1.0 read compatibility, and explicit trace migration workflow. Linked release aligns `agent-inspect`, `@agent-inspect/ai-sdk`, `@agent-inspect/langchain`, `@agent-inspect/tui`, and `@agent-inspect/openai-agents` at **2.0.0**.
362
-
363
- **Shipped in 1.9.0:** private harness workspace foundation, explain dry-run/local analysis, promoted adapter adoption paths, and the v2 root API slimming plan.
364
-
365
- **Shipped in 1.8.0:** experimental deterministic checks (`agent-inspect/checks` and `agent-inspect check`), safe-sharing workflows (`scan`, `verify-safe`, safe artifacts), and first public `@agent-inspect/openai-agents` package. Linked release aligns `agent-inspect`, `@agent-inspect/ai-sdk`, `@agent-inspect/langchain`, `@agent-inspect/tui`, and `@agent-inspect/openai-agents` at **1.8.0**.
366
-
367
- **Shipped in 1.7.0:** experimental `@agent-inspect/ai-sdk` telemetry integration for AI SDK v6 with a local no-network [ai-sdk-local-telemetry recipe](examples/recipes/ai-sdk-local-telemetry/), adapter conformance fixtures, OpenAI Agents/LangGraph support decisions, and local-first adapter docs. Examples keep `recordInputs: false`, `recordOutputs: false`, metadata-only capture, and no upload behavior. Linked release aligns `agent-inspect`, `@agent-inspect/ai-sdk`, `@agent-inspect/langchain`, and `@agent-inspect/tui` at **1.7.0**.
368
-
369
- **Shipped in 1.6.0:** experimental writer subpath (`agent-inspect/writers`), isolated `createInspector()` API via `agent-inspect/advanced`, local trace readers via `agent-inspect/readers`, OpenInference/OTLP JSON readers, universal `agent-inspect open`, and deterministic [runtime-and-ingestion recipe](examples/recipes/runtime-and-ingestion/). These remain local-only and do not add upload behavior. Linked release aligns all three then-published npm packages at **1.6.0**.
370
-
371
- **Shipped in 1.5.0:** non-breaking subpath exports; `what` and `report` CLI; dual-format read path (v0.1 + v0.2 JSONL); [what-report-inspect recipe](examples/recipes/what-report-inspect/). Linked release aligns all three npm packages at **1.5.0**.
372
-
373
- **Roadmap beyond current release work:** v2.5 guardrails/circuit patterns, optional viewer/IDE surfaces, and conditional v3 extensibility. See [ROADMAP.md](ROADMAP.md).
374
-
375
- **Shipped in 1.4.0:** CI artifact recipe ([docs/CI-ARTIFACTS.md](docs/CI-ARTIFACTS.md)); `timeline`, `stats`, and `search` CLI; core helpers `buildRunTimeline`, `buildTraceStats`, `searchTraces`. Linked release aligns all three npm packages at **1.4.0**.
376
-
377
- **Shipped in 1.3.0:** correlation metadata; redaction profiles (`local` / `share` / `strict`); `export --redaction-profile`; LangChain `stream: true` metadata (chunk counts, duration — no full token capture by default).
378
-
379
- **Also in 1.x** (local-first extensions):
380
-
381
- - **v1.2.0** — experimental persisted-event foundation (`PersistedInspectEvent`, converters, in-memory tree bridge). Manual writing remains **`schemaVersion: "0.1"`**; v0.2 is **not written by default**.
382
- - Optional **`@agent-inspect/langchain`** and **`@agent-inspect/tui`**
383
- - **Fixtures** and **recipes** for deterministic adoption patterns
384
-
385
- **Honest boundaries:** log parsing, export, diff, LangChain/TUI programmatic APIs, and OpenInference/OTLP JSON exports are **experimental or compatibility-oriented**. Nothing performs **vendor upload** by default.
386
-
387
- ## Optional packages
388
-
389
- ### Framework adapters (`@agent-inspect/ai-sdk`, `@agent-inspect/openai-agents`, `@agent-inspect/langchain`)
390
-
391
- Official framework adapters are optional packages and stay explicit, local-first, and metadata-only by default:
392
-
393
- - **AI SDK:** pass `agentInspect(...)` through AI SDK telemetry with `recordInputs: false` and `recordOutputs: false`.
394
- - **OpenAI Agents JS:** use `setTraceProcessors([agentInspectProcessor(...)])` for the documented local-only replacement path.
395
- - **LangChain/LangGraph:** pass `new AgentInspectCallback(...)` through callbacks; LangGraph support rides through the LangChain callback boundary.
396
-
397
- No-network recipes: [ai-sdk-local-telemetry](examples/recipes/ai-sdk-local-telemetry/), [ai-sdk-next-route](examples/recipes/ai-sdk-next-route/), [openai-agents-local-tracing](examples/recipes/openai-agents-local-tracing/), and [langgraph-callback-local](examples/recipes/langgraph-callback-local/). Conformance and limits are documented in [docs/ADAPTERS.md](docs/ADAPTERS.md) and [docs/ADAPTER-CONFORMANCE.md](docs/ADAPTER-CONFORMANCE.md).
398
-
399
- ### LangChain callback adapter (`@agent-inspect/langchain`)
400
-
401
- Optional package: official **LangChain.js callbacks** (`BaseCallbackHandler`), **metadata-oriented by default**, **no monkey-patching**, **no vendor sink**. Optional **`stream: true`** records chunk counts and stream duration **without storing full token text by default**. The LangChain adapter ships with 1.x; its programmatic API remains experimental and may evolve independently of the stable core tracing API.
402
-
403
- ```bash
404
- pnpm add agent-inspect @agent-inspect/langchain @langchain/core
405
- ```
406
-
407
- ```ts
408
- import { AgentInspectCallback } from "@agent-inspect/langchain";
409
-
410
- const callback = new AgentInspectCallback({
411
- runName: "support-agent",
412
- traceDir: "./.agent-inspect",
413
- persist: true,
414
- capture: "metadata-only",
415
- });
416
-
417
- await agent.invoke(input, { callbacks: [callback] });
418
- // In-memory events still available:
419
- const events = callback.getEvents();
420
- // Persisted runs are inspectable via CLI:
421
- // npx agent-inspect list --dir ./.agent-inspect
422
- // npx agent-inspect view <run-id> --dir ./.agent-inspect
423
- ```
424
-
425
- See [examples/08-langchain-adapter](examples/08-langchain-adapter/README.md) and [docs/ADAPTERS.md](docs/ADAPTERS.md).
426
-
427
- ### MCP client telemetry (`@agent-inspect/mcp`)
428
-
429
- Optional package for **local MCP client** tracing only. Wrap `tools/list` and `tools/call` so they emit tool steps with `source.type: mcp-client`, bounded argument summaries, server identity, and optional `sessionId` metadata.
430
-
431
- ```bash
432
- pnpm add agent-inspect @agent-inspect/mcp
433
- ```
434
-
435
- ```ts
436
- import { inspectRun } from "agent-inspect";
437
- import { wrapMcpClient } from "@agent-inspect/mcp";
438
-
439
- const traced = wrapMcpClient(mcpClient, {
440
- serverName: "docs-server",
441
- sessionId: "sess-123",
442
- });
443
-
444
- await inspectRun("agent-with-mcp", async () => {
445
- await traced.callTool({ name: "search", arguments: { query: "sessions" } });
446
- });
447
- ```
448
-
449
- No-network recipe: [mcp-client-tracing](examples/recipes/mcp-client-tracing/). This is **not** an MCP server, gateway, or hosted broker — see [docs/ADAPTERS.md](docs/ADAPTERS.md).
450
-
451
- ### Local viewer (`@agent-inspect/viewer`)
452
-
453
- Optional **localhost read-only** HTTP viewer. Start from the CLI:
454
-
455
- ```bash
456
- pnpm add agent-inspect @agent-inspect/viewer
457
- npx agent-inspect serve --dir ./.agent-inspect-runs
458
- ```
459
-
460
- Binds `127.0.0.1` by default. Serves trace list, timeline, and check JSON from disk — no upload, no mutation. Recipe: [read-only viewer workflow](examples/recipes/read-only-mcp-server/) (also covers MCP server tools).
95
+ ## Documentation
461
96
 
462
- ### Read-only MCP server (`@agent-inspect/mcp-server`)
97
+ | Start | Reference | Adoption |
98
+ | ----- | --------- | -------- |
99
+ | [Getting started](docs/GETTING-STARTED.md) | [API](docs/API.md) | [Adoption](docs/ADOPTION.md) |
100
+ | [One-page quickstart](docs/ONE-PAGE-QUICKSTART.md) | [CLI](docs/CLI.md) | [Demo script](docs/DEMO-SCRIPT.md) |
101
+ | [First trace in 5 min](docs/FIRST-TRACE-IN-5-MINUTES.md) | [Adapters](docs/ADAPTERS.md) | [Compare](docs/COMPARE.md) |
102
+ | [Examples](https://github.com/rajudandigam/agent-inspect/tree/main/examples) | [Performance](docs/PERFORMANCE.md) | [Pitch](docs/PITCH.md) |
463
103
 
464
- Optional package exposing **read-only** MCP tools (`list_traces`, `read_trace`, `search_traces`, `run_checks`, `create_share_safe_report`, and analysis helpers) over a local trace directory. Distinct from `@agent-inspect/mcp` (client telemetry). Default redaction profile is `share`.
104
+ Full index: [docs/README.md](docs/README.md) · Visual demos: [SCREENSHOTS.md](docs/SCREENSHOTS.md)
465
105
 
466
- ```bash
467
- pnpm add agent-inspect @agent-inspect/mcp-server
468
- ```
106
+ ## What AgentInspect is not
469
107
 
470
- ```ts
471
- import { runReadOnlyMcpServer } from "@agent-inspect/mcp-server";
108
+ - Hosted SaaS or dashboard product
109
+ - Production APM replacement (use LangSmith, Langfuse, OTel, etc. alongside)
110
+ - Eval dataset platform or LLM-as-judge service
111
+ - Prompt registry or pricing engine
112
+ - Default telemetry uploader or replay engine
472
113
 
473
- // stdio MCP server — configure trace dir via AGENT_INSPECT_TRACE_DIR
474
- await runReadOnlyMcpServer({ redactionProfile: "share" });
475
- ```
114
+ ## Install details
476
115
 
477
- IDE extension is **deferred** see [docs/IDE-SURFACES.md](docs/IDE-SURFACES.md).
478
-
479
- ### TUI viewer (`@agent-inspect/tui`)
480
-
481
- Optional **Ink/React** package, installed separately. Use with an interactive terminal:
116
+ Current release: **3.5.0** (sixteen linked npm packages). Persisted trace schema **1.0**.
482
117
 
483
118
  ```bash
484
- pnpm add agent-inspect @agent-inspect/tui
485
- npx agent-inspect view <run-id> --tui
119
+ pnpm add agent-inspect
120
+ npx agent-inspect doctor
486
121
  ```
487
122
 
488
- The TUI is available as a separate optional package; its programmatic API is experimental, while the CLI integration (`view --tui`) is the intended usage. Details: [docs/ADAPTERS.md](docs/ADAPTERS.md).
489
-
490
- ### Test reporter artifacts (`@agent-inspect/vitest`, `@agent-inspect/jest`)
491
-
492
- Optional Vitest/Jest reporter packages are public as of v2.2. They write shared `schemaVersion: "0.1"` reporter manifests with safe relative artifact paths and bounded structural metadata. Use `agent-inspect ci-summary` to summarize those local manifests in CI without reading trace contents or calling GitHub APIs.
493
-
494
- Reporter artifact behavior and API details are documented in [docs/API.md](docs/API.md) and [docs/CI-ARTIFACTS.md](docs/CI-ARTIFACTS.md).
495
-
496
- ## Examples and recipes
497
-
498
- | Example | Shows |
499
- | ------- | ----- |
500
- | [examples/00-quickstart-demo](examples/00-quickstart-demo/README.md) | Fast install-and-try trace |
501
- | [examples/01-basic](examples/01-basic) | `inspectRun` + `step` |
502
- | [examples/02-nested-steps](examples/02-nested-steps) | Nested tree |
503
- | [examples/03-parallel-steps](examples/03-parallel-steps) | Parallel siblings |
504
- | [examples/04-error-handling](examples/04-error-handling) | Failed steps |
505
- | [examples/05-observe-wrapper](examples/05-observe-wrapper) | `observe()` |
506
- | [examples/06-log-to-tree](examples/06-log-to-tree) | `logs` / `tail` |
507
- | [examples/08-langchain-adapter](examples/08-langchain-adapter/README.md) | LangChain callbacks |
508
- | [examples/recipes/rag-pipeline](examples/recipes/rag-pipeline) | RAG-shaped flow |
509
- | [examples/recipes/tool-failure-retry](examples/recipes/tool-failure-retry) | Tool failure + retry |
510
- | [examples/recipes/multi-agent-handoff](examples/recipes/multi-agent-handoff) | Handoff |
511
- | [examples/recipes/proactive-agent-logs](examples/recipes/proactive-agent-logs) | Structured logs |
512
- | [examples/recipes/pino-json-logs](examples/recipes/pino-json-logs) | pino-shaped JSON |
513
- | [examples/recipes/log4js-json-layout](examples/recipes/log4js-json-layout) | log4js embedded JSON |
514
- | [examples/recipes/nestjs-json-logging](examples/recipes/nestjs-json-logging) | NestJS JSON logs |
515
- | [examples/recipes/retry-fallback](examples/recipes/retry-fallback) | Fallback pattern |
516
- | [examples/recipes/parallel-tools](examples/recipes/parallel-tools) | Parallel tools |
517
- | [examples/recipes/github-actions-artifact](examples/recipes/github-actions-artifact) | CI trace artifacts |
518
- | [examples/recipes/deterministic-ci-checks](examples/recipes/deterministic-ci-checks) | v1.8 checks, baseline, and safe CI artifacts |
519
- | [examples/recipes/eval-local-checks](examples/recipes/eval-local-checks) | v2.1 deterministic local eval checks |
520
- | [examples/recipes/redact-share-safe-file](examples/recipes/redact-share-safe-file) | v2.1 share-safe local redaction copy |
521
- | [examples/recipes/eval-ci-artifacts](examples/recipes/eval-ci-artifacts) | v2.1 eval before safe CI artifacts |
522
- | [examples/recipes/test-reporter-artifacts](examples/recipes/test-reporter-artifacts) | Vitest/Jest reporter artifact patterns |
523
- | [examples/recipes/what-report-inspect](examples/recipes/what-report-inspect/) | `what` + `report` inspection |
524
- | [examples/recipes/runtime-and-ingestion](examples/recipes/runtime-and-ingestion/) | v1.6 runtime writers + universal ingestion |
525
- | [examples/recipes/mcp-client-tracing](examples/recipes/mcp-client-tracing) | v2.4 MCP client tool-call tracing |
526
- | [examples/recipes/guardrails-basic](examples/recipes/guardrails-basic) | v2.5 deterministic guardrails |
527
- | [examples/recipes/circuit-breaker-basic](examples/recipes/circuit-breaker-basic) | v2.5 circuit analyzers |
528
- | [examples/recipes/read-only-mcp-server](examples/recipes/read-only-mcp-server) | v2.6 read-only MCP trace tools |
529
-
530
- **Multi-run sessions:** set `sessionId` (and optional handoff/retry metadata) on `run_started`, then browse with `npx agent-inspect sessions` and `npx agent-inspect session <id> --timeline`. See [SESSIONS-AND-WORKFLOW-CAUSALITY](docs/proposals/SESSIONS-AND-WORKFLOW-CAUSALITY.md).
531
-
532
- **Recipes** are deterministic and require **no external services** by default. Index: [examples/README.md](examples/README.md), [examples/recipes/README.md](examples/recipes/README.md).
533
-
534
- ## Security and privacy posture
535
-
536
- - **Local files by default** — no upload, no vendor sinks in core workflows.
537
- - **No API keys** required for core tracing and CLI inspection.
538
- - **Manual metadata** is user-controlled. By default, common sensitive keys are **redacted before disk**; pass `redact: false` to opt out. Long metadata is truncated and events are capped at 64 KiB per JSONL line. Review traces and exports before sharing.
539
- - **Review exports** before sharing (especially with richer attribute flags).
540
-
541
- See [SECURITY.md](SECURITY.md) and the [safe trace sharing checklist](docs/SAFE-TRACE-SHARING.md).
542
-
543
- ## agent-inspect comparison
544
-
545
- It can **complement** LangSmith, Langfuse, Braintrust, Phoenix/OpenInference, OpenTelemetry, New Relic, Datadog, and similar platforms — but it does **not** replace their production or eval workflows.
546
-
547
- For a detailed comparison, see [Compare with other tools](docs/COMPARE.md).
548
-
549
- ## Documentation
550
-
551
- | Start here | Reference | Safety & boundaries |
552
- | ---------- | --------- | ------------------- |
553
- | [Getting started](docs/GETTING-STARTED.md) | [API](docs/API.md) | [Safe trace sharing](docs/SAFE-TRACE-SHARING.md) |
554
- | [Install smoke test](docs/INSTALL-SMOKE-TEST.md) | [CLI](docs/CLI.md) | [Security](SECURITY.md) |
555
- | [Log-to-tree quickstart](docs/LOG-TO-TREE-QUICKSTART.md) | [Schema](docs/SCHEMA.md) | [Limitations](docs/LIMITATIONS.md) |
556
- | [Logging playbook](docs/LOGGING-PLAYBOOK.md) | [Exports](docs/EXPORTS.md) | [Known issues](docs/KNOWN-ISSUES.md) |
557
- | [CI artifacts](docs/CI-ARTIFACTS.md) | [Adapters](docs/ADAPTERS.md) | [Compare with other tools](docs/COMPARE.md) |
558
- | [Visual demos](docs/SCREENSHOTS.md) | [Examples](examples/README.md) | |
559
-
560
- Also: [Architecture](docs/ARCHITECTURE.md) · [Logs & tail](docs/LOGS.md) · [Diff](docs/DIFF.md) · [Changelog](CHANGELOG.md) · [Roadmap](ROADMAP.md) · [Contributing](CONTRIBUTING.md) · [Good first issues](GOOD-FIRST-ISSUES.md)
123
+ Monorepo development: `pnpm install && pnpm build && pnpm test`
561
124
 
562
125
  ## Contributing
563
126
 
564
- AgentInspect welcomes docs, fixtures, examples, and carefully scoped CLI improvements.
565
-
566
- - **Good first issues:** [GOOD-FIRST-ISSUES.md](GOOD-FIRST-ISSUES.md) — live batches [#7–#14](https://github.com/rajudandigam/agent-inspect/issues?q=is%3Aissue+is%3Aopen) and [#18–#30](https://github.com/rajudandigam/agent-inspect/issues/18) (comment on an issue before opening a PR)
567
- - **Discussions:** [github.com/rajudandigam/agent-inspect/discussions](https://github.com/rajudandigam/agent-inspect/discussions) — feedback, stack survey, integration ideas
568
- - **Roadmap:** [ROADMAP.md](ROADMAP.md) — Now / Next / Future direction (non-committal)
569
- - **Contributing guide:** [CONTRIBUTING.md](CONTRIBUTING.md) — validation commands, PR expectations, scope boundaries
570
-
571
- **Security:** Traces and logs may contain secrets. **Redact before sharing** in issues, Discussions, PRs, or exports. See [SECURITY.md](SECURITY.md) and the [safe trace sharing checklist](docs/SAFE-TRACE-SHARING.md).
572
-
573
- ## Development
574
-
575
- From a clone of this repo:
576
-
577
- ```bash
578
- pnpm install
579
- pnpm build
580
- pnpm test
581
- pnpm test:all
582
- ```
127
+ [CONTRIBUTING.md](CONTRIBUTING.md) · [Good first issues](GOOD-FIRST-ISSUES.md) · [Discussions](https://github.com/rajudandigam/agent-inspect/discussions) · [Changelog](CHANGELOG.md)
583
128
 
584
- To run the CLI from source after a build: `node packages/cli/dist/index.cjs --help`.
129
+ **Redact traces before posting issues or PRs.**