LangChain — what we learn from them
Read on 2026-05-30. They're the most-deployed agent framework today and have shipped product around almost every problem we're going to hit. Worth reading before re-inventing.
What they call things vs what we call things
| LangChain | Harmony |
|---|---|
| Agent | Agent (versioned, Decision 0007) |
| Chain | Skill body — but theirs is graph-based, ours is markdown |
| Tool | Tool (MCP-shaped per Sprint 8/9) |
| Memory | Run event log + (future) Thread |
| LangSmith Trace | RunEvent log + Trace viewer (Decision 0008 + Sprint 9 Drop 2g) |
| LangSmith Eval | Decision 0015 — schema designed, runner not built |
| LangSmith Deployment | Compute Provider + Deploy contract (Decision 0011) |
| LLM Gateway | LLM Provider per workspace (Decision 0009) |
| Assistant | AgentVersion |
| Thread | Run (today) → Thread (TBD) |
| Run | Run (Decision 0008) |
| LangGraph node/edge/state | Implicit in our runAgentLoop |
The mapping is close enough that someone coming from LangChain should be able to find their way. The two big shape differences:
- They put governance in a hosted SaaS (LangSmith). We put it in the open RunEvent log + open API + self-hosted by default.
- They model orchestration as a state graph (LangGraph). We model it as a linear iteration loop. Cheaper conceptually until you need parallel branches, mid-run approvals, or replay-from-step.
What we adopt
1. Threads as a first-class entity
Today the "conversation" in our chat surface lives in React state. When you close the tab, it's gone. The Run + RunEvent log on the server records what happened, but no UI lets you reopen and continue.
LangChain's Thread is exactly this: a persistent conversation across runs. They store the message array, link runs to it, and re-load on resume.
For us:
- Add a
Threadmodel:{id, agentVersionId, title, createdAt, lastMessageAt} - Each Run gains
threadId?: string - Chat UI on agent detail / deployment: sidebar lists recent Threads, click to open + continue from where you left off
This is the next sprint candidate after MCP polish.
2. State + reducers (kind of)
LangGraph defines state as a TypedDict with reducer functions per field. Updates merge through the reducer; appends to messages: [] use a different rule than overwrites to current_step.
For us, our messages: [] is already append-only; budget tracking already accumulates. We do this implicitly. Adopting reducers explicitly would let:
- New event types (e.g.,
thread.message_added) update state predictably - Replay-from-checkpoint become trivial (apply events in order, each event is a reducer call)
Not adopting their type system or Runnable wrapper — just the pattern. Keep our event log as the canonical store.
3. Interrupts → human-in-the-loop
LangGraph's interrupt() pauses a run mid-execution, waits for a human, then resumes with Command(resume=value).
Our schema has Hook with phases pre_session, post_session, pre_tool, post_tool, pre_pr_create, budget_threshold — never wired. The pre_tool hook fits perfectly: an approval gate before destructive tool calls. When a hook returns "wait", runtime pauses, emits tool.pending_approval event, UI shows Approve/Deny, runtime resumes when user clicks Approve.
This needs the Threads work first (resume requires somewhere to resume from).
4. Eval separately + version-promotion gating
LangSmith treats eval as the gate between "ran in dev" and "deployed in prod". Decision 0015 already says this; we just haven't built the runner yet.
Their concrete pattern worth copying:
- Dataset = list of
{input, expected_output?}pairs - Run dataset across N agent versions = matrix of
{agentVersion, input, output, score, passed} - Pass gate = "version 0.2.1 must pass 90% of evals to be promoted from
agent_localtoworkspace"
The Eval model in Decision 0015 has the right shape. Drop 4 territory.
What we adopt as ideas but don't fully implement
5. Prompt versioning + optimization
We have SkillVersion which is the "versioned prompt" piece. LangChain bolts on optimization (DSPy-style automated prompt rewriting). That's a research area we won't reach for a while. Mention in roadmap as exploration, not a planned drop.
6. Streaming primitives
They have astream_events() / astream_log() / token-level streams. We have SSE + RunEvent. Already enough.
What we deliberately don't copy
LangGraph DAG itself
For our current scope, a graph abstraction is overkill. We have:
- One agent ↔ one Run ↔ one linear loop of LLM → tool → LLM → tool → final
- No branching, no parallel branches, no merge points yet
If we need branching agents (router-style: "is this a customer support ticket OR a sales lead?"), we can either:
- Build branching as a one-off (cheap, ~half a day)
- Adopt LangGraph wholesale (heavy)
We adopt later if the use case appears. For now linear stays.
LangSmith hosted SaaS
Our event log is open, portable, owned by the workspace, self-hostable. LangSmith pulls observability into a closed cloud product. That's a category mistake for our project: it would force users to ship traces off-prem, which violates the deploy-on-your-own-server promise. Trace stays inline. We do build the same kind of UI on top — that's already in Sessions + RunTrace.
Custom Runnable wrapper
LangChain wraps every operation in a Runnable. It's a typing + composition aid that makes their DSL hang together. Adopting it would lock us to their abstraction. We stay on plain functions + an event type union.
Deep Agents / Fleet
Fleet is "no-code agent builder". We're not pursuing no-code yet — wizard + edit form is enough until we have shape feedback from users.
So what should we actually build next
Ranked, from a Harmony perspective informed by reading their docs:
- Threads model + reopen chat — single biggest UX gap. Users keep losing their conversation history. (Sprint 9 Drop 4.)
pre_toolhook → human approval gate — visible value, schema already there. (Drop 5 — needs Threads.)- Eval suite runner — Decision 0015 implementation. Gates promotion. (Drop 6.)
- Triggers as the inverse of Hooks — webhook / cron / Gmail-arrived → start a run. (Drop 7 — separate from MCP, well-bounded.)
- Templates community library — submission flow + moderation. Sprint of its own when we have community signal.
Their docs are worth checking again when we get to:
- The actual eval runner shape (we'd benefit from looking at their pass/fail dataset shape)
- Human-in-the-loop UX (their interrupt + resume mental model is solid)
- LangGraph if we ever need DAG branching
But for now: take the patterns, leave the framework.