Parallel Fan-Out in LangGraph: Send, Bounded Concurrency, Nested Graphs, and Tool-Less Turns
Moving per-service AI analysis from a serial 90-minute prompt loop to LangGraph Send with max_concurrency=4, operator.add reducers, partial-failure outcomes, closure-wrapped workers, hidden nested workflows, and single tool-less schema-bound model turns.
Parallel Fan-Out in LangGraph: Send, Bounded Concurrency, Nested Graphs, and Tool-Less Turns
In our old prompt-orchestrated upgrade agent, services ran one at a time simply because the prompt told the model to work serially. A nine-service estate burned over an hour and a half and roughly 330 graph steps, slamming straight into default limits long before a real 50-service estate could finish. Even asking the model in prose to batch three services at a time was just a polite suggestion.
Part 1 laid out the three step shapes, and Part 2 covered interrupt() gates and durable jobs. This chapter covers how we run real work in parallel inside a LangGraph StateGraph: bounded Send fan-out, append-only reducers and identity bugs, treating partial failure as a normal outcome, wrapping compiled worker agents inside closures, nesting a hidden workflow, and running a single tool-less schema-bound model turn.
Send fan-out with typed payloads and bounded concurrency
Our upgrade graph runs three separate fan-outs (backend per-service impact, mobile per-journey impact, and per-service plan compilation). Every fan-out follows the same map-reduce pattern: a conditional router returns list[Send], LangGraph executes one branch per Send inside one superstep, and a join node runs once all branches settle.
Register every fan-out target node with its own typed input_schema so each branch receives only its scoped task payload, never the entire graph state, and always return the join node's name when the Send list is empty (returning [] leaves the graph stranded):
# Simplified from the workflow fan-out router
def fan_out_plans(state: UpgradeState) -> list[Send] | str:
by_service = {r.service: r for r in ensure_impact_reports(state.get("impact_reports") or [])}
rows = {row.label: row for row in ensure_estate_rows(state.get("estate") or [])}
tasks = []
for service, report in by_service.items():
if not service or not report.repo:
continue
row = rows.get(service)
tasks.append(
Send(
"plan_service",
PlanTask(
job_id=state.get("job_id"),
service=service,
repo=report.repo,
external_ref=row.external_ref if row else report.repo,
impact=report,
),
)
)
return tasks or "plan_join" # empty fan-out must still advance to join
Notice where concurrency actually lives: it is not an argument to Send. It is the top-level runtime config key max_concurrency (not under configurable), paired right alongside recursion_limit:
# Simplified from the workflow agent class
def _build_runtime_config(self) -> dict:
config = super()._build_runtime_config()
config["recursion_limit"] = max(int(config["recursion_limit"]), settings.UPGRADE_RECURSION_LIMIT)
config["max_concurrency"] = settings.UPGRADE_MAX_CONCURRENCY # set to 4
return config
Our settings comment calls max_concurrency "the run's real throughput dial", and two months of traces confirmed no fan-out ever exceeded four concurrent workers. One operational scar worth repeating: treat max_concurrency, recursion_limit, and run timeout as one coupled setting. Raising only timeout turns a timeout into a recursion kill steps later, and renaming a timeout env var without a fallback once nearly halved our run cap silently.
Reducers, identity bugs, and what append-only costs you
Because Send executes multiple branches in the same superstep, two branches writing to a plain state field raise InvalidUpdateError. Every channel touched by a fan-out gets an operator.add reducer, while single-writer channels stay last-write:
class UpgradeState(TypedDict, total=False):
work_items: Annotated[list[WorkItem], operator.add]
impact_reports: Annotated[list[ImpactReport], operator.add]
plan_results: Annotated[list[PlanOutcome], operator.add]
errors: Annotated[list[str], operator.add]
coverage: CoverageReport | None # single writer: last-write
Append-only reducers are great for one pass and broken for per-service re-runs. Our external durable job record converges cleanly because every write upserts on (kind, external_ref). Inside checkpoint state, however, re-running one service appends a second report onto impact_reports, throwing off any downstream count. That is the main reason selective per-service retries remain unbuilt.
And design composite keys before your first fan-out. When we added mobile journey fan-out, code review caught three pure identity bugs before merge: branches keyed on repo#journey while the merge looked up repo (dropping 100% of results), two mobile apps sharing a journey ID collapsing into one unit until the app name joined the key, and fan-out rows arriving at the merge node as plain dicts after checkpoint serialization.
Partial failure is an outcome, not an exception
If service 17 out of 25 times out or returns unparseable JSON, aborting the entire batch wastes twenty minutes of finished LLM calls. Our impact node wraps every worker invocation in an async lane_for() context manager (recording "running" on enter and "finished" on exit so the UI board never lies) and turns timeouts or parse errors into recorded failed work items:
# Simplified from the workflow impact node
async with lane_for(tools, config, job_id=job_id, agent_name=worker_name, item=item) as lane:
try:
text, structured = await invoke_worker(
worker, impact_task(task), config, scope=f"impact:{service}", lane=lane.subagent
)
except WorkerInvocationTimeout as exc:
return await close_impact_failure(lane, item, service, exc)
try:
report = parse_worker_report(ImpactReport, text, structured)
except WorkerReportError as exc:
return await close_impact_failure(lane, item, service, exc)
report, downgrades = normalize_report(report)
errors = await lane.close(item.model_copy(update={"status": "in_progress"}))
return {"work_items": [item], "impact_reports": [report], "errors": errors}
Service 17 gets skipped by the plan fan-out, explained cleanly inside a diagnostics report, and the rest of the batch still marches to the publication gate. Inside normalize_report, any item the worker marked confirmed that is missing required machine fields gets downgraded to "needs human review" rather than dropped silently.

