Overview
Orchestration frameworks define how agent workflows are structured, executed, and persisted. The choice of framework determines whether your agent system is a loose script, a rigid pipeline, or a resilient state machine. xCoder evaluated four approaches before settling on LangGraphJS as the foundation for the FlowEngine.
Comparison Matrix
| Dimension | LangGraphJS | Mastra | Vercel AI SDK | Custom |
|---|---|---|---|---|
| State Model | Graph-based state machine with checkpoints | Event-driven workflows | Stream-based function calling | Ad-hoc (varies) |
| TypeScript | Native | Native | Native | Depends |
| Persistence | Built-in (PostgreSQL, Redis, memory) | Via adapters | Manual implementation | Manual implementation |
| Human-in-the-loop | Native interrupts | Custom events | Not built-in | Must build |
| Cycles / Iteration | First-class (graph cycles) | Via event loops | Recursive functions | Manual loops |
| Observability | LangSmith integration | Custom tracing | Vercel AI SDK telemetry | Must build |
| Ecosystem | LangChain (hundreds of integrations) | Growing (Mem0, Basel) | Vercel ecosystem | None |
| Learning Curve | Medium | Low-Medium | Low | High |
| Production Usage | Stripe, Ramp, Coinbase | Early adopters | Vercel deployments | Varies |
| xCoder Score | 9/10 | 6/10 | 5/10 | 4/10 |
LangGraphJS
LangGraphJS models workflows as explicit state machines. Nodes are pure functions; edges are conditional transitions. This formalism makes it possible to reason about agent behavior, test individual nodes, and recover from failures by replaying from checkpoints. It is the only framework we evaluated with first-class support for cyclic workflows — essential for iterative coding agents that plan, execute, test, and reflect.
Mastra
Mastra is a newer framework with a simpler event-driven model. It is easier to learn than LangGraph but less powerful for complex state management. We considered it for rapid prototyping but rejected it for production because it lacks native checkpointing and graph visualization.
Vercel AI SDK
The Vercel AI SDK excels at streaming LLM responses and tool calling but provides no workflow abstractions. It is a building block, not an orchestration framework. We use it inside individual LangGraph nodes for model interaction but not for flow control.
Custom
A fully custom orchestrator gives maximum control but requires building persistence, recovery, observability, and testing infrastructure from scratch. We estimated 3-6 months of engineering effort for parity with LangGraph's built-in features. Not viable for our timeline.
xCoder's Decision
Winner: LangGraphJS
packages/flow-engine/. We extend it with domain-specific invariants (branch-gate, commit-gate, PR-gate) and custom nodes for the SDLC. The graph structure makes our flow explicit, testable, and observable.Integration Notes
- State schema — Our
XCoderStateinterface extends LangGraph's base state with xCoder-specific fields (issue number, branch name, QA verdicts, PR URL). - Checkpointer — We use the PostgreSQL checkpointer with TimescaleDB for time-series metrics on phase transitions.
- Streaming — Graph events stream through a Server-Sent Events (SSE) endpoint to the web dashboard.
- Testing — Each node is unit-tested in isolation; integration tests verify full graph paths.
- Upstream — We contribute TypeScript type improvements and bug fixes to LangGraphJS.