Workflow
Orchestrator-Workers News Fact-Checker
A durable orchestrator task breaks a news article into claims, fans them out to parallel worker tasks for source verification and historical analysis, then synthesizes a fact-check report.
What This Builds
This recipe implements Anthropic’s orchestrator-workers pattern as a durable background job. A central orchestrator LLM call dynamically decomposes a task, delegates the pieces to worker LLM calls, and synthesizes their results. Unlike fixed parallelization, the subtasks are not known in advance: the orchestrator decides how many claims exist and how to route each one.
The concrete use case is a news fact-checker. Given an article, the system:
- Extracts the distinct factual claims (one orchestrator-side worker).
- For each claim, verifies it against recent sources and assesses reliability (one worker per claim).
- For each claim, analyzes historical context and feasibility (another worker per claim).
- Returns the claims plus their verifications and historical analyses.
Because the number of claims is data-dependent, the orchestrator spawns a variable number of worker runs at runtime.
The Stack
- Trigger.dev — durable tasks with retries, queues, and
batch.triggerByTaskAndWaitto fan workers out in parallel and wait for all of them. This gives you observability and idempotency for free, which matters when an orchestrator spawns many child runs. - Vercel AI SDK (
generateText) — uniform LLM calls withexperimental_telemetryso each step shows up in traces. - An LLM provider — Anthropic Claude (e.g. via the Anthropic Startup Program) or any model behind OpenRouter for the claim, verification, and analysis prompts.
Step-by-Step Outline
- Define worker tasks. Create three Trigger.dev tasks:
extract-claims(article in, numbered claims out),verify-source(claim in, verification + confidence out), andanalyze-history(claim in, feasibility + context out). Each is a smallgenerateTextcall with a focused system prompt. - Define the orchestrator task.
news-fact-checkerfirst callsextract-claimsviabatch.triggerByTaskAndWait, parses the claim list, then issues one combined batch that maps every claim to bothverify-sourceandanalyze-history. - Synthesize. Filter the completed runs by
taskIdentifier, split them into verifications and historical analyses, and return the structured result. - Add guardrails. Lean on Trigger.dev retries for transient model errors, set a
maxDuration, and cap the number of claims so a hostile article can’t spawn unbounded workers. - Extend. Swap the placeholder “verified” flags for a worker that actually calls a search/grounding tool, and add an evaluator step that scores the final report.
Why This Shape Works
The orchestrator keeps control of decomposition and final synthesis, while workers stay simple and independently retryable. Running each consideration (verification vs. historical context) as a separate focused LLM call generally beats asking one prompt to do everything. Making the workers durable tasks rather than in-process async calls means a single failed claim can retry without restarting the whole job.
Source
Trigger.dev, Building effective AI agents with Trigger.dev (orchestrator-workers section, full TypeScript example): https://trigger.dev/blog/ai-agents-with-trigger
Pattern reference: Anthropic, Building effective agents (Workflow: Orchestrator-workers): https://www.anthropic.com/engineering/building-effective-agents