[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-trigger-dev-trigger-agents":3,"mdc--2blnds-key":35,"related-org-trigger-dev-trigger-agents":5757,"related-repo-trigger-dev-trigger-agents":5917},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":24,"repoUrl":25,"updatedAt":26,"license":27,"forks":28,"topics":29,"repo":30,"sourceUrl":33,"mdContent":34},"trigger-agents","orchestrate AI agents with Trigger.dev","AI agent patterns with Trigger.dev - orchestration, parallelization, routing, evaluator-optimizer, and human-in-the-loop. Use when building LLM-powered tasks that need parallel workers, approval gates, tool calling, or multi-step agent workflows.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"trigger-dev","Trigger.dev","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftrigger-dev.jpg","triggerdotdev",[13,15,18,21],{"name":9,"slug":8,"type":14},"tag",{"name":16,"slug":17,"type":14},"Agents","agents",{"name":19,"slug":20,"type":14},"Multi-Agent","multi-agent",{"name":22,"slug":23,"type":14},"Workflow Automation","workflow-automation",30,"https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fskills","2026-04-06T18:54:46.023553",null,5,[],{"repoUrl":25,"stars":24,"forks":28,"topics":31,"description":32},[],"Best practices for building AI agents and background jobs with Trigger.dev. Use when creating durable tasks, scheduling workflows, or integrating with the Trigger.dev SDK.","https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fskills\u002Ftree\u002FHEAD\u002Ftrigger-agents","---\nname: trigger-agents\ndescription: AI agent patterns with Trigger.dev - orchestration, parallelization, routing, evaluator-optimizer, and human-in-the-loop. Use when building LLM-powered tasks that need parallel workers, approval gates, tool calling, or multi-step agent workflows.\n---\n\n# AI Agent Patterns with Trigger.dev\n\nBuild production-ready AI agents using Trigger.dev's durable execution.\n\n## Pattern Selection\n\n```\nNeed to...                              → Use\n─────────────────────────────────────────────────────\nProcess items in parallel               → Parallelization\nRoute to different models\u002Fhandlers      → Routing\nChain steps with validation gates       → Prompt Chaining\nCoordinate multiple specialized tasks   → Orchestrator-Workers\nSelf-improve until quality threshold    → Evaluator-Optimizer\nPause for human approval                → Human-in-the-Loop (waitpoints.md)\nStream progress to frontend             → Realtime Streams (streaming.md)\nLet LLM call your tasks as tools        → ai.tool (ai-tool.md)\n```\n\n---\n\n## Core Patterns\n\n### 1. Prompt Chaining (Sequential with Gates)\n\nChain LLM calls with validation between steps. Fail early if intermediate output is bad.\n\n```typescript\nimport { task } from \"@trigger.dev\u002Fsdk\";\nimport { generateText } from \"ai\";\nimport { openai } from \"@ai-sdk\u002Fopenai\";\n\nexport const translateCopy = task({\n  id: \"translate-copy\",\n  run: async ({ text, targetLanguage, maxWords }) => {\n    \u002F\u002F Step 1: Generate\n    const draft = await generateText({\n      model: openai(\"gpt-4o\"),\n      prompt: `Write marketing copy about: ${text}`,\n    });\n\n    \u002F\u002F Gate: Validate before continuing\n    const wordCount = draft.text.split(\u002F\\s+\u002F).length;\n    if (wordCount > maxWords) {\n      throw new Error(`Draft too long: ${wordCount} > ${maxWords}`);\n    }\n\n    \u002F\u002F Step 2: Translate (only if gate passed)\n    const translated = await generateText({\n      model: openai(\"gpt-4o\"),\n      prompt: `Translate to ${targetLanguage}: ${draft.text}`,\n    });\n\n    return { draft: draft.text, translated: translated.text };\n  },\n});\n```\n\n---\n\n### 2. Routing (Classify → Dispatch)\n\nUse a cheap model to classify, then route to appropriate handler.\n\n```typescript\nimport { task } from \"@trigger.dev\u002Fsdk\";\nimport { generateText } from \"ai\";\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { z } from \"zod\";\n\nconst routingSchema = z.object({\n  model: z.enum([\"gpt-4o\", \"o1-mini\"]),\n  reason: z.string(),\n});\n\nexport const routeQuestion = task({\n  id: \"route-question\",\n  run: async ({ question }) => {\n    \u002F\u002F Cheap classification call\n    const routing = await generateText({\n      model: openai(\"gpt-4o-mini\"),\n      messages: [\n        {\n          role: \"system\",\n          content: `Classify question complexity. Return JSON: {\"model\": \"gpt-4o\" | \"o1-mini\", \"reason\": \"...\"}\n          - gpt-4o: simple factual questions\n          - o1-mini: complex reasoning, math, code`,\n        },\n        { role: \"user\", content: question },\n      ],\n    });\n\n    const { model } = routingSchema.parse(JSON.parse(routing.text));\n\n    \u002F\u002F Route to selected model\n    const answer = await generateText({\n      model: openai(model),\n      prompt: question,\n    });\n\n    return { answer: answer.text, routedTo: model };\n  },\n});\n```\n\n---\n\n### 3. Parallelization\n\nRun independent LLM calls simultaneously with `batch.triggerByTaskAndWait`.\n\n```typescript\nimport { batch, task } from \"@trigger.dev\u002Fsdk\";\n\nexport const analyzeContent = task({\n  id: \"analyze-content\",\n  run: async ({ text }) => {\n    \u002F\u002F All three run in parallel\n    const { runs: [sentiment, summary, moderation] } = await batch.triggerByTaskAndWait([\n      { task: analyzeSentiment, payload: { text } },\n      { task: summarizeText, payload: { text } },\n      { task: moderateContent, payload: { text } },\n    ]);\n\n    \u002F\u002F Check moderation first\n    if (moderation.ok && moderation.output.flagged) {\n      return { error: \"Content flagged\", reason: moderation.output.reason };\n    }\n\n    return {\n      sentiment: sentiment.ok ? sentiment.output : null,\n      summary: summary.ok ? summary.output : null,\n    };\n  },\n});\n```\n\n**See:** `references\u002Forchestration.md` for advanced patterns\n\n---\n\n### 4. Orchestrator-Workers (Fan-out\u002FFan-in)\n\nOrchestrator extracts work items, fans out to workers, aggregates results.\n\n```typescript\nimport { batch, task } from \"@trigger.dev\u002Fsdk\";\n\nexport const factChecker = task({\n  id: \"fact-checker\",\n  run: async ({ article }) => {\n    \u002F\u002F Step 1: Extract claims (sequential - need output first)\n    const { runs: [extractResult] } = await batch.triggerByTaskAndWait([\n      { task: extractClaims, payload: { article } },\n    ]);\n\n    if (!extractResult.ok) throw new Error(\"Failed to extract claims\");\n    const claims = extractResult.output;\n\n    \u002F\u002F Step 2: Fan-out - verify all claims in parallel\n    const { runs } = await batch.triggerByTaskAndWait(\n      claims.map(claim => ({ task: verifyClaim, payload: claim }))\n    );\n\n    \u002F\u002F Step 3: Fan-in - aggregate results\n    const verified = runs\n      .filter((r): r is typeof r & { ok: true } => r.ok)\n      .map(r => r.output);\n\n    return { claims, verifications: verified };\n  },\n});\n```\n\n---\n\n### 5. Evaluator-Optimizer (Self-Refining Loop)\n\nGenerate → Evaluate → Retry with feedback until approved.\n\n```typescript\nimport { task } from \"@trigger.dev\u002Fsdk\";\n\nexport const refineTranslation = task({\n  id: \"refine-translation\",\n  run: async ({ text, targetLanguage, feedback, attempt = 0 }) => {\n    \u002F\u002F Bail condition\n    if (attempt >= 5) {\n      return { text, status: \"MAX_ATTEMPTS\", attempts: attempt };\n    }\n\n    \u002F\u002F Generate (with feedback if retrying)\n    const prompt = feedback\n      ? `Improve this translation based on feedback:\\n${feedback}\\n\\nOriginal: ${text}`\n      : `Translate to ${targetLanguage}: ${text}`;\n\n    const translation = await generateText({\n      model: openai(\"gpt-4o\"),\n      prompt,\n    });\n\n    \u002F\u002F Evaluate\n    const evaluation = await generateText({\n      model: openai(\"gpt-4o\"),\n      prompt: `Evaluate translation quality. Reply APPROVED or provide specific feedback:\\n${translation.text}`,\n    });\n\n    if (evaluation.text.includes(\"APPROVED\")) {\n      return { text: translation.text, status: \"APPROVED\", attempts: attempt + 1 };\n    }\n\n    \u002F\u002F Recursive self-call with feedback\n    return refineTranslation.triggerAndWait({\n      text,\n      targetLanguage,\n      feedback: evaluation.text,\n      attempt: attempt + 1,\n    }).unwrap();\n  },\n});\n```\n\n---\n\n## Trigger-Specific Features\n\n| Feature | What it enables | Reference |\n|---------|-----------------|-----------|\n| **Waitpoints** | Human approval gates, external callbacks | `references\u002Fwaitpoints.md` |\n| **Streams** | Real-time progress to frontend | `references\u002Fstreaming.md` |\n| **ai.tool** | Let LLMs call your tasks as tools | `references\u002Fai-tool.md` |\n| **batch.triggerByTaskAndWait** | Typed parallel execution | `references\u002Forchestration.md` |\n\n---\n\n## Error Handling\n\n```typescript\nconst { runs } = await batch.triggerByTaskAndWait([...]);\n\n\u002F\u002F Check individual results\nfor (const run of runs) {\n  if (run.ok) {\n    console.log(run.output);  \u002F\u002F Typed output\n  } else {\n    console.error(run.error);  \u002F\u002F Error details\n    console.log(run.taskIdentifier);  \u002F\u002F Which task failed\n  }\n}\n\n\u002F\u002F Or filter by task type\nconst verifications = runs\n  .filter((r): r is typeof r & { ok: true } =>\n    r.ok && r.taskIdentifier === \"verify-claim\"\n  )\n  .map(r => r.output);\n```\n\n---\n\n## Quick Reference\n\n```typescript\n\u002F\u002F Trigger and wait for result\nconst result = await myTask.triggerAndWait(payload);\nif (result.ok) console.log(result.output);\n\n\u002F\u002F Batch trigger same task\nconst results = await myTask.batchTriggerAndWait([\n  { payload: item1 },\n  { payload: item2 },\n]);\n\n\u002F\u002F Batch trigger different tasks (typed)\nconst { runs } = await batch.triggerByTaskAndWait([\n  { task: taskA, payload: { foo: 1 } },\n  { task: taskB, payload: { bar: \"x\" } },\n]);\n\n\u002F\u002F Self-recursion with unwrap\nreturn myTask.triggerAndWait(newPayload).unwrap();\n```\n",{"data":36,"body":37},{"name":4,"description":6},{"type":38,"children":39},"root",[40,49,55,62,75,79,85,92,97,1012,1015,1021,1026,2013,2016,2022,2034,2742,2761,2764,2770,2775,3561,3564,3570,3575,4599,4602,4608,4739,4742,4748,5277,5280,5286,5751],{"type":41,"tag":42,"props":43,"children":45},"element","h1",{"id":44},"ai-agent-patterns-with-triggerdev",[46],{"type":47,"value":48},"text","AI Agent Patterns with Trigger.dev",{"type":41,"tag":50,"props":51,"children":52},"p",{},[53],{"type":47,"value":54},"Build production-ready AI agents using Trigger.dev's durable execution.",{"type":41,"tag":56,"props":57,"children":59},"h2",{"id":58},"pattern-selection",[60],{"type":47,"value":61},"Pattern Selection",{"type":41,"tag":63,"props":64,"children":68},"pre",{"className":65,"code":67,"language":47},[66],"language-text","Need to...                              → Use\n─────────────────────────────────────────────────────\nProcess items in parallel               → Parallelization\nRoute to different models\u002Fhandlers      → Routing\nChain steps with validation gates       → Prompt Chaining\nCoordinate multiple specialized tasks   → Orchestrator-Workers\nSelf-improve until quality threshold    → Evaluator-Optimizer\nPause for human approval                → Human-in-the-Loop (waitpoints.md)\nStream progress to frontend             → Realtime Streams (streaming.md)\nLet LLM call your tasks as tools        → ai.tool (ai-tool.md)\n",[69],{"type":41,"tag":70,"props":71,"children":73},"code",{"__ignoreMap":72},"",[74],{"type":47,"value":67},{"type":41,"tag":76,"props":77,"children":78},"hr",{},[],{"type":41,"tag":56,"props":80,"children":82},{"id":81},"core-patterns",[83],{"type":47,"value":84},"Core Patterns",{"type":41,"tag":86,"props":87,"children":89},"h3",{"id":88},"_1-prompt-chaining-sequential-with-gates",[90],{"type":47,"value":91},"1. Prompt Chaining (Sequential with Gates)",{"type":41,"tag":50,"props":93,"children":94},{},[95],{"type":47,"value":96},"Chain LLM calls with validation between steps. Fail early if intermediate output is bad.",{"type":41,"tag":63,"props":98,"children":102},{"className":99,"code":100,"language":101,"meta":72,"style":72},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { task } from \"@trigger.dev\u002Fsdk\";\nimport { generateText } from \"ai\";\nimport { openai } from \"@ai-sdk\u002Fopenai\";\n\nexport const translateCopy = task({\n  id: \"translate-copy\",\n  run: async ({ text, targetLanguage, maxWords }) => {\n    \u002F\u002F Step 1: Generate\n    const draft = await generateText({\n      model: openai(\"gpt-4o\"),\n      prompt: `Write marketing copy about: ${text}`,\n    });\n\n    \u002F\u002F Gate: Validate before continuing\n    const wordCount = draft.text.split(\u002F\\s+\u002F).length;\n    if (wordCount > maxWords) {\n      throw new Error(`Draft too long: ${wordCount} > ${maxWords}`);\n    }\n\n    \u002F\u002F Step 2: Translate (only if gate passed)\n    const translated = await generateText({\n      model: openai(\"gpt-4o\"),\n      prompt: `Translate to ${targetLanguage}: ${draft.text}`,\n    });\n\n    return { draft: draft.text, translated: translated.text };\n  },\n});\n","typescript",[103],{"type":41,"tag":70,"props":104,"children":105},{"__ignoreMap":72},[106,161,203,245,255,294,327,390,400,436,479,520,537,545,554,629,666,738,747,755,764,797,837,901,917,925,987,996],{"type":41,"tag":107,"props":108,"children":111},"span",{"class":109,"line":110},"line",1,[112,118,124,130,135,140,145,151,156],{"type":41,"tag":107,"props":113,"children":115},{"style":114},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[116],{"type":47,"value":117},"import",{"type":41,"tag":107,"props":119,"children":121},{"style":120},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[122],{"type":47,"value":123}," {",{"type":41,"tag":107,"props":125,"children":127},{"style":126},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[128],{"type":47,"value":129}," task",{"type":41,"tag":107,"props":131,"children":132},{"style":120},[133],{"type":47,"value":134}," }",{"type":41,"tag":107,"props":136,"children":137},{"style":114},[138],{"type":47,"value":139}," from",{"type":41,"tag":107,"props":141,"children":142},{"style":120},[143],{"type":47,"value":144}," \"",{"type":41,"tag":107,"props":146,"children":148},{"style":147},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[149],{"type":47,"value":150},"@trigger.dev\u002Fsdk",{"type":41,"tag":107,"props":152,"children":153},{"style":120},[154],{"type":47,"value":155},"\"",{"type":41,"tag":107,"props":157,"children":158},{"style":120},[159],{"type":47,"value":160},";\n",{"type":41,"tag":107,"props":162,"children":164},{"class":109,"line":163},2,[165,169,173,178,182,186,190,195,199],{"type":41,"tag":107,"props":166,"children":167},{"style":114},[168],{"type":47,"value":117},{"type":41,"tag":107,"props":170,"children":171},{"style":120},[172],{"type":47,"value":123},{"type":41,"tag":107,"props":174,"children":175},{"style":126},[176],{"type":47,"value":177}," generateText",{"type":41,"tag":107,"props":179,"children":180},{"style":120},[181],{"type":47,"value":134},{"type":41,"tag":107,"props":183,"children":184},{"style":114},[185],{"type":47,"value":139},{"type":41,"tag":107,"props":187,"children":188},{"style":120},[189],{"type":47,"value":144},{"type":41,"tag":107,"props":191,"children":192},{"style":147},[193],{"type":47,"value":194},"ai",{"type":41,"tag":107,"props":196,"children":197},{"style":120},[198],{"type":47,"value":155},{"type":41,"tag":107,"props":200,"children":201},{"style":120},[202],{"type":47,"value":160},{"type":41,"tag":107,"props":204,"children":206},{"class":109,"line":205},3,[207,211,215,220,224,228,232,237,241],{"type":41,"tag":107,"props":208,"children":209},{"style":114},[210],{"type":47,"value":117},{"type":41,"tag":107,"props":212,"children":213},{"style":120},[214],{"type":47,"value":123},{"type":41,"tag":107,"props":216,"children":217},{"style":126},[218],{"type":47,"value":219}," openai",{"type":41,"tag":107,"props":221,"children":222},{"style":120},[223],{"type":47,"value":134},{"type":41,"tag":107,"props":225,"children":226},{"style":114},[227],{"type":47,"value":139},{"type":41,"tag":107,"props":229,"children":230},{"style":120},[231],{"type":47,"value":144},{"type":41,"tag":107,"props":233,"children":234},{"style":147},[235],{"type":47,"value":236},"@ai-sdk\u002Fopenai",{"type":41,"tag":107,"props":238,"children":239},{"style":120},[240],{"type":47,"value":155},{"type":41,"tag":107,"props":242,"children":243},{"style":120},[244],{"type":47,"value":160},{"type":41,"tag":107,"props":246,"children":248},{"class":109,"line":247},4,[249],{"type":41,"tag":107,"props":250,"children":252},{"emptyLinePlaceholder":251},true,[253],{"type":47,"value":254},"\n",{"type":41,"tag":107,"props":256,"children":257},{"class":109,"line":28},[258,263,269,274,279,284,289],{"type":41,"tag":107,"props":259,"children":260},{"style":114},[261],{"type":47,"value":262},"export",{"type":41,"tag":107,"props":264,"children":266},{"style":265},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[267],{"type":47,"value":268}," const",{"type":41,"tag":107,"props":270,"children":271},{"style":126},[272],{"type":47,"value":273}," translateCopy ",{"type":41,"tag":107,"props":275,"children":276},{"style":120},[277],{"type":47,"value":278},"=",{"type":41,"tag":107,"props":280,"children":282},{"style":281},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[283],{"type":47,"value":129},{"type":41,"tag":107,"props":285,"children":286},{"style":126},[287],{"type":47,"value":288},"(",{"type":41,"tag":107,"props":290,"children":291},{"style":120},[292],{"type":47,"value":293},"{\n",{"type":41,"tag":107,"props":295,"children":297},{"class":109,"line":296},6,[298,304,309,313,318,322],{"type":41,"tag":107,"props":299,"children":301},{"style":300},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[302],{"type":47,"value":303},"  id",{"type":41,"tag":107,"props":305,"children":306},{"style":120},[307],{"type":47,"value":308},":",{"type":41,"tag":107,"props":310,"children":311},{"style":120},[312],{"type":47,"value":144},{"type":41,"tag":107,"props":314,"children":315},{"style":147},[316],{"type":47,"value":317},"translate-copy",{"type":41,"tag":107,"props":319,"children":320},{"style":120},[321],{"type":47,"value":155},{"type":41,"tag":107,"props":323,"children":324},{"style":120},[325],{"type":47,"value":326},",\n",{"type":41,"tag":107,"props":328,"children":330},{"class":109,"line":329},7,[331,336,340,345,350,356,361,366,370,375,380,385],{"type":41,"tag":107,"props":332,"children":333},{"style":281},[334],{"type":47,"value":335},"  run",{"type":41,"tag":107,"props":337,"children":338},{"style":120},[339],{"type":47,"value":308},{"type":41,"tag":107,"props":341,"children":342},{"style":265},[343],{"type":47,"value":344}," async",{"type":41,"tag":107,"props":346,"children":347},{"style":120},[348],{"type":47,"value":349}," ({",{"type":41,"tag":107,"props":351,"children":353},{"style":352},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[354],{"type":47,"value":355}," text",{"type":41,"tag":107,"props":357,"children":358},{"style":120},[359],{"type":47,"value":360},",",{"type":41,"tag":107,"props":362,"children":363},{"style":352},[364],{"type":47,"value":365}," targetLanguage",{"type":41,"tag":107,"props":367,"children":368},{"style":120},[369],{"type":47,"value":360},{"type":41,"tag":107,"props":371,"children":372},{"style":352},[373],{"type":47,"value":374}," maxWords",{"type":41,"tag":107,"props":376,"children":377},{"style":120},[378],{"type":47,"value":379}," })",{"type":41,"tag":107,"props":381,"children":382},{"style":265},[383],{"type":47,"value":384}," =>",{"type":41,"tag":107,"props":386,"children":387},{"style":120},[388],{"type":47,"value":389}," {\n",{"type":41,"tag":107,"props":391,"children":393},{"class":109,"line":392},8,[394],{"type":41,"tag":107,"props":395,"children":397},{"style":396},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[398],{"type":47,"value":399},"    \u002F\u002F Step 1: Generate\n",{"type":41,"tag":107,"props":401,"children":403},{"class":109,"line":402},9,[404,409,414,419,424,428,432],{"type":41,"tag":107,"props":405,"children":406},{"style":265},[407],{"type":47,"value":408},"    const",{"type":41,"tag":107,"props":410,"children":411},{"style":126},[412],{"type":47,"value":413}," draft",{"type":41,"tag":107,"props":415,"children":416},{"style":120},[417],{"type":47,"value":418}," =",{"type":41,"tag":107,"props":420,"children":421},{"style":114},[422],{"type":47,"value":423}," await",{"type":41,"tag":107,"props":425,"children":426},{"style":281},[427],{"type":47,"value":177},{"type":41,"tag":107,"props":429,"children":430},{"style":300},[431],{"type":47,"value":288},{"type":41,"tag":107,"props":433,"children":434},{"style":120},[435],{"type":47,"value":293},{"type":41,"tag":107,"props":437,"children":439},{"class":109,"line":438},10,[440,445,449,453,457,461,466,470,475],{"type":41,"tag":107,"props":441,"children":442},{"style":300},[443],{"type":47,"value":444},"      model",{"type":41,"tag":107,"props":446,"children":447},{"style":120},[448],{"type":47,"value":308},{"type":41,"tag":107,"props":450,"children":451},{"style":281},[452],{"type":47,"value":219},{"type":41,"tag":107,"props":454,"children":455},{"style":300},[456],{"type":47,"value":288},{"type":41,"tag":107,"props":458,"children":459},{"style":120},[460],{"type":47,"value":155},{"type":41,"tag":107,"props":462,"children":463},{"style":147},[464],{"type":47,"value":465},"gpt-4o",{"type":41,"tag":107,"props":467,"children":468},{"style":120},[469],{"type":47,"value":155},{"type":41,"tag":107,"props":471,"children":472},{"style":300},[473],{"type":47,"value":474},")",{"type":41,"tag":107,"props":476,"children":477},{"style":120},[478],{"type":47,"value":326},{"type":41,"tag":107,"props":480,"children":482},{"class":109,"line":481},11,[483,488,492,497,502,507,511,516],{"type":41,"tag":107,"props":484,"children":485},{"style":300},[486],{"type":47,"value":487},"      prompt",{"type":41,"tag":107,"props":489,"children":490},{"style":120},[491],{"type":47,"value":308},{"type":41,"tag":107,"props":493,"children":494},{"style":120},[495],{"type":47,"value":496}," `",{"type":41,"tag":107,"props":498,"children":499},{"style":147},[500],{"type":47,"value":501},"Write marketing copy about: ",{"type":41,"tag":107,"props":503,"children":504},{"style":120},[505],{"type":47,"value":506},"${",{"type":41,"tag":107,"props":508,"children":509},{"style":126},[510],{"type":47,"value":47},{"type":41,"tag":107,"props":512,"children":513},{"style":120},[514],{"type":47,"value":515},"}`",{"type":41,"tag":107,"props":517,"children":518},{"style":120},[519],{"type":47,"value":326},{"type":41,"tag":107,"props":521,"children":523},{"class":109,"line":522},12,[524,529,533],{"type":41,"tag":107,"props":525,"children":526},{"style":120},[527],{"type":47,"value":528},"    }",{"type":41,"tag":107,"props":530,"children":531},{"style":300},[532],{"type":47,"value":474},{"type":41,"tag":107,"props":534,"children":535},{"style":120},[536],{"type":47,"value":160},{"type":41,"tag":107,"props":538,"children":540},{"class":109,"line":539},13,[541],{"type":41,"tag":107,"props":542,"children":543},{"emptyLinePlaceholder":251},[544],{"type":47,"value":254},{"type":41,"tag":107,"props":546,"children":548},{"class":109,"line":547},14,[549],{"type":41,"tag":107,"props":550,"children":551},{"style":396},[552],{"type":47,"value":553},"    \u002F\u002F Gate: Validate before continuing\n",{"type":41,"tag":107,"props":555,"children":557},{"class":109,"line":556},15,[558,562,567,571,575,580,584,588,593,597,602,607,612,616,620,625],{"type":41,"tag":107,"props":559,"children":560},{"style":265},[561],{"type":47,"value":408},{"type":41,"tag":107,"props":563,"children":564},{"style":126},[565],{"type":47,"value":566}," wordCount",{"type":41,"tag":107,"props":568,"children":569},{"style":120},[570],{"type":47,"value":418},{"type":41,"tag":107,"props":572,"children":573},{"style":126},[574],{"type":47,"value":413},{"type":41,"tag":107,"props":576,"children":577},{"style":120},[578],{"type":47,"value":579},".",{"type":41,"tag":107,"props":581,"children":582},{"style":126},[583],{"type":47,"value":47},{"type":41,"tag":107,"props":585,"children":586},{"style":120},[587],{"type":47,"value":579},{"type":41,"tag":107,"props":589,"children":590},{"style":281},[591],{"type":47,"value":592},"split",{"type":41,"tag":107,"props":594,"children":595},{"style":300},[596],{"type":47,"value":288},{"type":41,"tag":107,"props":598,"children":599},{"style":120},[600],{"type":47,"value":601},"\u002F",{"type":41,"tag":107,"props":603,"children":604},{"style":147},[605],{"type":47,"value":606},"\\s",{"type":41,"tag":107,"props":608,"children":609},{"style":120},[610],{"type":47,"value":611},"+\u002F",{"type":41,"tag":107,"props":613,"children":614},{"style":300},[615],{"type":47,"value":474},{"type":41,"tag":107,"props":617,"children":618},{"style":120},[619],{"type":47,"value":579},{"type":41,"tag":107,"props":621,"children":622},{"style":126},[623],{"type":47,"value":624},"length",{"type":41,"tag":107,"props":626,"children":627},{"style":120},[628],{"type":47,"value":160},{"type":41,"tag":107,"props":630,"children":632},{"class":109,"line":631},16,[633,638,643,648,653,657,662],{"type":41,"tag":107,"props":634,"children":635},{"style":114},[636],{"type":47,"value":637},"    if",{"type":41,"tag":107,"props":639,"children":640},{"style":300},[641],{"type":47,"value":642}," (",{"type":41,"tag":107,"props":644,"children":645},{"style":126},[646],{"type":47,"value":647},"wordCount",{"type":41,"tag":107,"props":649,"children":650},{"style":120},[651],{"type":47,"value":652}," >",{"type":41,"tag":107,"props":654,"children":655},{"style":126},[656],{"type":47,"value":374},{"type":41,"tag":107,"props":658,"children":659},{"style":300},[660],{"type":47,"value":661},") ",{"type":41,"tag":107,"props":663,"children":664},{"style":120},[665],{"type":47,"value":293},{"type":41,"tag":107,"props":667,"children":669},{"class":109,"line":668},17,[670,675,680,685,689,694,699,703,707,712,717,721,726,730,734],{"type":41,"tag":107,"props":671,"children":672},{"style":114},[673],{"type":47,"value":674},"      throw",{"type":41,"tag":107,"props":676,"children":677},{"style":120},[678],{"type":47,"value":679}," new",{"type":41,"tag":107,"props":681,"children":682},{"style":281},[683],{"type":47,"value":684}," Error",{"type":41,"tag":107,"props":686,"children":687},{"style":300},[688],{"type":47,"value":288},{"type":41,"tag":107,"props":690,"children":691},{"style":120},[692],{"type":47,"value":693},"`",{"type":41,"tag":107,"props":695,"children":696},{"style":147},[697],{"type":47,"value":698},"Draft too long: ",{"type":41,"tag":107,"props":700,"children":701},{"style":120},[702],{"type":47,"value":506},{"type":41,"tag":107,"props":704,"children":705},{"style":126},[706],{"type":47,"value":647},{"type":41,"tag":107,"props":708,"children":709},{"style":120},[710],{"type":47,"value":711},"}",{"type":41,"tag":107,"props":713,"children":714},{"style":147},[715],{"type":47,"value":716}," > ",{"type":41,"tag":107,"props":718,"children":719},{"style":120},[720],{"type":47,"value":506},{"type":41,"tag":107,"props":722,"children":723},{"style":126},[724],{"type":47,"value":725},"maxWords",{"type":41,"tag":107,"props":727,"children":728},{"style":120},[729],{"type":47,"value":515},{"type":41,"tag":107,"props":731,"children":732},{"style":300},[733],{"type":47,"value":474},{"type":41,"tag":107,"props":735,"children":736},{"style":120},[737],{"type":47,"value":160},{"type":41,"tag":107,"props":739,"children":741},{"class":109,"line":740},18,[742],{"type":41,"tag":107,"props":743,"children":744},{"style":120},[745],{"type":47,"value":746},"    }\n",{"type":41,"tag":107,"props":748,"children":750},{"class":109,"line":749},19,[751],{"type":41,"tag":107,"props":752,"children":753},{"emptyLinePlaceholder":251},[754],{"type":47,"value":254},{"type":41,"tag":107,"props":756,"children":758},{"class":109,"line":757},20,[759],{"type":41,"tag":107,"props":760,"children":761},{"style":396},[762],{"type":47,"value":763},"    \u002F\u002F Step 2: Translate (only if gate passed)\n",{"type":41,"tag":107,"props":765,"children":767},{"class":109,"line":766},21,[768,772,777,781,785,789,793],{"type":41,"tag":107,"props":769,"children":770},{"style":265},[771],{"type":47,"value":408},{"type":41,"tag":107,"props":773,"children":774},{"style":126},[775],{"type":47,"value":776}," translated",{"type":41,"tag":107,"props":778,"children":779},{"style":120},[780],{"type":47,"value":418},{"type":41,"tag":107,"props":782,"children":783},{"style":114},[784],{"type":47,"value":423},{"type":41,"tag":107,"props":786,"children":787},{"style":281},[788],{"type":47,"value":177},{"type":41,"tag":107,"props":790,"children":791},{"style":300},[792],{"type":47,"value":288},{"type":41,"tag":107,"props":794,"children":795},{"style":120},[796],{"type":47,"value":293},{"type":41,"tag":107,"props":798,"children":800},{"class":109,"line":799},22,[801,805,809,813,817,821,825,829,833],{"type":41,"tag":107,"props":802,"children":803},{"style":300},[804],{"type":47,"value":444},{"type":41,"tag":107,"props":806,"children":807},{"style":120},[808],{"type":47,"value":308},{"type":41,"tag":107,"props":810,"children":811},{"style":281},[812],{"type":47,"value":219},{"type":41,"tag":107,"props":814,"children":815},{"style":300},[816],{"type":47,"value":288},{"type":41,"tag":107,"props":818,"children":819},{"style":120},[820],{"type":47,"value":155},{"type":41,"tag":107,"props":822,"children":823},{"style":147},[824],{"type":47,"value":465},{"type":41,"tag":107,"props":826,"children":827},{"style":120},[828],{"type":47,"value":155},{"type":41,"tag":107,"props":830,"children":831},{"style":300},[832],{"type":47,"value":474},{"type":41,"tag":107,"props":834,"children":835},{"style":120},[836],{"type":47,"value":326},{"type":41,"tag":107,"props":838,"children":840},{"class":109,"line":839},23,[841,845,849,853,858,862,867,871,876,880,885,889,893,897],{"type":41,"tag":107,"props":842,"children":843},{"style":300},[844],{"type":47,"value":487},{"type":41,"tag":107,"props":846,"children":847},{"style":120},[848],{"type":47,"value":308},{"type":41,"tag":107,"props":850,"children":851},{"style":120},[852],{"type":47,"value":496},{"type":41,"tag":107,"props":854,"children":855},{"style":147},[856],{"type":47,"value":857},"Translate to ",{"type":41,"tag":107,"props":859,"children":860},{"style":120},[861],{"type":47,"value":506},{"type":41,"tag":107,"props":863,"children":864},{"style":126},[865],{"type":47,"value":866},"targetLanguage",{"type":41,"tag":107,"props":868,"children":869},{"style":120},[870],{"type":47,"value":711},{"type":41,"tag":107,"props":872,"children":873},{"style":147},[874],{"type":47,"value":875},": ",{"type":41,"tag":107,"props":877,"children":878},{"style":120},[879],{"type":47,"value":506},{"type":41,"tag":107,"props":881,"children":882},{"style":126},[883],{"type":47,"value":884},"draft",{"type":41,"tag":107,"props":886,"children":887},{"style":120},[888],{"type":47,"value":579},{"type":41,"tag":107,"props":890,"children":891},{"style":126},[892],{"type":47,"value":47},{"type":41,"tag":107,"props":894,"children":895},{"style":120},[896],{"type":47,"value":515},{"type":41,"tag":107,"props":898,"children":899},{"style":120},[900],{"type":47,"value":326},{"type":41,"tag":107,"props":902,"children":904},{"class":109,"line":903},24,[905,909,913],{"type":41,"tag":107,"props":906,"children":907},{"style":120},[908],{"type":47,"value":528},{"type":41,"tag":107,"props":910,"children":911},{"style":300},[912],{"type":47,"value":474},{"type":41,"tag":107,"props":914,"children":915},{"style":120},[916],{"type":47,"value":160},{"type":41,"tag":107,"props":918,"children":920},{"class":109,"line":919},25,[921],{"type":41,"tag":107,"props":922,"children":923},{"emptyLinePlaceholder":251},[924],{"type":47,"value":254},{"type":41,"tag":107,"props":926,"children":928},{"class":109,"line":927},26,[929,934,938,942,946,950,954,958,962,966,970,974,978,982],{"type":41,"tag":107,"props":930,"children":931},{"style":114},[932],{"type":47,"value":933},"    return",{"type":41,"tag":107,"props":935,"children":936},{"style":120},[937],{"type":47,"value":123},{"type":41,"tag":107,"props":939,"children":940},{"style":300},[941],{"type":47,"value":413},{"type":41,"tag":107,"props":943,"children":944},{"style":120},[945],{"type":47,"value":308},{"type":41,"tag":107,"props":947,"children":948},{"style":126},[949],{"type":47,"value":413},{"type":41,"tag":107,"props":951,"children":952},{"style":120},[953],{"type":47,"value":579},{"type":41,"tag":107,"props":955,"children":956},{"style":126},[957],{"type":47,"value":47},{"type":41,"tag":107,"props":959,"children":960},{"style":120},[961],{"type":47,"value":360},{"type":41,"tag":107,"props":963,"children":964},{"style":300},[965],{"type":47,"value":776},{"type":41,"tag":107,"props":967,"children":968},{"style":120},[969],{"type":47,"value":308},{"type":41,"tag":107,"props":971,"children":972},{"style":126},[973],{"type":47,"value":776},{"type":41,"tag":107,"props":975,"children":976},{"style":120},[977],{"type":47,"value":579},{"type":41,"tag":107,"props":979,"children":980},{"style":126},[981],{"type":47,"value":47},{"type":41,"tag":107,"props":983,"children":984},{"style":120},[985],{"type":47,"value":986}," };\n",{"type":41,"tag":107,"props":988,"children":990},{"class":109,"line":989},27,[991],{"type":41,"tag":107,"props":992,"children":993},{"style":120},[994],{"type":47,"value":995},"  },\n",{"type":41,"tag":107,"props":997,"children":999},{"class":109,"line":998},28,[1000,1004,1008],{"type":41,"tag":107,"props":1001,"children":1002},{"style":120},[1003],{"type":47,"value":711},{"type":41,"tag":107,"props":1005,"children":1006},{"style":126},[1007],{"type":47,"value":474},{"type":41,"tag":107,"props":1009,"children":1010},{"style":120},[1011],{"type":47,"value":160},{"type":41,"tag":76,"props":1013,"children":1014},{},[],{"type":41,"tag":86,"props":1016,"children":1018},{"id":1017},"_2-routing-classify-dispatch",[1019],{"type":47,"value":1020},"2. Routing (Classify → Dispatch)",{"type":41,"tag":50,"props":1022,"children":1023},{},[1024],{"type":47,"value":1025},"Use a cheap model to classify, then route to appropriate handler.",{"type":41,"tag":63,"props":1027,"children":1029},{"className":99,"code":1028,"language":101,"meta":72,"style":72},"import { task } from \"@trigger.dev\u002Fsdk\";\nimport { generateText } from \"ai\";\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { z } from \"zod\";\n\nconst routingSchema = z.object({\n  model: z.enum([\"gpt-4o\", \"o1-mini\"]),\n  reason: z.string(),\n});\n\nexport const routeQuestion = task({\n  id: \"route-question\",\n  run: async ({ question }) => {\n    \u002F\u002F Cheap classification call\n    const routing = await generateText({\n      model: openai(\"gpt-4o-mini\"),\n      messages: [\n        {\n          role: \"system\",\n          content: `Classify question complexity. Return JSON: {\"model\": \"gpt-4o\" | \"o1-mini\", \"reason\": \"...\"}\n          - gpt-4o: simple factual questions\n          - o1-mini: complex reasoning, math, code`,\n        },\n        { role: \"user\", content: question },\n      ],\n    });\n\n    const { model } = routingSchema.parse(JSON.parse(routing.text));\n\n    \u002F\u002F Route to selected model\n    const answer = await generateText({\n      model: openai(model),\n      prompt: question,\n    });\n\n    return { answer: answer.text, routedTo: model };\n  },\n});\n",[1030],{"type":41,"tag":70,"props":1031,"children":1032},{"__ignoreMap":72},[1033,1072,1111,1150,1191,1198,1236,1304,1338,1353,1360,1392,1420,1456,1464,1496,1536,1553,1561,1590,1611,1619,1635,1643,1695,1707,1722,1729,1810,1818,1826,1859,1892,1912,1928,1936,1989,1997],{"type":41,"tag":107,"props":1034,"children":1035},{"class":109,"line":110},[1036,1040,1044,1048,1052,1056,1060,1064,1068],{"type":41,"tag":107,"props":1037,"children":1038},{"style":114},[1039],{"type":47,"value":117},{"type":41,"tag":107,"props":1041,"children":1042},{"style":120},[1043],{"type":47,"value":123},{"type":41,"tag":107,"props":1045,"children":1046},{"style":126},[1047],{"type":47,"value":129},{"type":41,"tag":107,"props":1049,"children":1050},{"style":120},[1051],{"type":47,"value":134},{"type":41,"tag":107,"props":1053,"children":1054},{"style":114},[1055],{"type":47,"value":139},{"type":41,"tag":107,"props":1057,"children":1058},{"style":120},[1059],{"type":47,"value":144},{"type":41,"tag":107,"props":1061,"children":1062},{"style":147},[1063],{"type":47,"value":150},{"type":41,"tag":107,"props":1065,"children":1066},{"style":120},[1067],{"type":47,"value":155},{"type":41,"tag":107,"props":1069,"children":1070},{"style":120},[1071],{"type":47,"value":160},{"type":41,"tag":107,"props":1073,"children":1074},{"class":109,"line":163},[1075,1079,1083,1087,1091,1095,1099,1103,1107],{"type":41,"tag":107,"props":1076,"children":1077},{"style":114},[1078],{"type":47,"value":117},{"type":41,"tag":107,"props":1080,"children":1081},{"style":120},[1082],{"type":47,"value":123},{"type":41,"tag":107,"props":1084,"children":1085},{"style":126},[1086],{"type":47,"value":177},{"type":41,"tag":107,"props":1088,"children":1089},{"style":120},[1090],{"type":47,"value":134},{"type":41,"tag":107,"props":1092,"children":1093},{"style":114},[1094],{"type":47,"value":139},{"type":41,"tag":107,"props":1096,"children":1097},{"style":120},[1098],{"type":47,"value":144},{"type":41,"tag":107,"props":1100,"children":1101},{"style":147},[1102],{"type":47,"value":194},{"type":41,"tag":107,"props":1104,"children":1105},{"style":120},[1106],{"type":47,"value":155},{"type":41,"tag":107,"props":1108,"children":1109},{"style":120},[1110],{"type":47,"value":160},{"type":41,"tag":107,"props":1112,"children":1113},{"class":109,"line":205},[1114,1118,1122,1126,1130,1134,1138,1142,1146],{"type":41,"tag":107,"props":1115,"children":1116},{"style":114},[1117],{"type":47,"value":117},{"type":41,"tag":107,"props":1119,"children":1120},{"style":120},[1121],{"type":47,"value":123},{"type":41,"tag":107,"props":1123,"children":1124},{"style":126},[1125],{"type":47,"value":219},{"type":41,"tag":107,"props":1127,"children":1128},{"style":120},[1129],{"type":47,"value":134},{"type":41,"tag":107,"props":1131,"children":1132},{"style":114},[1133],{"type":47,"value":139},{"type":41,"tag":107,"props":1135,"children":1136},{"style":120},[1137],{"type":47,"value":144},{"type":41,"tag":107,"props":1139,"children":1140},{"style":147},[1141],{"type":47,"value":236},{"type":41,"tag":107,"props":1143,"children":1144},{"style":120},[1145],{"type":47,"value":155},{"type":41,"tag":107,"props":1147,"children":1148},{"style":120},[1149],{"type":47,"value":160},{"type":41,"tag":107,"props":1151,"children":1152},{"class":109,"line":247},[1153,1157,1161,1166,1170,1174,1178,1183,1187],{"type":41,"tag":107,"props":1154,"children":1155},{"style":114},[1156],{"type":47,"value":117},{"type":41,"tag":107,"props":1158,"children":1159},{"style":120},[1160],{"type":47,"value":123},{"type":41,"tag":107,"props":1162,"children":1163},{"style":126},[1164],{"type":47,"value":1165}," z",{"type":41,"tag":107,"props":1167,"children":1168},{"style":120},[1169],{"type":47,"value":134},{"type":41,"tag":107,"props":1171,"children":1172},{"style":114},[1173],{"type":47,"value":139},{"type":41,"tag":107,"props":1175,"children":1176},{"style":120},[1177],{"type":47,"value":144},{"type":41,"tag":107,"props":1179,"children":1180},{"style":147},[1181],{"type":47,"value":1182},"zod",{"type":41,"tag":107,"props":1184,"children":1185},{"style":120},[1186],{"type":47,"value":155},{"type":41,"tag":107,"props":1188,"children":1189},{"style":120},[1190],{"type":47,"value":160},{"type":41,"tag":107,"props":1192,"children":1193},{"class":109,"line":28},[1194],{"type":41,"tag":107,"props":1195,"children":1196},{"emptyLinePlaceholder":251},[1197],{"type":47,"value":254},{"type":41,"tag":107,"props":1199,"children":1200},{"class":109,"line":296},[1201,1206,1211,1215,1219,1223,1228,1232],{"type":41,"tag":107,"props":1202,"children":1203},{"style":265},[1204],{"type":47,"value":1205},"const",{"type":41,"tag":107,"props":1207,"children":1208},{"style":126},[1209],{"type":47,"value":1210}," routingSchema ",{"type":41,"tag":107,"props":1212,"children":1213},{"style":120},[1214],{"type":47,"value":278},{"type":41,"tag":107,"props":1216,"children":1217},{"style":126},[1218],{"type":47,"value":1165},{"type":41,"tag":107,"props":1220,"children":1221},{"style":120},[1222],{"type":47,"value":579},{"type":41,"tag":107,"props":1224,"children":1225},{"style":281},[1226],{"type":47,"value":1227},"object",{"type":41,"tag":107,"props":1229,"children":1230},{"style":126},[1231],{"type":47,"value":288},{"type":41,"tag":107,"props":1233,"children":1234},{"style":120},[1235],{"type":47,"value":293},{"type":41,"tag":107,"props":1237,"children":1238},{"class":109,"line":329},[1239,1244,1248,1252,1256,1261,1266,1270,1274,1278,1282,1286,1291,1295,1300],{"type":41,"tag":107,"props":1240,"children":1241},{"style":300},[1242],{"type":47,"value":1243},"  model",{"type":41,"tag":107,"props":1245,"children":1246},{"style":120},[1247],{"type":47,"value":308},{"type":41,"tag":107,"props":1249,"children":1250},{"style":126},[1251],{"type":47,"value":1165},{"type":41,"tag":107,"props":1253,"children":1254},{"style":120},[1255],{"type":47,"value":579},{"type":41,"tag":107,"props":1257,"children":1258},{"style":281},[1259],{"type":47,"value":1260},"enum",{"type":41,"tag":107,"props":1262,"children":1263},{"style":126},[1264],{"type":47,"value":1265},"([",{"type":41,"tag":107,"props":1267,"children":1268},{"style":120},[1269],{"type":47,"value":155},{"type":41,"tag":107,"props":1271,"children":1272},{"style":147},[1273],{"type":47,"value":465},{"type":41,"tag":107,"props":1275,"children":1276},{"style":120},[1277],{"type":47,"value":155},{"type":41,"tag":107,"props":1279,"children":1280},{"style":120},[1281],{"type":47,"value":360},{"type":41,"tag":107,"props":1283,"children":1284},{"style":120},[1285],{"type":47,"value":144},{"type":41,"tag":107,"props":1287,"children":1288},{"style":147},[1289],{"type":47,"value":1290},"o1-mini",{"type":41,"tag":107,"props":1292,"children":1293},{"style":120},[1294],{"type":47,"value":155},{"type":41,"tag":107,"props":1296,"children":1297},{"style":126},[1298],{"type":47,"value":1299},"])",{"type":41,"tag":107,"props":1301,"children":1302},{"style":120},[1303],{"type":47,"value":326},{"type":41,"tag":107,"props":1305,"children":1306},{"class":109,"line":392},[1307,1312,1316,1320,1324,1329,1334],{"type":41,"tag":107,"props":1308,"children":1309},{"style":300},[1310],{"type":47,"value":1311},"  reason",{"type":41,"tag":107,"props":1313,"children":1314},{"style":120},[1315],{"type":47,"value":308},{"type":41,"tag":107,"props":1317,"children":1318},{"style":126},[1319],{"type":47,"value":1165},{"type":41,"tag":107,"props":1321,"children":1322},{"style":120},[1323],{"type":47,"value":579},{"type":41,"tag":107,"props":1325,"children":1326},{"style":281},[1327],{"type":47,"value":1328},"string",{"type":41,"tag":107,"props":1330,"children":1331},{"style":126},[1332],{"type":47,"value":1333},"()",{"type":41,"tag":107,"props":1335,"children":1336},{"style":120},[1337],{"type":47,"value":326},{"type":41,"tag":107,"props":1339,"children":1340},{"class":109,"line":402},[1341,1345,1349],{"type":41,"tag":107,"props":1342,"children":1343},{"style":120},[1344],{"type":47,"value":711},{"type":41,"tag":107,"props":1346,"children":1347},{"style":126},[1348],{"type":47,"value":474},{"type":41,"tag":107,"props":1350,"children":1351},{"style":120},[1352],{"type":47,"value":160},{"type":41,"tag":107,"props":1354,"children":1355},{"class":109,"line":438},[1356],{"type":41,"tag":107,"props":1357,"children":1358},{"emptyLinePlaceholder":251},[1359],{"type":47,"value":254},{"type":41,"tag":107,"props":1361,"children":1362},{"class":109,"line":481},[1363,1367,1371,1376,1380,1384,1388],{"type":41,"tag":107,"props":1364,"children":1365},{"style":114},[1366],{"type":47,"value":262},{"type":41,"tag":107,"props":1368,"children":1369},{"style":265},[1370],{"type":47,"value":268},{"type":41,"tag":107,"props":1372,"children":1373},{"style":126},[1374],{"type":47,"value":1375}," routeQuestion ",{"type":41,"tag":107,"props":1377,"children":1378},{"style":120},[1379],{"type":47,"value":278},{"type":41,"tag":107,"props":1381,"children":1382},{"style":281},[1383],{"type":47,"value":129},{"type":41,"tag":107,"props":1385,"children":1386},{"style":126},[1387],{"type":47,"value":288},{"type":41,"tag":107,"props":1389,"children":1390},{"style":120},[1391],{"type":47,"value":293},{"type":41,"tag":107,"props":1393,"children":1394},{"class":109,"line":522},[1395,1399,1403,1407,1412,1416],{"type":41,"tag":107,"props":1396,"children":1397},{"style":300},[1398],{"type":47,"value":303},{"type":41,"tag":107,"props":1400,"children":1401},{"style":120},[1402],{"type":47,"value":308},{"type":41,"tag":107,"props":1404,"children":1405},{"style":120},[1406],{"type":47,"value":144},{"type":41,"tag":107,"props":1408,"children":1409},{"style":147},[1410],{"type":47,"value":1411},"route-question",{"type":41,"tag":107,"props":1413,"children":1414},{"style":120},[1415],{"type":47,"value":155},{"type":41,"tag":107,"props":1417,"children":1418},{"style":120},[1419],{"type":47,"value":326},{"type":41,"tag":107,"props":1421,"children":1422},{"class":109,"line":539},[1423,1427,1431,1435,1439,1444,1448,1452],{"type":41,"tag":107,"props":1424,"children":1425},{"style":281},[1426],{"type":47,"value":335},{"type":41,"tag":107,"props":1428,"children":1429},{"style":120},[1430],{"type":47,"value":308},{"type":41,"tag":107,"props":1432,"children":1433},{"style":265},[1434],{"type":47,"value":344},{"type":41,"tag":107,"props":1436,"children":1437},{"style":120},[1438],{"type":47,"value":349},{"type":41,"tag":107,"props":1440,"children":1441},{"style":352},[1442],{"type":47,"value":1443}," question",{"type":41,"tag":107,"props":1445,"children":1446},{"style":120},[1447],{"type":47,"value":379},{"type":41,"tag":107,"props":1449,"children":1450},{"style":265},[1451],{"type":47,"value":384},{"type":41,"tag":107,"props":1453,"children":1454},{"style":120},[1455],{"type":47,"value":389},{"type":41,"tag":107,"props":1457,"children":1458},{"class":109,"line":547},[1459],{"type":41,"tag":107,"props":1460,"children":1461},{"style":396},[1462],{"type":47,"value":1463},"    \u002F\u002F Cheap classification call\n",{"type":41,"tag":107,"props":1465,"children":1466},{"class":109,"line":556},[1467,1471,1476,1480,1484,1488,1492],{"type":41,"tag":107,"props":1468,"children":1469},{"style":265},[1470],{"type":47,"value":408},{"type":41,"tag":107,"props":1472,"children":1473},{"style":126},[1474],{"type":47,"value":1475}," routing",{"type":41,"tag":107,"props":1477,"children":1478},{"style":120},[1479],{"type":47,"value":418},{"type":41,"tag":107,"props":1481,"children":1482},{"style":114},[1483],{"type":47,"value":423},{"type":41,"tag":107,"props":1485,"children":1486},{"style":281},[1487],{"type":47,"value":177},{"type":41,"tag":107,"props":1489,"children":1490},{"style":300},[1491],{"type":47,"value":288},{"type":41,"tag":107,"props":1493,"children":1494},{"style":120},[1495],{"type":47,"value":293},{"type":41,"tag":107,"props":1497,"children":1498},{"class":109,"line":631},[1499,1503,1507,1511,1515,1519,1524,1528,1532],{"type":41,"tag":107,"props":1500,"children":1501},{"style":300},[1502],{"type":47,"value":444},{"type":41,"tag":107,"props":1504,"children":1505},{"style":120},[1506],{"type":47,"value":308},{"type":41,"tag":107,"props":1508,"children":1509},{"style":281},[1510],{"type":47,"value":219},{"type":41,"tag":107,"props":1512,"children":1513},{"style":300},[1514],{"type":47,"value":288},{"type":41,"tag":107,"props":1516,"children":1517},{"style":120},[1518],{"type":47,"value":155},{"type":41,"tag":107,"props":1520,"children":1521},{"style":147},[1522],{"type":47,"value":1523},"gpt-4o-mini",{"type":41,"tag":107,"props":1525,"children":1526},{"style":120},[1527],{"type":47,"value":155},{"type":41,"tag":107,"props":1529,"children":1530},{"style":300},[1531],{"type":47,"value":474},{"type":41,"tag":107,"props":1533,"children":1534},{"style":120},[1535],{"type":47,"value":326},{"type":41,"tag":107,"props":1537,"children":1538},{"class":109,"line":668},[1539,1544,1548],{"type":41,"tag":107,"props":1540,"children":1541},{"style":300},[1542],{"type":47,"value":1543},"      messages",{"type":41,"tag":107,"props":1545,"children":1546},{"style":120},[1547],{"type":47,"value":308},{"type":41,"tag":107,"props":1549,"children":1550},{"style":300},[1551],{"type":47,"value":1552}," [\n",{"type":41,"tag":107,"props":1554,"children":1555},{"class":109,"line":740},[1556],{"type":41,"tag":107,"props":1557,"children":1558},{"style":120},[1559],{"type":47,"value":1560},"        {\n",{"type":41,"tag":107,"props":1562,"children":1563},{"class":109,"line":749},[1564,1569,1573,1577,1582,1586],{"type":41,"tag":107,"props":1565,"children":1566},{"style":300},[1567],{"type":47,"value":1568},"          role",{"type":41,"tag":107,"props":1570,"children":1571},{"style":120},[1572],{"type":47,"value":308},{"type":41,"tag":107,"props":1574,"children":1575},{"style":120},[1576],{"type":47,"value":144},{"type":41,"tag":107,"props":1578,"children":1579},{"style":147},[1580],{"type":47,"value":1581},"system",{"type":41,"tag":107,"props":1583,"children":1584},{"style":120},[1585],{"type":47,"value":155},{"type":41,"tag":107,"props":1587,"children":1588},{"style":120},[1589],{"type":47,"value":326},{"type":41,"tag":107,"props":1591,"children":1592},{"class":109,"line":757},[1593,1598,1602,1606],{"type":41,"tag":107,"props":1594,"children":1595},{"style":300},[1596],{"type":47,"value":1597},"          content",{"type":41,"tag":107,"props":1599,"children":1600},{"style":120},[1601],{"type":47,"value":308},{"type":41,"tag":107,"props":1603,"children":1604},{"style":120},[1605],{"type":47,"value":496},{"type":41,"tag":107,"props":1607,"children":1608},{"style":147},[1609],{"type":47,"value":1610},"Classify question complexity. Return JSON: {\"model\": \"gpt-4o\" | \"o1-mini\", \"reason\": \"...\"}\n",{"type":41,"tag":107,"props":1612,"children":1613},{"class":109,"line":766},[1614],{"type":41,"tag":107,"props":1615,"children":1616},{"style":147},[1617],{"type":47,"value":1618},"          - gpt-4o: simple factual questions\n",{"type":41,"tag":107,"props":1620,"children":1621},{"class":109,"line":799},[1622,1627,1631],{"type":41,"tag":107,"props":1623,"children":1624},{"style":147},[1625],{"type":47,"value":1626},"          - o1-mini: complex reasoning, math, code",{"type":41,"tag":107,"props":1628,"children":1629},{"style":120},[1630],{"type":47,"value":693},{"type":41,"tag":107,"props":1632,"children":1633},{"style":120},[1634],{"type":47,"value":326},{"type":41,"tag":107,"props":1636,"children":1637},{"class":109,"line":839},[1638],{"type":41,"tag":107,"props":1639,"children":1640},{"style":120},[1641],{"type":47,"value":1642},"        },\n",{"type":41,"tag":107,"props":1644,"children":1645},{"class":109,"line":903},[1646,1651,1656,1660,1664,1669,1673,1677,1682,1686,1690],{"type":41,"tag":107,"props":1647,"children":1648},{"style":120},[1649],{"type":47,"value":1650},"        {",{"type":41,"tag":107,"props":1652,"children":1653},{"style":300},[1654],{"type":47,"value":1655}," role",{"type":41,"tag":107,"props":1657,"children":1658},{"style":120},[1659],{"type":47,"value":308},{"type":41,"tag":107,"props":1661,"children":1662},{"style":120},[1663],{"type":47,"value":144},{"type":41,"tag":107,"props":1665,"children":1666},{"style":147},[1667],{"type":47,"value":1668},"user",{"type":41,"tag":107,"props":1670,"children":1671},{"style":120},[1672],{"type":47,"value":155},{"type":41,"tag":107,"props":1674,"children":1675},{"style":120},[1676],{"type":47,"value":360},{"type":41,"tag":107,"props":1678,"children":1679},{"style":300},[1680],{"type":47,"value":1681}," content",{"type":41,"tag":107,"props":1683,"children":1684},{"style":120},[1685],{"type":47,"value":308},{"type":41,"tag":107,"props":1687,"children":1688},{"style":126},[1689],{"type":47,"value":1443},{"type":41,"tag":107,"props":1691,"children":1692},{"style":120},[1693],{"type":47,"value":1694}," },\n",{"type":41,"tag":107,"props":1696,"children":1697},{"class":109,"line":919},[1698,1703],{"type":41,"tag":107,"props":1699,"children":1700},{"style":300},[1701],{"type":47,"value":1702},"      ]",{"type":41,"tag":107,"props":1704,"children":1705},{"style":120},[1706],{"type":47,"value":326},{"type":41,"tag":107,"props":1708,"children":1709},{"class":109,"line":927},[1710,1714,1718],{"type":41,"tag":107,"props":1711,"children":1712},{"style":120},[1713],{"type":47,"value":528},{"type":41,"tag":107,"props":1715,"children":1716},{"style":300},[1717],{"type":47,"value":474},{"type":41,"tag":107,"props":1719,"children":1720},{"style":120},[1721],{"type":47,"value":160},{"type":41,"tag":107,"props":1723,"children":1724},{"class":109,"line":989},[1725],{"type":41,"tag":107,"props":1726,"children":1727},{"emptyLinePlaceholder":251},[1728],{"type":47,"value":254},{"type":41,"tag":107,"props":1730,"children":1731},{"class":109,"line":998},[1732,1736,1740,1745,1749,1753,1758,1762,1767,1771,1776,1780,1784,1788,1793,1797,1801,1806],{"type":41,"tag":107,"props":1733,"children":1734},{"style":265},[1735],{"type":47,"value":408},{"type":41,"tag":107,"props":1737,"children":1738},{"style":120},[1739],{"type":47,"value":123},{"type":41,"tag":107,"props":1741,"children":1742},{"style":126},[1743],{"type":47,"value":1744}," model",{"type":41,"tag":107,"props":1746,"children":1747},{"style":120},[1748],{"type":47,"value":134},{"type":41,"tag":107,"props":1750,"children":1751},{"style":120},[1752],{"type":47,"value":418},{"type":41,"tag":107,"props":1754,"children":1755},{"style":126},[1756],{"type":47,"value":1757}," routingSchema",{"type":41,"tag":107,"props":1759,"children":1760},{"style":120},[1761],{"type":47,"value":579},{"type":41,"tag":107,"props":1763,"children":1764},{"style":281},[1765],{"type":47,"value":1766},"parse",{"type":41,"tag":107,"props":1768,"children":1769},{"style":300},[1770],{"type":47,"value":288},{"type":41,"tag":107,"props":1772,"children":1773},{"style":126},[1774],{"type":47,"value":1775},"JSON",{"type":41,"tag":107,"props":1777,"children":1778},{"style":120},[1779],{"type":47,"value":579},{"type":41,"tag":107,"props":1781,"children":1782},{"style":281},[1783],{"type":47,"value":1766},{"type":41,"tag":107,"props":1785,"children":1786},{"style":300},[1787],{"type":47,"value":288},{"type":41,"tag":107,"props":1789,"children":1790},{"style":126},[1791],{"type":47,"value":1792},"routing",{"type":41,"tag":107,"props":1794,"children":1795},{"style":120},[1796],{"type":47,"value":579},{"type":41,"tag":107,"props":1798,"children":1799},{"style":126},[1800],{"type":47,"value":47},{"type":41,"tag":107,"props":1802,"children":1803},{"style":300},[1804],{"type":47,"value":1805},"))",{"type":41,"tag":107,"props":1807,"children":1808},{"style":120},[1809],{"type":47,"value":160},{"type":41,"tag":107,"props":1811,"children":1813},{"class":109,"line":1812},29,[1814],{"type":41,"tag":107,"props":1815,"children":1816},{"emptyLinePlaceholder":251},[1817],{"type":47,"value":254},{"type":41,"tag":107,"props":1819,"children":1820},{"class":109,"line":24},[1821],{"type":41,"tag":107,"props":1822,"children":1823},{"style":396},[1824],{"type":47,"value":1825},"    \u002F\u002F Route to selected model\n",{"type":41,"tag":107,"props":1827,"children":1829},{"class":109,"line":1828},31,[1830,1834,1839,1843,1847,1851,1855],{"type":41,"tag":107,"props":1831,"children":1832},{"style":265},[1833],{"type":47,"value":408},{"type":41,"tag":107,"props":1835,"children":1836},{"style":126},[1837],{"type":47,"value":1838}," answer",{"type":41,"tag":107,"props":1840,"children":1841},{"style":120},[1842],{"type":47,"value":418},{"type":41,"tag":107,"props":1844,"children":1845},{"style":114},[1846],{"type":47,"value":423},{"type":41,"tag":107,"props":1848,"children":1849},{"style":281},[1850],{"type":47,"value":177},{"type":41,"tag":107,"props":1852,"children":1853},{"style":300},[1854],{"type":47,"value":288},{"type":41,"tag":107,"props":1856,"children":1857},{"style":120},[1858],{"type":47,"value":293},{"type":41,"tag":107,"props":1860,"children":1862},{"class":109,"line":1861},32,[1863,1867,1871,1875,1879,1884,1888],{"type":41,"tag":107,"props":1864,"children":1865},{"style":300},[1866],{"type":47,"value":444},{"type":41,"tag":107,"props":1868,"children":1869},{"style":120},[1870],{"type":47,"value":308},{"type":41,"tag":107,"props":1872,"children":1873},{"style":281},[1874],{"type":47,"value":219},{"type":41,"tag":107,"props":1876,"children":1877},{"style":300},[1878],{"type":47,"value":288},{"type":41,"tag":107,"props":1880,"children":1881},{"style":126},[1882],{"type":47,"value":1883},"model",{"type":41,"tag":107,"props":1885,"children":1886},{"style":300},[1887],{"type":47,"value":474},{"type":41,"tag":107,"props":1889,"children":1890},{"style":120},[1891],{"type":47,"value":326},{"type":41,"tag":107,"props":1893,"children":1895},{"class":109,"line":1894},33,[1896,1900,1904,1908],{"type":41,"tag":107,"props":1897,"children":1898},{"style":300},[1899],{"type":47,"value":487},{"type":41,"tag":107,"props":1901,"children":1902},{"style":120},[1903],{"type":47,"value":308},{"type":41,"tag":107,"props":1905,"children":1906},{"style":126},[1907],{"type":47,"value":1443},{"type":41,"tag":107,"props":1909,"children":1910},{"style":120},[1911],{"type":47,"value":326},{"type":41,"tag":107,"props":1913,"children":1915},{"class":109,"line":1914},34,[1916,1920,1924],{"type":41,"tag":107,"props":1917,"children":1918},{"style":120},[1919],{"type":47,"value":528},{"type":41,"tag":107,"props":1921,"children":1922},{"style":300},[1923],{"type":47,"value":474},{"type":41,"tag":107,"props":1925,"children":1926},{"style":120},[1927],{"type":47,"value":160},{"type":41,"tag":107,"props":1929,"children":1931},{"class":109,"line":1930},35,[1932],{"type":41,"tag":107,"props":1933,"children":1934},{"emptyLinePlaceholder":251},[1935],{"type":47,"value":254},{"type":41,"tag":107,"props":1937,"children":1939},{"class":109,"line":1938},36,[1940,1944,1948,1952,1956,1960,1964,1968,1972,1977,1981,1985],{"type":41,"tag":107,"props":1941,"children":1942},{"style":114},[1943],{"type":47,"value":933},{"type":41,"tag":107,"props":1945,"children":1946},{"style":120},[1947],{"type":47,"value":123},{"type":41,"tag":107,"props":1949,"children":1950},{"style":300},[1951],{"type":47,"value":1838},{"type":41,"tag":107,"props":1953,"children":1954},{"style":120},[1955],{"type":47,"value":308},{"type":41,"tag":107,"props":1957,"children":1958},{"style":126},[1959],{"type":47,"value":1838},{"type":41,"tag":107,"props":1961,"children":1962},{"style":120},[1963],{"type":47,"value":579},{"type":41,"tag":107,"props":1965,"children":1966},{"style":126},[1967],{"type":47,"value":47},{"type":41,"tag":107,"props":1969,"children":1970},{"style":120},[1971],{"type":47,"value":360},{"type":41,"tag":107,"props":1973,"children":1974},{"style":300},[1975],{"type":47,"value":1976}," routedTo",{"type":41,"tag":107,"props":1978,"children":1979},{"style":120},[1980],{"type":47,"value":308},{"type":41,"tag":107,"props":1982,"children":1983},{"style":126},[1984],{"type":47,"value":1744},{"type":41,"tag":107,"props":1986,"children":1987},{"style":120},[1988],{"type":47,"value":986},{"type":41,"tag":107,"props":1990,"children":1992},{"class":109,"line":1991},37,[1993],{"type":41,"tag":107,"props":1994,"children":1995},{"style":120},[1996],{"type":47,"value":995},{"type":41,"tag":107,"props":1998,"children":2000},{"class":109,"line":1999},38,[2001,2005,2009],{"type":41,"tag":107,"props":2002,"children":2003},{"style":120},[2004],{"type":47,"value":711},{"type":41,"tag":107,"props":2006,"children":2007},{"style":126},[2008],{"type":47,"value":474},{"type":41,"tag":107,"props":2010,"children":2011},{"style":120},[2012],{"type":47,"value":160},{"type":41,"tag":76,"props":2014,"children":2015},{},[],{"type":41,"tag":86,"props":2017,"children":2019},{"id":2018},"_3-parallelization",[2020],{"type":47,"value":2021},"3. Parallelization",{"type":41,"tag":50,"props":2023,"children":2024},{},[2025,2027,2033],{"type":47,"value":2026},"Run independent LLM calls simultaneously with ",{"type":41,"tag":70,"props":2028,"children":2030},{"className":2029},[],[2031],{"type":47,"value":2032},"batch.triggerByTaskAndWait",{"type":47,"value":579},{"type":41,"tag":63,"props":2035,"children":2037},{"className":99,"code":2036,"language":101,"meta":72,"style":72},"import { batch, task } from \"@trigger.dev\u002Fsdk\";\n\nexport const analyzeContent = task({\n  id: \"analyze-content\",\n  run: async ({ text }) => {\n    \u002F\u002F All three run in parallel\n    const { runs: [sentiment, summary, moderation] } = await batch.triggerByTaskAndWait([\n      { task: analyzeSentiment, payload: { text } },\n      { task: summarizeText, payload: { text } },\n      { task: moderateContent, payload: { text } },\n    ]);\n\n    \u002F\u002F Check moderation first\n    if (moderation.ok && moderation.output.flagged) {\n      return { error: \"Content flagged\", reason: moderation.output.reason };\n    }\n\n    return {\n      sentiment: sentiment.ok ? sentiment.output : null,\n      summary: summary.ok ? summary.output : null,\n    };\n  },\n});\n",[2038],{"type":41,"tag":70,"props":2039,"children":2040},{"__ignoreMap":72},[2041,2089,2096,2128,2156,2191,2199,2282,2332,2380,2428,2440,2447,2455,2515,2587,2594,2601,2612,2664,2712,2720,2727],{"type":41,"tag":107,"props":2042,"children":2043},{"class":109,"line":110},[2044,2048,2052,2057,2061,2065,2069,2073,2077,2081,2085],{"type":41,"tag":107,"props":2045,"children":2046},{"style":114},[2047],{"type":47,"value":117},{"type":41,"tag":107,"props":2049,"children":2050},{"style":120},[2051],{"type":47,"value":123},{"type":41,"tag":107,"props":2053,"children":2054},{"style":126},[2055],{"type":47,"value":2056}," batch",{"type":41,"tag":107,"props":2058,"children":2059},{"style":120},[2060],{"type":47,"value":360},{"type":41,"tag":107,"props":2062,"children":2063},{"style":126},[2064],{"type":47,"value":129},{"type":41,"tag":107,"props":2066,"children":2067},{"style":120},[2068],{"type":47,"value":134},{"type":41,"tag":107,"props":2070,"children":2071},{"style":114},[2072],{"type":47,"value":139},{"type":41,"tag":107,"props":2074,"children":2075},{"style":120},[2076],{"type":47,"value":144},{"type":41,"tag":107,"props":2078,"children":2079},{"style":147},[2080],{"type":47,"value":150},{"type":41,"tag":107,"props":2082,"children":2083},{"style":120},[2084],{"type":47,"value":155},{"type":41,"tag":107,"props":2086,"children":2087},{"style":120},[2088],{"type":47,"value":160},{"type":41,"tag":107,"props":2090,"children":2091},{"class":109,"line":163},[2092],{"type":41,"tag":107,"props":2093,"children":2094},{"emptyLinePlaceholder":251},[2095],{"type":47,"value":254},{"type":41,"tag":107,"props":2097,"children":2098},{"class":109,"line":205},[2099,2103,2107,2112,2116,2120,2124],{"type":41,"tag":107,"props":2100,"children":2101},{"style":114},[2102],{"type":47,"value":262},{"type":41,"tag":107,"props":2104,"children":2105},{"style":265},[2106],{"type":47,"value":268},{"type":41,"tag":107,"props":2108,"children":2109},{"style":126},[2110],{"type":47,"value":2111}," analyzeContent ",{"type":41,"tag":107,"props":2113,"children":2114},{"style":120},[2115],{"type":47,"value":278},{"type":41,"tag":107,"props":2117,"children":2118},{"style":281},[2119],{"type":47,"value":129},{"type":41,"tag":107,"props":2121,"children":2122},{"style":126},[2123],{"type":47,"value":288},{"type":41,"tag":107,"props":2125,"children":2126},{"style":120},[2127],{"type":47,"value":293},{"type":41,"tag":107,"props":2129,"children":2130},{"class":109,"line":247},[2131,2135,2139,2143,2148,2152],{"type":41,"tag":107,"props":2132,"children":2133},{"style":300},[2134],{"type":47,"value":303},{"type":41,"tag":107,"props":2136,"children":2137},{"style":120},[2138],{"type":47,"value":308},{"type":41,"tag":107,"props":2140,"children":2141},{"style":120},[2142],{"type":47,"value":144},{"type":41,"tag":107,"props":2144,"children":2145},{"style":147},[2146],{"type":47,"value":2147},"analyze-content",{"type":41,"tag":107,"props":2149,"children":2150},{"style":120},[2151],{"type":47,"value":155},{"type":41,"tag":107,"props":2153,"children":2154},{"style":120},[2155],{"type":47,"value":326},{"type":41,"tag":107,"props":2157,"children":2158},{"class":109,"line":28},[2159,2163,2167,2171,2175,2179,2183,2187],{"type":41,"tag":107,"props":2160,"children":2161},{"style":281},[2162],{"type":47,"value":335},{"type":41,"tag":107,"props":2164,"children":2165},{"style":120},[2166],{"type":47,"value":308},{"type":41,"tag":107,"props":2168,"children":2169},{"style":265},[2170],{"type":47,"value":344},{"type":41,"tag":107,"props":2172,"children":2173},{"style":120},[2174],{"type":47,"value":349},{"type":41,"tag":107,"props":2176,"children":2177},{"style":352},[2178],{"type":47,"value":355},{"type":41,"tag":107,"props":2180,"children":2181},{"style":120},[2182],{"type":47,"value":379},{"type":41,"tag":107,"props":2184,"children":2185},{"style":265},[2186],{"type":47,"value":384},{"type":41,"tag":107,"props":2188,"children":2189},{"style":120},[2190],{"type":47,"value":389},{"type":41,"tag":107,"props":2192,"children":2193},{"class":109,"line":296},[2194],{"type":41,"tag":107,"props":2195,"children":2196},{"style":396},[2197],{"type":47,"value":2198},"    \u002F\u002F All three run in parallel\n",{"type":41,"tag":107,"props":2200,"children":2201},{"class":109,"line":329},[2202,2206,2210,2215,2219,2224,2229,2233,2238,2242,2247,2252,2256,2260,2264,2268,2272,2277],{"type":41,"tag":107,"props":2203,"children":2204},{"style":265},[2205],{"type":47,"value":408},{"type":41,"tag":107,"props":2207,"children":2208},{"style":120},[2209],{"type":47,"value":123},{"type":41,"tag":107,"props":2211,"children":2212},{"style":300},[2213],{"type":47,"value":2214}," runs",{"type":41,"tag":107,"props":2216,"children":2217},{"style":120},[2218],{"type":47,"value":308},{"type":41,"tag":107,"props":2220,"children":2221},{"style":120},[2222],{"type":47,"value":2223}," [",{"type":41,"tag":107,"props":2225,"children":2226},{"style":126},[2227],{"type":47,"value":2228},"sentiment",{"type":41,"tag":107,"props":2230,"children":2231},{"style":120},[2232],{"type":47,"value":360},{"type":41,"tag":107,"props":2234,"children":2235},{"style":126},[2236],{"type":47,"value":2237}," summary",{"type":41,"tag":107,"props":2239,"children":2240},{"style":120},[2241],{"type":47,"value":360},{"type":41,"tag":107,"props":2243,"children":2244},{"style":126},[2245],{"type":47,"value":2246}," moderation",{"type":41,"tag":107,"props":2248,"children":2249},{"style":120},[2250],{"type":47,"value":2251},"]",{"type":41,"tag":107,"props":2253,"children":2254},{"style":120},[2255],{"type":47,"value":134},{"type":41,"tag":107,"props":2257,"children":2258},{"style":120},[2259],{"type":47,"value":418},{"type":41,"tag":107,"props":2261,"children":2262},{"style":114},[2263],{"type":47,"value":423},{"type":41,"tag":107,"props":2265,"children":2266},{"style":126},[2267],{"type":47,"value":2056},{"type":41,"tag":107,"props":2269,"children":2270},{"style":120},[2271],{"type":47,"value":579},{"type":41,"tag":107,"props":2273,"children":2274},{"style":281},[2275],{"type":47,"value":2276},"triggerByTaskAndWait",{"type":41,"tag":107,"props":2278,"children":2279},{"style":300},[2280],{"type":47,"value":2281},"([\n",{"type":41,"tag":107,"props":2283,"children":2284},{"class":109,"line":392},[2285,2290,2294,2298,2303,2307,2312,2316,2320,2324,2328],{"type":41,"tag":107,"props":2286,"children":2287},{"style":120},[2288],{"type":47,"value":2289},"      {",{"type":41,"tag":107,"props":2291,"children":2292},{"style":300},[2293],{"type":47,"value":129},{"type":41,"tag":107,"props":2295,"children":2296},{"style":120},[2297],{"type":47,"value":308},{"type":41,"tag":107,"props":2299,"children":2300},{"style":126},[2301],{"type":47,"value":2302}," analyzeSentiment",{"type":41,"tag":107,"props":2304,"children":2305},{"style":120},[2306],{"type":47,"value":360},{"type":41,"tag":107,"props":2308,"children":2309},{"style":300},[2310],{"type":47,"value":2311}," payload",{"type":41,"tag":107,"props":2313,"children":2314},{"style":120},[2315],{"type":47,"value":308},{"type":41,"tag":107,"props":2317,"children":2318},{"style":120},[2319],{"type":47,"value":123},{"type":41,"tag":107,"props":2321,"children":2322},{"style":126},[2323],{"type":47,"value":355},{"type":41,"tag":107,"props":2325,"children":2326},{"style":120},[2327],{"type":47,"value":134},{"type":41,"tag":107,"props":2329,"children":2330},{"style":120},[2331],{"type":47,"value":1694},{"type":41,"tag":107,"props":2333,"children":2334},{"class":109,"line":402},[2335,2339,2343,2347,2352,2356,2360,2364,2368,2372,2376],{"type":41,"tag":107,"props":2336,"children":2337},{"style":120},[2338],{"type":47,"value":2289},{"type":41,"tag":107,"props":2340,"children":2341},{"style":300},[2342],{"type":47,"value":129},{"type":41,"tag":107,"props":2344,"children":2345},{"style":120},[2346],{"type":47,"value":308},{"type":41,"tag":107,"props":2348,"children":2349},{"style":126},[2350],{"type":47,"value":2351}," summarizeText",{"type":41,"tag":107,"props":2353,"children":2354},{"style":120},[2355],{"type":47,"value":360},{"type":41,"tag":107,"props":2357,"children":2358},{"style":300},[2359],{"type":47,"value":2311},{"type":41,"tag":107,"props":2361,"children":2362},{"style":120},[2363],{"type":47,"value":308},{"type":41,"tag":107,"props":2365,"children":2366},{"style":120},[2367],{"type":47,"value":123},{"type":41,"tag":107,"props":2369,"children":2370},{"style":126},[2371],{"type":47,"value":355},{"type":41,"tag":107,"props":2373,"children":2374},{"style":120},[2375],{"type":47,"value":134},{"type":41,"tag":107,"props":2377,"children":2378},{"style":120},[2379],{"type":47,"value":1694},{"type":41,"tag":107,"props":2381,"children":2382},{"class":109,"line":438},[2383,2387,2391,2395,2400,2404,2408,2412,2416,2420,2424],{"type":41,"tag":107,"props":2384,"children":2385},{"style":120},[2386],{"type":47,"value":2289},{"type":41,"tag":107,"props":2388,"children":2389},{"style":300},[2390],{"type":47,"value":129},{"type":41,"tag":107,"props":2392,"children":2393},{"style":120},[2394],{"type":47,"value":308},{"type":41,"tag":107,"props":2396,"children":2397},{"style":126},[2398],{"type":47,"value":2399}," moderateContent",{"type":41,"tag":107,"props":2401,"children":2402},{"style":120},[2403],{"type":47,"value":360},{"type":41,"tag":107,"props":2405,"children":2406},{"style":300},[2407],{"type":47,"value":2311},{"type":41,"tag":107,"props":2409,"children":2410},{"style":120},[2411],{"type":47,"value":308},{"type":41,"tag":107,"props":2413,"children":2414},{"style":120},[2415],{"type":47,"value":123},{"type":41,"tag":107,"props":2417,"children":2418},{"style":126},[2419],{"type":47,"value":355},{"type":41,"tag":107,"props":2421,"children":2422},{"style":120},[2423],{"type":47,"value":134},{"type":41,"tag":107,"props":2425,"children":2426},{"style":120},[2427],{"type":47,"value":1694},{"type":41,"tag":107,"props":2429,"children":2430},{"class":109,"line":481},[2431,2436],{"type":41,"tag":107,"props":2432,"children":2433},{"style":300},[2434],{"type":47,"value":2435},"    ])",{"type":41,"tag":107,"props":2437,"children":2438},{"style":120},[2439],{"type":47,"value":160},{"type":41,"tag":107,"props":2441,"children":2442},{"class":109,"line":522},[2443],{"type":41,"tag":107,"props":2444,"children":2445},{"emptyLinePlaceholder":251},[2446],{"type":47,"value":254},{"type":41,"tag":107,"props":2448,"children":2449},{"class":109,"line":539},[2450],{"type":41,"tag":107,"props":2451,"children":2452},{"style":396},[2453],{"type":47,"value":2454},"    \u002F\u002F Check moderation first\n",{"type":41,"tag":107,"props":2456,"children":2457},{"class":109,"line":547},[2458,2462,2466,2471,2475,2480,2485,2489,2493,2498,2502,2507,2511],{"type":41,"tag":107,"props":2459,"children":2460},{"style":114},[2461],{"type":47,"value":637},{"type":41,"tag":107,"props":2463,"children":2464},{"style":300},[2465],{"type":47,"value":642},{"type":41,"tag":107,"props":2467,"children":2468},{"style":126},[2469],{"type":47,"value":2470},"moderation",{"type":41,"tag":107,"props":2472,"children":2473},{"style":120},[2474],{"type":47,"value":579},{"type":41,"tag":107,"props":2476,"children":2477},{"style":126},[2478],{"type":47,"value":2479},"ok",{"type":41,"tag":107,"props":2481,"children":2482},{"style":120},[2483],{"type":47,"value":2484}," &&",{"type":41,"tag":107,"props":2486,"children":2487},{"style":126},[2488],{"type":47,"value":2246},{"type":41,"tag":107,"props":2490,"children":2491},{"style":120},[2492],{"type":47,"value":579},{"type":41,"tag":107,"props":2494,"children":2495},{"style":126},[2496],{"type":47,"value":2497},"output",{"type":41,"tag":107,"props":2499,"children":2500},{"style":120},[2501],{"type":47,"value":579},{"type":41,"tag":107,"props":2503,"children":2504},{"style":126},[2505],{"type":47,"value":2506},"flagged",{"type":41,"tag":107,"props":2508,"children":2509},{"style":300},[2510],{"type":47,"value":661},{"type":41,"tag":107,"props":2512,"children":2513},{"style":120},[2514],{"type":47,"value":293},{"type":41,"tag":107,"props":2516,"children":2517},{"class":109,"line":556},[2518,2523,2527,2532,2536,2540,2545,2549,2553,2558,2562,2566,2570,2574,2578,2583],{"type":41,"tag":107,"props":2519,"children":2520},{"style":114},[2521],{"type":47,"value":2522},"      return",{"type":41,"tag":107,"props":2524,"children":2525},{"style":120},[2526],{"type":47,"value":123},{"type":41,"tag":107,"props":2528,"children":2529},{"style":300},[2530],{"type":47,"value":2531}," error",{"type":41,"tag":107,"props":2533,"children":2534},{"style":120},[2535],{"type":47,"value":308},{"type":41,"tag":107,"props":2537,"children":2538},{"style":120},[2539],{"type":47,"value":144},{"type":41,"tag":107,"props":2541,"children":2542},{"style":147},[2543],{"type":47,"value":2544},"Content flagged",{"type":41,"tag":107,"props":2546,"children":2547},{"style":120},[2548],{"type":47,"value":155},{"type":41,"tag":107,"props":2550,"children":2551},{"style":120},[2552],{"type":47,"value":360},{"type":41,"tag":107,"props":2554,"children":2555},{"style":300},[2556],{"type":47,"value":2557}," reason",{"type":41,"tag":107,"props":2559,"children":2560},{"style":120},[2561],{"type":47,"value":308},{"type":41,"tag":107,"props":2563,"children":2564},{"style":126},[2565],{"type":47,"value":2246},{"type":41,"tag":107,"props":2567,"children":2568},{"style":120},[2569],{"type":47,"value":579},{"type":41,"tag":107,"props":2571,"children":2572},{"style":126},[2573],{"type":47,"value":2497},{"type":41,"tag":107,"props":2575,"children":2576},{"style":120},[2577],{"type":47,"value":579},{"type":41,"tag":107,"props":2579,"children":2580},{"style":126},[2581],{"type":47,"value":2582},"reason",{"type":41,"tag":107,"props":2584,"children":2585},{"style":120},[2586],{"type":47,"value":986},{"type":41,"tag":107,"props":2588,"children":2589},{"class":109,"line":631},[2590],{"type":41,"tag":107,"props":2591,"children":2592},{"style":120},[2593],{"type":47,"value":746},{"type":41,"tag":107,"props":2595,"children":2596},{"class":109,"line":668},[2597],{"type":41,"tag":107,"props":2598,"children":2599},{"emptyLinePlaceholder":251},[2600],{"type":47,"value":254},{"type":41,"tag":107,"props":2602,"children":2603},{"class":109,"line":740},[2604,2608],{"type":41,"tag":107,"props":2605,"children":2606},{"style":114},[2607],{"type":47,"value":933},{"type":41,"tag":107,"props":2609,"children":2610},{"style":120},[2611],{"type":47,"value":389},{"type":41,"tag":107,"props":2613,"children":2614},{"class":109,"line":749},[2615,2620,2624,2629,2633,2637,2642,2646,2650,2654,2659],{"type":41,"tag":107,"props":2616,"children":2617},{"style":300},[2618],{"type":47,"value":2619},"      sentiment",{"type":41,"tag":107,"props":2621,"children":2622},{"style":120},[2623],{"type":47,"value":308},{"type":41,"tag":107,"props":2625,"children":2626},{"style":126},[2627],{"type":47,"value":2628}," sentiment",{"type":41,"tag":107,"props":2630,"children":2631},{"style":120},[2632],{"type":47,"value":579},{"type":41,"tag":107,"props":2634,"children":2635},{"style":126},[2636],{"type":47,"value":2479},{"type":41,"tag":107,"props":2638,"children":2639},{"style":120},[2640],{"type":47,"value":2641}," ?",{"type":41,"tag":107,"props":2643,"children":2644},{"style":126},[2645],{"type":47,"value":2628},{"type":41,"tag":107,"props":2647,"children":2648},{"style":120},[2649],{"type":47,"value":579},{"type":41,"tag":107,"props":2651,"children":2652},{"style":126},[2653],{"type":47,"value":2497},{"type":41,"tag":107,"props":2655,"children":2656},{"style":120},[2657],{"type":47,"value":2658}," :",{"type":41,"tag":107,"props":2660,"children":2661},{"style":120},[2662],{"type":47,"value":2663}," null,\n",{"type":41,"tag":107,"props":2665,"children":2666},{"class":109,"line":757},[2667,2672,2676,2680,2684,2688,2692,2696,2700,2704,2708],{"type":41,"tag":107,"props":2668,"children":2669},{"style":300},[2670],{"type":47,"value":2671},"      summary",{"type":41,"tag":107,"props":2673,"children":2674},{"style":120},[2675],{"type":47,"value":308},{"type":41,"tag":107,"props":2677,"children":2678},{"style":126},[2679],{"type":47,"value":2237},{"type":41,"tag":107,"props":2681,"children":2682},{"style":120},[2683],{"type":47,"value":579},{"type":41,"tag":107,"props":2685,"children":2686},{"style":126},[2687],{"type":47,"value":2479},{"type":41,"tag":107,"props":2689,"children":2690},{"style":120},[2691],{"type":47,"value":2641},{"type":41,"tag":107,"props":2693,"children":2694},{"style":126},[2695],{"type":47,"value":2237},{"type":41,"tag":107,"props":2697,"children":2698},{"style":120},[2699],{"type":47,"value":579},{"type":41,"tag":107,"props":2701,"children":2702},{"style":126},[2703],{"type":47,"value":2497},{"type":41,"tag":107,"props":2705,"children":2706},{"style":120},[2707],{"type":47,"value":2658},{"type":41,"tag":107,"props":2709,"children":2710},{"style":120},[2711],{"type":47,"value":2663},{"type":41,"tag":107,"props":2713,"children":2714},{"class":109,"line":766},[2715],{"type":41,"tag":107,"props":2716,"children":2717},{"style":120},[2718],{"type":47,"value":2719},"    };\n",{"type":41,"tag":107,"props":2721,"children":2722},{"class":109,"line":799},[2723],{"type":41,"tag":107,"props":2724,"children":2725},{"style":120},[2726],{"type":47,"value":995},{"type":41,"tag":107,"props":2728,"children":2729},{"class":109,"line":839},[2730,2734,2738],{"type":41,"tag":107,"props":2731,"children":2732},{"style":120},[2733],{"type":47,"value":711},{"type":41,"tag":107,"props":2735,"children":2736},{"style":126},[2737],{"type":47,"value":474},{"type":41,"tag":107,"props":2739,"children":2740},{"style":120},[2741],{"type":47,"value":160},{"type":41,"tag":50,"props":2743,"children":2744},{},[2745,2751,2753,2759],{"type":41,"tag":2746,"props":2747,"children":2748},"strong",{},[2749],{"type":47,"value":2750},"See:",{"type":47,"value":2752}," ",{"type":41,"tag":70,"props":2754,"children":2756},{"className":2755},[],[2757],{"type":47,"value":2758},"references\u002Forchestration.md",{"type":47,"value":2760}," for advanced patterns",{"type":41,"tag":76,"props":2762,"children":2763},{},[],{"type":41,"tag":86,"props":2765,"children":2767},{"id":2766},"_4-orchestrator-workers-fan-outfan-in",[2768],{"type":47,"value":2769},"4. Orchestrator-Workers (Fan-out\u002FFan-in)",{"type":41,"tag":50,"props":2771,"children":2772},{},[2773],{"type":47,"value":2774},"Orchestrator extracts work items, fans out to workers, aggregates results.",{"type":41,"tag":63,"props":2776,"children":2778},{"className":99,"code":2777,"language":101,"meta":72,"style":72},"import { batch, task } from \"@trigger.dev\u002Fsdk\";\n\nexport const factChecker = task({\n  id: \"fact-checker\",\n  run: async ({ article }) => {\n    \u002F\u002F Step 1: Extract claims (sequential - need output first)\n    const { runs: [extractResult] } = await batch.triggerByTaskAndWait([\n      { task: extractClaims, payload: { article } },\n    ]);\n\n    if (!extractResult.ok) throw new Error(\"Failed to extract claims\");\n    const claims = extractResult.output;\n\n    \u002F\u002F Step 2: Fan-out - verify all claims in parallel\n    const { runs } = await batch.triggerByTaskAndWait(\n      claims.map(claim => ({ task: verifyClaim, payload: claim }))\n    );\n\n    \u002F\u002F Step 3: Fan-in - aggregate results\n    const verified = runs\n      .filter((r): r is typeof r & { ok: true } => r.ok)\n      .map(r => r.output);\n\n    return { claims, verifications: verified };\n  },\n});\n",[2779],{"type":41,"tag":70,"props":2780,"children":2781},{"__ignoreMap":72},[2782,2829,2836,2868,2896,2932,2940,3000,3048,3059,3066,3136,3169,3176,3184,3228,3306,3318,3325,3333,3354,3453,3496,3503,3539,3546],{"type":41,"tag":107,"props":2783,"children":2784},{"class":109,"line":110},[2785,2789,2793,2797,2801,2805,2809,2813,2817,2821,2825],{"type":41,"tag":107,"props":2786,"children":2787},{"style":114},[2788],{"type":47,"value":117},{"type":41,"tag":107,"props":2790,"children":2791},{"style":120},[2792],{"type":47,"value":123},{"type":41,"tag":107,"props":2794,"children":2795},{"style":126},[2796],{"type":47,"value":2056},{"type":41,"tag":107,"props":2798,"children":2799},{"style":120},[2800],{"type":47,"value":360},{"type":41,"tag":107,"props":2802,"children":2803},{"style":126},[2804],{"type":47,"value":129},{"type":41,"tag":107,"props":2806,"children":2807},{"style":120},[2808],{"type":47,"value":134},{"type":41,"tag":107,"props":2810,"children":2811},{"style":114},[2812],{"type":47,"value":139},{"type":41,"tag":107,"props":2814,"children":2815},{"style":120},[2816],{"type":47,"value":144},{"type":41,"tag":107,"props":2818,"children":2819},{"style":147},[2820],{"type":47,"value":150},{"type":41,"tag":107,"props":2822,"children":2823},{"style":120},[2824],{"type":47,"value":155},{"type":41,"tag":107,"props":2826,"children":2827},{"style":120},[2828],{"type":47,"value":160},{"type":41,"tag":107,"props":2830,"children":2831},{"class":109,"line":163},[2832],{"type":41,"tag":107,"props":2833,"children":2834},{"emptyLinePlaceholder":251},[2835],{"type":47,"value":254},{"type":41,"tag":107,"props":2837,"children":2838},{"class":109,"line":205},[2839,2843,2847,2852,2856,2860,2864],{"type":41,"tag":107,"props":2840,"children":2841},{"style":114},[2842],{"type":47,"value":262},{"type":41,"tag":107,"props":2844,"children":2845},{"style":265},[2846],{"type":47,"value":268},{"type":41,"tag":107,"props":2848,"children":2849},{"style":126},[2850],{"type":47,"value":2851}," factChecker ",{"type":41,"tag":107,"props":2853,"children":2854},{"style":120},[2855],{"type":47,"value":278},{"type":41,"tag":107,"props":2857,"children":2858},{"style":281},[2859],{"type":47,"value":129},{"type":41,"tag":107,"props":2861,"children":2862},{"style":126},[2863],{"type":47,"value":288},{"type":41,"tag":107,"props":2865,"children":2866},{"style":120},[2867],{"type":47,"value":293},{"type":41,"tag":107,"props":2869,"children":2870},{"class":109,"line":247},[2871,2875,2879,2883,2888,2892],{"type":41,"tag":107,"props":2872,"children":2873},{"style":300},[2874],{"type":47,"value":303},{"type":41,"tag":107,"props":2876,"children":2877},{"style":120},[2878],{"type":47,"value":308},{"type":41,"tag":107,"props":2880,"children":2881},{"style":120},[2882],{"type":47,"value":144},{"type":41,"tag":107,"props":2884,"children":2885},{"style":147},[2886],{"type":47,"value":2887},"fact-checker",{"type":41,"tag":107,"props":2889,"children":2890},{"style":120},[2891],{"type":47,"value":155},{"type":41,"tag":107,"props":2893,"children":2894},{"style":120},[2895],{"type":47,"value":326},{"type":41,"tag":107,"props":2897,"children":2898},{"class":109,"line":28},[2899,2903,2907,2911,2915,2920,2924,2928],{"type":41,"tag":107,"props":2900,"children":2901},{"style":281},[2902],{"type":47,"value":335},{"type":41,"tag":107,"props":2904,"children":2905},{"style":120},[2906],{"type":47,"value":308},{"type":41,"tag":107,"props":2908,"children":2909},{"style":265},[2910],{"type":47,"value":344},{"type":41,"tag":107,"props":2912,"children":2913},{"style":120},[2914],{"type":47,"value":349},{"type":41,"tag":107,"props":2916,"children":2917},{"style":352},[2918],{"type":47,"value":2919}," article",{"type":41,"tag":107,"props":2921,"children":2922},{"style":120},[2923],{"type":47,"value":379},{"type":41,"tag":107,"props":2925,"children":2926},{"style":265},[2927],{"type":47,"value":384},{"type":41,"tag":107,"props":2929,"children":2930},{"style":120},[2931],{"type":47,"value":389},{"type":41,"tag":107,"props":2933,"children":2934},{"class":109,"line":296},[2935],{"type":41,"tag":107,"props":2936,"children":2937},{"style":396},[2938],{"type":47,"value":2939},"    \u002F\u002F Step 1: Extract claims (sequential - need output first)\n",{"type":41,"tag":107,"props":2941,"children":2942},{"class":109,"line":329},[2943,2947,2951,2955,2959,2963,2968,2972,2976,2980,2984,2988,2992,2996],{"type":41,"tag":107,"props":2944,"children":2945},{"style":265},[2946],{"type":47,"value":408},{"type":41,"tag":107,"props":2948,"children":2949},{"style":120},[2950],{"type":47,"value":123},{"type":41,"tag":107,"props":2952,"children":2953},{"style":300},[2954],{"type":47,"value":2214},{"type":41,"tag":107,"props":2956,"children":2957},{"style":120},[2958],{"type":47,"value":308},{"type":41,"tag":107,"props":2960,"children":2961},{"style":120},[2962],{"type":47,"value":2223},{"type":41,"tag":107,"props":2964,"children":2965},{"style":126},[2966],{"type":47,"value":2967},"extractResult",{"type":41,"tag":107,"props":2969,"children":2970},{"style":120},[2971],{"type":47,"value":2251},{"type":41,"tag":107,"props":2973,"children":2974},{"style":120},[2975],{"type":47,"value":134},{"type":41,"tag":107,"props":2977,"children":2978},{"style":120},[2979],{"type":47,"value":418},{"type":41,"tag":107,"props":2981,"children":2982},{"style":114},[2983],{"type":47,"value":423},{"type":41,"tag":107,"props":2985,"children":2986},{"style":126},[2987],{"type":47,"value":2056},{"type":41,"tag":107,"props":2989,"children":2990},{"style":120},[2991],{"type":47,"value":579},{"type":41,"tag":107,"props":2993,"children":2994},{"style":281},[2995],{"type":47,"value":2276},{"type":41,"tag":107,"props":2997,"children":2998},{"style":300},[2999],{"type":47,"value":2281},{"type":41,"tag":107,"props":3001,"children":3002},{"class":109,"line":392},[3003,3007,3011,3015,3020,3024,3028,3032,3036,3040,3044],{"type":41,"tag":107,"props":3004,"children":3005},{"style":120},[3006],{"type":47,"value":2289},{"type":41,"tag":107,"props":3008,"children":3009},{"style":300},[3010],{"type":47,"value":129},{"type":41,"tag":107,"props":3012,"children":3013},{"style":120},[3014],{"type":47,"value":308},{"type":41,"tag":107,"props":3016,"children":3017},{"style":126},[3018],{"type":47,"value":3019}," extractClaims",{"type":41,"tag":107,"props":3021,"children":3022},{"style":120},[3023],{"type":47,"value":360},{"type":41,"tag":107,"props":3025,"children":3026},{"style":300},[3027],{"type":47,"value":2311},{"type":41,"tag":107,"props":3029,"children":3030},{"style":120},[3031],{"type":47,"value":308},{"type":41,"tag":107,"props":3033,"children":3034},{"style":120},[3035],{"type":47,"value":123},{"type":41,"tag":107,"props":3037,"children":3038},{"style":126},[3039],{"type":47,"value":2919},{"type":41,"tag":107,"props":3041,"children":3042},{"style":120},[3043],{"type":47,"value":134},{"type":41,"tag":107,"props":3045,"children":3046},{"style":120},[3047],{"type":47,"value":1694},{"type":41,"tag":107,"props":3049,"children":3050},{"class":109,"line":402},[3051,3055],{"type":41,"tag":107,"props":3052,"children":3053},{"style":300},[3054],{"type":47,"value":2435},{"type":41,"tag":107,"props":3056,"children":3057},{"style":120},[3058],{"type":47,"value":160},{"type":41,"tag":107,"props":3060,"children":3061},{"class":109,"line":438},[3062],{"type":41,"tag":107,"props":3063,"children":3064},{"emptyLinePlaceholder":251},[3065],{"type":47,"value":254},{"type":41,"tag":107,"props":3067,"children":3068},{"class":109,"line":481},[3069,3073,3077,3082,3086,3090,3094,3098,3103,3107,3111,3115,3119,3124,3128,3132],{"type":41,"tag":107,"props":3070,"children":3071},{"style":114},[3072],{"type":47,"value":637},{"type":41,"tag":107,"props":3074,"children":3075},{"style":300},[3076],{"type":47,"value":642},{"type":41,"tag":107,"props":3078,"children":3079},{"style":120},[3080],{"type":47,"value":3081},"!",{"type":41,"tag":107,"props":3083,"children":3084},{"style":126},[3085],{"type":47,"value":2967},{"type":41,"tag":107,"props":3087,"children":3088},{"style":120},[3089],{"type":47,"value":579},{"type":41,"tag":107,"props":3091,"children":3092},{"style":126},[3093],{"type":47,"value":2479},{"type":41,"tag":107,"props":3095,"children":3096},{"style":300},[3097],{"type":47,"value":661},{"type":41,"tag":107,"props":3099,"children":3100},{"style":114},[3101],{"type":47,"value":3102},"throw",{"type":41,"tag":107,"props":3104,"children":3105},{"style":120},[3106],{"type":47,"value":679},{"type":41,"tag":107,"props":3108,"children":3109},{"style":281},[3110],{"type":47,"value":684},{"type":41,"tag":107,"props":3112,"children":3113},{"style":300},[3114],{"type":47,"value":288},{"type":41,"tag":107,"props":3116,"children":3117},{"style":120},[3118],{"type":47,"value":155},{"type":41,"tag":107,"props":3120,"children":3121},{"style":147},[3122],{"type":47,"value":3123},"Failed to extract claims",{"type":41,"tag":107,"props":3125,"children":3126},{"style":120},[3127],{"type":47,"value":155},{"type":41,"tag":107,"props":3129,"children":3130},{"style":300},[3131],{"type":47,"value":474},{"type":41,"tag":107,"props":3133,"children":3134},{"style":120},[3135],{"type":47,"value":160},{"type":41,"tag":107,"props":3137,"children":3138},{"class":109,"line":522},[3139,3143,3148,3152,3157,3161,3165],{"type":41,"tag":107,"props":3140,"children":3141},{"style":265},[3142],{"type":47,"value":408},{"type":41,"tag":107,"props":3144,"children":3145},{"style":126},[3146],{"type":47,"value":3147}," claims",{"type":41,"tag":107,"props":3149,"children":3150},{"style":120},[3151],{"type":47,"value":418},{"type":41,"tag":107,"props":3153,"children":3154},{"style":126},[3155],{"type":47,"value":3156}," extractResult",{"type":41,"tag":107,"props":3158,"children":3159},{"style":120},[3160],{"type":47,"value":579},{"type":41,"tag":107,"props":3162,"children":3163},{"style":126},[3164],{"type":47,"value":2497},{"type":41,"tag":107,"props":3166,"children":3167},{"style":120},[3168],{"type":47,"value":160},{"type":41,"tag":107,"props":3170,"children":3171},{"class":109,"line":539},[3172],{"type":41,"tag":107,"props":3173,"children":3174},{"emptyLinePlaceholder":251},[3175],{"type":47,"value":254},{"type":41,"tag":107,"props":3177,"children":3178},{"class":109,"line":547},[3179],{"type":41,"tag":107,"props":3180,"children":3181},{"style":396},[3182],{"type":47,"value":3183},"    \u002F\u002F Step 2: Fan-out - verify all claims in parallel\n",{"type":41,"tag":107,"props":3185,"children":3186},{"class":109,"line":556},[3187,3191,3195,3199,3203,3207,3211,3215,3219,3223],{"type":41,"tag":107,"props":3188,"children":3189},{"style":265},[3190],{"type":47,"value":408},{"type":41,"tag":107,"props":3192,"children":3193},{"style":120},[3194],{"type":47,"value":123},{"type":41,"tag":107,"props":3196,"children":3197},{"style":126},[3198],{"type":47,"value":2214},{"type":41,"tag":107,"props":3200,"children":3201},{"style":120},[3202],{"type":47,"value":134},{"type":41,"tag":107,"props":3204,"children":3205},{"style":120},[3206],{"type":47,"value":418},{"type":41,"tag":107,"props":3208,"children":3209},{"style":114},[3210],{"type":47,"value":423},{"type":41,"tag":107,"props":3212,"children":3213},{"style":126},[3214],{"type":47,"value":2056},{"type":41,"tag":107,"props":3216,"children":3217},{"style":120},[3218],{"type":47,"value":579},{"type":41,"tag":107,"props":3220,"children":3221},{"style":281},[3222],{"type":47,"value":2276},{"type":41,"tag":107,"props":3224,"children":3225},{"style":300},[3226],{"type":47,"value":3227},"(\n",{"type":41,"tag":107,"props":3229,"children":3230},{"class":109,"line":631},[3231,3236,3240,3245,3249,3254,3258,3262,3267,3271,3275,3280,3284,3288,3292,3297,3301],{"type":41,"tag":107,"props":3232,"children":3233},{"style":126},[3234],{"type":47,"value":3235},"      claims",{"type":41,"tag":107,"props":3237,"children":3238},{"style":120},[3239],{"type":47,"value":579},{"type":41,"tag":107,"props":3241,"children":3242},{"style":281},[3243],{"type":47,"value":3244},"map",{"type":41,"tag":107,"props":3246,"children":3247},{"style":300},[3248],{"type":47,"value":288},{"type":41,"tag":107,"props":3250,"children":3251},{"style":352},[3252],{"type":47,"value":3253},"claim",{"type":41,"tag":107,"props":3255,"children":3256},{"style":265},[3257],{"type":47,"value":384},{"type":41,"tag":107,"props":3259,"children":3260},{"style":300},[3261],{"type":47,"value":642},{"type":41,"tag":107,"props":3263,"children":3264},{"style":120},[3265],{"type":47,"value":3266},"{",{"type":41,"tag":107,"props":3268,"children":3269},{"style":300},[3270],{"type":47,"value":129},{"type":41,"tag":107,"props":3272,"children":3273},{"style":120},[3274],{"type":47,"value":308},{"type":41,"tag":107,"props":3276,"children":3277},{"style":126},[3278],{"type":47,"value":3279}," verifyClaim",{"type":41,"tag":107,"props":3281,"children":3282},{"style":120},[3283],{"type":47,"value":360},{"type":41,"tag":107,"props":3285,"children":3286},{"style":300},[3287],{"type":47,"value":2311},{"type":41,"tag":107,"props":3289,"children":3290},{"style":120},[3291],{"type":47,"value":308},{"type":41,"tag":107,"props":3293,"children":3294},{"style":126},[3295],{"type":47,"value":3296}," claim",{"type":41,"tag":107,"props":3298,"children":3299},{"style":120},[3300],{"type":47,"value":134},{"type":41,"tag":107,"props":3302,"children":3303},{"style":300},[3304],{"type":47,"value":3305},"))\n",{"type":41,"tag":107,"props":3307,"children":3308},{"class":109,"line":668},[3309,3314],{"type":41,"tag":107,"props":3310,"children":3311},{"style":300},[3312],{"type":47,"value":3313},"    )",{"type":41,"tag":107,"props":3315,"children":3316},{"style":120},[3317],{"type":47,"value":160},{"type":41,"tag":107,"props":3319,"children":3320},{"class":109,"line":740},[3321],{"type":41,"tag":107,"props":3322,"children":3323},{"emptyLinePlaceholder":251},[3324],{"type":47,"value":254},{"type":41,"tag":107,"props":3326,"children":3327},{"class":109,"line":749},[3328],{"type":41,"tag":107,"props":3329,"children":3330},{"style":396},[3331],{"type":47,"value":3332},"    \u002F\u002F Step 3: Fan-in - aggregate results\n",{"type":41,"tag":107,"props":3334,"children":3335},{"class":109,"line":757},[3336,3340,3345,3349],{"type":41,"tag":107,"props":3337,"children":3338},{"style":265},[3339],{"type":47,"value":408},{"type":41,"tag":107,"props":3341,"children":3342},{"style":126},[3343],{"type":47,"value":3344}," verified",{"type":41,"tag":107,"props":3346,"children":3347},{"style":120},[3348],{"type":47,"value":418},{"type":41,"tag":107,"props":3350,"children":3351},{"style":126},[3352],{"type":47,"value":3353}," runs\n",{"type":41,"tag":107,"props":3355,"children":3356},{"class":109,"line":766},[3357,3362,3367,3371,3375,3380,3385,3390,3395,3400,3404,3409,3413,3418,3422,3428,3432,3436,3440,3444,3448],{"type":41,"tag":107,"props":3358,"children":3359},{"style":120},[3360],{"type":47,"value":3361},"      .",{"type":41,"tag":107,"props":3363,"children":3364},{"style":281},[3365],{"type":47,"value":3366},"filter",{"type":41,"tag":107,"props":3368,"children":3369},{"style":300},[3370],{"type":47,"value":288},{"type":41,"tag":107,"props":3372,"children":3373},{"style":120},[3374],{"type":47,"value":288},{"type":41,"tag":107,"props":3376,"children":3377},{"style":352},[3378],{"type":47,"value":3379},"r",{"type":41,"tag":107,"props":3381,"children":3382},{"style":120},[3383],{"type":47,"value":3384},"):",{"type":41,"tag":107,"props":3386,"children":3387},{"style":352},[3388],{"type":47,"value":3389}," r",{"type":41,"tag":107,"props":3391,"children":3392},{"style":120},[3393],{"type":47,"value":3394}," is",{"type":41,"tag":107,"props":3396,"children":3397},{"style":120},[3398],{"type":47,"value":3399}," typeof",{"type":41,"tag":107,"props":3401,"children":3402},{"style":126},[3403],{"type":47,"value":3389},{"type":41,"tag":107,"props":3405,"children":3406},{"style":120},[3407],{"type":47,"value":3408}," &",{"type":41,"tag":107,"props":3410,"children":3411},{"style":120},[3412],{"type":47,"value":123},{"type":41,"tag":107,"props":3414,"children":3415},{"style":300},[3416],{"type":47,"value":3417}," ok",{"type":41,"tag":107,"props":3419,"children":3420},{"style":120},[3421],{"type":47,"value":308},{"type":41,"tag":107,"props":3423,"children":3425},{"style":3424},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[3426],{"type":47,"value":3427}," true",{"type":41,"tag":107,"props":3429,"children":3430},{"style":120},[3431],{"type":47,"value":134},{"type":41,"tag":107,"props":3433,"children":3434},{"style":265},[3435],{"type":47,"value":384},{"type":41,"tag":107,"props":3437,"children":3438},{"style":126},[3439],{"type":47,"value":3389},{"type":41,"tag":107,"props":3441,"children":3442},{"style":120},[3443],{"type":47,"value":579},{"type":41,"tag":107,"props":3445,"children":3446},{"style":126},[3447],{"type":47,"value":2479},{"type":41,"tag":107,"props":3449,"children":3450},{"style":300},[3451],{"type":47,"value":3452},")\n",{"type":41,"tag":107,"props":3454,"children":3455},{"class":109,"line":799},[3456,3460,3464,3468,3472,3476,3480,3484,3488,3492],{"type":41,"tag":107,"props":3457,"children":3458},{"style":120},[3459],{"type":47,"value":3361},{"type":41,"tag":107,"props":3461,"children":3462},{"style":281},[3463],{"type":47,"value":3244},{"type":41,"tag":107,"props":3465,"children":3466},{"style":300},[3467],{"type":47,"value":288},{"type":41,"tag":107,"props":3469,"children":3470},{"style":352},[3471],{"type":47,"value":3379},{"type":41,"tag":107,"props":3473,"children":3474},{"style":265},[3475],{"type":47,"value":384},{"type":41,"tag":107,"props":3477,"children":3478},{"style":126},[3479],{"type":47,"value":3389},{"type":41,"tag":107,"props":3481,"children":3482},{"style":120},[3483],{"type":47,"value":579},{"type":41,"tag":107,"props":3485,"children":3486},{"style":126},[3487],{"type":47,"value":2497},{"type":41,"tag":107,"props":3489,"children":3490},{"style":300},[3491],{"type":47,"value":474},{"type":41,"tag":107,"props":3493,"children":3494},{"style":120},[3495],{"type":47,"value":160},{"type":41,"tag":107,"props":3497,"children":3498},{"class":109,"line":839},[3499],{"type":41,"tag":107,"props":3500,"children":3501},{"emptyLinePlaceholder":251},[3502],{"type":47,"value":254},{"type":41,"tag":107,"props":3504,"children":3505},{"class":109,"line":903},[3506,3510,3514,3518,3522,3527,3531,3535],{"type":41,"tag":107,"props":3507,"children":3508},{"style":114},[3509],{"type":47,"value":933},{"type":41,"tag":107,"props":3511,"children":3512},{"style":120},[3513],{"type":47,"value":123},{"type":41,"tag":107,"props":3515,"children":3516},{"style":126},[3517],{"type":47,"value":3147},{"type":41,"tag":107,"props":3519,"children":3520},{"style":120},[3521],{"type":47,"value":360},{"type":41,"tag":107,"props":3523,"children":3524},{"style":300},[3525],{"type":47,"value":3526}," verifications",{"type":41,"tag":107,"props":3528,"children":3529},{"style":120},[3530],{"type":47,"value":308},{"type":41,"tag":107,"props":3532,"children":3533},{"style":126},[3534],{"type":47,"value":3344},{"type":41,"tag":107,"props":3536,"children":3537},{"style":120},[3538],{"type":47,"value":986},{"type":41,"tag":107,"props":3540,"children":3541},{"class":109,"line":919},[3542],{"type":41,"tag":107,"props":3543,"children":3544},{"style":120},[3545],{"type":47,"value":995},{"type":41,"tag":107,"props":3547,"children":3548},{"class":109,"line":927},[3549,3553,3557],{"type":41,"tag":107,"props":3550,"children":3551},{"style":120},[3552],{"type":47,"value":711},{"type":41,"tag":107,"props":3554,"children":3555},{"style":126},[3556],{"type":47,"value":474},{"type":41,"tag":107,"props":3558,"children":3559},{"style":120},[3560],{"type":47,"value":160},{"type":41,"tag":76,"props":3562,"children":3563},{},[],{"type":41,"tag":86,"props":3565,"children":3567},{"id":3566},"_5-evaluator-optimizer-self-refining-loop",[3568],{"type":47,"value":3569},"5. Evaluator-Optimizer (Self-Refining Loop)",{"type":41,"tag":50,"props":3571,"children":3572},{},[3573],{"type":47,"value":3574},"Generate → Evaluate → Retry with feedback until approved.",{"type":41,"tag":63,"props":3576,"children":3578},{"className":99,"code":3577,"language":101,"meta":72,"style":72},"import { task } from \"@trigger.dev\u002Fsdk\";\n\nexport const refineTranslation = task({\n  id: \"refine-translation\",\n  run: async ({ text, targetLanguage, feedback, attempt = 0 }) => {\n    \u002F\u002F Bail condition\n    if (attempt >= 5) {\n      return { text, status: \"MAX_ATTEMPTS\", attempts: attempt };\n    }\n\n    \u002F\u002F Generate (with feedback if retrying)\n    const prompt = feedback\n      ? `Improve this translation based on feedback:\\n${feedback}\\n\\nOriginal: ${text}`\n      : `Translate to ${targetLanguage}: ${text}`;\n\n    const translation = await generateText({\n      model: openai(\"gpt-4o\"),\n      prompt,\n    });\n\n    \u002F\u002F Evaluate\n    const evaluation = await generateText({\n      model: openai(\"gpt-4o\"),\n      prompt: `Evaluate translation quality. Reply APPROVED or provide specific feedback:\\n${translation.text}`,\n    });\n\n    if (evaluation.text.includes(\"APPROVED\")) {\n      return { text: translation.text, status: \"APPROVED\", attempts: attempt + 1 };\n    }\n\n    \u002F\u002F Recursive self-call with feedback\n    return refineTranslation.triggerAndWait({\n      text,\n      targetLanguage,\n      feedback: evaluation.text,\n      attempt: attempt + 1,\n    }).unwrap();\n  },\n});\n",[3579],{"type":41,"tag":70,"props":3580,"children":3581},{"__ignoreMap":72},[3582,3621,3628,3660,3688,3759,3767,3801,3863,3870,3877,3885,3906,3964,4012,4019,4051,4090,4101,4116,4123,4131,4163,4202,4251,4266,4273,4332,4417,4424,4431,4439,4468,4480,4492,4520,4548,4576,4583],{"type":41,"tag":107,"props":3583,"children":3584},{"class":109,"line":110},[3585,3589,3593,3597,3601,3605,3609,3613,3617],{"type":41,"tag":107,"props":3586,"children":3587},{"style":114},[3588],{"type":47,"value":117},{"type":41,"tag":107,"props":3590,"children":3591},{"style":120},[3592],{"type":47,"value":123},{"type":41,"tag":107,"props":3594,"children":3595},{"style":126},[3596],{"type":47,"value":129},{"type":41,"tag":107,"props":3598,"children":3599},{"style":120},[3600],{"type":47,"value":134},{"type":41,"tag":107,"props":3602,"children":3603},{"style":114},[3604],{"type":47,"value":139},{"type":41,"tag":107,"props":3606,"children":3607},{"style":120},[3608],{"type":47,"value":144},{"type":41,"tag":107,"props":3610,"children":3611},{"style":147},[3612],{"type":47,"value":150},{"type":41,"tag":107,"props":3614,"children":3615},{"style":120},[3616],{"type":47,"value":155},{"type":41,"tag":107,"props":3618,"children":3619},{"style":120},[3620],{"type":47,"value":160},{"type":41,"tag":107,"props":3622,"children":3623},{"class":109,"line":163},[3624],{"type":41,"tag":107,"props":3625,"children":3626},{"emptyLinePlaceholder":251},[3627],{"type":47,"value":254},{"type":41,"tag":107,"props":3629,"children":3630},{"class":109,"line":205},[3631,3635,3639,3644,3648,3652,3656],{"type":41,"tag":107,"props":3632,"children":3633},{"style":114},[3634],{"type":47,"value":262},{"type":41,"tag":107,"props":3636,"children":3637},{"style":265},[3638],{"type":47,"value":268},{"type":41,"tag":107,"props":3640,"children":3641},{"style":126},[3642],{"type":47,"value":3643}," refineTranslation ",{"type":41,"tag":107,"props":3645,"children":3646},{"style":120},[3647],{"type":47,"value":278},{"type":41,"tag":107,"props":3649,"children":3650},{"style":281},[3651],{"type":47,"value":129},{"type":41,"tag":107,"props":3653,"children":3654},{"style":126},[3655],{"type":47,"value":288},{"type":41,"tag":107,"props":3657,"children":3658},{"style":120},[3659],{"type":47,"value":293},{"type":41,"tag":107,"props":3661,"children":3662},{"class":109,"line":247},[3663,3667,3671,3675,3680,3684],{"type":41,"tag":107,"props":3664,"children":3665},{"style":300},[3666],{"type":47,"value":303},{"type":41,"tag":107,"props":3668,"children":3669},{"style":120},[3670],{"type":47,"value":308},{"type":41,"tag":107,"props":3672,"children":3673},{"style":120},[3674],{"type":47,"value":144},{"type":41,"tag":107,"props":3676,"children":3677},{"style":147},[3678],{"type":47,"value":3679},"refine-translation",{"type":41,"tag":107,"props":3681,"children":3682},{"style":120},[3683],{"type":47,"value":155},{"type":41,"tag":107,"props":3685,"children":3686},{"style":120},[3687],{"type":47,"value":326},{"type":41,"tag":107,"props":3689,"children":3690},{"class":109,"line":28},[3691,3695,3699,3703,3707,3711,3715,3719,3723,3728,3732,3737,3741,3747,3751,3755],{"type":41,"tag":107,"props":3692,"children":3693},{"style":281},[3694],{"type":47,"value":335},{"type":41,"tag":107,"props":3696,"children":3697},{"style":120},[3698],{"type":47,"value":308},{"type":41,"tag":107,"props":3700,"children":3701},{"style":265},[3702],{"type":47,"value":344},{"type":41,"tag":107,"props":3704,"children":3705},{"style":120},[3706],{"type":47,"value":349},{"type":41,"tag":107,"props":3708,"children":3709},{"style":352},[3710],{"type":47,"value":355},{"type":41,"tag":107,"props":3712,"children":3713},{"style":120},[3714],{"type":47,"value":360},{"type":41,"tag":107,"props":3716,"children":3717},{"style":352},[3718],{"type":47,"value":365},{"type":41,"tag":107,"props":3720,"children":3721},{"style":120},[3722],{"type":47,"value":360},{"type":41,"tag":107,"props":3724,"children":3725},{"style":352},[3726],{"type":47,"value":3727}," feedback",{"type":41,"tag":107,"props":3729,"children":3730},{"style":120},[3731],{"type":47,"value":360},{"type":41,"tag":107,"props":3733,"children":3734},{"style":352},[3735],{"type":47,"value":3736}," attempt",{"type":41,"tag":107,"props":3738,"children":3739},{"style":120},[3740],{"type":47,"value":418},{"type":41,"tag":107,"props":3742,"children":3744},{"style":3743},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[3745],{"type":47,"value":3746}," 0",{"type":41,"tag":107,"props":3748,"children":3749},{"style":120},[3750],{"type":47,"value":379},{"type":41,"tag":107,"props":3752,"children":3753},{"style":265},[3754],{"type":47,"value":384},{"type":41,"tag":107,"props":3756,"children":3757},{"style":120},[3758],{"type":47,"value":389},{"type":41,"tag":107,"props":3760,"children":3761},{"class":109,"line":296},[3762],{"type":41,"tag":107,"props":3763,"children":3764},{"style":396},[3765],{"type":47,"value":3766},"    \u002F\u002F Bail condition\n",{"type":41,"tag":107,"props":3768,"children":3769},{"class":109,"line":329},[3770,3774,3778,3783,3788,3793,3797],{"type":41,"tag":107,"props":3771,"children":3772},{"style":114},[3773],{"type":47,"value":637},{"type":41,"tag":107,"props":3775,"children":3776},{"style":300},[3777],{"type":47,"value":642},{"type":41,"tag":107,"props":3779,"children":3780},{"style":126},[3781],{"type":47,"value":3782},"attempt",{"type":41,"tag":107,"props":3784,"children":3785},{"style":120},[3786],{"type":47,"value":3787}," >=",{"type":41,"tag":107,"props":3789,"children":3790},{"style":3743},[3791],{"type":47,"value":3792}," 5",{"type":41,"tag":107,"props":3794,"children":3795},{"style":300},[3796],{"type":47,"value":661},{"type":41,"tag":107,"props":3798,"children":3799},{"style":120},[3800],{"type":47,"value":293},{"type":41,"tag":107,"props":3802,"children":3803},{"class":109,"line":392},[3804,3808,3812,3816,3820,3825,3829,3833,3838,3842,3846,3851,3855,3859],{"type":41,"tag":107,"props":3805,"children":3806},{"style":114},[3807],{"type":47,"value":2522},{"type":41,"tag":107,"props":3809,"children":3810},{"style":120},[3811],{"type":47,"value":123},{"type":41,"tag":107,"props":3813,"children":3814},{"style":126},[3815],{"type":47,"value":355},{"type":41,"tag":107,"props":3817,"children":3818},{"style":120},[3819],{"type":47,"value":360},{"type":41,"tag":107,"props":3821,"children":3822},{"style":300},[3823],{"type":47,"value":3824}," status",{"type":41,"tag":107,"props":3826,"children":3827},{"style":120},[3828],{"type":47,"value":308},{"type":41,"tag":107,"props":3830,"children":3831},{"style":120},[3832],{"type":47,"value":144},{"type":41,"tag":107,"props":3834,"children":3835},{"style":147},[3836],{"type":47,"value":3837},"MAX_ATTEMPTS",{"type":41,"tag":107,"props":3839,"children":3840},{"style":120},[3841],{"type":47,"value":155},{"type":41,"tag":107,"props":3843,"children":3844},{"style":120},[3845],{"type":47,"value":360},{"type":41,"tag":107,"props":3847,"children":3848},{"style":300},[3849],{"type":47,"value":3850}," attempts",{"type":41,"tag":107,"props":3852,"children":3853},{"style":120},[3854],{"type":47,"value":308},{"type":41,"tag":107,"props":3856,"children":3857},{"style":126},[3858],{"type":47,"value":3736},{"type":41,"tag":107,"props":3860,"children":3861},{"style":120},[3862],{"type":47,"value":986},{"type":41,"tag":107,"props":3864,"children":3865},{"class":109,"line":402},[3866],{"type":41,"tag":107,"props":3867,"children":3868},{"style":120},[3869],{"type":47,"value":746},{"type":41,"tag":107,"props":3871,"children":3872},{"class":109,"line":438},[3873],{"type":41,"tag":107,"props":3874,"children":3875},{"emptyLinePlaceholder":251},[3876],{"type":47,"value":254},{"type":41,"tag":107,"props":3878,"children":3879},{"class":109,"line":481},[3880],{"type":41,"tag":107,"props":3881,"children":3882},{"style":396},[3883],{"type":47,"value":3884},"    \u002F\u002F Generate (with feedback if retrying)\n",{"type":41,"tag":107,"props":3886,"children":3887},{"class":109,"line":522},[3888,3892,3897,3901],{"type":41,"tag":107,"props":3889,"children":3890},{"style":265},[3891],{"type":47,"value":408},{"type":41,"tag":107,"props":3893,"children":3894},{"style":126},[3895],{"type":47,"value":3896}," prompt",{"type":41,"tag":107,"props":3898,"children":3899},{"style":120},[3900],{"type":47,"value":418},{"type":41,"tag":107,"props":3902,"children":3903},{"style":126},[3904],{"type":47,"value":3905}," feedback\n",{"type":41,"tag":107,"props":3907,"children":3908},{"class":109,"line":539},[3909,3914,3918,3923,3928,3932,3937,3941,3946,3951,3955,3959],{"type":41,"tag":107,"props":3910,"children":3911},{"style":120},[3912],{"type":47,"value":3913},"      ?",{"type":41,"tag":107,"props":3915,"children":3916},{"style":120},[3917],{"type":47,"value":496},{"type":41,"tag":107,"props":3919,"children":3920},{"style":147},[3921],{"type":47,"value":3922},"Improve this translation based on feedback:",{"type":41,"tag":107,"props":3924,"children":3925},{"style":126},[3926],{"type":47,"value":3927},"\\n",{"type":41,"tag":107,"props":3929,"children":3930},{"style":120},[3931],{"type":47,"value":506},{"type":41,"tag":107,"props":3933,"children":3934},{"style":126},[3935],{"type":47,"value":3936},"feedback",{"type":41,"tag":107,"props":3938,"children":3939},{"style":120},[3940],{"type":47,"value":711},{"type":41,"tag":107,"props":3942,"children":3943},{"style":126},[3944],{"type":47,"value":3945},"\\n\\n",{"type":41,"tag":107,"props":3947,"children":3948},{"style":147},[3949],{"type":47,"value":3950},"Original: ",{"type":41,"tag":107,"props":3952,"children":3953},{"style":120},[3954],{"type":47,"value":506},{"type":41,"tag":107,"props":3956,"children":3957},{"style":126},[3958],{"type":47,"value":47},{"type":41,"tag":107,"props":3960,"children":3961},{"style":120},[3962],{"type":47,"value":3963},"}`\n",{"type":41,"tag":107,"props":3965,"children":3966},{"class":109,"line":547},[3967,3972,3976,3980,3984,3988,3992,3996,4000,4004,4008],{"type":41,"tag":107,"props":3968,"children":3969},{"style":120},[3970],{"type":47,"value":3971},"      :",{"type":41,"tag":107,"props":3973,"children":3974},{"style":120},[3975],{"type":47,"value":496},{"type":41,"tag":107,"props":3977,"children":3978},{"style":147},[3979],{"type":47,"value":857},{"type":41,"tag":107,"props":3981,"children":3982},{"style":120},[3983],{"type":47,"value":506},{"type":41,"tag":107,"props":3985,"children":3986},{"style":126},[3987],{"type":47,"value":866},{"type":41,"tag":107,"props":3989,"children":3990},{"style":120},[3991],{"type":47,"value":711},{"type":41,"tag":107,"props":3993,"children":3994},{"style":147},[3995],{"type":47,"value":875},{"type":41,"tag":107,"props":3997,"children":3998},{"style":120},[3999],{"type":47,"value":506},{"type":41,"tag":107,"props":4001,"children":4002},{"style":126},[4003],{"type":47,"value":47},{"type":41,"tag":107,"props":4005,"children":4006},{"style":120},[4007],{"type":47,"value":515},{"type":41,"tag":107,"props":4009,"children":4010},{"style":120},[4011],{"type":47,"value":160},{"type":41,"tag":107,"props":4013,"children":4014},{"class":109,"line":556},[4015],{"type":41,"tag":107,"props":4016,"children":4017},{"emptyLinePlaceholder":251},[4018],{"type":47,"value":254},{"type":41,"tag":107,"props":4020,"children":4021},{"class":109,"line":631},[4022,4026,4031,4035,4039,4043,4047],{"type":41,"tag":107,"props":4023,"children":4024},{"style":265},[4025],{"type":47,"value":408},{"type":41,"tag":107,"props":4027,"children":4028},{"style":126},[4029],{"type":47,"value":4030}," translation",{"type":41,"tag":107,"props":4032,"children":4033},{"style":120},[4034],{"type":47,"value":418},{"type":41,"tag":107,"props":4036,"children":4037},{"style":114},[4038],{"type":47,"value":423},{"type":41,"tag":107,"props":4040,"children":4041},{"style":281},[4042],{"type":47,"value":177},{"type":41,"tag":107,"props":4044,"children":4045},{"style":300},[4046],{"type":47,"value":288},{"type":41,"tag":107,"props":4048,"children":4049},{"style":120},[4050],{"type":47,"value":293},{"type":41,"tag":107,"props":4052,"children":4053},{"class":109,"line":668},[4054,4058,4062,4066,4070,4074,4078,4082,4086],{"type":41,"tag":107,"props":4055,"children":4056},{"style":300},[4057],{"type":47,"value":444},{"type":41,"tag":107,"props":4059,"children":4060},{"style":120},[4061],{"type":47,"value":308},{"type":41,"tag":107,"props":4063,"children":4064},{"style":281},[4065],{"type":47,"value":219},{"type":41,"tag":107,"props":4067,"children":4068},{"style":300},[4069],{"type":47,"value":288},{"type":41,"tag":107,"props":4071,"children":4072},{"style":120},[4073],{"type":47,"value":155},{"type":41,"tag":107,"props":4075,"children":4076},{"style":147},[4077],{"type":47,"value":465},{"type":41,"tag":107,"props":4079,"children":4080},{"style":120},[4081],{"type":47,"value":155},{"type":41,"tag":107,"props":4083,"children":4084},{"style":300},[4085],{"type":47,"value":474},{"type":41,"tag":107,"props":4087,"children":4088},{"style":120},[4089],{"type":47,"value":326},{"type":41,"tag":107,"props":4091,"children":4092},{"class":109,"line":740},[4093,4097],{"type":41,"tag":107,"props":4094,"children":4095},{"style":126},[4096],{"type":47,"value":487},{"type":41,"tag":107,"props":4098,"children":4099},{"style":120},[4100],{"type":47,"value":326},{"type":41,"tag":107,"props":4102,"children":4103},{"class":109,"line":749},[4104,4108,4112],{"type":41,"tag":107,"props":4105,"children":4106},{"style":120},[4107],{"type":47,"value":528},{"type":41,"tag":107,"props":4109,"children":4110},{"style":300},[4111],{"type":47,"value":474},{"type":41,"tag":107,"props":4113,"children":4114},{"style":120},[4115],{"type":47,"value":160},{"type":41,"tag":107,"props":4117,"children":4118},{"class":109,"line":757},[4119],{"type":41,"tag":107,"props":4120,"children":4121},{"emptyLinePlaceholder":251},[4122],{"type":47,"value":254},{"type":41,"tag":107,"props":4124,"children":4125},{"class":109,"line":766},[4126],{"type":41,"tag":107,"props":4127,"children":4128},{"style":396},[4129],{"type":47,"value":4130},"    \u002F\u002F Evaluate\n",{"type":41,"tag":107,"props":4132,"children":4133},{"class":109,"line":799},[4134,4138,4143,4147,4151,4155,4159],{"type":41,"tag":107,"props":4135,"children":4136},{"style":265},[4137],{"type":47,"value":408},{"type":41,"tag":107,"props":4139,"children":4140},{"style":126},[4141],{"type":47,"value":4142}," evaluation",{"type":41,"tag":107,"props":4144,"children":4145},{"style":120},[4146],{"type":47,"value":418},{"type":41,"tag":107,"props":4148,"children":4149},{"style":114},[4150],{"type":47,"value":423},{"type":41,"tag":107,"props":4152,"children":4153},{"style":281},[4154],{"type":47,"value":177},{"type":41,"tag":107,"props":4156,"children":4157},{"style":300},[4158],{"type":47,"value":288},{"type":41,"tag":107,"props":4160,"children":4161},{"style":120},[4162],{"type":47,"value":293},{"type":41,"tag":107,"props":4164,"children":4165},{"class":109,"line":839},[4166,4170,4174,4178,4182,4186,4190,4194,4198],{"type":41,"tag":107,"props":4167,"children":4168},{"style":300},[4169],{"type":47,"value":444},{"type":41,"tag":107,"props":4171,"children":4172},{"style":120},[4173],{"type":47,"value":308},{"type":41,"tag":107,"props":4175,"children":4176},{"style":281},[4177],{"type":47,"value":219},{"type":41,"tag":107,"props":4179,"children":4180},{"style":300},[4181],{"type":47,"value":288},{"type":41,"tag":107,"props":4183,"children":4184},{"style":120},[4185],{"type":47,"value":155},{"type":41,"tag":107,"props":4187,"children":4188},{"style":147},[4189],{"type":47,"value":465},{"type":41,"tag":107,"props":4191,"children":4192},{"style":120},[4193],{"type":47,"value":155},{"type":41,"tag":107,"props":4195,"children":4196},{"style":300},[4197],{"type":47,"value":474},{"type":41,"tag":107,"props":4199,"children":4200},{"style":120},[4201],{"type":47,"value":326},{"type":41,"tag":107,"props":4203,"children":4204},{"class":109,"line":903},[4205,4209,4213,4217,4222,4226,4230,4235,4239,4243,4247],{"type":41,"tag":107,"props":4206,"children":4207},{"style":300},[4208],{"type":47,"value":487},{"type":41,"tag":107,"props":4210,"children":4211},{"style":120},[4212],{"type":47,"value":308},{"type":41,"tag":107,"props":4214,"children":4215},{"style":120},[4216],{"type":47,"value":496},{"type":41,"tag":107,"props":4218,"children":4219},{"style":147},[4220],{"type":47,"value":4221},"Evaluate translation quality. Reply APPROVED or provide specific feedback:",{"type":41,"tag":107,"props":4223,"children":4224},{"style":126},[4225],{"type":47,"value":3927},{"type":41,"tag":107,"props":4227,"children":4228},{"style":120},[4229],{"type":47,"value":506},{"type":41,"tag":107,"props":4231,"children":4232},{"style":126},[4233],{"type":47,"value":4234},"translation",{"type":41,"tag":107,"props":4236,"children":4237},{"style":120},[4238],{"type":47,"value":579},{"type":41,"tag":107,"props":4240,"children":4241},{"style":126},[4242],{"type":47,"value":47},{"type":41,"tag":107,"props":4244,"children":4245},{"style":120},[4246],{"type":47,"value":515},{"type":41,"tag":107,"props":4248,"children":4249},{"style":120},[4250],{"type":47,"value":326},{"type":41,"tag":107,"props":4252,"children":4253},{"class":109,"line":919},[4254,4258,4262],{"type":41,"tag":107,"props":4255,"children":4256},{"style":120},[4257],{"type":47,"value":528},{"type":41,"tag":107,"props":4259,"children":4260},{"style":300},[4261],{"type":47,"value":474},{"type":41,"tag":107,"props":4263,"children":4264},{"style":120},[4265],{"type":47,"value":160},{"type":41,"tag":107,"props":4267,"children":4268},{"class":109,"line":927},[4269],{"type":41,"tag":107,"props":4270,"children":4271},{"emptyLinePlaceholder":251},[4272],{"type":47,"value":254},{"type":41,"tag":107,"props":4274,"children":4275},{"class":109,"line":989},[4276,4280,4284,4289,4293,4297,4301,4306,4310,4314,4319,4323,4328],{"type":41,"tag":107,"props":4277,"children":4278},{"style":114},[4279],{"type":47,"value":637},{"type":41,"tag":107,"props":4281,"children":4282},{"style":300},[4283],{"type":47,"value":642},{"type":41,"tag":107,"props":4285,"children":4286},{"style":126},[4287],{"type":47,"value":4288},"evaluation",{"type":41,"tag":107,"props":4290,"children":4291},{"style":120},[4292],{"type":47,"value":579},{"type":41,"tag":107,"props":4294,"children":4295},{"style":126},[4296],{"type":47,"value":47},{"type":41,"tag":107,"props":4298,"children":4299},{"style":120},[4300],{"type":47,"value":579},{"type":41,"tag":107,"props":4302,"children":4303},{"style":281},[4304],{"type":47,"value":4305},"includes",{"type":41,"tag":107,"props":4307,"children":4308},{"style":300},[4309],{"type":47,"value":288},{"type":41,"tag":107,"props":4311,"children":4312},{"style":120},[4313],{"type":47,"value":155},{"type":41,"tag":107,"props":4315,"children":4316},{"style":147},[4317],{"type":47,"value":4318},"APPROVED",{"type":41,"tag":107,"props":4320,"children":4321},{"style":120},[4322],{"type":47,"value":155},{"type":41,"tag":107,"props":4324,"children":4325},{"style":300},[4326],{"type":47,"value":4327},")) ",{"type":41,"tag":107,"props":4329,"children":4330},{"style":120},[4331],{"type":47,"value":293},{"type":41,"tag":107,"props":4333,"children":4334},{"class":109,"line":998},[4335,4339,4343,4347,4351,4355,4359,4363,4367,4371,4375,4379,4383,4387,4391,4395,4399,4403,4408,4413],{"type":41,"tag":107,"props":4336,"children":4337},{"style":114},[4338],{"type":47,"value":2522},{"type":41,"tag":107,"props":4340,"children":4341},{"style":120},[4342],{"type":47,"value":123},{"type":41,"tag":107,"props":4344,"children":4345},{"style":300},[4346],{"type":47,"value":355},{"type":41,"tag":107,"props":4348,"children":4349},{"style":120},[4350],{"type":47,"value":308},{"type":41,"tag":107,"props":4352,"children":4353},{"style":126},[4354],{"type":47,"value":4030},{"type":41,"tag":107,"props":4356,"children":4357},{"style":120},[4358],{"type":47,"value":579},{"type":41,"tag":107,"props":4360,"children":4361},{"style":126},[4362],{"type":47,"value":47},{"type":41,"tag":107,"props":4364,"children":4365},{"style":120},[4366],{"type":47,"value":360},{"type":41,"tag":107,"props":4368,"children":4369},{"style":300},[4370],{"type":47,"value":3824},{"type":41,"tag":107,"props":4372,"children":4373},{"style":120},[4374],{"type":47,"value":308},{"type":41,"tag":107,"props":4376,"children":4377},{"style":120},[4378],{"type":47,"value":144},{"type":41,"tag":107,"props":4380,"children":4381},{"style":147},[4382],{"type":47,"value":4318},{"type":41,"tag":107,"props":4384,"children":4385},{"style":120},[4386],{"type":47,"value":155},{"type":41,"tag":107,"props":4388,"children":4389},{"style":120},[4390],{"type":47,"value":360},{"type":41,"tag":107,"props":4392,"children":4393},{"style":300},[4394],{"type":47,"value":3850},{"type":41,"tag":107,"props":4396,"children":4397},{"style":120},[4398],{"type":47,"value":308},{"type":41,"tag":107,"props":4400,"children":4401},{"style":126},[4402],{"type":47,"value":3736},{"type":41,"tag":107,"props":4404,"children":4405},{"style":120},[4406],{"type":47,"value":4407}," +",{"type":41,"tag":107,"props":4409,"children":4410},{"style":3743},[4411],{"type":47,"value":4412}," 1",{"type":41,"tag":107,"props":4414,"children":4415},{"style":120},[4416],{"type":47,"value":986},{"type":41,"tag":107,"props":4418,"children":4419},{"class":109,"line":1812},[4420],{"type":41,"tag":107,"props":4421,"children":4422},{"style":120},[4423],{"type":47,"value":746},{"type":41,"tag":107,"props":4425,"children":4426},{"class":109,"line":24},[4427],{"type":41,"tag":107,"props":4428,"children":4429},{"emptyLinePlaceholder":251},[4430],{"type":47,"value":254},{"type":41,"tag":107,"props":4432,"children":4433},{"class":109,"line":1828},[4434],{"type":41,"tag":107,"props":4435,"children":4436},{"style":396},[4437],{"type":47,"value":4438},"    \u002F\u002F Recursive self-call with feedback\n",{"type":41,"tag":107,"props":4440,"children":4441},{"class":109,"line":1861},[4442,4446,4451,4455,4460,4464],{"type":41,"tag":107,"props":4443,"children":4444},{"style":114},[4445],{"type":47,"value":933},{"type":41,"tag":107,"props":4447,"children":4448},{"style":126},[4449],{"type":47,"value":4450}," refineTranslation",{"type":41,"tag":107,"props":4452,"children":4453},{"style":120},[4454],{"type":47,"value":579},{"type":41,"tag":107,"props":4456,"children":4457},{"style":281},[4458],{"type":47,"value":4459},"triggerAndWait",{"type":41,"tag":107,"props":4461,"children":4462},{"style":300},[4463],{"type":47,"value":288},{"type":41,"tag":107,"props":4465,"children":4466},{"style":120},[4467],{"type":47,"value":293},{"type":41,"tag":107,"props":4469,"children":4470},{"class":109,"line":1894},[4471,4476],{"type":41,"tag":107,"props":4472,"children":4473},{"style":126},[4474],{"type":47,"value":4475},"      text",{"type":41,"tag":107,"props":4477,"children":4478},{"style":120},[4479],{"type":47,"value":326},{"type":41,"tag":107,"props":4481,"children":4482},{"class":109,"line":1914},[4483,4488],{"type":41,"tag":107,"props":4484,"children":4485},{"style":126},[4486],{"type":47,"value":4487},"      targetLanguage",{"type":41,"tag":107,"props":4489,"children":4490},{"style":120},[4491],{"type":47,"value":326},{"type":41,"tag":107,"props":4493,"children":4494},{"class":109,"line":1930},[4495,4500,4504,4508,4512,4516],{"type":41,"tag":107,"props":4496,"children":4497},{"style":300},[4498],{"type":47,"value":4499},"      feedback",{"type":41,"tag":107,"props":4501,"children":4502},{"style":120},[4503],{"type":47,"value":308},{"type":41,"tag":107,"props":4505,"children":4506},{"style":126},[4507],{"type":47,"value":4142},{"type":41,"tag":107,"props":4509,"children":4510},{"style":120},[4511],{"type":47,"value":579},{"type":41,"tag":107,"props":4513,"children":4514},{"style":126},[4515],{"type":47,"value":47},{"type":41,"tag":107,"props":4517,"children":4518},{"style":120},[4519],{"type":47,"value":326},{"type":41,"tag":107,"props":4521,"children":4522},{"class":109,"line":1938},[4523,4528,4532,4536,4540,4544],{"type":41,"tag":107,"props":4524,"children":4525},{"style":300},[4526],{"type":47,"value":4527},"      attempt",{"type":41,"tag":107,"props":4529,"children":4530},{"style":120},[4531],{"type":47,"value":308},{"type":41,"tag":107,"props":4533,"children":4534},{"style":126},[4535],{"type":47,"value":3736},{"type":41,"tag":107,"props":4537,"children":4538},{"style":120},[4539],{"type":47,"value":4407},{"type":41,"tag":107,"props":4541,"children":4542},{"style":3743},[4543],{"type":47,"value":4412},{"type":41,"tag":107,"props":4545,"children":4546},{"style":120},[4547],{"type":47,"value":326},{"type":41,"tag":107,"props":4549,"children":4550},{"class":109,"line":1991},[4551,4555,4559,4563,4568,4572],{"type":41,"tag":107,"props":4552,"children":4553},{"style":120},[4554],{"type":47,"value":528},{"type":41,"tag":107,"props":4556,"children":4557},{"style":300},[4558],{"type":47,"value":474},{"type":41,"tag":107,"props":4560,"children":4561},{"style":120},[4562],{"type":47,"value":579},{"type":41,"tag":107,"props":4564,"children":4565},{"style":281},[4566],{"type":47,"value":4567},"unwrap",{"type":41,"tag":107,"props":4569,"children":4570},{"style":300},[4571],{"type":47,"value":1333},{"type":41,"tag":107,"props":4573,"children":4574},{"style":120},[4575],{"type":47,"value":160},{"type":41,"tag":107,"props":4577,"children":4578},{"class":109,"line":1999},[4579],{"type":41,"tag":107,"props":4580,"children":4581},{"style":120},[4582],{"type":47,"value":995},{"type":41,"tag":107,"props":4584,"children":4586},{"class":109,"line":4585},39,[4587,4591,4595],{"type":41,"tag":107,"props":4588,"children":4589},{"style":120},[4590],{"type":47,"value":711},{"type":41,"tag":107,"props":4592,"children":4593},{"style":126},[4594],{"type":47,"value":474},{"type":41,"tag":107,"props":4596,"children":4597},{"style":120},[4598],{"type":47,"value":160},{"type":41,"tag":76,"props":4600,"children":4601},{},[],{"type":41,"tag":56,"props":4603,"children":4605},{"id":4604},"trigger-specific-features",[4606],{"type":47,"value":4607},"Trigger-Specific Features",{"type":41,"tag":4609,"props":4610,"children":4611},"table",{},[4612,4636],{"type":41,"tag":4613,"props":4614,"children":4615},"thead",{},[4616],{"type":41,"tag":4617,"props":4618,"children":4619},"tr",{},[4620,4626,4631],{"type":41,"tag":4621,"props":4622,"children":4623},"th",{},[4624],{"type":47,"value":4625},"Feature",{"type":41,"tag":4621,"props":4627,"children":4628},{},[4629],{"type":47,"value":4630},"What it enables",{"type":41,"tag":4621,"props":4632,"children":4633},{},[4634],{"type":47,"value":4635},"Reference",{"type":41,"tag":4637,"props":4638,"children":4639},"tbody",{},[4640,4666,4691,4716],{"type":41,"tag":4617,"props":4641,"children":4642},{},[4643,4652,4657],{"type":41,"tag":4644,"props":4645,"children":4646},"td",{},[4647],{"type":41,"tag":2746,"props":4648,"children":4649},{},[4650],{"type":47,"value":4651},"Waitpoints",{"type":41,"tag":4644,"props":4653,"children":4654},{},[4655],{"type":47,"value":4656},"Human approval gates, external callbacks",{"type":41,"tag":4644,"props":4658,"children":4659},{},[4660],{"type":41,"tag":70,"props":4661,"children":4663},{"className":4662},[],[4664],{"type":47,"value":4665},"references\u002Fwaitpoints.md",{"type":41,"tag":4617,"props":4667,"children":4668},{},[4669,4677,4682],{"type":41,"tag":4644,"props":4670,"children":4671},{},[4672],{"type":41,"tag":2746,"props":4673,"children":4674},{},[4675],{"type":47,"value":4676},"Streams",{"type":41,"tag":4644,"props":4678,"children":4679},{},[4680],{"type":47,"value":4681},"Real-time progress to frontend",{"type":41,"tag":4644,"props":4683,"children":4684},{},[4685],{"type":41,"tag":70,"props":4686,"children":4688},{"className":4687},[],[4689],{"type":47,"value":4690},"references\u002Fstreaming.md",{"type":41,"tag":4617,"props":4692,"children":4693},{},[4694,4702,4707],{"type":41,"tag":4644,"props":4695,"children":4696},{},[4697],{"type":41,"tag":2746,"props":4698,"children":4699},{},[4700],{"type":47,"value":4701},"ai.tool",{"type":41,"tag":4644,"props":4703,"children":4704},{},[4705],{"type":47,"value":4706},"Let LLMs call your tasks as tools",{"type":41,"tag":4644,"props":4708,"children":4709},{},[4710],{"type":41,"tag":70,"props":4711,"children":4713},{"className":4712},[],[4714],{"type":47,"value":4715},"references\u002Fai-tool.md",{"type":41,"tag":4617,"props":4717,"children":4718},{},[4719,4726,4731],{"type":41,"tag":4644,"props":4720,"children":4721},{},[4722],{"type":41,"tag":2746,"props":4723,"children":4724},{},[4725],{"type":47,"value":2032},{"type":41,"tag":4644,"props":4727,"children":4728},{},[4729],{"type":47,"value":4730},"Typed parallel execution",{"type":41,"tag":4644,"props":4732,"children":4733},{},[4734],{"type":41,"tag":70,"props":4735,"children":4737},{"className":4736},[],[4738],{"type":47,"value":2758},{"type":41,"tag":76,"props":4740,"children":4741},{},[],{"type":41,"tag":56,"props":4743,"children":4745},{"id":4744},"error-handling",[4746],{"type":47,"value":4747},"Error Handling",{"type":41,"tag":63,"props":4749,"children":4751},{"className":99,"code":4750,"language":101,"meta":72,"style":72},"const { runs } = await batch.triggerByTaskAndWait([...]);\n\n\u002F\u002F Check individual results\nfor (const run of runs) {\n  if (run.ok) {\n    console.log(run.output);  \u002F\u002F Typed output\n  } else {\n    console.error(run.error);  \u002F\u002F Error details\n    console.log(run.taskIdentifier);  \u002F\u002F Which task failed\n  }\n}\n\n\u002F\u002F Or filter by task type\nconst verifications = runs\n  .filter((r): r is typeof r & { ok: true } =>\n    r.ok && r.taskIdentifier === \"verify-claim\"\n  )\n  .map(r => r.output);\n",[4752],{"type":41,"tag":70,"props":4753,"children":4754},{"__ignoreMap":72},[4755,4812,4819,4827,4862,4895,4942,4959,5004,5049,5057,5065,5072,5080,5100,5175,5229,5237],{"type":41,"tag":107,"props":4756,"children":4757},{"class":109,"line":110},[4758,4762,4766,4771,4775,4779,4783,4787,4791,4795,4799,4804,4808],{"type":41,"tag":107,"props":4759,"children":4760},{"style":265},[4761],{"type":47,"value":1205},{"type":41,"tag":107,"props":4763,"children":4764},{"style":120},[4765],{"type":47,"value":123},{"type":41,"tag":107,"props":4767,"children":4768},{"style":126},[4769],{"type":47,"value":4770}," runs ",{"type":41,"tag":107,"props":4772,"children":4773},{"style":120},[4774],{"type":47,"value":711},{"type":41,"tag":107,"props":4776,"children":4777},{"style":120},[4778],{"type":47,"value":418},{"type":41,"tag":107,"props":4780,"children":4781},{"style":114},[4782],{"type":47,"value":423},{"type":41,"tag":107,"props":4784,"children":4785},{"style":126},[4786],{"type":47,"value":2056},{"type":41,"tag":107,"props":4788,"children":4789},{"style":120},[4790],{"type":47,"value":579},{"type":41,"tag":107,"props":4792,"children":4793},{"style":281},[4794],{"type":47,"value":2276},{"type":41,"tag":107,"props":4796,"children":4797},{"style":126},[4798],{"type":47,"value":1265},{"type":41,"tag":107,"props":4800,"children":4801},{"style":120},[4802],{"type":47,"value":4803},"...",{"type":41,"tag":107,"props":4805,"children":4806},{"style":126},[4807],{"type":47,"value":1299},{"type":41,"tag":107,"props":4809,"children":4810},{"style":120},[4811],{"type":47,"value":160},{"type":41,"tag":107,"props":4813,"children":4814},{"class":109,"line":163},[4815],{"type":41,"tag":107,"props":4816,"children":4817},{"emptyLinePlaceholder":251},[4818],{"type":47,"value":254},{"type":41,"tag":107,"props":4820,"children":4821},{"class":109,"line":205},[4822],{"type":41,"tag":107,"props":4823,"children":4824},{"style":396},[4825],{"type":47,"value":4826},"\u002F\u002F Check individual results\n",{"type":41,"tag":107,"props":4828,"children":4829},{"class":109,"line":247},[4830,4835,4839,4843,4848,4853,4858],{"type":41,"tag":107,"props":4831,"children":4832},{"style":114},[4833],{"type":47,"value":4834},"for",{"type":41,"tag":107,"props":4836,"children":4837},{"style":126},[4838],{"type":47,"value":642},{"type":41,"tag":107,"props":4840,"children":4841},{"style":265},[4842],{"type":47,"value":1205},{"type":41,"tag":107,"props":4844,"children":4845},{"style":126},[4846],{"type":47,"value":4847}," run ",{"type":41,"tag":107,"props":4849,"children":4850},{"style":120},[4851],{"type":47,"value":4852},"of",{"type":41,"tag":107,"props":4854,"children":4855},{"style":126},[4856],{"type":47,"value":4857}," runs) ",{"type":41,"tag":107,"props":4859,"children":4860},{"style":120},[4861],{"type":47,"value":293},{"type":41,"tag":107,"props":4863,"children":4864},{"class":109,"line":28},[4865,4870,4874,4879,4883,4887,4891],{"type":41,"tag":107,"props":4866,"children":4867},{"style":114},[4868],{"type":47,"value":4869},"  if",{"type":41,"tag":107,"props":4871,"children":4872},{"style":300},[4873],{"type":47,"value":642},{"type":41,"tag":107,"props":4875,"children":4876},{"style":126},[4877],{"type":47,"value":4878},"run",{"type":41,"tag":107,"props":4880,"children":4881},{"style":120},[4882],{"type":47,"value":579},{"type":41,"tag":107,"props":4884,"children":4885},{"style":126},[4886],{"type":47,"value":2479},{"type":41,"tag":107,"props":4888,"children":4889},{"style":300},[4890],{"type":47,"value":661},{"type":41,"tag":107,"props":4892,"children":4893},{"style":120},[4894],{"type":47,"value":293},{"type":41,"tag":107,"props":4896,"children":4897},{"class":109,"line":296},[4898,4903,4907,4912,4916,4920,4924,4928,4932,4937],{"type":41,"tag":107,"props":4899,"children":4900},{"style":126},[4901],{"type":47,"value":4902},"    console",{"type":41,"tag":107,"props":4904,"children":4905},{"style":120},[4906],{"type":47,"value":579},{"type":41,"tag":107,"props":4908,"children":4909},{"style":281},[4910],{"type":47,"value":4911},"log",{"type":41,"tag":107,"props":4913,"children":4914},{"style":300},[4915],{"type":47,"value":288},{"type":41,"tag":107,"props":4917,"children":4918},{"style":126},[4919],{"type":47,"value":4878},{"type":41,"tag":107,"props":4921,"children":4922},{"style":120},[4923],{"type":47,"value":579},{"type":41,"tag":107,"props":4925,"children":4926},{"style":126},[4927],{"type":47,"value":2497},{"type":41,"tag":107,"props":4929,"children":4930},{"style":300},[4931],{"type":47,"value":474},{"type":41,"tag":107,"props":4933,"children":4934},{"style":120},[4935],{"type":47,"value":4936},";",{"type":41,"tag":107,"props":4938,"children":4939},{"style":396},[4940],{"type":47,"value":4941},"  \u002F\u002F Typed output\n",{"type":41,"tag":107,"props":4943,"children":4944},{"class":109,"line":329},[4945,4950,4955],{"type":41,"tag":107,"props":4946,"children":4947},{"style":120},[4948],{"type":47,"value":4949},"  }",{"type":41,"tag":107,"props":4951,"children":4952},{"style":114},[4953],{"type":47,"value":4954}," else",{"type":41,"tag":107,"props":4956,"children":4957},{"style":120},[4958],{"type":47,"value":389},{"type":41,"tag":107,"props":4960,"children":4961},{"class":109,"line":392},[4962,4966,4970,4975,4979,4983,4987,4991,4995,4999],{"type":41,"tag":107,"props":4963,"children":4964},{"style":126},[4965],{"type":47,"value":4902},{"type":41,"tag":107,"props":4967,"children":4968},{"style":120},[4969],{"type":47,"value":579},{"type":41,"tag":107,"props":4971,"children":4972},{"style":281},[4973],{"type":47,"value":4974},"error",{"type":41,"tag":107,"props":4976,"children":4977},{"style":300},[4978],{"type":47,"value":288},{"type":41,"tag":107,"props":4980,"children":4981},{"style":126},[4982],{"type":47,"value":4878},{"type":41,"tag":107,"props":4984,"children":4985},{"style":120},[4986],{"type":47,"value":579},{"type":41,"tag":107,"props":4988,"children":4989},{"style":126},[4990],{"type":47,"value":4974},{"type":41,"tag":107,"props":4992,"children":4993},{"style":300},[4994],{"type":47,"value":474},{"type":41,"tag":107,"props":4996,"children":4997},{"style":120},[4998],{"type":47,"value":4936},{"type":41,"tag":107,"props":5000,"children":5001},{"style":396},[5002],{"type":47,"value":5003},"  \u002F\u002F Error details\n",{"type":41,"tag":107,"props":5005,"children":5006},{"class":109,"line":402},[5007,5011,5015,5019,5023,5027,5031,5036,5040,5044],{"type":41,"tag":107,"props":5008,"children":5009},{"style":126},[5010],{"type":47,"value":4902},{"type":41,"tag":107,"props":5012,"children":5013},{"style":120},[5014],{"type":47,"value":579},{"type":41,"tag":107,"props":5016,"children":5017},{"style":281},[5018],{"type":47,"value":4911},{"type":41,"tag":107,"props":5020,"children":5021},{"style":300},[5022],{"type":47,"value":288},{"type":41,"tag":107,"props":5024,"children":5025},{"style":126},[5026],{"type":47,"value":4878},{"type":41,"tag":107,"props":5028,"children":5029},{"style":120},[5030],{"type":47,"value":579},{"type":41,"tag":107,"props":5032,"children":5033},{"style":126},[5034],{"type":47,"value":5035},"taskIdentifier",{"type":41,"tag":107,"props":5037,"children":5038},{"style":300},[5039],{"type":47,"value":474},{"type":41,"tag":107,"props":5041,"children":5042},{"style":120},[5043],{"type":47,"value":4936},{"type":41,"tag":107,"props":5045,"children":5046},{"style":396},[5047],{"type":47,"value":5048},"  \u002F\u002F Which task failed\n",{"type":41,"tag":107,"props":5050,"children":5051},{"class":109,"line":438},[5052],{"type":41,"tag":107,"props":5053,"children":5054},{"style":120},[5055],{"type":47,"value":5056},"  }\n",{"type":41,"tag":107,"props":5058,"children":5059},{"class":109,"line":481},[5060],{"type":41,"tag":107,"props":5061,"children":5062},{"style":120},[5063],{"type":47,"value":5064},"}\n",{"type":41,"tag":107,"props":5066,"children":5067},{"class":109,"line":522},[5068],{"type":41,"tag":107,"props":5069,"children":5070},{"emptyLinePlaceholder":251},[5071],{"type":47,"value":254},{"type":41,"tag":107,"props":5073,"children":5074},{"class":109,"line":539},[5075],{"type":41,"tag":107,"props":5076,"children":5077},{"style":396},[5078],{"type":47,"value":5079},"\u002F\u002F Or filter by task type\n",{"type":41,"tag":107,"props":5081,"children":5082},{"class":109,"line":547},[5083,5087,5092,5096],{"type":41,"tag":107,"props":5084,"children":5085},{"style":265},[5086],{"type":47,"value":1205},{"type":41,"tag":107,"props":5088,"children":5089},{"style":126},[5090],{"type":47,"value":5091}," verifications ",{"type":41,"tag":107,"props":5093,"children":5094},{"style":120},[5095],{"type":47,"value":278},{"type":41,"tag":107,"props":5097,"children":5098},{"style":126},[5099],{"type":47,"value":3353},{"type":41,"tag":107,"props":5101,"children":5102},{"class":109,"line":556},[5103,5108,5112,5116,5120,5124,5128,5132,5136,5140,5145,5150,5154,5158,5162,5166,5170],{"type":41,"tag":107,"props":5104,"children":5105},{"style":120},[5106],{"type":47,"value":5107},"  .",{"type":41,"tag":107,"props":5109,"children":5110},{"style":281},[5111],{"type":47,"value":3366},{"type":41,"tag":107,"props":5113,"children":5114},{"style":126},[5115],{"type":47,"value":288},{"type":41,"tag":107,"props":5117,"children":5118},{"style":120},[5119],{"type":47,"value":288},{"type":41,"tag":107,"props":5121,"children":5122},{"style":352},[5123],{"type":47,"value":3379},{"type":41,"tag":107,"props":5125,"children":5126},{"style":120},[5127],{"type":47,"value":3384},{"type":41,"tag":107,"props":5129,"children":5130},{"style":352},[5131],{"type":47,"value":3389},{"type":41,"tag":107,"props":5133,"children":5134},{"style":120},[5135],{"type":47,"value":3394},{"type":41,"tag":107,"props":5137,"children":5138},{"style":120},[5139],{"type":47,"value":3399},{"type":41,"tag":107,"props":5141,"children":5142},{"style":126},[5143],{"type":47,"value":5144}," r ",{"type":41,"tag":107,"props":5146,"children":5147},{"style":120},[5148],{"type":47,"value":5149},"&",{"type":41,"tag":107,"props":5151,"children":5152},{"style":120},[5153],{"type":47,"value":123},{"type":41,"tag":107,"props":5155,"children":5156},{"style":300},[5157],{"type":47,"value":3417},{"type":41,"tag":107,"props":5159,"children":5160},{"style":120},[5161],{"type":47,"value":308},{"type":41,"tag":107,"props":5163,"children":5164},{"style":3424},[5165],{"type":47,"value":3427},{"type":41,"tag":107,"props":5167,"children":5168},{"style":120},[5169],{"type":47,"value":134},{"type":41,"tag":107,"props":5171,"children":5172},{"style":265},[5173],{"type":47,"value":5174}," =>\n",{"type":41,"tag":107,"props":5176,"children":5177},{"class":109,"line":631},[5178,5183,5187,5192,5197,5201,5205,5210,5215,5219,5224],{"type":41,"tag":107,"props":5179,"children":5180},{"style":126},[5181],{"type":47,"value":5182},"    r",{"type":41,"tag":107,"props":5184,"children":5185},{"style":120},[5186],{"type":47,"value":579},{"type":41,"tag":107,"props":5188,"children":5189},{"style":126},[5190],{"type":47,"value":5191},"ok ",{"type":41,"tag":107,"props":5193,"children":5194},{"style":120},[5195],{"type":47,"value":5196},"&&",{"type":41,"tag":107,"props":5198,"children":5199},{"style":126},[5200],{"type":47,"value":3389},{"type":41,"tag":107,"props":5202,"children":5203},{"style":120},[5204],{"type":47,"value":579},{"type":41,"tag":107,"props":5206,"children":5207},{"style":126},[5208],{"type":47,"value":5209},"taskIdentifier ",{"type":41,"tag":107,"props":5211,"children":5212},{"style":120},[5213],{"type":47,"value":5214},"===",{"type":41,"tag":107,"props":5216,"children":5217},{"style":120},[5218],{"type":47,"value":144},{"type":41,"tag":107,"props":5220,"children":5221},{"style":147},[5222],{"type":47,"value":5223},"verify-claim",{"type":41,"tag":107,"props":5225,"children":5226},{"style":120},[5227],{"type":47,"value":5228},"\"\n",{"type":41,"tag":107,"props":5230,"children":5231},{"class":109,"line":668},[5232],{"type":41,"tag":107,"props":5233,"children":5234},{"style":126},[5235],{"type":47,"value":5236},"  )\n",{"type":41,"tag":107,"props":5238,"children":5239},{"class":109,"line":740},[5240,5244,5248,5252,5256,5260,5264,5268,5273],{"type":41,"tag":107,"props":5241,"children":5242},{"style":120},[5243],{"type":47,"value":5107},{"type":41,"tag":107,"props":5245,"children":5246},{"style":281},[5247],{"type":47,"value":3244},{"type":41,"tag":107,"props":5249,"children":5250},{"style":126},[5251],{"type":47,"value":288},{"type":41,"tag":107,"props":5253,"children":5254},{"style":352},[5255],{"type":47,"value":3379},{"type":41,"tag":107,"props":5257,"children":5258},{"style":265},[5259],{"type":47,"value":384},{"type":41,"tag":107,"props":5261,"children":5262},{"style":126},[5263],{"type":47,"value":3389},{"type":41,"tag":107,"props":5265,"children":5266},{"style":120},[5267],{"type":47,"value":579},{"type":41,"tag":107,"props":5269,"children":5270},{"style":126},[5271],{"type":47,"value":5272},"output)",{"type":41,"tag":107,"props":5274,"children":5275},{"style":120},[5276],{"type":47,"value":160},{"type":41,"tag":76,"props":5278,"children":5279},{},[],{"type":41,"tag":56,"props":5281,"children":5283},{"id":5282},"quick-reference",[5284],{"type":47,"value":5285},"Quick Reference",{"type":41,"tag":63,"props":5287,"children":5289},{"className":99,"code":5288,"language":101,"meta":72,"style":72},"\u002F\u002F Trigger and wait for result\nconst result = await myTask.triggerAndWait(payload);\nif (result.ok) console.log(result.output);\n\n\u002F\u002F Batch trigger same task\nconst results = await myTask.batchTriggerAndWait([\n  { payload: item1 },\n  { payload: item2 },\n]);\n\n\u002F\u002F Batch trigger different tasks (typed)\nconst { runs } = await batch.triggerByTaskAndWait([\n  { task: taskA, payload: { foo: 1 } },\n  { task: taskB, payload: { bar: \"x\" } },\n]);\n\n\u002F\u002F Self-recursion with unwrap\nreturn myTask.triggerAndWait(newPayload).unwrap();\n",[5290],{"type":41,"tag":70,"props":5291,"children":5292},{"__ignoreMap":72},[5293,5301,5343,5390,5397,5405,5442,5468,5492,5503,5510,5518,5561,5618,5684,5695,5702,5710],{"type":41,"tag":107,"props":5294,"children":5295},{"class":109,"line":110},[5296],{"type":41,"tag":107,"props":5297,"children":5298},{"style":396},[5299],{"type":47,"value":5300},"\u002F\u002F Trigger and wait for result\n",{"type":41,"tag":107,"props":5302,"children":5303},{"class":109,"line":163},[5304,5308,5313,5317,5321,5326,5330,5334,5339],{"type":41,"tag":107,"props":5305,"children":5306},{"style":265},[5307],{"type":47,"value":1205},{"type":41,"tag":107,"props":5309,"children":5310},{"style":126},[5311],{"type":47,"value":5312}," result ",{"type":41,"tag":107,"props":5314,"children":5315},{"style":120},[5316],{"type":47,"value":278},{"type":41,"tag":107,"props":5318,"children":5319},{"style":114},[5320],{"type":47,"value":423},{"type":41,"tag":107,"props":5322,"children":5323},{"style":126},[5324],{"type":47,"value":5325}," myTask",{"type":41,"tag":107,"props":5327,"children":5328},{"style":120},[5329],{"type":47,"value":579},{"type":41,"tag":107,"props":5331,"children":5332},{"style":281},[5333],{"type":47,"value":4459},{"type":41,"tag":107,"props":5335,"children":5336},{"style":126},[5337],{"type":47,"value":5338},"(payload)",{"type":41,"tag":107,"props":5340,"children":5341},{"style":120},[5342],{"type":47,"value":160},{"type":41,"tag":107,"props":5344,"children":5345},{"class":109,"line":205},[5346,5351,5356,5360,5365,5369,5373,5378,5382,5386],{"type":41,"tag":107,"props":5347,"children":5348},{"style":114},[5349],{"type":47,"value":5350},"if",{"type":41,"tag":107,"props":5352,"children":5353},{"style":126},[5354],{"type":47,"value":5355}," (result",{"type":41,"tag":107,"props":5357,"children":5358},{"style":120},[5359],{"type":47,"value":579},{"type":41,"tag":107,"props":5361,"children":5362},{"style":126},[5363],{"type":47,"value":5364},"ok) console",{"type":41,"tag":107,"props":5366,"children":5367},{"style":120},[5368],{"type":47,"value":579},{"type":41,"tag":107,"props":5370,"children":5371},{"style":281},[5372],{"type":47,"value":4911},{"type":41,"tag":107,"props":5374,"children":5375},{"style":126},[5376],{"type":47,"value":5377},"(result",{"type":41,"tag":107,"props":5379,"children":5380},{"style":120},[5381],{"type":47,"value":579},{"type":41,"tag":107,"props":5383,"children":5384},{"style":126},[5385],{"type":47,"value":5272},{"type":41,"tag":107,"props":5387,"children":5388},{"style":120},[5389],{"type":47,"value":160},{"type":41,"tag":107,"props":5391,"children":5392},{"class":109,"line":247},[5393],{"type":41,"tag":107,"props":5394,"children":5395},{"emptyLinePlaceholder":251},[5396],{"type":47,"value":254},{"type":41,"tag":107,"props":5398,"children":5399},{"class":109,"line":28},[5400],{"type":41,"tag":107,"props":5401,"children":5402},{"style":396},[5403],{"type":47,"value":5404},"\u002F\u002F Batch trigger same task\n",{"type":41,"tag":107,"props":5406,"children":5407},{"class":109,"line":296},[5408,5412,5417,5421,5425,5429,5433,5438],{"type":41,"tag":107,"props":5409,"children":5410},{"style":265},[5411],{"type":47,"value":1205},{"type":41,"tag":107,"props":5413,"children":5414},{"style":126},[5415],{"type":47,"value":5416}," results ",{"type":41,"tag":107,"props":5418,"children":5419},{"style":120},[5420],{"type":47,"value":278},{"type":41,"tag":107,"props":5422,"children":5423},{"style":114},[5424],{"type":47,"value":423},{"type":41,"tag":107,"props":5426,"children":5427},{"style":126},[5428],{"type":47,"value":5325},{"type":41,"tag":107,"props":5430,"children":5431},{"style":120},[5432],{"type":47,"value":579},{"type":41,"tag":107,"props":5434,"children":5435},{"style":281},[5436],{"type":47,"value":5437},"batchTriggerAndWait",{"type":41,"tag":107,"props":5439,"children":5440},{"style":126},[5441],{"type":47,"value":2281},{"type":41,"tag":107,"props":5443,"children":5444},{"class":109,"line":329},[5445,5450,5454,5458,5463],{"type":41,"tag":107,"props":5446,"children":5447},{"style":120},[5448],{"type":47,"value":5449},"  {",{"type":41,"tag":107,"props":5451,"children":5452},{"style":300},[5453],{"type":47,"value":2311},{"type":41,"tag":107,"props":5455,"children":5456},{"style":120},[5457],{"type":47,"value":308},{"type":41,"tag":107,"props":5459,"children":5460},{"style":126},[5461],{"type":47,"value":5462}," item1 ",{"type":41,"tag":107,"props":5464,"children":5465},{"style":120},[5466],{"type":47,"value":5467},"},\n",{"type":41,"tag":107,"props":5469,"children":5470},{"class":109,"line":392},[5471,5475,5479,5483,5488],{"type":41,"tag":107,"props":5472,"children":5473},{"style":120},[5474],{"type":47,"value":5449},{"type":41,"tag":107,"props":5476,"children":5477},{"style":300},[5478],{"type":47,"value":2311},{"type":41,"tag":107,"props":5480,"children":5481},{"style":120},[5482],{"type":47,"value":308},{"type":41,"tag":107,"props":5484,"children":5485},{"style":126},[5486],{"type":47,"value":5487}," item2 ",{"type":41,"tag":107,"props":5489,"children":5490},{"style":120},[5491],{"type":47,"value":5467},{"type":41,"tag":107,"props":5493,"children":5494},{"class":109,"line":402},[5495,5499],{"type":41,"tag":107,"props":5496,"children":5497},{"style":126},[5498],{"type":47,"value":1299},{"type":41,"tag":107,"props":5500,"children":5501},{"style":120},[5502],{"type":47,"value":160},{"type":41,"tag":107,"props":5504,"children":5505},{"class":109,"line":438},[5506],{"type":41,"tag":107,"props":5507,"children":5508},{"emptyLinePlaceholder":251},[5509],{"type":47,"value":254},{"type":41,"tag":107,"props":5511,"children":5512},{"class":109,"line":481},[5513],{"type":41,"tag":107,"props":5514,"children":5515},{"style":396},[5516],{"type":47,"value":5517},"\u002F\u002F Batch trigger different tasks (typed)\n",{"type":41,"tag":107,"props":5519,"children":5520},{"class":109,"line":522},[5521,5525,5529,5533,5537,5541,5545,5549,5553,5557],{"type":41,"tag":107,"props":5522,"children":5523},{"style":265},[5524],{"type":47,"value":1205},{"type":41,"tag":107,"props":5526,"children":5527},{"style":120},[5528],{"type":47,"value":123},{"type":41,"tag":107,"props":5530,"children":5531},{"style":126},[5532],{"type":47,"value":4770},{"type":41,"tag":107,"props":5534,"children":5535},{"style":120},[5536],{"type":47,"value":711},{"type":41,"tag":107,"props":5538,"children":5539},{"style":120},[5540],{"type":47,"value":418},{"type":41,"tag":107,"props":5542,"children":5543},{"style":114},[5544],{"type":47,"value":423},{"type":41,"tag":107,"props":5546,"children":5547},{"style":126},[5548],{"type":47,"value":2056},{"type":41,"tag":107,"props":5550,"children":5551},{"style":120},[5552],{"type":47,"value":579},{"type":41,"tag":107,"props":5554,"children":5555},{"style":281},[5556],{"type":47,"value":2276},{"type":41,"tag":107,"props":5558,"children":5559},{"style":126},[5560],{"type":47,"value":2281},{"type":41,"tag":107,"props":5562,"children":5563},{"class":109,"line":539},[5564,5568,5572,5576,5581,5585,5589,5593,5597,5602,5606,5610,5614],{"type":41,"tag":107,"props":5565,"children":5566},{"style":120},[5567],{"type":47,"value":5449},{"type":41,"tag":107,"props":5569,"children":5570},{"style":300},[5571],{"type":47,"value":129},{"type":41,"tag":107,"props":5573,"children":5574},{"style":120},[5575],{"type":47,"value":308},{"type":41,"tag":107,"props":5577,"children":5578},{"style":126},[5579],{"type":47,"value":5580}," taskA",{"type":41,"tag":107,"props":5582,"children":5583},{"style":120},[5584],{"type":47,"value":360},{"type":41,"tag":107,"props":5586,"children":5587},{"style":300},[5588],{"type":47,"value":2311},{"type":41,"tag":107,"props":5590,"children":5591},{"style":120},[5592],{"type":47,"value":308},{"type":41,"tag":107,"props":5594,"children":5595},{"style":120},[5596],{"type":47,"value":123},{"type":41,"tag":107,"props":5598,"children":5599},{"style":300},[5600],{"type":47,"value":5601}," foo",{"type":41,"tag":107,"props":5603,"children":5604},{"style":120},[5605],{"type":47,"value":308},{"type":41,"tag":107,"props":5607,"children":5608},{"style":3743},[5609],{"type":47,"value":4412},{"type":41,"tag":107,"props":5611,"children":5612},{"style":120},[5613],{"type":47,"value":134},{"type":41,"tag":107,"props":5615,"children":5616},{"style":120},[5617],{"type":47,"value":1694},{"type":41,"tag":107,"props":5619,"children":5620},{"class":109,"line":547},[5621,5625,5629,5633,5638,5642,5646,5650,5654,5659,5663,5667,5672,5676,5680],{"type":41,"tag":107,"props":5622,"children":5623},{"style":120},[5624],{"type":47,"value":5449},{"type":41,"tag":107,"props":5626,"children":5627},{"style":300},[5628],{"type":47,"value":129},{"type":41,"tag":107,"props":5630,"children":5631},{"style":120},[5632],{"type":47,"value":308},{"type":41,"tag":107,"props":5634,"children":5635},{"style":126},[5636],{"type":47,"value":5637}," taskB",{"type":41,"tag":107,"props":5639,"children":5640},{"style":120},[5641],{"type":47,"value":360},{"type":41,"tag":107,"props":5643,"children":5644},{"style":300},[5645],{"type":47,"value":2311},{"type":41,"tag":107,"props":5647,"children":5648},{"style":120},[5649],{"type":47,"value":308},{"type":41,"tag":107,"props":5651,"children":5652},{"style":120},[5653],{"type":47,"value":123},{"type":41,"tag":107,"props":5655,"children":5656},{"style":300},[5657],{"type":47,"value":5658}," bar",{"type":41,"tag":107,"props":5660,"children":5661},{"style":120},[5662],{"type":47,"value":308},{"type":41,"tag":107,"props":5664,"children":5665},{"style":120},[5666],{"type":47,"value":144},{"type":41,"tag":107,"props":5668,"children":5669},{"style":147},[5670],{"type":47,"value":5671},"x",{"type":41,"tag":107,"props":5673,"children":5674},{"style":120},[5675],{"type":47,"value":155},{"type":41,"tag":107,"props":5677,"children":5678},{"style":120},[5679],{"type":47,"value":134},{"type":41,"tag":107,"props":5681,"children":5682},{"style":120},[5683],{"type":47,"value":1694},{"type":41,"tag":107,"props":5685,"children":5686},{"class":109,"line":556},[5687,5691],{"type":41,"tag":107,"props":5688,"children":5689},{"style":126},[5690],{"type":47,"value":1299},{"type":41,"tag":107,"props":5692,"children":5693},{"style":120},[5694],{"type":47,"value":160},{"type":41,"tag":107,"props":5696,"children":5697},{"class":109,"line":631},[5698],{"type":41,"tag":107,"props":5699,"children":5700},{"emptyLinePlaceholder":251},[5701],{"type":47,"value":254},{"type":41,"tag":107,"props":5703,"children":5704},{"class":109,"line":668},[5705],{"type":41,"tag":107,"props":5706,"children":5707},{"style":396},[5708],{"type":47,"value":5709},"\u002F\u002F Self-recursion with unwrap\n",{"type":41,"tag":107,"props":5711,"children":5712},{"class":109,"line":740},[5713,5718,5722,5726,5730,5735,5739,5743,5747],{"type":41,"tag":107,"props":5714,"children":5715},{"style":114},[5716],{"type":47,"value":5717},"return",{"type":41,"tag":107,"props":5719,"children":5720},{"style":126},[5721],{"type":47,"value":5325},{"type":41,"tag":107,"props":5723,"children":5724},{"style":120},[5725],{"type":47,"value":579},{"type":41,"tag":107,"props":5727,"children":5728},{"style":281},[5729],{"type":47,"value":4459},{"type":41,"tag":107,"props":5731,"children":5732},{"style":126},[5733],{"type":47,"value":5734},"(newPayload)",{"type":41,"tag":107,"props":5736,"children":5737},{"style":120},[5738],{"type":47,"value":579},{"type":41,"tag":107,"props":5740,"children":5741},{"style":281},[5742],{"type":47,"value":4567},{"type":41,"tag":107,"props":5744,"children":5745},{"style":126},[5746],{"type":47,"value":1333},{"type":41,"tag":107,"props":5748,"children":5749},{"style":120},[5750],{"type":47,"value":160},{"type":41,"tag":5752,"props":5753,"children":5754},"style",{},[5755],{"type":47,"value":5756},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":5758,"total":927},[5759,5774,5787,5797,5814,5821,5835,5852,5865,5877,5888,5902],{"slug":5760,"name":5760,"fn":5761,"description":5762,"org":5763,"tags":5764,"stars":5771,"repoUrl":5772,"updatedAt":5773},"trigger-authoring-chat-agent","author durable AI chat agents with Trigger.dev","Author and run a durable AI chat agent with chat.agent from @trigger.dev\u002Fsdk\u002Fai: the per-turn run loop, why you MUST spread ...chat.toStreamTextOptions() first, returning a StreamTextResult vs calling chat.pipe(), the two server actions (chat.createStartSessionAction + auth.createPublicToken), and wiring useChat to useTriggerChatTransport. Load this when building, modifying, or debugging a chat backend (the agent task or its lifecycle hooks) or its React transport, when declaring typed tools or custom data parts, or when migrating a plain AI SDK streamText route to chat.agent.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5765,5766,5769,5770],{"name":16,"slug":17,"type":14},{"name":5767,"slug":5768,"type":14},"SDK","sdk",{"name":9,"slug":8,"type":14},{"name":22,"slug":23,"type":14},14401,"https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Ftrigger.dev","2026-07-02T17:12:52.307135",{"slug":5775,"name":5775,"fn":5776,"description":5777,"org":5778,"tags":5779,"stars":5771,"repoUrl":5772,"updatedAt":5786},"trigger-authoring-tasks","author backend Trigger.dev tasks","Covers writing backend Trigger.dev tasks with @trigger.dev\u002Fsdk: defining task() and schemaTask(), the run function and its ctx, retries, waits, queues and concurrency, idempotency keys, run metadata, logging, triggering other tasks (and the Result shape), scheduled\u002Fcron tasks, and the essentials of trigger.config.ts. Load this whenever you are authoring or editing code inside a \u002Ftrigger directory, defining a task, or writing backend code that triggers tasks. Realtime\u002FReact hooks and AI chat are covered by separate skills.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5780,5783,5784,5785],{"name":5781,"slug":5782,"type":14},"Backend","backend",{"name":5767,"slug":5768,"type":14},{"name":9,"slug":8,"type":14},{"name":22,"slug":23,"type":14},"2026-07-02T17:12:48.396964",{"slug":5788,"name":5788,"fn":5789,"description":5790,"org":5791,"tags":5792,"stars":5771,"repoUrl":5772,"updatedAt":5796},"trigger-chat-agent-advanced","manage Trigger.dev chat sessions and transports","Advanced and operational chat.agent capabilities for Trigger.dev, loaded on demand. Load this when working on the raw Sessions primitive (sessions \u002F SessionHandle), a custom chat transport or the realtime wire protocol, durable sub-agents (AgentChat, chat.stream.writer), human-in-the-loop, steering, actions, background injection (chat.defer \u002F chat.inject), fast starts (preload, Head Start via @trigger.dev\u002Fsdk\u002Fchat-server), context resilience (compaction, recovery boot, OOM, large payloads), chat.local run-scoped state, offline testing with mockChatAgent, or prerelease\u002Fversion upgrades. For the everyday chat.agent({...}) definition and the useTriggerChatTransport happy path, use the trigger-authoring-chat-agent skill instead.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5793,5794,5795],{"name":16,"slug":17,"type":14},{"name":9,"slug":8,"type":14},{"name":22,"slug":23,"type":14},"2026-07-02T17:12:51.03018",{"slug":5798,"name":5798,"fn":5799,"description":5800,"org":5801,"tags":5802,"stars":5771,"repoUrl":5772,"updatedAt":5813},"trigger-realtime-and-frontend","subscribe to Trigger.dev runs in realtime","Trigger.dev client\u002Ffrontend surface: subscribe to runs in realtime (runs.subscribeToRun and the @trigger.dev\u002Freact-hooks hook useRealtimeRun), consume metadata and AI\u002Ftext streams in React (useRealtimeStream), trigger tasks from the browser (useTaskTrigger, useRealtimeTaskTrigger), and mint scoped frontend credentials with auth.createPublicToken \u002F auth.createTriggerPublicToken. Load when wiring a frontend (React\u002FNext.js\u002FRemix) or backend-for-frontend to show live run progress, status badges, token streams, trigger buttons, or wait-token approval UIs. NOT for writing the backend task itself (streams.define \u002F metadata.set is trigger-authoring-tasks territory); this is the consumer side.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5803,5806,5809,5812],{"name":5804,"slug":5805,"type":14},"Frontend","frontend",{"name":5807,"slug":5808,"type":14},"React","react",{"name":5810,"slug":5811,"type":14},"Real-time","real-time",{"name":9,"slug":8,"type":14},"2026-07-02T17:12:49.717706",{"slug":4,"name":4,"fn":5,"description":6,"org":5815,"tags":5816,"stars":24,"repoUrl":25,"updatedAt":26},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5817,5818,5819,5820],{"name":16,"slug":17,"type":14},{"name":19,"slug":20,"type":14},{"name":9,"slug":8,"type":14},{"name":22,"slug":23,"type":14},{"slug":5822,"name":5822,"fn":5823,"description":5824,"org":5825,"tags":5826,"stars":24,"repoUrl":25,"updatedAt":5834},"trigger-config","configure Trigger.dev project settings","Configure Trigger.dev projects with trigger.config.ts. Use when setting up build extensions for Prisma, Playwright, FFmpeg, Python, or customizing deployment settings.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5827,5830,5833],{"name":5828,"slug":5829,"type":14},"Configuration","configuration",{"name":5831,"slug":5832,"type":14},"Deployment","deployment",{"name":9,"slug":8,"type":14},"2026-04-06T18:54:44.764258",{"slug":5836,"name":5836,"fn":5837,"description":5838,"org":5839,"tags":5840,"stars":24,"repoUrl":25,"updatedAt":5851},"trigger-cost-savings","optimize Trigger.dev task costs","Analyze Trigger.dev tasks, schedules, and runs for cost optimization opportunities. Use when asked to reduce spend, optimize costs, audit usage, right-size machines, or review task efficiency. Requires Trigger.dev MCP tools for run analysis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5841,5844,5847,5850],{"name":5842,"slug":5843,"type":14},"Analytics","analytics",{"name":5845,"slug":5846,"type":14},"Cost Optimization","cost-optimization",{"name":5848,"slug":5849,"type":14},"Operations","operations",{"name":9,"slug":8,"type":14},"2026-04-06T18:54:48.555552",{"slug":5853,"name":5853,"fn":5854,"description":5855,"org":5856,"tags":5857,"stars":24,"repoUrl":25,"updatedAt":5864},"trigger-realtime","monitor Trigger.dev tasks in real-time","Subscribe to Trigger.dev task runs in real-time from frontend and backend. Use when building progress indicators, live dashboards, streaming AI\u002FLLM responses, or React components that display task status.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5858,5859,5862,5863],{"name":5804,"slug":5805,"type":14},{"name":5860,"slug":5861,"type":14},"Observability","observability",{"name":5810,"slug":5811,"type":14},{"name":9,"slug":8,"type":14},"2026-04-06T18:54:47.293822",{"slug":5866,"name":5866,"fn":5867,"description":5868,"org":5869,"tags":5870,"stars":24,"repoUrl":25,"updatedAt":5876},"trigger-setup","set up Trigger.dev in projects","Set up Trigger.dev in your project. Use when adding Trigger.dev for the first time, creating trigger.config.ts, or initializing the trigger directory.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5871,5872,5875],{"name":5828,"slug":5829,"type":14},{"name":5873,"slug":5874,"type":14},"Local Development","local-development",{"name":9,"slug":8,"type":14},"2026-04-06T18:54:42.280816",{"slug":5878,"name":5878,"fn":5879,"description":5880,"org":5881,"tags":5882,"stars":24,"repoUrl":25,"updatedAt":5887},"trigger-tasks","build durable background tasks with Trigger.dev","Build AI agents, workflows and durable background tasks with Trigger.dev. Use when creating tasks, triggering jobs, handling retries, scheduling cron jobs, or implementing queues and concurrency control.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5883,5884,5885,5886],{"name":16,"slug":17,"type":14},{"name":5781,"slug":5782,"type":14},{"name":9,"slug":8,"type":14},{"name":22,"slug":23,"type":14},"2026-04-06T18:54:43.514369",{"slug":5889,"name":5889,"fn":5890,"description":5891,"org":5892,"tags":5893,"stars":205,"repoUrl":5900,"updatedAt":5901},"staff-engineering-skills-backpressure","implement backpressure in streaming pipelines","Prevent unbounded resource growth when producers outpace consumers. Use when writing producer-consumer code, queue processing, batch operations, fan-out patterns, streaming pipelines, or any code where work is generated faster than it can be processed. Activates on patterns like Promise.all on dynamic-sized arrays, unbounded in-memory queues, producer loops without depth checks, fire-and-forget async calls in loops, or any buffer between a producer and consumer without a size limit.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5894,5897],{"name":5895,"slug":5896,"type":14},"Architecture","architecture",{"name":5898,"slug":5899,"type":14},"Performance","performance","https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fstaff-engineering-skills","2026-06-17T08:40:42.723559",{"slug":5903,"name":5903,"fn":5904,"description":5905,"org":5906,"tags":5907,"stars":205,"repoUrl":5900,"updatedAt":5916},"staff-engineering-skills-cache-invalidation","implement cache invalidation strategies","Prevent stale data bugs caused by missing or incomplete cache invalidation. Use when adding caching layers (Redis, in-memory Map, CDN, HTTP cache headers), optimizing read performance, or reviewing code that caches query results, API responses, or computed values. Activates on patterns like cache.set without cache.delete on write paths, unbounded Map\u002Fobject caches, TTL-only invalidation on security-sensitive data, Cache-Control headers on mutable content, or any caching where the write path doesn't invalidate the read cache.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5908,5909,5912,5915],{"name":5895,"slug":5896,"type":14},{"name":5910,"slug":5911,"type":14},"Caching","caching",{"name":5913,"slug":5914,"type":14},"Engineering","engineering",{"name":5898,"slug":5899,"type":14},"2026-06-17T08:40:45.194583",{"items":5918,"total":296},[5919,5926,5932,5939,5946,5952],{"slug":4,"name":4,"fn":5,"description":6,"org":5920,"tags":5921,"stars":24,"repoUrl":25,"updatedAt":26},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5922,5923,5924,5925],{"name":16,"slug":17,"type":14},{"name":19,"slug":20,"type":14},{"name":9,"slug":8,"type":14},{"name":22,"slug":23,"type":14},{"slug":5822,"name":5822,"fn":5823,"description":5824,"org":5927,"tags":5928,"stars":24,"repoUrl":25,"updatedAt":5834},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5929,5930,5931],{"name":5828,"slug":5829,"type":14},{"name":5831,"slug":5832,"type":14},{"name":9,"slug":8,"type":14},{"slug":5836,"name":5836,"fn":5837,"description":5838,"org":5933,"tags":5934,"stars":24,"repoUrl":25,"updatedAt":5851},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5935,5936,5937,5938],{"name":5842,"slug":5843,"type":14},{"name":5845,"slug":5846,"type":14},{"name":5848,"slug":5849,"type":14},{"name":9,"slug":8,"type":14},{"slug":5853,"name":5853,"fn":5854,"description":5855,"org":5940,"tags":5941,"stars":24,"repoUrl":25,"updatedAt":5864},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5942,5943,5944,5945],{"name":5804,"slug":5805,"type":14},{"name":5860,"slug":5861,"type":14},{"name":5810,"slug":5811,"type":14},{"name":9,"slug":8,"type":14},{"slug":5866,"name":5866,"fn":5867,"description":5868,"org":5947,"tags":5948,"stars":24,"repoUrl":25,"updatedAt":5876},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5949,5950,5951],{"name":5828,"slug":5829,"type":14},{"name":5873,"slug":5874,"type":14},{"name":9,"slug":8,"type":14},{"slug":5878,"name":5878,"fn":5879,"description":5880,"org":5953,"tags":5954,"stars":24,"repoUrl":25,"updatedAt":5887},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5955,5956,5957,5958],{"name":16,"slug":17,"type":14},{"name":5781,"slug":5782,"type":14},{"name":9,"slug":8,"type":14},{"name":22,"slug":23,"type":14}]