@agent-inspect/langchain 6.7.5 → 6.9.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/README.md CHANGED
@@ -31,10 +31,16 @@ import { AgentInspectCallback } from "@agent-inspect/langchain";
31
31
  const handler = new AgentInspectCallback({
32
32
  traceDir: ".agent-inspect",
33
33
  runName: "my-chain",
34
- persist: true,
34
+ // persist omitted: enabled automatically when traceDir is set
35
35
  });
36
36
 
37
- // Pass handler to your chain / runnable callbacks
37
+ // Pass handler to your chain / LangGraph invoke callbacks
38
+ await graph.invoke(input, { callbacks: [handler] });
39
+ await handler.flush(); // optional — awaitHandlers already drains persistence
40
+ await handler.close(); // serverless / unusual shapes — idempotent
41
+
42
+ const d = handler.getDiagnostics();
43
+ // counts only: lateEventCount, pendingRelationshipCount, finalized, …
38
44
  ```
39
45
 
40
46
  ## Privacy
@@ -46,9 +52,13 @@ const handler = new AgentInspectCallback({
46
52
 
47
53
  | Export | Purpose |
48
54
  | ------ | ------- |
49
- | `AgentInspectCallback` | LangChain `BaseCallbackHandler` |
55
+ | `AgentInspectCallback` | LangChain `BaseCallbackHandler` (`awaitHandlers`, `flush`/`finalize`/`close`, `getDiagnostics`) |
50
56
  | `extractModelName`, `safePreview` | Metadata helpers |
51
57
 
58
+ ## Fidelity
59
+
60
+ See [LANGGRAPH-FIDELITY.md](https://github.com/rajudandigam/agent-inspect/blob/main/docs/LANGGRAPH-FIDELITY.md) for the LangGraph/LangChain adapter contract (lifecycle, parents, tool identity, persist-by-intent).
61
+
52
62
  ## CLI
53
63
 
54
64
  With `persist: true`, use the same directory configured in `traceDir`:
@@ -70,8 +80,10 @@ and review the generated artifact for sensitive metadata.
70
80
 
71
81
  ## Troubleshooting
72
82
 
73
- - **Empty trace:** Set `persist: true` and ensure callbacks are attached to the runnable
74
- - **LangGraph:** Route through LangChain callback surfaces where possible
83
+ - **Empty trace:** Provide `traceDir` (persist-by-intent) or `persist: true`, and attach callbacks to invoke/stream
84
+ - **LangGraph:** Prefer `{ callbacks: [handler] }` on `invoke`/`stream`; tool nodes should forward runnable `config`
85
+ - **Incomplete run:** Call `await handler.finalize()` / `close()` on shutdown; check `getDiagnostics().lateEventCount`
86
+ - **Unresolved parents:** Expected for semantic labels like `LangGraph` / `__start__` when no unique match exists — visible in step metadata
75
87
 
76
88
 
77
89
  ## Version