[{"data":1,"prerenderedAt":1708},["ShallowReactive",2],{"navigation_docs":3,"-frameworks-vercel-workflow":85,"-frameworks-vercel-workflow-surround":1703},[4,26,49,73],{"title":5,"path":6,"stem":7,"children":8,"page":25},"Getting Started","\u002Fgetting-started","docs",[9,13,17,21],{"title":10,"path":11,"stem":12},"Introduction","\u002Fgetting-started\u002Fintroduction","docs\u002F1.getting-started\u002F1.introduction",{"title":14,"path":15,"stem":16},"Installation","\u002Fgetting-started\u002Finstallation","docs\u002F1.getting-started\u002F2.installation",{"title":18,"path":19,"stem":20},"Quick Start","\u002Fgetting-started\u002Fquick-start","docs\u002F1.getting-started\u002F3.quick-start",{"title":22,"path":23,"stem":24},"Agent Skills","\u002Fgetting-started\u002Fagent-skills","docs\u002F1.getting-started\u002F4.agent-skills",false,{"title":27,"path":28,"stem":7,"children":29,"page":25},"Frameworks","\u002Fframeworks",[30,35,40,44],{"title":31,"path":32,"stem":33,"icon":34},"eve","\u002Fframeworks\u002Feve","docs\u002F2.frameworks\u002F1.eve","i-custom:eve",{"title":36,"path":37,"stem":38,"icon":39},"AI SDK","\u002Fframeworks\u002Fai-sdk","docs\u002F2.frameworks\u002F2.ai-sdk","i-simple-icons-vercel",{"title":41,"path":42,"stem":43,"icon":39},"Vercel Workflow","\u002Fframeworks\u002Fvercel-workflow","docs\u002F2.frameworks\u002F3.vercel-workflow",{"title":45,"path":46,"stem":47,"icon":48},"Chat SDK","\u002Fframeworks\u002Fchat-sdk","docs\u002F2.frameworks\u002F4.chat-sdk","i-lucide-message-square",{"title":50,"path":51,"stem":7,"children":52,"page":25},"Guide","\u002Fguide",[53,57,61,65,69],{"title":54,"path":55,"stem":56},"Scope with Presets","\u002Fguide\u002Fpresets","docs\u002F3.guide\u002F1.presets",{"title":58,"path":59,"stem":60},"Control Write Safety","\u002Fguide\u002Fapproval-control","docs\u002F3.guide\u002F2.approval-control",{"title":62,"path":63,"stem":64},"Commit Attribution","\u002Fguide\u002Fcommit-attribution","docs\u002F3.guide\u002F3.commit-attribution",{"title":66,"path":67,"stem":68},"Tokens & Auth","\u002Fguide\u002Ftokens-and-auth","docs\u002F3.guide\u002F4.tokens-and-auth",{"title":70,"path":71,"stem":72},"Examples","\u002Fguide\u002Fexamples","docs\u002F3.guide\u002F5.examples",{"title":74,"path":75,"stem":7,"children":76,"page":25},"Api","\u002Fapi",[77,81],{"title":78,"path":79,"stem":80},"Tools Catalog","\u002Fapi\u002Ftools-catalog","docs\u002F4.api\u002F1.tools-catalog",{"title":82,"path":83,"stem":84},"API Reference","\u002Fapi\u002Freference","docs\u002F4.api\u002F2.reference",{"id":86,"title":87,"body":88,"description":1686,"extension":1687,"links":1688,"meta":1699,"navigation":1700,"path":42,"seo":1701,"stem":43,"__hash__":1702},"docs\u002Fdocs\u002F2.frameworks\u002F3.vercel-workflow.md","Durable agents with Vercel Workflow",{"type":89,"value":90,"toc":1672},"minimark",[91,117,146,151,201,208,212,222,301,318,322,331,353,356,361,687,691,701,918,922,925,1384,1409,1413,1468,1472,1494,1508,1518,1522,1620,1624,1649,1653,1668],[92,93,94,95,99,100,104,105,112,113,116],"p",{},"Long-running assistants and chat backends often need ",[96,97,98],"strong",{},"durable"," execution: if a function restarts, the same logical run should resume, tool calls should retry safely, and each step should be observable. ",[101,102,103],"code",{},"@github-tools\u002Fsdk"," supports this through the ",[106,107,111],"a",{"href":108,"rel":109},"https:\u002F\u002Fvercel.com\u002Fdocs\u002Fworkflow",[110],"nofollow","Vercel Workflow SDK"," and the ",[101,114,115],{},"@github-tools\u002Fsdk\u002Fworkflow"," entry point.",[118,119,123,126],"prompt",{":actions":120,"description":121,"icon":122},"[\"copy\",\"cursor\",\"windsurf\"]","Integrate a durable GitHub assistant","i-lucide-refresh-cw",[92,124,125],{},"Integrate a durable GitHub assistant using @github-tools\u002Fsdk\u002Fworkflow and the Vercel Workflow SDK in this repo.",[127,128,129,133,140,143],"ul",{},[130,131,132],"li",{},"Add dependencies: workflow, @ai-sdk\u002Fworkflow (and existing @github-tools\u002Fsdk, ai, zod)",[130,134,135,136,139],{},"Define an async function with \"use workflow\" using createDurableGithubAgent, getWritable from \"workflow\", and agent.stream with ModelMessage",[137,138],"span",{}," and ModelCallStreamPart",[130,141,142],{},"Pipe run.readable through createModelCallToUIChunkTransform() in the route handler; return x-workflow-run-id for WorkflowChatTransport",[130,144,145],{},"Match this framework’s workflow layout (e.g. server\u002Fworkflows in Nuxt)",[147,148,150],"h2",{"id":149},"what-durable-means-here","What “durable” means here",[127,152,153,161,173],{},[130,154,155,160],{},[96,156,157],{},[101,158,159],{},"\"use workflow\""," — Your orchestration function is a workflow: the platform can pause, resume, and replay it across failures and deploys.",[130,162,163,168,169,172],{},[96,164,165],{},[101,166,167],{},"\"use step\""," — Each GitHub tool implementation runs inside a ",[96,170,171],{},"named, module-level step",". Every tool call is a durable step with retries and full Node.js access in the workflow runtime.",[130,174,175,180,181,188,189,192,193,196,197,200],{},[96,176,177],{},[101,178,179],{},"createDurableGithubAgent"," — Wraps the same GitHub tools in a ",[106,182,185],{"href":183,"rel":184},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fagents\u002Fworkflow-agent",[110],[101,186,187],{},"WorkflowAgent"," from ",[101,190,191],{},"@ai-sdk\u002Fworkflow"," so ",[96,194,195],{},"LLM turns and tool invocations"," participate in that durable model (not just raw ",[101,198,199],{},"generateText"," in a plain serverless handler).",[92,202,203,204,207],{},"Together, this is the recommended pattern when you build ",[96,205,206],{},"Nuxt",", Next.js, or other apps that expose a chat or agent API and must not lose progress on timeout or cold start.",[147,209,211],{"id":210},"install-optional-workflow-dependencies","Install optional workflow dependencies",[92,213,214,215,218,219,221],{},"Durable agents are ",[96,216,217],{},"optional",". Add them only when you use ",[101,220,115],{},":",[223,224,225,252,269,285],"code-group",{},[226,227,233],"pre",{"className":228,"code":229,"filename":230,"language":231,"meta":232,"style":232},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm add workflow @ai-sdk\u002Fworkflow\n","pnpm","bash","",[101,234,235],{"__ignoreMap":232},[137,236,239,242,246,249],{"class":237,"line":238},"line",1,[137,240,230],{"class":241},"sBMFI",[137,243,245],{"class":244},"sfazB"," add",[137,247,248],{"class":244}," workflow",[137,250,251],{"class":244}," @ai-sdk\u002Fworkflow\n",[226,253,256],{"className":228,"code":254,"filename":255,"language":231,"meta":232,"style":232},"npm install workflow @ai-sdk\u002Fworkflow\n","npm",[101,257,258],{"__ignoreMap":232},[137,259,260,262,265,267],{"class":237,"line":238},[137,261,255],{"class":241},[137,263,264],{"class":244}," install",[137,266,248],{"class":244},[137,268,251],{"class":244},[226,270,273],{"className":228,"code":271,"filename":272,"language":231,"meta":232,"style":232},"yarn add workflow @ai-sdk\u002Fworkflow\n","yarn",[101,274,275],{"__ignoreMap":232},[137,276,277,279,281,283],{"class":237,"line":238},[137,278,272],{"class":241},[137,280,245],{"class":244},[137,282,248],{"class":244},[137,284,251],{"class":244},[226,286,289],{"className":228,"code":287,"filename":288,"language":231,"meta":232,"style":232},"bun add workflow @ai-sdk\u002Fworkflow\n","bun",[101,290,291],{"__ignoreMap":232},[137,292,293,295,297,299],{"class":237,"line":238},[137,294,288],{"class":241},[137,296,245],{"class":244},[137,298,248],{"class":244},[137,300,251],{"class":244},[92,302,303,304,307,308,311,312,314,315,317],{},"You still need ",[101,305,306],{},"ai",", ",[101,309,310],{},"zod",", and ",[101,313,103],{}," as documented in ",[106,316,14],{"href":15},".",[147,319,321],{"id":320},"minimal-durable-workflow","Minimal durable workflow",[92,323,324,326,327,330],{},[101,325,179],{}," returns a ",[101,328,329],{},"DurableGithubAgent"," with two methods:",[127,332,333,345],{},[130,334,335,340,341,344],{},[96,336,337],{},[101,338,339],{},".stream()"," — real-time output to a ",[101,342,343],{},"WritableStream"," (for chat UIs)",[130,346,347,352],{},[96,348,349],{},[101,350,351],{},".generate()"," — non-streaming, returns the full text response (for bots, background jobs, webhooks)",[92,354,355],{},"Both methods execute each tool call as a durable workflow step with automatic retries.",[357,358,360],"h3",{"id":359},"streaming-chat-ui","Streaming (chat UI)",[226,362,367],{"className":363,"code":364,"filename":365,"language":366,"meta":232,"style":232},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createDurableGithubAgent } from '@github-tools\u002Fsdk\u002Fworkflow'\nimport { getWritable } from 'workflow'\nimport type { ModelCallStreamPart, ModelMessage } from 'ai'\n\nexport async function durableGithubChat(\n  messages: ModelMessage[],\n  token: string,\n  model: string\n) {\n  'use workflow'\n\n  const writable = getWritable\u003CModelCallStreamPart>()\n\n  const agent = createDurableGithubAgent({\n    model,\n    token,\n    preset: 'code-review',\n    requireApproval: true,\n  })\n\n  await agent.stream({ messages, writable })\n}\n","durable-chat.workflow.ts","ts",[101,368,369,397,418,447,454,474,491,504,515,524,535,540,567,572,590,598,606,624,638,647,652,681],{"__ignoreMap":232},[137,370,371,375,379,383,386,389,392,394],{"class":237,"line":238},[137,372,374],{"class":373},"s7zQu","import",[137,376,378],{"class":377},"sMK4o"," {",[137,380,382],{"class":381},"sTEyZ"," createDurableGithubAgent",[137,384,385],{"class":377}," }",[137,387,388],{"class":373}," from",[137,390,391],{"class":377}," '",[137,393,115],{"class":244},[137,395,396],{"class":377},"'\n",[137,398,400,402,404,407,409,411,413,416],{"class":237,"line":399},2,[137,401,374],{"class":373},[137,403,378],{"class":377},[137,405,406],{"class":381}," getWritable",[137,408,385],{"class":377},[137,410,388],{"class":373},[137,412,391],{"class":377},[137,414,415],{"class":244},"workflow",[137,417,396],{"class":377},[137,419,421,423,426,428,431,434,437,439,441,443,445],{"class":237,"line":420},3,[137,422,374],{"class":373},[137,424,425],{"class":373}," type",[137,427,378],{"class":377},[137,429,430],{"class":381}," ModelCallStreamPart",[137,432,433],{"class":377},",",[137,435,436],{"class":381}," ModelMessage",[137,438,385],{"class":377},[137,440,388],{"class":373},[137,442,391],{"class":377},[137,444,306],{"class":244},[137,446,396],{"class":377},[137,448,450],{"class":237,"line":449},4,[137,451,453],{"emptyLinePlaceholder":452},true,"\n",[137,455,457,460,464,467,471],{"class":237,"line":456},5,[137,458,459],{"class":373},"export",[137,461,463],{"class":462},"spNyl"," async",[137,465,466],{"class":462}," function",[137,468,470],{"class":469},"s2Zo4"," durableGithubChat",[137,472,473],{"class":377},"(\n",[137,475,477,481,483,485,488],{"class":237,"line":476},6,[137,478,480],{"class":479},"sHdIc","  messages",[137,482,221],{"class":377},[137,484,436],{"class":241},[137,486,487],{"class":381},"[]",[137,489,490],{"class":377},",\n",[137,492,494,497,499,502],{"class":237,"line":493},7,[137,495,496],{"class":479},"  token",[137,498,221],{"class":377},[137,500,501],{"class":241}," string",[137,503,490],{"class":377},[137,505,507,510,512],{"class":237,"line":506},8,[137,508,509],{"class":479},"  model",[137,511,221],{"class":377},[137,513,514],{"class":241}," string\n",[137,516,518,521],{"class":237,"line":517},9,[137,519,520],{"class":377},")",[137,522,523],{"class":377}," {\n",[137,525,527,530,533],{"class":237,"line":526},10,[137,528,529],{"class":377},"  '",[137,531,532],{"class":244},"use workflow",[137,534,396],{"class":377},[137,536,538],{"class":237,"line":537},11,[137,539,453],{"emptyLinePlaceholder":452},[137,541,543,546,549,552,554,557,560,563],{"class":237,"line":542},12,[137,544,545],{"class":462},"  const",[137,547,548],{"class":381}," writable",[137,550,551],{"class":377}," =",[137,553,406],{"class":469},[137,555,556],{"class":377},"\u003C",[137,558,559],{"class":241},"ModelCallStreamPart",[137,561,562],{"class":377},">",[137,564,566],{"class":565},"swJcz","()\n",[137,568,570],{"class":237,"line":569},13,[137,571,453],{"emptyLinePlaceholder":452},[137,573,575,577,580,582,584,587],{"class":237,"line":574},14,[137,576,545],{"class":462},[137,578,579],{"class":381}," agent",[137,581,551],{"class":377},[137,583,382],{"class":469},[137,585,586],{"class":565},"(",[137,588,589],{"class":377},"{\n",[137,591,593,596],{"class":237,"line":592},15,[137,594,595],{"class":381},"    model",[137,597,490],{"class":377},[137,599,601,604],{"class":237,"line":600},16,[137,602,603],{"class":381},"    token",[137,605,490],{"class":377},[137,607,609,612,614,616,619,622],{"class":237,"line":608},17,[137,610,611],{"class":565},"    preset",[137,613,221],{"class":377},[137,615,391],{"class":377},[137,617,618],{"class":244},"code-review",[137,620,621],{"class":377},"'",[137,623,490],{"class":377},[137,625,627,630,632,636],{"class":237,"line":626},18,[137,628,629],{"class":565},"    requireApproval",[137,631,221],{"class":377},[137,633,635],{"class":634},"sfNiH"," true",[137,637,490],{"class":377},[137,639,641,644],{"class":237,"line":640},19,[137,642,643],{"class":377},"  }",[137,645,646],{"class":565},")\n",[137,648,650],{"class":237,"line":649},20,[137,651,453],{"emptyLinePlaceholder":452},[137,653,655,658,660,662,665,667,670,673,675,677,679],{"class":237,"line":654},21,[137,656,657],{"class":373},"  await",[137,659,579],{"class":381},[137,661,317],{"class":377},[137,663,664],{"class":469},"stream",[137,666,586],{"class":565},[137,668,669],{"class":377},"{",[137,671,672],{"class":381}," messages",[137,674,433],{"class":377},[137,676,548],{"class":381},[137,678,385],{"class":377},[137,680,646],{"class":565},[137,682,684],{"class":237,"line":683},22,[137,685,686],{"class":377},"}\n",[357,688,690],{"id":689},"non-streaming-bot-background-job","Non-streaming (bot \u002F background job)",[92,692,693,694,697,698,700],{},"For non-streaming use cases (bots, webhooks, background jobs), use ",[101,695,696],{},"createGithubAgent"," inside a ",[101,699,167],{}," function. This gives you the full tool loop while keeping the step durable:",[226,702,705],{"className":363,"code":703,"filename":704,"language":366,"meta":232,"style":232},"import { createGithubAgent } from '@github-tools\u002Fsdk'\n\nasync function runAgentTurn(prompt: string) {\n  'use step'\n  const agent = createGithubAgent({\n    model: 'anthropic\u002Fclaude-sonnet-4.6',\n    preset: 'code-review',\n    requireApproval: false,\n  })\n  const { text } = await agent.generate({ prompt })\n  return text\n}\n\nexport async function reviewWorkflow(prompt: string) {\n  'use workflow'\n  await runAgentTurn(prompt)\n}\n","review-agent.workflow.ts",[101,706,707,726,730,752,761,775,790,804,815,821,855,863,867,871,894,902,914],{"__ignoreMap":232},[137,708,709,711,713,716,718,720,722,724],{"class":237,"line":238},[137,710,374],{"class":373},[137,712,378],{"class":377},[137,714,715],{"class":381}," createGithubAgent",[137,717,385],{"class":377},[137,719,388],{"class":373},[137,721,391],{"class":377},[137,723,103],{"class":244},[137,725,396],{"class":377},[137,727,728],{"class":237,"line":399},[137,729,453],{"emptyLinePlaceholder":452},[137,731,732,735,737,740,742,744,746,748,750],{"class":237,"line":420},[137,733,734],{"class":462},"async",[137,736,466],{"class":462},[137,738,739],{"class":469}," runAgentTurn",[137,741,586],{"class":377},[137,743,118],{"class":479},[137,745,221],{"class":377},[137,747,501],{"class":241},[137,749,520],{"class":377},[137,751,523],{"class":377},[137,753,754,756,759],{"class":237,"line":449},[137,755,529],{"class":377},[137,757,758],{"class":244},"use step",[137,760,396],{"class":377},[137,762,763,765,767,769,771,773],{"class":237,"line":456},[137,764,545],{"class":462},[137,766,579],{"class":381},[137,768,551],{"class":377},[137,770,715],{"class":469},[137,772,586],{"class":565},[137,774,589],{"class":377},[137,776,777,779,781,783,786,788],{"class":237,"line":476},[137,778,595],{"class":565},[137,780,221],{"class":377},[137,782,391],{"class":377},[137,784,785],{"class":244},"anthropic\u002Fclaude-sonnet-4.6",[137,787,621],{"class":377},[137,789,490],{"class":377},[137,791,792,794,796,798,800,802],{"class":237,"line":493},[137,793,611],{"class":565},[137,795,221],{"class":377},[137,797,391],{"class":377},[137,799,618],{"class":244},[137,801,621],{"class":377},[137,803,490],{"class":377},[137,805,806,808,810,813],{"class":237,"line":506},[137,807,629],{"class":565},[137,809,221],{"class":377},[137,811,812],{"class":634}," false",[137,814,490],{"class":377},[137,816,817,819],{"class":237,"line":517},[137,818,643],{"class":377},[137,820,646],{"class":565},[137,822,823,825,827,830,832,834,837,839,841,844,846,848,851,853],{"class":237,"line":526},[137,824,545],{"class":462},[137,826,378],{"class":377},[137,828,829],{"class":381}," text",[137,831,385],{"class":377},[137,833,551],{"class":377},[137,835,836],{"class":373}," await",[137,838,579],{"class":381},[137,840,317],{"class":377},[137,842,843],{"class":469},"generate",[137,845,586],{"class":565},[137,847,669],{"class":377},[137,849,850],{"class":381}," prompt",[137,852,385],{"class":377},[137,854,646],{"class":565},[137,856,857,860],{"class":237,"line":537},[137,858,859],{"class":373},"  return",[137,861,862],{"class":381}," text\n",[137,864,865],{"class":237,"line":542},[137,866,686],{"class":377},[137,868,869],{"class":237,"line":569},[137,870,453],{"emptyLinePlaceholder":452},[137,872,873,875,877,879,882,884,886,888,890,892],{"class":237,"line":574},[137,874,459],{"class":373},[137,876,463],{"class":462},[137,878,466],{"class":462},[137,880,881],{"class":469}," reviewWorkflow",[137,883,586],{"class":377},[137,885,118],{"class":479},[137,887,221],{"class":377},[137,889,501],{"class":241},[137,891,520],{"class":377},[137,893,523],{"class":377},[137,895,896,898,900],{"class":237,"line":592},[137,897,529],{"class":377},[137,899,532],{"class":244},[137,901,396],{"class":377},[137,903,904,906,908,910,912],{"class":237,"line":600},[137,905,657],{"class":373},[137,907,739],{"class":469},[137,909,586],{"class":565},[137,911,118],{"class":381},[137,913,646],{"class":565},[137,915,916],{"class":237,"line":608},[137,917,686],{"class":377},[147,919,921],{"id":920},"wire-it-into-your-framework","Wire it into your framework",[92,923,924],{},"Workflows are plain exported functions — your framework's Workflow integration starts the run from an API route and streams results to the client.",[926,927,928,1165],"tabs",{},[929,930,932,939],"tabs-item",{"icon":931,"label":206},"i-simple-icons-nuxtdotjs",[92,933,934,935,938],{},"Place workflows under ",[101,936,937],{},"server\u002Fworkflows\u002F"," and start them from a Nitro server route:",[226,940,943],{"className":363,"code":941,"filename":942,"language":366,"meta":232,"style":232},"import { start } from 'workflow\u002Fapi'\nimport { durableGithubChat } from '..\u002Fworkflows\u002Fdurable-chat.workflow'\n\nexport default defineEventHandler(async (event) => {\n  const { messages, model } = await readBody(event)\n  const session = await requireUserSession(event)\n\n  const run = await start(durableGithubChat, [messages, session.secure.githubToken, model])\n\n  setHeader(event, 'x-workflow-run-id', run.runId)\n  return run.readable\n})\n","server\u002Fapi\u002Fchat.post.ts",[101,944,945,965,984,988,1015,1043,1063,1067,1114,1118,1147,1158],{"__ignoreMap":232},[137,946,947,949,951,954,956,958,960,963],{"class":237,"line":238},[137,948,374],{"class":373},[137,950,378],{"class":377},[137,952,953],{"class":381}," start",[137,955,385],{"class":377},[137,957,388],{"class":373},[137,959,391],{"class":377},[137,961,962],{"class":244},"workflow\u002Fapi",[137,964,396],{"class":377},[137,966,967,969,971,973,975,977,979,982],{"class":237,"line":399},[137,968,374],{"class":373},[137,970,378],{"class":377},[137,972,470],{"class":381},[137,974,385],{"class":377},[137,976,388],{"class":373},[137,978,391],{"class":377},[137,980,981],{"class":244},"..\u002Fworkflows\u002Fdurable-chat.workflow",[137,983,396],{"class":377},[137,985,986],{"class":237,"line":420},[137,987,453],{"emptyLinePlaceholder":452},[137,989,990,992,995,998,1000,1002,1005,1008,1010,1013],{"class":237,"line":449},[137,991,459],{"class":373},[137,993,994],{"class":373}," default",[137,996,997],{"class":469}," defineEventHandler",[137,999,586],{"class":381},[137,1001,734],{"class":462},[137,1003,1004],{"class":377}," (",[137,1006,1007],{"class":479},"event",[137,1009,520],{"class":377},[137,1011,1012],{"class":462}," =>",[137,1014,523],{"class":377},[137,1016,1017,1019,1021,1023,1025,1028,1030,1032,1034,1037,1039,1041],{"class":237,"line":456},[137,1018,545],{"class":462},[137,1020,378],{"class":377},[137,1022,672],{"class":381},[137,1024,433],{"class":377},[137,1026,1027],{"class":381}," model",[137,1029,385],{"class":377},[137,1031,551],{"class":377},[137,1033,836],{"class":373},[137,1035,1036],{"class":469}," readBody",[137,1038,586],{"class":565},[137,1040,1007],{"class":381},[137,1042,646],{"class":565},[137,1044,1045,1047,1050,1052,1054,1057,1059,1061],{"class":237,"line":476},[137,1046,545],{"class":462},[137,1048,1049],{"class":381}," session",[137,1051,551],{"class":377},[137,1053,836],{"class":373},[137,1055,1056],{"class":469}," requireUserSession",[137,1058,586],{"class":565},[137,1060,1007],{"class":381},[137,1062,646],{"class":565},[137,1064,1065],{"class":237,"line":493},[137,1066,453],{"emptyLinePlaceholder":452},[137,1068,1069,1071,1074,1076,1078,1080,1082,1085,1087,1090,1093,1095,1097,1099,1102,1104,1107,1109,1111],{"class":237,"line":506},[137,1070,545],{"class":462},[137,1072,1073],{"class":381}," run",[137,1075,551],{"class":377},[137,1077,836],{"class":373},[137,1079,953],{"class":469},[137,1081,586],{"class":565},[137,1083,1084],{"class":381},"durableGithubChat",[137,1086,433],{"class":377},[137,1088,1089],{"class":565}," [",[137,1091,1092],{"class":381},"messages",[137,1094,433],{"class":377},[137,1096,1049],{"class":381},[137,1098,317],{"class":377},[137,1100,1101],{"class":381},"secure",[137,1103,317],{"class":377},[137,1105,1106],{"class":381},"githubToken",[137,1108,433],{"class":377},[137,1110,1027],{"class":381},[137,1112,1113],{"class":565},"])\n",[137,1115,1116],{"class":237,"line":517},[137,1117,453],{"emptyLinePlaceholder":452},[137,1119,1120,1123,1125,1127,1129,1131,1134,1136,1138,1140,1142,1145],{"class":237,"line":526},[137,1121,1122],{"class":469},"  setHeader",[137,1124,586],{"class":565},[137,1126,1007],{"class":381},[137,1128,433],{"class":377},[137,1130,391],{"class":377},[137,1132,1133],{"class":244},"x-workflow-run-id",[137,1135,621],{"class":377},[137,1137,433],{"class":377},[137,1139,1073],{"class":381},[137,1141,317],{"class":377},[137,1143,1144],{"class":381},"runId",[137,1146,646],{"class":565},[137,1148,1149,1151,1153,1155],{"class":237,"line":537},[137,1150,859],{"class":373},[137,1152,1073],{"class":381},[137,1154,317],{"class":377},[137,1156,1157],{"class":381},"readable\n",[137,1159,1160,1163],{"class":237,"line":542},[137,1161,1162],{"class":377},"}",[137,1164,646],{"class":381},[929,1166,1169,1172],{"icon":1167,"label":1168},"i-simple-icons-nextdotjs","Next.js",[92,1170,1171],{},"Export workflows from any module and start them from an App Router route handler:",[226,1173,1176],{"className":363,"code":1174,"filename":1175,"language":366,"meta":232,"style":232},"import { start } from 'workflow\u002Fapi'\nimport { durableGithubChat } from '@\u002Fworkflows\u002Fdurable-chat.workflow'\n\nexport async function POST(req: Request) {\n  const { messages, model } = await req.json()\n\n  const run = await start(durableGithubChat, [messages, process.env.GITHUB_TOKEN!, model])\n\n  return new Response(run.readable, {\n    headers: { 'x-workflow-run-id': run.runId },\n  })\n}\n","app\u002Fapi\u002Fchat\u002Froute.ts",[101,1177,1178,1196,1215,1219,1244,1272,1276,1320,1324,1348,1374,1380],{"__ignoreMap":232},[137,1179,1180,1182,1184,1186,1188,1190,1192,1194],{"class":237,"line":238},[137,1181,374],{"class":373},[137,1183,378],{"class":377},[137,1185,953],{"class":381},[137,1187,385],{"class":377},[137,1189,388],{"class":373},[137,1191,391],{"class":377},[137,1193,962],{"class":244},[137,1195,396],{"class":377},[137,1197,1198,1200,1202,1204,1206,1208,1210,1213],{"class":237,"line":399},[137,1199,374],{"class":373},[137,1201,378],{"class":377},[137,1203,470],{"class":381},[137,1205,385],{"class":377},[137,1207,388],{"class":373},[137,1209,391],{"class":377},[137,1211,1212],{"class":244},"@\u002Fworkflows\u002Fdurable-chat.workflow",[137,1214,396],{"class":377},[137,1216,1217],{"class":237,"line":420},[137,1218,453],{"emptyLinePlaceholder":452},[137,1220,1221,1223,1225,1227,1230,1232,1235,1237,1240,1242],{"class":237,"line":449},[137,1222,459],{"class":373},[137,1224,463],{"class":462},[137,1226,466],{"class":462},[137,1228,1229],{"class":469}," POST",[137,1231,586],{"class":377},[137,1233,1234],{"class":479},"req",[137,1236,221],{"class":377},[137,1238,1239],{"class":241}," Request",[137,1241,520],{"class":377},[137,1243,523],{"class":377},[137,1245,1246,1248,1250,1252,1254,1256,1258,1260,1262,1265,1267,1270],{"class":237,"line":456},[137,1247,545],{"class":462},[137,1249,378],{"class":377},[137,1251,672],{"class":381},[137,1253,433],{"class":377},[137,1255,1027],{"class":381},[137,1257,385],{"class":377},[137,1259,551],{"class":377},[137,1261,836],{"class":373},[137,1263,1264],{"class":381}," req",[137,1266,317],{"class":377},[137,1268,1269],{"class":469},"json",[137,1271,566],{"class":565},[137,1273,1274],{"class":237,"line":476},[137,1275,453],{"emptyLinePlaceholder":452},[137,1277,1278,1280,1282,1284,1286,1288,1290,1292,1294,1296,1298,1300,1303,1305,1308,1310,1313,1316,1318],{"class":237,"line":493},[137,1279,545],{"class":462},[137,1281,1073],{"class":381},[137,1283,551],{"class":377},[137,1285,836],{"class":373},[137,1287,953],{"class":469},[137,1289,586],{"class":565},[137,1291,1084],{"class":381},[137,1293,433],{"class":377},[137,1295,1089],{"class":565},[137,1297,1092],{"class":381},[137,1299,433],{"class":377},[137,1301,1302],{"class":381}," process",[137,1304,317],{"class":377},[137,1306,1307],{"class":381},"env",[137,1309,317],{"class":377},[137,1311,1312],{"class":381},"GITHUB_TOKEN",[137,1314,1315],{"class":377},"!,",[137,1317,1027],{"class":381},[137,1319,1113],{"class":565},[137,1321,1322],{"class":237,"line":506},[137,1323,453],{"emptyLinePlaceholder":452},[137,1325,1326,1328,1331,1334,1336,1339,1341,1344,1346],{"class":237,"line":517},[137,1327,859],{"class":373},[137,1329,1330],{"class":377}," new",[137,1332,1333],{"class":469}," Response",[137,1335,586],{"class":565},[137,1337,1338],{"class":381},"run",[137,1340,317],{"class":377},[137,1342,1343],{"class":381},"readable",[137,1345,433],{"class":377},[137,1347,523],{"class":377},[137,1349,1350,1353,1355,1357,1359,1361,1363,1365,1367,1369,1371],{"class":237,"line":526},[137,1351,1352],{"class":565},"    headers",[137,1354,221],{"class":377},[137,1356,378],{"class":377},[137,1358,391],{"class":377},[137,1360,1133],{"class":565},[137,1362,621],{"class":377},[137,1364,221],{"class":377},[137,1366,1073],{"class":381},[137,1368,317],{"class":377},[137,1370,1144],{"class":381},[137,1372,1373],{"class":377}," },\n",[137,1375,1376,1378],{"class":237,"line":537},[137,1377,643],{"class":377},[137,1379,646],{"class":565},[137,1381,1382],{"class":237,"line":542},[137,1383,686],{"class":377},[1385,1386,1387,1388,1392,1393,1400,1401,1406,1407,317],"note",{},"For a complete working example that connects a durable agent to GitHub via ",[106,1389,45],{"href":1390,"rel":1391},"https:\u002F\u002Fchat-sdk.dev",[110],", see the ",[106,1394,1397],{"href":1395,"rel":1396},"https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fgithub-tools\u002Ftree\u002Fmain\u002Fexamples\u002Fpr-review-agent",[110],[101,1398,1399],{},"examples\u002Fpr-review-agent\u002F"," starter — a ~60-line PR review agent with multi-turn durable sessions and ",[106,1402,1405],{"href":1403,"rel":1404},"https:\u002F\u002Fevlog.dev",[110],"evlog"," AI observability. Full walkthrough: ",[106,1408,45],{"href":46},[147,1410,1412],{"id":1411},"presets-and-options","Presets and options",[92,1414,1415,1416,307,1418,307,1421,307,1424,307,1427,1430,1431,1433,1434,1438,1439,1442,1443,307,1446,307,1449,311,1452,1455,1456,1459,1460,1463,1464,1467],{},"All presets (",[101,1417,618],{},[101,1419,1420],{},"issue-triage",[101,1422,1423],{},"repo-explorer",[101,1425,1426],{},"ci-ops",[101,1428,1429],{},"maintainer",") work with ",[101,1432,179],{},". Options mirror ",[106,1435,1436],{"href":83},[101,1437,696],{}," for model, token, preset, instructions, and temperature, with additional pass-through for ",[101,1440,1441],{},"WorkflowAgentOptions"," fields like ",[101,1444,1445],{},"experimental_telemetry",[101,1447,1448],{},"onStepEnd",[101,1450,1451],{},"onEnd",[101,1453,1454],{},"prepareStep",". Use ",[101,1457,1458],{},"stopWhen"," (for example ",[101,1461,1462],{},"stepCountIs(n)",") instead of the deprecated ",[101,1465,1466],{},"maxSteps"," parameter.",[147,1469,1471],{"id":1470},"approval-control-and-durable-agents","Approval control and durable agents",[92,1473,1474,1477,1478,1481,1482,1484,1485,1488,1489,1493],{},[101,1475,1476],{},"requireApproval"," maps to ",[101,1479,1480],{},"needsApproval"," on write tools. When a tool needs approval, ",[101,1483,187],{}," ",[96,1486,1487],{},"pauses the workflow",", emits an approval request to the stream, and resumes when the user approves or denies — the same UX as ",[106,1490,1491],{"href":83},[101,1492,696],{},", but durable across restarts.",[92,1495,1496,1497,1503,1504,1507],{},"Wire the client with ",[106,1498,1500],{"href":183,"rel":1499},[110],[101,1501,1502],{},"WorkflowChatTransport"," and a GET reconnect route (",[101,1505,1506],{},"{api}\u002F{runId}\u002Fstream",") so long runs survive timeouts. The demo chat app toggles this with the shield icon.",[92,1509,1510,1511,1514,1515,317],{},"For richer approval policies — ",[101,1512,1513],{},"'once'"," per session, input-dependent predicates — use ",[106,1516,1517],{"href":32},"eve agents",[147,1519,1521],{"id":1520},"standard-agents-vs-durable-agents","Standard agents vs durable agents",[1523,1524,1525,1542],"table",{},[1526,1527,1528],"thead",{},[1529,1530,1531,1534,1538],"tr",{},[1532,1533],"th",{},[1532,1535,1536],{},[101,1537,696],{},[1532,1539,1540],{},[101,1541,179],{},[1543,1544,1545,1559,1577,1594,1605],"tbody",{},[1529,1546,1547,1551,1555],{},[1548,1549,1550],"td",{},"Import",[1548,1552,1553],{},[101,1554,103],{},[1548,1556,1557],{},[101,1558,115],{},[1529,1560,1561,1564,1570],{},[1548,1562,1563],{},"Runtime",[1548,1565,1566,1567],{},"In-process ",[101,1568,1569],{},"ToolLoopAgent",[1548,1571,1572,1574,1575],{},[101,1573,329],{}," inside ",[101,1576,159],{},[1529,1578,1579,1582,1588],{},[1548,1580,1581],{},"Methods",[1548,1583,1584,307,1586],{},[101,1585,351],{},[101,1587,339],{},[1548,1589,1590,307,1592],{},[101,1591,351],{},[101,1593,339],{},[1529,1595,1596,1599,1602],{},[1548,1597,1598],{},"Retries \u002F resume",[1548,1600,1601],{},"You handle",[1548,1603,1604],{},"Workflow-managed durable steps",[1529,1606,1607,1611,1614],{},[1548,1608,1609],{},[101,1610,1476],{},[1548,1612,1613],{},"Supported",[1548,1615,1616,1617,1619],{},"Supported (via ",[101,1618,1480],{}," on tools)",[147,1621,1623],{"id":1622},"durable-steps-on-every-tool","Durable steps on every tool",[92,1625,1626,1627,1630,1631,1633,1634,1637,1638,1640,1641,1644,1645,1648],{},"Even if you do ",[96,1628,1629],{},"not"," use ",[101,1632,179],{},", spreading ",[101,1635,1636],{},"createGithubTools()"," inside a workflow still benefits from per-tool ",[101,1639,167],{}," boundaries when the AI SDK executes tools — each GitHub operation remains a proper workflow step. The ",[96,1642,1643],{},"durable agent"," entry point additionally durably wraps the ",[96,1646,1647],{},"LLM loop"," itself.",[147,1650,1652],{"id":1651},"external-references","External references",[127,1654,1655,1661],{},[130,1656,1657],{},[106,1658,1660],{"href":108,"rel":1659},[110],"Vercel Workflow documentation",[130,1662,1663],{},[106,1664,1667],{"href":1665,"rel":1666},"https:\u002F\u002Fai-sdk.dev\u002Fdocs\u002Fai-sdk-core\u002Ftools-and-tool-calling",[110],"AI SDK tools",[1669,1670,1671],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":232,"searchDepth":399,"depth":399,"links":1673},[1674,1675,1676,1680,1681,1682,1683,1684,1685],{"id":149,"depth":399,"text":150},{"id":210,"depth":399,"text":211},{"id":320,"depth":399,"text":321,"children":1677},[1678,1679],{"id":359,"depth":420,"text":360},{"id":689,"depth":420,"text":690},{"id":920,"depth":399,"text":921},{"id":1411,"depth":399,"text":1412},{"id":1470,"depth":399,"text":1471},{"id":1520,"depth":399,"text":1521},{"id":1622,"depth":399,"text":1623},{"id":1651,"depth":399,"text":1652},"Run GitHub tools as durable, retryable steps with createDurableGithubAgent — crash-safe agents for Nuxt and Next.js apps on Vercel.","md",[1689,1694,1696],{"label":1690,"icon":1691,"to":83,"color":1692,"variant":1693},"API reference — createDurableGithubAgent","i-lucide-braces","neutral","subtle",{"label":22,"icon":1695,"to":23,"color":1692,"variant":1693},"i-lucide-sparkles",{"label":1697,"icon":1698,"to":59,"color":1692,"variant":1693},"Control write safety","i-lucide-shield-check",{},{"title":41,"icon":39},{"title":87,"description":1686},"_op6HXsQLjQA_LGhvtzmIPOmorFt8uKnZth_LdmZZgo",[1704,1706],{"title":36,"path":37,"stem":38,"description":1705,"icon":39,"children":-1},"Call GitHub from generateText, streamText, or a ToolLoopAgent — the core integration path for @github-tools\u002Fsdk in any Vercel AI SDK app.",{"title":45,"path":46,"stem":47,"description":1707,"icon":48,"children":-1},"Connect GitHub tools to Chat SDK for durable GitHub, Slack, and Discord bots — a complete PR review agent in about 60 lines of code.",1783444204936]