Add LangSmith trace normalization - #1
Conversation
# Conflicts: # PARITY.md # README.md # src/types.ts # test/normalize.test.ts
cpacker
left a comment
There was a problem hiding this comment.
There is a trace-loss edge case in aggregate-root selection. findDeepAgentsRoots() can select a root carrying ls_message_view_exclude. The decode loop then skips every child because an aggregate root exists, and skips the root itself because of the exclusion marker. A trace with valid child LLM runs consequently emits no events and fails with missing_user_records.
Please exclude such roots from aggregate-root selection or fall back to processing their children, and add a regression test for an excluded Deep Agents root with valid child spans.
This branch also currently conflicts with main across the adapter registry/types/tests and generated Python bundle, so it needs a substantive rebase and full regeneration before another review.
👾 Generated with Letta Code
Summary
langsmithtrajectory source for canonical LangSmithRun[]and/runs/query{ "runs": [...] }payloadsls_integration: "deepagents"or"deepagents-code"through their aggregate LangGraphoutputs.messages, ignoring redundant child spansls_message_view_excludeWhy
LangSmith stores traces as canonical Run spans, while conversational content remains integration-specific. The generic adapter reconstructs documented message formats from LLM and tool runs.
Deep Agents is different in one useful, explicit way: its root LangGraph run already contains the complete ordered message state. Processing both that aggregate and its accumulated child LLM/tool spans duplicates history. For
deepagentsanddeepagents-code, the adapter now uses the root aggregate as the canonical trajectory. Claude Code, Codex, and all other integration markers deliberately remain on the existing generic path.Scope
The adapter accepts canonical Run arrays or
{ "runs": [...] }envelopes. It does not implement filesystem discovery, LangSmith network fetching, single-run aliases, or a Claude Code/Codex-specific aggregate decoder. The local Codex adapter is unchanged.Validation
bun run check— 51 passed, 7 optional Deep Agents tests skipped without the Python extra; typecheck, bundle consistency, and build passeddeepagentsanddeepagents-codefixtures normalize without diagnostics and ignore deliberately redundant child spansnpm pack --dry-rungit diff --checkandgit diff --cached --checkgit diff origin/main -- src/adapters/codex.tsis emptyRaw account trace content is not included in this PR.