[{"data":1,"prerenderedAt":708},["ShallowReactive",2],{"docs:\u002Fdocs\u002Fguides\u002Fserver-logic":3,"docs:navigation":587,"docs:surround:\u002Fdocs\u002Fguides\u002Fserver-logic":703},{"id":4,"title":5,"body":6,"description":579,"extension":580,"meta":581,"navigation":207,"navigationTitle":582,"path":583,"seo":584,"stem":585,"__hash__":586},"docs\u002Fdocs\u002F3.guides\u002F8.server-logic.md","Server logic",{"type":7,"value":8,"toc":573},"minimark",[9,13,18,25,139,152,164,168,171,288,292,460,472,476,479,547,558,569],[10,11,12],"p",{},"Use actor-bound services in your own routes to list records, start runs, or answer approvals.\nServices use the signed-in user and selected workspace, so you keep the API's access checks without\nmaking an HTTP request back to your app.",[14,15,17],"h2",{"id":16},"using-services-in-nuxt","Using Services in Nuxt",[10,19,20,24],{},[21,22,23],"code",{},"useAgentic(event)"," is auto-imported in server routes:",[26,27,33],"pre",{"className":28,"code":29,"filename":30,"language":31,"meta":32,"style":32},"language-ts shiki shiki-themes github-dark-default","export default defineEventHandler(async (event) => {\n  const { models } = await useAgentic(event)\n  return models.customer.list({ filter: { plan: 'pro' }, columns: ['name', 'email'] })\n})\n","server\u002Fapi\u002Fpro-customers.get.ts","ts","",[21,34,35,68,96,130],{"__ignoreMap":32},[36,37,40,44,47,51,55,58,61,64],"span",{"class":38,"line":39},"line",1,[36,41,43],{"class":42},"suJrU","export",[36,45,46],{"class":42}," default",[36,48,50],{"class":49},"sc3cj"," defineEventHandler",[36,52,54],{"class":53},"sQhOw","(",[36,56,57],{"class":42},"async",[36,59,60],{"class":53}," (event) ",[36,62,63],{"class":42},"=>",[36,65,67],{"class":66},"sZEs4"," {\n",[36,69,71,74,77,81,84,87,90,93],{"class":38,"line":70},2,[36,72,73],{"class":42},"  const",[36,75,76],{"class":66}," { ",[36,78,80],{"class":79},"sFSAA","models",[36,82,83],{"class":66}," } ",[36,85,86],{"class":42},"=",[36,88,89],{"class":42}," await",[36,91,92],{"class":49}," useAgentic",[36,94,95],{"class":66},"(event)\n",[36,97,99,102,105,108,111,115,118,121,124,127],{"class":38,"line":98},3,[36,100,101],{"class":42},"  return",[36,103,104],{"class":66}," models.customer.",[36,106,107],{"class":49},"list",[36,109,110],{"class":66},"({ filter: { plan: ",[36,112,114],{"class":113},"s9uIt","'pro'",[36,116,117],{"class":66}," }, columns: [",[36,119,120],{"class":113},"'name'",[36,122,123],{"class":66},", ",[36,125,126],{"class":113},"'email'",[36,128,129],{"class":66},"] })\n",[36,131,133,136],{"class":38,"line":132},4,[36,134,135],{"class":66},"}",[36,137,138],{"class":53},")\n",[10,140,141,143,144,147,148,151],{},[21,142,23],{}," reads the session cookie and the ",[21,145,146],{},"X-Agentic-Workspace"," header, exactly like\nthe API. Requests without a session fail with ",[21,149,150],{},"401",". Services are typed from your models, agents,\nand features.",[10,153,154,157,158,163],{},[21,155,156],{},"useAgenticAuth(env)"," returns the better-auth instance, for example to read the session. See\n",[159,160,162],"a",{"href":161},"\u002Fdocs\u002Freference\u002Fserver-utils","Server Utilities",".",[14,165,167],{"id":166},"using-services-in-void","Using Services in Void",[10,169,170],{},"Import your definition and pass it the request and bindings:",[26,172,175],{"className":28,"code":173,"filename":174,"language":31,"meta":32,"style":32},"import { defineHandler } from 'void'\nimport agentic from '..\u002F..\u002Fsrc\u002Fagentic'\n\nexport const GET = defineHandler(async (context) => {\n  const { models } = await agentic.services(context.req.raw, context.env)\n  return models.customer.list({ filter: { plan: 'pro' } })\n})\n","routes\u002Fapi\u002Fpro-customers.ts",[21,176,177,191,203,209,242,266,282],{"__ignoreMap":32},[36,178,179,182,185,188],{"class":38,"line":39},[36,180,181],{"class":42},"import",[36,183,184],{"class":66}," { defineHandler } ",[36,186,187],{"class":42},"from",[36,189,190],{"class":113}," 'void'\n",[36,192,193,195,198,200],{"class":38,"line":70},[36,194,181],{"class":42},[36,196,197],{"class":66}," agentic ",[36,199,187],{"class":42},[36,201,202],{"class":113}," '..\u002F..\u002Fsrc\u002Fagentic'\n",[36,204,205],{"class":38,"line":98},[36,206,208],{"emptyLinePlaceholder":207},true,"\n",[36,210,211,213,216,219,222,225,227,229,232,235,238,240],{"class":38,"line":132},[36,212,43],{"class":42},[36,214,215],{"class":42}," const",[36,217,218],{"class":79}," GET",[36,220,221],{"class":42}," =",[36,223,224],{"class":49}," defineHandler",[36,226,54],{"class":66},[36,228,57],{"class":42},[36,230,231],{"class":66}," (",[36,233,234],{"class":53},"context",[36,236,237],{"class":66},") ",[36,239,63],{"class":42},[36,241,67],{"class":66},[36,243,245,247,249,251,253,255,257,260,263],{"class":38,"line":244},5,[36,246,73],{"class":42},[36,248,76],{"class":66},[36,250,80],{"class":79},[36,252,83],{"class":66},[36,254,86],{"class":42},[36,256,89],{"class":42},[36,258,259],{"class":66}," agentic.",[36,261,262],{"class":49},"services",[36,264,265],{"class":66},"(context.req.raw, context.env)\n",[36,267,269,271,273,275,277,279],{"class":38,"line":268},6,[36,270,101],{"class":42},[36,272,104],{"class":66},[36,274,107],{"class":49},[36,276,110],{"class":66},[36,278,114],{"class":113},[36,280,281],{"class":66}," } })\n",[36,283,285],{"class":38,"line":284},7,[36,286,287],{"class":66},"})\n",[14,289,291],{"id":290},"what-services-offer","What Services Offer",[293,294,295,308],"table",{},[296,297,298],"thead",{},[299,300,301,305],"tr",{},[302,303,304],"th",{},"Service",[302,306,307],{},"Operations",[309,310,311,336,358,378,400,414,440],"tbody",{},[299,312,313,319],{},[314,315,316],"td",{},[21,317,318],{},"models.\u003Cname>",[314,320,321,123,323,123,326,123,329,123,332,335],{},[21,322,107],{},[21,324,325],{},"get",[21,327,328],{},"create",[21,330,331],{},"update",[21,333,334],{},"delete",", as allowed by the model's access",[299,337,338,343],{},[314,339,340],{},[21,341,342],{},"agents",[314,344,345,123,347,123,349,123,352,123,354,123,356],{},[21,346,107],{},[21,348,325],{},[21,350,351],{},"code(slug)",[21,353,328],{},[21,355,331],{},[21,357,334],{},[299,359,360,365],{},[314,361,362],{},[21,363,364],{},"runs",[314,366,367,123,370,123,372,123,375],{},[21,368,369],{},"start(agentId, input)",[21,371,325],{},[21,373,374],{},"cancel",[21,376,377],{},"runtimes",[299,379,380,385],{},[314,381,382],{},[21,383,384],{},"automations",[314,386,387,388,123,391,123,393,123,396,399],{},"CRUD, ",[21,389,390],{},"start",[21,392,374],{},[21,394,395],{},"resume",[21,397,398],{},"deliverEvent",", folders, runs, templates",[299,401,402,407],{},[314,403,404],{},[21,405,406],{},"approvals",[314,408,409,410,413],{},"The approvals inbox; ",[21,411,412],{},"answer(approvalId, approve)"," approves or rejects a call",[299,415,416,421],{},[314,417,418],{},[21,419,420],{},"workspaces",[314,422,423,123,426,123,428,123,430,123,432,123,434,123,437],{},[21,424,425],{},"session",[21,427,107],{},[21,429,328],{},[21,431,325],{},[21,433,331],{},[21,435,436],{},"setRole",[21,438,439],{},"removeMember",[299,441,442,447],{},[314,443,444],{},[21,445,446],{},"prompt",[314,448,449,123,452,123,455,123,458],{},[21,450,451],{},"options",[21,453,454],{},"plan",[21,456,457],{},"execute",[21,459,374],{},[10,461,462,463,467,468,163],{},"See ",[159,464,466],{"href":465},"\u002Fdocs\u002Freference\u002Fservices","Services"," for inputs and results. To add your own routes to the\nAgentic API, with access checks and OpenAPI, write a ",[159,469,471],{"href":470},"\u002Fdocs\u002Fguides\u002Ffeatures","feature",[14,473,475],{"id":474},"starting-automations-from-your-code","Starting Automations from Your Code",[10,477,478],{},"Deliver an app event, and every matching automation starts:",[26,480,482],{"className":28,"code":481,"language":31,"meta":32,"style":32},"const { automations } = await useAgentic(event)\nawait automations.deliverEvent({\n  event: 'order.created',\n  id: String(order.id),\n  payload: { order },\n})\n",[21,483,484,503,516,527,538,543],{"__ignoreMap":32},[36,485,486,489,491,493,495,497,499,501],{"class":38,"line":39},[36,487,488],{"class":42},"const",[36,490,76],{"class":66},[36,492,384],{"class":79},[36,494,83],{"class":66},[36,496,86],{"class":42},[36,498,89],{"class":42},[36,500,92],{"class":49},[36,502,95],{"class":66},[36,504,505,508,511,513],{"class":38,"line":70},[36,506,507],{"class":42},"await",[36,509,510],{"class":66}," automations.",[36,512,398],{"class":49},[36,514,515],{"class":66},"({\n",[36,517,518,521,524],{"class":38,"line":98},[36,519,520],{"class":66},"  event: ",[36,522,523],{"class":113},"'order.created'",[36,525,526],{"class":66},",\n",[36,528,529,532,535],{"class":38,"line":132},[36,530,531],{"class":66},"  id: ",[36,533,534],{"class":49},"String",[36,536,537],{"class":66},"(order.id),\n",[36,539,540],{"class":38,"line":244},[36,541,542],{"class":66},"  payload: { order },\n",[36,544,545],{"class":38,"line":268},[36,546,287],{"class":66},[10,548,549,550,553,554,557],{},"This starts the signed-in user's active ",[21,551,552],{},"order.created"," automations in the current workspace.\nOther members' automations do not start. The ",[21,555,556],{},"id"," (up to 200 characters) makes delivery\nidempotent: sending the same event again does not start another run.",[10,559,560,561,564,565,163],{},"Services always act as the signed-in person. For work without a request, use an automation with\na ",[21,562,563],{},"schedule"," trigger or a ",[159,566,568],{"href":567},"\u002Fdocs\u002Fguides\u002Fautomations#starting-from-a-webhook","webhook",[570,571,572],"style",{},"html pre.shiki code .suJrU, html code.shiki .suJrU{--shiki-default:#FF7B72}html pre.shiki code .sc3cj, html code.shiki .sc3cj{--shiki-default:#D2A8FF}html pre.shiki code .sQhOw, html code.shiki .sQhOw{--shiki-default:#FFA657}html pre.shiki code .sZEs4, html code.shiki .sZEs4{--shiki-default:#E6EDF3}html pre.shiki code .sFSAA, html code.shiki .sFSAA{--shiki-default:#79C0FF}html pre.shiki code .s9uIt, html code.shiki .s9uIt{--shiki-default:#A5D6FF}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);}",{"title":32,"searchDepth":70,"depth":70,"links":574},[575,576,577,578],{"id":16,"depth":70,"text":17},{"id":166,"depth":70,"text":167},{"id":290,"depth":70,"text":291},{"id":474,"depth":70,"text":475},"Call agents, runs, automations and models from your own routes with actor-bound services.","md",{},null,"\u002Fdocs\u002Fguides\u002Fserver-logic",{"title":5,"description":579},"docs\u002F3.guides\u002F8.server-logic","0ocOI-aHW49TAQ8yqXa_tumdJwN487kByJl7chorwRA",[588],{"title":589,"path":590,"stem":591,"children":592,"navigationTitle":582},"Introduction","\u002Fdocs","docs\u002F0.index",[593,594,612,616,665,669,673,699],{"title":589,"path":590,"stem":591,"navigationTitle":582},{"title":595,"path":596,"stem":597,"children":598,"page":611},"Getting Started","\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started",[599,603,607],{"title":600,"path":601,"stem":602,"navigationTitle":582},"Free module","\u002Fdocs\u002Fgetting-started\u002Ffree","docs\u002F1.getting-started\u002F1.free",{"title":604,"path":605,"stem":606,"navigationTitle":582},"Pro on Nuxt","\u002Fdocs\u002Fgetting-started\u002Fnuxt","docs\u002F1.getting-started\u002F2.nuxt",{"title":608,"path":609,"stem":610,"navigationTitle":582},"Pro on Void","\u002Fdocs\u002Fgetting-started\u002Fvoid","docs\u002F1.getting-started\u002F3.void",false,{"title":613,"path":614,"stem":615,"navigationTitle":582},"Concepts","\u002Fdocs\u002Fconcepts","docs\u002F2.concepts",{"title":617,"path":618,"stem":619,"children":620,"page":611},"Guides","\u002Fdocs\u002Fguides","docs\u002F3.guides",[621,625,629,632,636,640,644,648,652,656,660,661],{"title":622,"path":623,"stem":624,"navigationTitle":582},"Agents","\u002Fdocs\u002Fguides\u002Fagents","docs\u002F3.guides\u002F1.agents",{"title":626,"path":627,"stem":628,"navigationTitle":582},"Events","\u002Fdocs\u002Fguides\u002Fevents","docs\u002F3.guides\u002F10.events",{"title":630,"path":470,"stem":631,"navigationTitle":582},"Features","docs\u002F3.guides\u002F11.features",{"title":633,"path":634,"stem":635,"navigationTitle":582},"Coding agents","\u002Fdocs\u002Fguides\u002Fcoding-agents","docs\u002F3.guides\u002F12.coding-agents",{"title":637,"path":638,"stem":639,"navigationTitle":582},"Tools","\u002Fdocs\u002Fguides\u002Ftools","docs\u002F3.guides\u002F2.tools",{"title":641,"path":642,"stem":643,"navigationTitle":582},"Automations","\u002Fdocs\u002Fguides\u002Fautomations","docs\u002F3.guides\u002F3.automations",{"title":645,"path":646,"stem":647,"navigationTitle":582},"Agentic Models","\u002Fdocs\u002Fguides\u002Fagentic-models","docs\u002F3.guides\u002F4.agentic-models",{"title":649,"path":650,"stem":651,"navigationTitle":582},"Outcomes","\u002Fdocs\u002Fguides\u002Foutcomes","docs\u002F3.guides\u002F5.outcomes",{"title":653,"path":654,"stem":655,"navigationTitle":582},"Integrations","\u002Fdocs\u002Fguides\u002Fintegrations","docs\u002F3.guides\u002F6.integrations",{"title":657,"path":658,"stem":659,"navigationTitle":582},"Prompt","\u002Fdocs\u002Fguides\u002Fprompt","docs\u002F3.guides\u002F7.prompt",{"title":5,"path":583,"stem":585,"navigationTitle":582},{"title":662,"path":663,"stem":664,"navigationTitle":582},"Dashboard UI","\u002Fdocs\u002Fguides\u002Fui","docs\u002F3.guides\u002F9.ui",{"title":666,"path":667,"stem":668,"navigationTitle":582},"Deploy to Cloudflare","\u002Fdocs\u002Fdeploy","docs\u002F4.deploy",{"title":670,"path":671,"stem":672,"navigationTitle":582},"Upgrading","\u002Fdocs\u002Fupgrade","docs\u002F5.upgrade",{"title":674,"path":675,"stem":676,"children":677,"page":611},"Reference","\u002Fdocs\u002Freference","docs\u002F6.reference",[678,682,686,689,691,695],{"title":679,"path":680,"stem":681,"navigationTitle":582},"Configuration","\u002Fdocs\u002Freference\u002Fconfiguration","docs\u002F6.reference\u002F1.configuration",{"title":683,"path":684,"stem":685,"navigationTitle":582},"Composables","\u002Fdocs\u002Freference\u002Fcomposables","docs\u002F6.reference\u002F2.composables",{"title":687,"path":161,"stem":688,"navigationTitle":582},"Server utilities","docs\u002F6.reference\u002F3.server-utils",{"title":466,"path":465,"stem":690,"navigationTitle":582},"docs\u002F6.reference\u002F4.services",{"title":692,"path":693,"stem":694,"navigationTitle":582},"REST API","\u002Fdocs\u002Freference\u002Frest-api","docs\u002F6.reference\u002F5.rest-api",{"title":696,"path":697,"stem":698,"navigationTitle":582},"CLI","\u002Fdocs\u002Freference\u002Fcli","docs\u002F6.reference\u002F6.cli",{"title":700,"path":701,"stem":702,"navigationTitle":582},"Licensing & FAQ","\u002Fdocs\u002Flicensing","docs\u002F8.licensing",[704,706],{"title":657,"path":658,"stem":659,"description":705,"children":-1},"The dashboard prompt finds records and proposes reviewed changes in plain language.",{"title":662,"path":663,"stem":664,"description":707,"children":-1},"Brand the dashboard, override any page and add your own pages, navigation and settings.",1792672479675]