Skip to content

docs(langsmith): M17 slice 2 — README integration + runnable example (#218) - #220

Merged
surlymochan merged 1 commit into
mainfrom
m17s2-readme-example
Nov 19, 2026
Merged

surlymochan merged 1 commit into
mainfrom
m17s2-readme-example

Conversation

@surlymochan

Copy link
Copy Markdown
Owner

Fixes #218 · part of epic #215 (evalid as LangSmith's external deterministic judge)

Slice 1 (#216/#217) landed the bridge core. This slice is docs + example only — no verdict semantics or CLI behaviour changed, no real API key needed.

What lands

README — new LangSmith: evalid as an external deterministic judge section (plus the xflow langsmith verify row in the Commands table):

  • Positioning: LangSmith is the scoreboard, evalid is the judge; judging stays local, no LLM judge, nothing moves into LangSmith's sandbox.
  • Setup: langsmith SDK ships as a dependency; LANGSMITH_API_KEY required (free Developer-tier key is enough to try it); optional LANGSMITH_PROJECT / LANGSMITH_ENDPOINT; traces must exist in LangSmith first.
  • One-command end-to-end usage (xflow langsmith verify --project <name>, --dry-run, --limit / --since / --cwd / --out / --json) and exit codes (0 ok · 1 feedback write failed · 2 usage/config · 3 no runs found).
  • Feedback format: key evalid_claim_verified, score = confirmed / checked (4 dp), written on the trace's root run with feedbackSourceType: 'api'; comment = score line + one line per claim with verdict, evidence note, and source quote (real example included).
  • Graceful degradation: no key → hard error, exit 2, nothing fabricated; network / write failure → exit 1 with local results kept (evalid-langsmith-results.json); empty project → exit 3; claim-free trace → no feedback; trace from another workspace → unknown verdicts, never invented; failed child fetch → root-run-only degradation, recorded.

Runnable example — examples/langsmith-verify/ (no key, no network):

  • run.mjs runs the full chain — recorded traces (runs.json, same shapes as test/fixtures/langsmith/runs.json) → in-memory fake client → map → verify with real replays in workspace/ → feedback recorded in memory on the root run.
  • workspace/: pass.test.mjs (passes), fail.test.mjs (fails), real.txt (exists); ghost.txt absent by design.
  • Observed output (Node v24.22.1): trace A — 4 claims, 2 confirmed, 2 breach, score 0.5, one feedback on run-a-root; trace B — 0 claims, skipped. Full output in examples/langsmith-verify/README.md.

Test — test/langsmith-example.test.js (new): spawns the example in CI and asserts exit 0 plus the verdict/feedback lines, so the example cannot silently rot.

Honest scope note

Live end-to-end against a real LangSmith project (feedback read back via the API) is still the remaining M17 acceptance step (epic #215) and needs a LANGSMITH_API_KEY; the README says so explicitly. Nothing in this PR claims otherwise.

Tests

  • New test: 1/1; bridge tests: 15/15 (local).
  • Full suite minus the two known pre-existing environment failures (test/i6d-acceptance-demo.test.js, test/xflow-audit.test.js — pytest-replay cases already documented in M17 slice 1: LangSmith bridge core (fetch → map → verify → feedback) #217; the first reproduces identically on clean main in this VM, A/B-verified via stash): 73 files, all green.
  • git diff --check clean.

…218)

README gains the LangSmith integration section (positioning, setup,
one-command end-to-end usage, feedback key/comment format, graceful
degradation for missing key / no network / empty project / claim-free
traces); examples/langsmith-verify/run.mjs runs the full
fetch → map → verify → feedback chain offline on recorded traces
with an in-memory fake client and real replays in its workspace;
test/langsmith-example.test.js runs the example in CI and asserts
its verdict lines. No verdict semantics or CLI behaviour changed.
@surlymochan
surlymochan merged commit 0619a78 into main Nov 19, 2026
2 checks passed
@surlymochan
surlymochan deleted the m17s2-readme-example branch November 19, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

M17 slice 2: README LangSmith 集成段+可跑示例

1 participant