Left: one timed-out worker becomes a recorded failure in the diagnostics report while healthy services continue to plan compilation. Right: the three library contracts (closures, derived worker_config, and shared checkpointer) that make nested workers and workflows behave cleanly.
Wrapping compiled workers and nested workflows: three library traps
Invoking a registered Deep Agent worker or a nested hidden discovery workflow from inside a StateGraph node took one real production bug per rule:
- Use closures, never
functools.partialor declared subgraphs. LangGraph Studio discovers nested graphs by inspecting closure variables, sopartialhides the worker completely. Conversely, registering the compiled worker directly as a declared subgraph caused our web streaming adapter to stop attributing subagent events to separate UI lanes. A plainasync def impact(...)closure closing over the compiled workers satisfied both (and a test pins both). - Derive
worker_configcarefully. The worker must inherit authentication and tracing from the parent, yet it must not inheritcheckpoint_idorcheckpoint_map:
Settingdef worker_config(config, scope: str, lane) -> RunnableConfig: configurable = {**(config.get("configurable") or {})} for key in ("checkpoint_id", "checkpoint_map"): configurable.pop(key, None) configurable["checkpoint_ns"] = lane.checkpoint_ns # "tools:<uuid>" configurable["thread_id"] = f"{configurable.get('thread_id')}::{scope}" return {**config, "configurable": configurable}checkpoint_ns = "tools:<uuid>"matches the streaming adapter's subagent heuristic so parallel workers get separate UI lanes that close individually instead of interleaving into one lane. And as I covered in Upgrading Deep Agents and LangGraph, constructing workers withis_subagent=Truestops parent+child callback propagation from double-tracing every LLM call and inflating tokens by ~25%. - Keep nested workflows hidden, checkpointer-less, and whitelisted. We extracted discovery into a hidden workflow agent (zero user-facing transports) compiled without its own checkpointer so it rides on the parent's checkpointer under an isolated thread. The parent seeds tracked counters (like estate revision) in and copies back only whitelisted non-empty channels, never letting the child write to the job store directly. Enforcing agent-independence via
import-linterstopped the parent and child packages from tangling imports.
The smallest model step: typed_complete
Inside that hidden discovery workflow, mobile journeys with low-confidence classification need one bounded judgement over pre-packed files. Instead of launching an autonomous worker with tools, the node calls a small harness helper that runs one tool-less, schema-bound turn:
# Simplified from the harness typed-completion helper
async def typed_complete(model, *, prompt: str, context, data_type: type[T], metadata=None) -> T:
user_text = f"{render_context(context)}\n\n{schema_block(data_type)}"
messages = [SystemMessage(content=prompt), HumanMessage(content=user_text)]
response = await model.ainvoke(messages, config={"metadata": dict(metadata or {})})
return parse(reply_text(response.content), data_type) # skips thinking blocks, validates Pydantic
Because our primary model did not support provider-enforced structured outputs, appending the JSON schema and parsing the final fenced JSON block into Pydantic (followed by fail-closed Python domain rules from Part 1) gave us predictable, replayable judgements tagged with exact prompt and rule versions in trace metadata.
What I am still going back and forth on
Two rough edges still bother me about this design. First, because the whole fan-out runs inside one parent graph run, cancellation is all-or-nothing per run rather than per service, and under deep nesting we uncovered a subtle context-loss bug where ambient authentication context can drop before a nested tool call (requiring explicit credential forwarding from node config).
Second, leaning on a streaming library's private heuristics (like checkpoint_ns = "tools:<uuid>" to open and close subagent UI lanes) feels uncomfortably fragile. It works cleanly today, and any upstream minor release of the streaming adapter could break UI lanes silently unless we pin and contract-test it.
Make parallelism a config dial, not a prompt wish
With Send, max_concurrency=4, typed payloads, closure-wrapped workers, and partial-failure accounting, a twenty-service fan-out runs cleanly four at a time with every model call confined strictly inside the workers.
Now comes the final question most teams skip until a bug hits production: once 80% of your agent is a deterministic graph and 20% is model nodes, how do you test and evaluate it without wasting money judging code or letting the graph and its evals drift apart?
Previous: Part 2: Building Deterministic LangGraph Workflows: StateGraph, interrupt() Gates, and Durable Jobs. Next: Part 4: How to Test and Evaluate LangGraph Workflow Agents: Graph Tests vs LLM Node Evals.