agent-inspect 1.0.0 → 1.0.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/docs/CLI.md ADDED
@@ -0,0 +1,212 @@
1
+ # CLI (AgentInspect 1.0)
2
+
3
+ This document describes the **stable CLI surface** of AgentInspect.
4
+
5
+ AgentInspect is **local-first** and **read-only by default** where possible:
6
+
7
+ - **No upload** (exports write local strings/files only)
8
+ - **No vendor sinks**
9
+ - **No external services required**
10
+ - **No replay/fork execution**
11
+
12
+ ## 1. Overview
13
+
14
+ The CLI command is:
15
+
16
+ ```bash
17
+ agent-inspect <command> [options]
18
+ ```
19
+
20
+ Core commands:
21
+
22
+ - `list` — list local runs
23
+ - `view` — render a single run
24
+ - `clean` — safely delete old runs (verified traces only)
25
+ - `logs` — parse structured logs into local execution trees
26
+ - `tail` — live-tail logs into updating local trees
27
+ - `export` — export manual traces to Markdown/HTML/OpenInference/OTLP JSON (local only)
28
+ - `diff` — compare two manual traces (local, read-only)
29
+
30
+ ## 2. Environment variables
31
+
32
+ - **`AGENT_INSPECT_TRACE_DIR`**: default directory for manual trace files (`.jsonl`) when not passed via `--dir` (or API options).
33
+ - **`AGENT_INSPECT_SILENT`**: when `true`, suppresses live terminal tree output during manual tracing (`inspectRun` / `step`). Trace files are still written.
34
+
35
+ ## 3. Exit code policy
36
+
37
+ - **0**: command succeeded (even if a diff reports “differences”)
38
+ - **1**: command error (invalid args, missing files, missing runs, parse failures, validation failures, etc.)
39
+
40
+ AgentInspect favors **human-readable errors without stack traces** for expected user mistakes.
41
+
42
+ ## 4. JSON output policy
43
+
44
+ Many commands support `--json` for scripting. JSON output is intended to be:
45
+
46
+ - machine-parseable
47
+ - deterministic for the same input files
48
+ - local-only (no network)
49
+
50
+ ## 5. Safety and redaction notes
51
+
52
+ - Log-derived output includes **confidence** labels and avoids inventing parent-child relationships.
53
+ - Redaction defaults are conservative (e.g. `authorization`, `cookie`, `token`, `apiKey`, `password`, `secret`, `email`).
54
+ - Exported payloads are **redacted by default** unless explicitly configured otherwise.
55
+
56
+ ## 6. Command reference
57
+
58
+ ### 6.1 `list`
59
+
60
+ List recent local runs (trace files).
61
+
62
+ ```bash
63
+ agent-inspect list [options]
64
+ ```
65
+
66
+ Options:
67
+
68
+ - `--dir <path>`: trace directory
69
+ - `--limit <number>`: max runs to show (default 20, max 100)
70
+ - `--status <running|success|error|unknown>`: filter by status
71
+ - `--name <query>`: substring match on run id/name
72
+ - `--since <duration>`: only include recent runs (e.g. `30s`, `5m`, `2h`, `7d`)
73
+ - `--json`: print list as JSON
74
+
75
+ ### 6.2 `view`
76
+
77
+ Render a single manual trace by run id.
78
+
79
+ ```bash
80
+ agent-inspect view <run-id> [options]
81
+ ```
82
+
83
+ Options:
84
+
85
+ - `--dir <path>`: trace directory
86
+ - `--summary`: run summary (counts, max depth, longest step)
87
+ - `--metadata`: file path/size + timestamps
88
+ - `--errors-only`: only error events/failed steps
89
+ - `--verbose`: include extra detail (types, metadata, stacks)
90
+ - `--json`: print raw trace events as JSON
91
+ - `--tui`: open optional interactive TUI viewer (requires `@agent-inspect/tui`)
92
+
93
+ ### 6.3 `clean`
94
+
95
+ Safely delete old local trace files. This is safety-critical: the CLI verifies trace files before deletion.
96
+
97
+ ```bash
98
+ agent-inspect clean --older-than <duration> [--dry-run] [--yes]
99
+ agent-inspect clean --keep <count> [--dry-run] [--yes]
100
+ ```
101
+
102
+ Options:
103
+
104
+ - `--dir <path>`: trace directory
105
+ - `--older-than <duration>`: delete runs older than a duration
106
+ - `--keep <count>`: keep N most recent runs
107
+ - `--dry-run`: show what would be deleted
108
+ - `--yes`: skip confirmation prompt
109
+
110
+ Recommendation: run with `--dry-run` first.
111
+
112
+ ### 6.4 `logs`
113
+
114
+ Parse structured logs into local execution trees.
115
+
116
+ ```bash
117
+ agent-inspect logs <file> [options]
118
+ ```
119
+
120
+ Options:
121
+
122
+ - `--format <auto|json|log4js>`
123
+ - `--config <path>`: ingest config JSON (see `docs/SCHEMA.md` for config types)
124
+ - `--run-id-key <keys>`: override runId keys (comma-separated)
125
+ - `--event-key <key>`: override event key
126
+ - `--timestamp-key <key>`: override timestamp key
127
+ - `--message-key <key>`: override message key
128
+ - `--level-key <key>`: override level key
129
+ - `--parent-id-key <key>`: override parent id key
130
+ - `--duration-key <key>`: override duration key
131
+ - `--status-key <key>`: override status key
132
+ - `--json`: emit JSON payload (events/trees/warnings/summary)
133
+ - `--summary`: include summary section in human output
134
+ - `--warnings <none|summary|all>`: warning output mode
135
+
136
+ Example (fixtures):
137
+
138
+ ```bash
139
+ agent-inspect logs fixtures/logs/proactive-json.log --format json --config fixtures/configs/proactive-agent-inspect.logs.json
140
+ ```
141
+
142
+ ### 6.5 `tail`
143
+
144
+ Live-tail logs into updating execution trees in the terminal.
145
+
146
+ ```bash
147
+ agent-inspect tail [options]
148
+ ```
149
+
150
+ Options:
151
+
152
+ - `--file <path>`: tail a file (otherwise reads stdin)
153
+ - `--format <auto|json|log4js>`
154
+ - `--config <path>`
155
+ - `--once`: read once and exit (useful for CI/scripting with `--file`)
156
+ - `--warnings <none|summary|all>`
157
+ - `--refresh <ms>`: minimum time between renders
158
+ - `--json`: newline-delimited JSON updates
159
+
160
+ Important: `tail` is a local developer tool, not a production monitor.
161
+
162
+ ### 6.6 `export`
163
+
164
+ Export a manual trace run to local formats. **No upload**.
165
+
166
+ ```bash
167
+ agent-inspect export <run-id> --format <markdown|html|openinference|otlp-json> [options]
168
+ ```
169
+
170
+ Options:
171
+
172
+ - `--dir <path>`
173
+ - `--format <format>`
174
+ - `-o, --output <path>`: write file
175
+ - `--json`: JSON wrapper output (includes content if not writing to file)
176
+ - `--validate`: validate exported payload shape
177
+ - `--include-attributes`: include bounded attributes (review before sharing)
178
+ - `--no-metadata`: omit summary/metadata sections
179
+ - `--no-errors`: omit error sections
180
+
181
+ ### 6.7 `diff`
182
+
183
+ Compare two manual trace runs. Diff is **local** and **read-only** (does not rerun agents).
184
+
185
+ ```bash
186
+ agent-inspect diff <left-run-id> <right-run-id> [options]
187
+ ```
188
+
189
+ Options:
190
+
191
+ - `--dir <path>`
192
+ - `--json`
193
+ - `--ignore-duration`
194
+ - `--duration-threshold <duration>`
195
+ - `--focus <all|errors|structure|outputs>`
196
+ - `--check <all|structure|outputs|errors|timing>`
197
+
198
+ ## 7. Optional TUI behavior
199
+
200
+ `view --tui` delegates to `@agent-inspect/tui` and requires an interactive terminal. If the package is not installed, the CLI prints a short install hint.
201
+
202
+ ## 8. Warnings behavior
203
+
204
+ Log parsing emits warnings for malformed lines or missing required keys. `--warnings` controls whether warnings are hidden, summarized, or printed line-by-line.
205
+
206
+ ## 9. Limitations (reminder)
207
+
208
+ See:
209
+
210
+ - `docs/KNOWN-ISSUES.md`
211
+ - `docs/LIMITATIONS.md`
212
+
@@ -0,0 +1,69 @@
1
+ ## Compare AgentInspect
2
+
3
+ AgentInspect is a local-first execution-tree debugger for TypeScript AI agents. It’s designed for inner-loop debugging and quick inspection — not as a replacement for hosted observability, evaluation, or production monitoring platforms.
4
+
5
+ ## AgentInspect vs console.log
6
+
7
+ - **console.log is flat**: logs are a stream of lines without run grouping or step boundaries.
8
+ - **AgentInspect adds structure**: runs, nested steps, step types (tool/LLM), durations, status summaries, and local trace files you can inspect later.
9
+ - **console.log still matters**: use it for quick values or ad-hoc debugging inside a step.
10
+ - **AgentInspect helps you understand flow**: especially when your agent fans out, retries, or has nested tool/LLM calls.
11
+
12
+ ## AgentInspect vs LangSmith
13
+
14
+ LangSmith is a hosted/platform workflow for tracing, evaluation, and observability in the LangChain ecosystem.
15
+
16
+ AgentInspect is local-first CLI debugging:
17
+
18
+ - Use AgentInspect to debug locally before/alongside LangSmith when iterating on agent logic.
19
+ - AgentInspect does not provide hosted dashboards, dataset/eval workflows, or production tracing pipelines.
20
+
21
+ ## AgentInspect vs Langfuse
22
+
23
+ Langfuse provides broader LLM observability (tracing, prompt management, datasets/evals, dashboards).
24
+
25
+ AgentInspect focuses on local execution trees and CLI workflows:
26
+
27
+ - Complementary: use AgentInspect for quick local run understanding; use Langfuse for dashboards and longer-lived observability workflows.
28
+ - Not a replacement.
29
+
30
+ ## AgentInspect vs Braintrust
31
+
32
+ Braintrust is strong for evals, regressions, datasets, and production AI quality workflows.
33
+
34
+ AgentInspect is lighter and local-first:
35
+
36
+ - Use AgentInspect to understand a single run locally.
37
+ - Use Braintrust when you want repeatable evals, comparisons at scale, and production quality workflows.
38
+
39
+ ## AgentInspect vs Phoenix / OpenInference
40
+
41
+ Phoenix and the OpenInference ecosystem are standards-oriented and useful for trace visualization and interoperability.
42
+
43
+ AgentInspect can export **OpenInference-compatible JSON** and **OTLP JSON** as local files:
44
+
45
+ - Exports are **compatibility-oriented** and should be validated against your target backend/collector.
46
+ - AgentInspect does not claim that every backend will accept these exports without configuration.
47
+
48
+ ## AgentInspect vs OpenTelemetry setup
49
+
50
+ OpenTelemetry is powerful, but setup can be heavier (SDK configuration, exporters, collectors, backend).
51
+
52
+ AgentInspect avoids SDK/collector setup for local debugging:
53
+
54
+ - Use AgentInspect when you want quick, local execution trees with no collector required.
55
+ - Use OpenTelemetry when you need organization-wide production telemetry pipelines.
56
+ - Exports can help bridge later, but AgentInspect is not an OpenTelemetry SDK replacement.
57
+
58
+ ## Quick decision table
59
+
60
+ | Need | AgentInspect fit |
61
+ | --- | --- |
62
+ | Local agent debugging | Strong fit |
63
+ | No-account CLI tracing | Strong fit |
64
+ | Production dashboards | Not the goal |
65
+ | Hosted eval datasets | Not the goal |
66
+ | Prompt management | Not the goal |
67
+ | Standards-aligned local export | Partial (compatibility-oriented) |
68
+ | Full observability platform | Use a dedicated platform |
69
+
package/docs/DIFF.md ADDED
@@ -0,0 +1,11 @@
1
+ ## Diff / compare
2
+
3
+ AgentInspect can compare two runs (manual traces) locally and render a diff summary.
4
+
5
+ - **CLI usage**: `docs/CLI.md` (`diff`)
6
+ - **Schema expectations for diff inputs**: `docs/SCHEMA.md` (manual trace JSONL, `schemaVersion: "0.1"`)
7
+
8
+ Notes:
9
+ - Programmatic diff APIs are documented as **experimental** in `docs/API.md`.
10
+ - `diff` is read-only and does **not** rerun agents; “differences” do not necessarily imply failure (command errors do).
11
+
@@ -0,0 +1,12 @@
1
+ ## Exports
2
+
3
+ AgentInspect supports local-only exports from run trees and traces. Exports are intended for **compatibility and sharing**, but should be reviewed before sending to others.
4
+
5
+ - **CLI usage**: `docs/CLI.md` (`export`)
6
+ - **Schema + compatibility guarantees**: `docs/SCHEMA.md`
7
+ - **Safety / redaction notes**: `docs/CLI.md`, `SECURITY.md`, and `docs-local/architecture/REDACTION.md`
8
+
9
+ Notes:
10
+ - Export formats (Markdown/HTML/OpenInference/OTLP JSON) are documented as **experimental / compatibility-oriented** in `docs/API.md`.
11
+ - AgentInspect does **not** upload anywhere; exports write local strings/files only.
12
+
@@ -0,0 +1,128 @@
1
+ # Getting started
2
+
3
+ AgentInspect is a **local-first execution-tree debugger** for TypeScript AI agents. It helps you produce and inspect an execution tree of steps, safely and deterministically, without uploading data anywhere.
4
+
5
+ ## 1. Install
6
+
7
+ ```bash
8
+ pnpm add agent-inspect
9
+ ```
10
+
11
+ The `agent-inspect` package includes the CLI binary via its `bin` field:
12
+
13
+ ```bash
14
+ npx agent-inspect --help
15
+ ```
16
+
17
+ For local repo development (this monorepo), build and run the CLI from `packages/cli`:
18
+
19
+ ```bash
20
+ pnpm build
21
+ node packages/cli/dist/index.cjs --help
22
+ ```
23
+
24
+ ## 2. Basic manual trace
25
+
26
+ ```ts
27
+ import { inspectRun, step } from "agent-inspect";
28
+
29
+ await inspectRun("demo-agent", async () => {
30
+ await step("plan", async () => "ok");
31
+ await step.tool("search", async () => ({ count: 2 }));
32
+ await step.llm("fixture-model", async () => "done");
33
+ });
34
+ ```
35
+
36
+ This writes a local JSONL trace with stable v1.0 event names:
37
+
38
+ - `run_started`, `run_completed`
39
+ - `step_started`, `step_completed`
40
+
41
+ ## 3. View runs
42
+
43
+ ```bash
44
+ agent-inspect list
45
+ agent-inspect view <runId>
46
+ ```
47
+
48
+ ## 4. Clean old runs (safely)
49
+
50
+ Always start with `--dry-run`:
51
+
52
+ ```bash
53
+ agent-inspect clean --older-than 7d --dry-run
54
+ agent-inspect clean --older-than 7d --yes
55
+ ```
56
+
57
+ ## 5. Parse existing logs
58
+
59
+ ```bash
60
+ agent-inspect logs fixtures/logs/proactive-json.log \
61
+ --format json \
62
+ --config fixtures/configs/proactive-agent-inspect.logs.json
63
+ ```
64
+
65
+ ## 6. Tail logs
66
+
67
+ For scripting/CI-style usage, `--once` reads and exits:
68
+
69
+ ```bash
70
+ agent-inspect tail \
71
+ --file fixtures/logs/proactive-json.log \
72
+ --format json \
73
+ --config fixtures/configs/proactive-agent-inspect.logs.json \
74
+ --once
75
+ ```
76
+
77
+ ## 7. Export a run
78
+
79
+ ```bash
80
+ agent-inspect export minimal-success --dir fixtures/traces --format markdown
81
+ agent-inspect export minimal-success --dir fixtures/traces --format openinference --validate
82
+ ```
83
+
84
+ Exports are **local-only** and do not upload anywhere.
85
+
86
+ ## 8. Diff two runs
87
+
88
+ ```bash
89
+ agent-inspect diff minimal-success minimal-error --dir fixtures/traces
90
+ ```
91
+
92
+ ## 9. Try recipes
93
+
94
+ See `examples/recipes/README.md`.
95
+
96
+ ## 10. Optional LangChain adapter
97
+
98
+ `@agent-inspect/langchain` is optional and **experimental**:
99
+
100
+ ```bash
101
+ pnpm add @agent-inspect/langchain
102
+ ```
103
+
104
+ ## 11. Optional TUI
105
+
106
+ `@agent-inspect/tui` is optional and **experimental**. The CLI can invoke it with:
107
+
108
+ ```bash
109
+ agent-inspect view <runId> --tui
110
+ ```
111
+
112
+ ## 12. Safety notes
113
+
114
+ - Redaction is on by default for log-derived attributes and exports.
115
+ - Confidence labels are required to keep attribution honest.
116
+ - AgentInspect is for local debugging, not production monitoring.
117
+
118
+ ## 13. Next docs
119
+
120
+ - `docs/API.md`
121
+ - `docs/CLI.md`
122
+ - `docs/SCHEMA.md`
123
+ - `docs/COMPARE.md`
124
+ - `docs/LOG-TO-TREE-QUICKSTART.md`
125
+ - `docs/KNOWN-ISSUES.md`
126
+ - `docs/LIMITATIONS.md`
127
+ - `docs-local/V1-READINESS-CHECKLIST.md`
128
+
@@ -0,0 +1,34 @@
1
+ # Known issues
2
+
3
+ AgentInspect is **local-first** and **CLI-first**. These behaviors are intentional constraints or best-effort areas—not silent guarantees.
4
+
5
+ ## Logs
6
+
7
+ - **log4js-style parsing** is **best-effort**: embedded JSON must be recoverable from the line; unusual layouts may lose fields or warn.
8
+ - **JavaScript object-style log payloads** (e.g. `{ msg: '...', meta: ... }` printed without JSON) are **not** a supported interchange format for ingestion.
9
+
10
+ ## Exports
11
+
12
+ - **OpenInference** and **OTLP JSON** exports are **compatibility-oriented** and **experimental**. Validate against your target collector or backend before relying on them.
13
+ - Exports generate **strings/files locally** only—there is **no** automatic upload.
14
+
15
+ ## Integrations
16
+
17
+ - **Vendor sinks** (hosted dashboards, Langfuse/Braintrust/New Relic/Datadog native uploads, OTLP gRPC streaming, etc.) are **not implemented** in the core packages described here.
18
+ - **LangChain adapter** captures **metadata-oriented** signals by default; it does not replace full framework observability.
19
+
20
+ ## UI / replay
21
+
22
+ - **Optional TUI** (`@agent-inspect/tui`) is separate from the default CLI and requires an interactive terminal where documented.
23
+ - **Live streaming tree inside the TUI** is not the same as **live tail** over logs; product scope varies by version—see roadmap docs.
24
+ - **Full replay / fork execution** of historical traces is **out of scope** for current MVP-style releases.
25
+
26
+ ## Cost / tokens
27
+
28
+ - **Token counting** and **cost calculation** are **not** core features.
29
+
30
+ ## Confidence labels
31
+
32
+ - Log-derived trees carry **confidence** (`explicit`, `correlated`, `heuristic`, `unknown`). Labels explain **how** relationships were inferred—they are not semantic proof.
33
+
34
+ When in doubt, treat AgentInspect as a **debugging aid**, not a compliance or billing system of record.
@@ -0,0 +1,32 @@
1
+ # Limitations
2
+
3
+ This document states what AgentInspect **does not** provide today. It complements [KNOWN-ISSUES.md](./KNOWN-ISSUES.md).
4
+
5
+ ## Product boundaries
6
+
7
+ - **No SaaS dashboard** or hosted multi-tenant product in the open-source core workflow.
8
+ - **No production APM replacement**: no sampling agents, no fleet-wide aggregation, no uptime SLAs.
9
+ - **No vendor upload pipeline**: no built-in Langfuse/Braintrust/New Relic/Datadog direct exporters as live sinks.
10
+ - **No automatic universal instrumentation** of every framework: integration is explicit (manual traces, log ingest, optional adapters).
11
+
12
+ ## Data fidelity
13
+
14
+ - **No full prompt/output capture by default** for manual traces (by design: safety and PII risk).
15
+ - **Log-derived runs** and **manual JSONL traces** may differ in fidelity (timestamps, nesting, confidence).
16
+ - **Confidence labels** qualify inferred relationships; they do not guarantee correctness.
17
+
18
+ ## Execution semantics
19
+
20
+ - **No replay / fork** of past runs from traces alone.
21
+ - **No time-travel debugging** across arbitrary runtime state.
22
+ - **No multi-run statistical evaluation** built into core.
23
+
24
+ ## Economics
25
+
26
+ - **No cost engine**: no pricing tables, invoice-grade usage, or provider billing reconciliation.
27
+
28
+ ## Scale
29
+
30
+ - Designed for **developer machines** and **inner-loop debugging**, not petabyte log warehouses.
31
+
32
+ For roadmap intent, see `docs-local/roadmap/VERSION-ROADMAP.md` and `docs-local/prd/v1.0-STABLE-LOCAL-INSPECTOR-PRD.md` (planning docs; not a promise of future features).
@@ -0,0 +1,54 @@
1
+ ## Log-to-tree quickstart
2
+
3
+ AgentInspect can inspect **structured logs** and render a local execution tree without requiring you to wrap every function in manual tracing.
4
+
5
+ ## Example JSON log lines
6
+
7
+ `agent.log` (JSONL):
8
+
9
+ ```json
10
+ {"timestamp":"2026-05-08T10:00:00.000Z","requestId":"req_123","event":"agent.started","message":"Agent started"}
11
+ {"timestamp":"2026-05-08T10:00:00.150Z","requestId":"req_123","event":"tool.search.started","tool":"searchDocs"}
12
+ {"timestamp":"2026-05-08T10:00:00.420Z","requestId":"req_123","event":"tool.search.completed","tool":"searchDocs","durationMs":270}
13
+ {"timestamp":"2026-05-08T10:00:00.500Z","requestId":"req_123","event":"llm.answer.started","model":"gpt-example"}
14
+ {"timestamp":"2026-05-08T10:00:01.100Z","requestId":"req_123","event":"llm.answer.completed","model":"gpt-example","durationMs":600}
15
+ {"timestamp":"2026-05-08T10:00:01.150Z","requestId":"req_123","event":"agent.completed","status":"ok"}
16
+ ```
17
+
18
+ ## Parse logs into trees
19
+
20
+ ```bash
21
+ npx agent-inspect logs ./agent.log \
22
+ --format json \
23
+ --run-id-key requestId \
24
+ --event-key event \
25
+ --timestamp-key timestamp
26
+ ```
27
+
28
+ Example output:
29
+
30
+ ```text
31
+ Run req_123
32
+ ├─ agent.started
33
+ ├─ tool.search.started
34
+ ├─ tool.search.completed (270ms)
35
+ ├─ llm.answer.started
36
+ ├─ llm.answer.completed (600ms)
37
+ └─ agent.completed (ok)
38
+ ```
39
+
40
+ ## Important notes
41
+
42
+ - **JSON logs are first-class**. (Line-delimited JSON is the recommended input.)
43
+ - **log4js text logs with embedded JSON are best-effort**.
44
+ - AgentInspect does **not** evaluate JavaScript object strings (`eval` is not used).
45
+ - **Flat timeline is the default** for log-derived events.
46
+ - Nesting is conservative: **explicit parent/config wins**, and inferred relationships are labeled.
47
+ - **Confidence labels** explain how relationships were inferred (`explicit`, `correlated`, `heuristic`, `unknown`).
48
+ - **Redaction** is applied where configured/defaulted for log-derived attributes and exports.
49
+
50
+ See also:
51
+ - `docs/CLI.md` (`logs`, `tail`)
52
+ - `docs/LOGS.md`
53
+ - `docs/SCHEMA.md` (log ingest config types + confidence)
54
+
package/docs/LOGS.md ADDED
@@ -0,0 +1,13 @@
1
+ ## Logs (structured log → tree)
2
+
3
+ AgentInspect can parse **existing logs** (line-delimited JSON, and best-effort log4js-style text with embedded JSON) into a local execution tree / grouped timeline.
4
+
5
+ - **CLI usage**: `docs/CLI.md` (`logs`, `tail`)
6
+ - **Quickstart**: `docs/LOG-TO-TREE-QUICKSTART.md`
7
+ - **Log ingest config (field mapping + redaction)**: `docs-local/architecture/LOG-INGEST-CONFIG.md`
8
+ - **Safety constraints** (no eval, no JS object parsing): `docs-local/architecture/ARCHITECTURE.md`
9
+
10
+ Notes:
11
+ - Log parsing APIs are documented as **experimental** in `docs/API.md`.
12
+ - Log-derived events include **confidence labels**; AgentInspect is conservative about inferring parent/child structure.
13
+
@@ -0,0 +1,109 @@
1
+ # Migration guide (to AgentInspect 1.0)
2
+
3
+ This guide summarizes how to move from early AgentInspect MVP usage to **AgentInspect 1.0**.
4
+
5
+ AgentInspect remains local-first: it does not introduce any network upload or vendor sink workflows.
6
+
7
+ ## Scope
8
+
9
+ Covered:
10
+
11
+ - manual tracing (`inspectRun`, `step`, `observe`)
12
+ - trace directory behavior
13
+ - CLI commands (`list`, `view`, `clean`, `logs`, `tail`, `export`, `diff`)
14
+ - optional packages (`@agent-inspect/langchain`, `@agent-inspect/tui`)
15
+ - schema compatibility guarantees
16
+
17
+ Not covered:
18
+
19
+ - publish/version bump workflows (see `docs-local/RELEASE-CHECKLIST.md`)
20
+ - vendor sinks (not implemented)
21
+ - replay (not implemented)
22
+ - cost engine (not implemented)
23
+
24
+ ## Manual tracing API
25
+
26
+ If you were using:
27
+
28
+ ```ts
29
+ import { inspectRun, step } from "agent-inspect";
30
+ ```
31
+
32
+ that remains the recommended stable path. AgentInspect 1.0 is specifically about keeping these entry points compatible.
33
+
34
+ ### Event names and failure representation
35
+
36
+ Manual JSONL event names remain stable:
37
+
38
+ - `run_started`
39
+ - `run_completed`
40
+ - `step_started`
41
+ - `step_completed`
42
+
43
+ There is **no `step_failed` event**. Step failures are represented as:
44
+
45
+ - `step_completed` with `status: "error"`
46
+
47
+ Existing `schemaVersion: "0.1"` traces remain readable. No migration command is required.
48
+
49
+ ## Trace directory behavior
50
+
51
+ - `AGENT_INSPECT_TRACE_DIR` is supported.
52
+ - When unset, AgentInspect uses its default local directory (see `docs/CLI.md` and `docs/API.md`).
53
+ - Trace files are JSONL and are not automatically rewritten.
54
+
55
+ ## CLI changes and additive commands
56
+
57
+ Manual inspection commands (`list`, `view`) are stable and local-only.
58
+
59
+ The following commands are additive workflows that remain local-only:
60
+
61
+ - `logs`: parse structured logs into normalized trees
62
+ - `tail`: live-tail structured logs in the terminal
63
+ - `export`: export a manual trace as Markdown/HTML/OpenInference-compatible JSON/OTLP JSON (local-only)
64
+ - `diff`: compare two manual traces (local, read-only)
65
+
66
+ ### `clean` is safety-critical
67
+
68
+ `clean` verifies traces before deletion using conservative heuristics. If a file cannot be verified as an AgentInspect trace, it is skipped.
69
+
70
+ ## Logs and tail
71
+
72
+ - JSON logs are first-class.
73
+ - log4js parsing is best-effort.
74
+ - No JS object literal parsing or `eval`.
75
+ - Redaction is applied to log-derived attributes based on config/default rules.
76
+
77
+ ## Export and share safety
78
+
79
+ - Exports are **generated locally** and do not upload anywhere.
80
+ - Exporters default to **redacted** and **bounded** attribute previews.
81
+ - Always review exports before sharing.
82
+
83
+ ## Diff and compare
84
+
85
+ - Diff compares two existing local traces.
86
+ - Diff does not rerun agents, mutate trace files, or call an LLM.
87
+
88
+ ## Optional LangChain adapter
89
+
90
+ `@agent-inspect/langchain` is optional and separate from core. It uses `@langchain/core` as a **peer dependency**.
91
+
92
+ ## Optional TUI
93
+
94
+ `@agent-inspect/tui` is optional and separate from core. It contains `ink`/`react` dependencies so the main `agent-inspect` install remains lean.
95
+
96
+ ## Breaking changes
97
+
98
+ This stabilization effort aims to avoid breaking changes. If a breaking change is ever required:
99
+
100
+ - it requires a major version
101
+ - it must preserve trace readability where possible
102
+ - it must be explicitly documented
103
+
104
+ ## Known non-migrations
105
+
106
+ - No vendor sink migration exists because there are **no vendor sinks** in core.
107
+ - No replay migration exists because replay is **not implemented**.
108
+ - No cost engine migration exists because cost calculation is **not implemented**.
109
+