Organize work before adding agents
A multi-agent prototype can look productive while making the underlying task harder to debug. Several specialists exchange convincing messages, but nobody owns the final decision, duplicated work consumes the budget, and a retry unexpectedly runs an external action twice.
This guide is for engineers designing LangGraph workflows and technical leaders deciding whether multiple agents are justified. Start with task dependencies, typed state and failure ownership. Add independent reasoning roles only where they create a measurable advantage over a simpler graph of deterministic steps and one model.
Key takeaways
- Choose an orchestration pattern from the task's dependency structure.
- Give every state field a clear writer and merge policy.
- Separate evidence gathering, decision making and external execution.
- Treat checkpoints as recovery support, not proof of exactly-once effects.
- Evaluate coordination overhead as well as final answer quality.
Choose a pattern that matches the work
A sequential pipeline suits tasks with ordered dependencies: extract facts, validate them, then draft a response. Parallel specialists suit independent evidence sources. A supervisor can select among capabilities when the appropriate route depends on the request. A handoff model suits a conversation that genuinely needs to transfer responsibility between roles.
These patterns can coexist, but each additional coordination point introduces another place for ambiguity. Ask what information a specialist needs, what artifact it returns and who decides whether that artifact is sufficient. A role described only as an expert usually has a weaker contract than a node described as returning verified source identifiers and unresolved questions.
| Pattern | Good fit | Main operational cost |
|---|---|---|
| Sequential pipeline | Ordered transformations | Slow stages block later work |
| Parallel branches | Independent evidence gathering | Merge rules and straggler handling |
| Supervisor routing | Variable capability selection | Routing errors and extra decisions |
| Explicit handoff | Changing task ownership | Context transfer and responsibility |
The LangGraph overview describes a stateful orchestration runtime that can mix deterministic and model-driven steps. That flexibility is useful because not every node needs an LLM. Authorization, schema validation, budget checks and arithmetic usually have clearer behavior as ordinary functions.
Before implementing a supervisor, build a fixed baseline. Run the same task set through both designs and compare correctness, required human intervention, tool calls, latency and cost. If the supervisor only chooses the same route every time, explicit routing may deliver the same result with fewer moving parts.
Define state as a shared contract
State should represent durable facts about the task, not an unrestricted conversation among agents. Useful fields include the request identifier, authorized scope, evidence references, branch results, open questions, attempt counts and final status. Large documents can live in an artifact store while state holds immutable references and content hashes.
For each field, specify whether nodes replace it, append to it or merge it by key. Parallel branches writing the same scalar field create an ownership conflict. Appending results is convenient, but retries can append duplicates unless the result carries a stable identity. A merge by source identifier is often clearer than concatenating free-form messages indefinitely.
+---------------+ +----------------+
| Request scope | ---> | Route and plan |
+---------------+ +-------+--------+
|
+----------------+----------------+
| |
+---------v----------+ +---------v----------+
| Evidence branch A | | Evidence branch B |
+---------+----------+ +---------+----------+
| |
+----------------+----------------+
|
+---------v----------+
| Validate and merge |
+---------+----------+
|
+---------v----------+
| Review or complete |
+--------------------+
The following small LangGraph example runs without an API key after installing a compatible langgraph package. It uses deterministic nodes to make state movement visible. The Graph API documentation explains the node, edge and state abstractions; check it for your installed version before adding persistence or provider integrations.
from typing import TypedDict
from langgraph.graph import StateGraph, START, END
class State(TypedDict):
question: str
evidence: list[str]
answer: str
def collect(state: State):
return {"evidence": ["Only approved sources are eligible."]}
def summarize(state: State):
return {"answer": " ".join(state["evidence"])}
builder = StateGraph(State)
builder.add_node("collect", collect)
builder.add_node("summarize", summarize)
builder.add_edge(START, "collect")
builder.add_edge("collect", "summarize")
builder.add_edge("summarize", END)
graph = builder.compile()
result = graph.invoke({
"question": "Which sources can be used?",
"evidence": [], "answer": ""
})
print(result["answer"])
The example deliberately leaves out agent conversations. First verify that the graph carries the right information and reaches a terminal state. Then replace a deterministic node with a model-backed implementation while preserving its input and output contract. That makes failures attributable to a specific responsibility instead of an entire conversation.
Route work with explicit stopping conditions
Routing should produce a small, validated set of destinations. For example, a support workflow might choose account lookup, documentation retrieval or clarification. A model can propose the route, but the application should reject an unknown destination and enforce whether that capability is available to the current user.
Define what happens when no route is appropriate. A missing account identifier should lead to a clarification state. An unsupported request should end with a useful explanation. A repeated failure should stop or escalate rather than route back to the same specialist forever. Track attempts per logical task so that a handoff cannot accidentally reset the overall budget.
A supervisor should receive compact result objects, not every token produced by every specialist. Include the conclusion, evidence references, confidence limitations and remaining questions. The supervisor needs enough context to select the next action without inheriting irrelevant or untrusted instructions from a branch's source material.
Model the merge as a decision
Parallel outputs may disagree for valid reasons. One source might describe the current policy while another describes a previous version. A merge step should preserve that conflict, compare source authority and timestamp, and decide whether additional retrieval is necessary. Asking a final writer to blend the answers can conceal the disagreement.
This runnable Python example demonstrates a strict merge rule for branch results. Conflicting values become explicit failures for review. In a real workflow, the result key should include the fact's scope and source version so that two different entities are not mistaken for one contradiction.
def merge_results(branches):
merged = {}
for branch in branches:
for key, value in branch.items():
if key in merged and merged[key] != value:
raise ValueError(f"conflicting result: {key}")
merged[key] = value
return merged
result = merge_results([
{"policy_version": "2026-10", "currency": "USD"},
{"policy_version": "2026-10", "status": "verified"},
])
assert result["status"] == "verified"
print(result)
There is no universal merge policy. Append-only evidence, last-observed state and authoritative business facts have different semantics. Document the choice next to the field definition and test it with duplicate, missing and conflicting branch outputs.
Make parallelism and recovery predictable
Parallel execution reduces waiting only when branches are sufficiently independent. If each specialist immediately needs another specialist's output, parallelism creates synchronization overhead. Bound concurrency to protect downstream APIs and the shared model budget. Plan for one branch to finish quickly while another times out or returns unusable data.
Specify whether partial results are acceptable. A research summary may be able to proceed with one unavailable source and a visible limitation. A financial reconciliation cannot silently omit one ledger. The merge step should receive branch statuses as well as branch content, so absence is not confused with an empty successful result.
Persist checkpoints at meaningful transitions. A checkpoint can recover graph state, but an external API call may already have succeeded before the checkpoint was written. Make side effects idempotent and reconcile uncertain outcomes. Keep action execution in a dedicated node with its own durable operation record rather than burying it inside a specialist's reasoning loop.
For more detail on that execution boundary, see AI agents in production. The same principle applies inside a multi-agent system: additional planning roles do not create additional authority. Every external action still needs application-side permission checks and a valid action budget.
Plan for graph changes
A paused workflow may resume after code has changed. Version the state schema and graph definition, and decide whether old runs use their original implementation or a tested migration. Renaming a node or changing a reducer can alter recovery behavior even when the user-facing task appears unchanged.
A practical release rehearsal starts an old workflow, pauses it after evidence gathering, deploys the candidate version and attempts resumption in staging. Check that stored references remain readable and that completed effects are not repeated. If migration is unsupported, make the operational choice explicit: drain old runs or keep the old worker available until they finish.
Evaluate the system rather than its personalities
Create task fixtures with expected artifacts and allowed actions. Score the final result, but also inspect route selection, evidence coverage, contradiction handling, duplicate work and budget exhaustion. A specialist that writes a polished answer but never provides verifiable evidence is failing its contract even if a reviewer likes its style.
Use ablations to establish whether each role helps. Remove one specialist, replace a supervisor with deterministic routing, or compare parallel and sequential execution on the same cases. The purpose is not to prove that more agents are better. It is to discover which responsibilities need independent reasoning and which need better interfaces.
Record a trace for each node with graph version, input artifact references, output validation, elapsed time and status. Avoid copying confidential documents into every span. A trace should make it possible to identify a bad route or repeated branch while respecting the same access restrictions as the underlying task.
Human review also needs a contract. Show the proposed outcome, relevant evidence, unresolved disagreements and exact action awaiting approval. Record the reviewer decision and the reviewed artifact version. If another agent edits the proposal afterward, the old approval should no longer authorize execution.
Test coordination failures deliberately
Build fixtures in which two branches claim different versions of the same policy, one branch returns an unknown field, and another exceeds its deadline. Verify that the merge reports the right status and that the final writer cannot turn a failed branch into a confident unsupported statement. These cases test system behavior rather than prompt wording.
Add a duplicate-delivery case by feeding the same branch result twice. The final evidence set should remain stable when the merge contract promises deduplication. Then simulate a worker interruption after one branch completes. On recovery, completed work should either be reused or repeated safely according to the documented policy, with the trace explaining which occurred.
Common mistakes
- Creating specialists with different names but identical responsibilities and access.
- Letting parallel branches overwrite shared fields without a merge contract.
- Feeding every message into every agent until context and cost grow uncontrollably.
- Assuming a checkpoint makes external actions exactly once.
- Judging success only by the final answer and missing repeated internal failures.
Checklist
- Establish a single-agent or deterministic baseline.
- Specify each node's inputs, outputs, authority and failure status.
- Define field ownership, merge rules and stable result identifiers.
- Limit concurrency, retries, routing loops and total task budget.
- Test partial completion, disagreement and duplicate branch results.
- Rehearse interruption and resumption across graph versions.
- Measure whether every specialist improves a relevant outcome.
FAQ
When is a multi-agent system useful?
It is useful when a task has separable responsibilities that benefit from different tools, context or independent checks. If every role needs the same information and always follows the same sequence, a simpler workflow may be easier to operate.
Does LangGraph require every node to call a model?
No. Nodes can perform ordinary deterministic work, including validation and data transformation. Mixing those steps with selective model calls often makes a graph easier to test and explain.
Can parallel agents share one mutable conversation?
They can be designed to share messages, but ownership and merge behavior still need explicit rules. Prefer bounded artifacts and scoped context when unrestricted sharing makes results hard to attribute or duplicates sensitive information.
What is the first production reliability test?
Interrupt the workflow around an external side effect and resume it. Verify both the recovered graph state and the external system, because a correct checkpoint alone does not prove that the action happened only once.
Final thoughts
Reliable multi-agent orchestration comes from contracts between responsibilities: who owns a field, who validates evidence, who can act and who resolves uncertainty. LangGraph can express that structure, but the architecture still needs explicit operational decisions.
If you need help designing the workflow, explore my LangChain engineering service and book a conversation.


Comments
No comments yet. Start the conversation.
Leave a comment