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:

  1. Extracts the distinct factual claims (one orchestrator-side worker).
  2. For each claim, verifies it against recent sources and assesses reliability (one worker per claim).
  3. For each claim, analyzes historical context and feasibility (another worker per claim).
  4. 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.triggerByTaskAndWait to 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 with experimental_telemetry so 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

  1. Define worker tasks. Create three Trigger.dev tasks: extract-claims (article in, numbered claims out), verify-source (claim in, verification + confidence out), and analyze-history (claim in, feasibility + context out). Each is a small generateText call with a focused system prompt.
  2. Define the orchestrator task. news-fact-checker first calls extract-claims via batch.triggerByTaskAndWait, parses the claim list, then issues one combined batch that maps every claim to both verify-source and analyze-history.
  3. Synthesize. Filter the completed runs by taskIdentifier, split them into verifications and historical analyses, and return the structured result.
  4. 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.
  5. 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