@grok/agent-sdk 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (550) hide show
  1. package/AGENTS.md +40 -0
  2. package/dist/channels/github/cursor-account.d.ts +1 -0
  3. package/dist/channels/github/cursor-account.d.ts.map +1 -1
  4. package/dist/channels/github/cursor-account.js +8 -2
  5. package/dist/channels/github/forward.d.ts +5 -0
  6. package/dist/channels/github/forward.d.ts.map +1 -1
  7. package/dist/channels/github/forward.js +6 -3
  8. package/dist/channels/origin/cursor-account.d.ts +6 -0
  9. package/dist/channels/origin/cursor-account.d.ts.map +1 -1
  10. package/dist/channels/origin/cursor-account.js +17 -0
  11. package/dist/channels/slack/api.d.ts +18 -0
  12. package/dist/channels/slack/api.d.ts.map +1 -1
  13. package/dist/channels/slack/api.js +31 -0
  14. package/dist/channels/slack/approvals.d.ts +19 -2
  15. package/dist/channels/slack/approvals.d.ts.map +1 -1
  16. package/dist/channels/slack/approvals.js +90 -19
  17. package/dist/channels/slack/attachments.d.ts +7 -2
  18. package/dist/channels/slack/attachments.d.ts.map +1 -1
  19. package/dist/channels/slack/attachments.js +318 -156
  20. package/dist/channels/slack/connect-card.d.ts +16 -0
  21. package/dist/channels/slack/connect-card.d.ts.map +1 -0
  22. package/dist/channels/slack/connect-card.js +31 -0
  23. package/dist/channels/slack/credentials.d.ts +10 -2
  24. package/dist/channels/slack/credentials.d.ts.map +1 -1
  25. package/dist/channels/slack/credentials.js +17 -15
  26. package/dist/channels/slack/defaults.d.ts.map +1 -1
  27. package/dist/channels/slack/defaults.js +18 -9
  28. package/dist/channels/slack/dispatch.d.ts +1 -1
  29. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  30. package/dist/channels/slack/dispatch.js +19 -3
  31. package/dist/channels/slack/inbound.d.ts +8 -2
  32. package/dist/channels/slack/inbound.d.ts.map +1 -1
  33. package/dist/channels/slack/inbound.js +25 -4
  34. package/dist/channels/slack/index.d.ts +3 -2
  35. package/dist/channels/slack/index.d.ts.map +1 -1
  36. package/dist/channels/slack/index.js +3 -2
  37. package/dist/channels/slack/init.d.ts.map +1 -1
  38. package/dist/channels/slack/init.js +2 -1
  39. package/dist/channels/slack/mentions.d.ts +28 -0
  40. package/dist/channels/slack/mentions.d.ts.map +1 -0
  41. package/dist/channels/slack/mentions.js +178 -0
  42. package/dist/channels/slack/setup.js +1 -1
  43. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  44. package/dist/channels/slack/slack-channel.js +46 -3
  45. package/dist/channels/slack/stop.d.ts.map +1 -1
  46. package/dist/channels/slack/stop.js +7 -1
  47. package/dist/channels/slack/thread-context.d.ts +3 -0
  48. package/dist/channels/slack/thread-context.d.ts.map +1 -1
  49. package/dist/channels/slack/thread-context.js +17 -7
  50. package/dist/channels/slack/tool-approval-events.d.ts.map +1 -1
  51. package/dist/channels/slack/tool-approval-events.js +55 -2
  52. package/dist/channels/slack/types.d.ts +2 -0
  53. package/dist/channels/slack/types.d.ts.map +1 -1
  54. package/dist/channels/teams/activity.d.ts +33 -0
  55. package/dist/channels/teams/activity.d.ts.map +1 -0
  56. package/dist/channels/teams/activity.js +213 -0
  57. package/dist/channels/teams/auth.d.ts +25 -0
  58. package/dist/channels/teams/auth.d.ts.map +1 -0
  59. package/dist/channels/teams/auth.js +55 -0
  60. package/dist/channels/teams/bot-framework-auth.d.ts +33 -0
  61. package/dist/channels/teams/bot-framework-auth.d.ts.map +1 -0
  62. package/dist/channels/teams/bot-framework-auth.js +154 -0
  63. package/dist/channels/teams/cards.d.ts +23 -0
  64. package/dist/channels/teams/cards.d.ts.map +1 -0
  65. package/dist/channels/teams/cards.js +107 -0
  66. package/dist/channels/teams/connector.d.ts +48 -0
  67. package/dist/channels/teams/connector.d.ts.map +1 -0
  68. package/dist/channels/teams/connector.js +159 -0
  69. package/dist/channels/teams/credentials.d.ts +65 -0
  70. package/dist/channels/teams/credentials.d.ts.map +1 -0
  71. package/dist/channels/teams/credentials.js +84 -0
  72. package/dist/channels/teams/delivery.d.ts +14 -0
  73. package/dist/channels/teams/delivery.d.ts.map +1 -0
  74. package/dist/channels/teams/delivery.js +169 -0
  75. package/dist/channels/teams/dispatch.d.ts +45 -0
  76. package/dist/channels/teams/dispatch.d.ts.map +1 -0
  77. package/dist/channels/teams/dispatch.js +402 -0
  78. package/dist/channels/teams/engagement.d.ts +32 -0
  79. package/dist/channels/teams/engagement.d.ts.map +1 -0
  80. package/dist/channels/teams/engagement.js +120 -0
  81. package/dist/channels/teams/index.d.ts +21 -0
  82. package/dist/channels/teams/index.d.ts.map +1 -0
  83. package/dist/channels/teams/index.js +19 -0
  84. package/dist/channels/teams/marks.d.ts +19 -0
  85. package/dist/channels/teams/marks.d.ts.map +1 -0
  86. package/dist/channels/teams/marks.js +96 -0
  87. package/dist/channels/teams/senders.d.ts +27 -0
  88. package/dist/channels/teams/senders.d.ts.map +1 -0
  89. package/dist/channels/teams/senders.js +72 -0
  90. package/dist/channels/teams/teams-channel.d.ts +43 -0
  91. package/dist/channels/teams/teams-channel.d.ts.map +1 -0
  92. package/dist/channels/teams/teams-channel.js +278 -0
  93. package/dist/channels/teams/text.d.ts +7 -0
  94. package/dist/channels/teams/text.d.ts.map +1 -0
  95. package/dist/channels/teams/text.js +63 -0
  96. package/dist/channels/teams/types.d.ts +306 -0
  97. package/dist/channels/teams/types.d.ts.map +1 -0
  98. package/dist/channels/teams/types.js +1 -0
  99. package/dist/channels.d.ts +31 -0
  100. package/dist/channels.d.ts.map +1 -1
  101. package/dist/channels.js +37 -0
  102. package/dist/connections.d.ts +1 -1
  103. package/dist/connections.d.ts.map +1 -1
  104. package/dist/docs/404.html +3 -3
  105. package/dist/docs/assets/{app.lt-BYgI2.js → app.CpLKJnOA.js} +4 -4
  106. package/dist/docs/assets/changelog.md.DoOgjnPC.js +1 -0
  107. package/dist/docs/assets/{changelog.md.DVNB-ApU.lean.js → changelog.md.DoOgjnPC.lean.js} +1 -1
  108. package/dist/docs/assets/chunks/@localSearchIndexroot.BJ_1eI6D.js +1 -0
  109. package/dist/docs/assets/chunks/{VPLocalSearchBox.v_dV4U2Q.js → VPLocalSearchBox.Cr1HJ_9k.js} +2 -2
  110. package/dist/docs/assets/chunks/{arc.5o92kOg5.js → arc.BjpgGAMM.js} +1 -1
  111. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.C-oTwnNq.js → architectureDiagram-Q4EWVU46.CKdhNPPk.js} +1 -1
  112. package/dist/docs/assets/chunks/{baseUniq.zJ-VNOib.js → baseUniq.iovoEQbg.js} +1 -1
  113. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.B9ZJZuPd.js → blockDiagram-DXYQGD6D.BYQIeDre.js} +1 -1
  114. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.BBMwSIaN.js → c4Diagram-AHTNJAMY.gbWi2q8N.js} +1 -1
  115. package/dist/docs/assets/chunks/channel.BP0n324b.js +1 -0
  116. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.D8qAJpDD.js → chunk-4BX2VUAB.1Mem4UG9.js} +1 -1
  117. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.B8QR5cdE.js → chunk-4TB4RGXK.Dn3H-X_H.js} +1 -1
  118. package/dist/docs/assets/chunks/{chunk-55IACEB6.BsWxVuew.js → chunk-55IACEB6.BkpSDZwX.js} +1 -1
  119. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.BeGygY_i.js → chunk-EDXVE4YY.BScqy1zP.js} +1 -1
  120. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DdwgH-ZH.js → chunk-FMBD7UC4.Cp394LWf.js} +1 -1
  121. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.B9zC_ALe.js → chunk-OYMX7WX6.BDv9LhoL.js} +1 -1
  122. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BIxJ0rcL.js → chunk-QZHKN3VN.CsgCcrKO.js} +1 -1
  123. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.qiM_23_f.js → chunk-YZCP3GAM.BKBpIC5O.js} +1 -1
  124. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.BhTtyWMA.js +1 -0
  125. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.BhTtyWMA.js +1 -0
  126. package/dist/docs/assets/chunks/clone.BVK2rFqj.js +1 -0
  127. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BKB971D5.js → cose-bilkent-S5V4N54A.Bs3ZS9PC.js} +1 -1
  128. package/dist/docs/assets/chunks/{dagre-KV5264BT.CcILjJgp.js → dagre-KV5264BT.CgWi0tY2.js} +1 -1
  129. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.DkY9A0nu.js → diagram-5BDNPKRD.rn6qIo9N.js} +1 -1
  130. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.BbdzmjMt.js → diagram-G4DWMVQ6.ChhW8oww.js} +1 -1
  131. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.Be0zy1cM.js → diagram-MMDJMWI5.C0wH5KSk.js} +1 -1
  132. package/dist/docs/assets/chunks/{diagram-TYMM5635.zOiEycLe.js → diagram-TYMM5635.CNEcrwA0.js} +1 -1
  133. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DUd_9HMF.js → erDiagram-SMLLAGMA.DCsnKO-7.js} +1 -1
  134. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.2KPYoZBO.js → flowDiagram-DWJPFMVM.WCMkfvP0.js} +1 -1
  135. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.DqE8_YpP.js → ganttDiagram-T4ZO3ILL.BUb1Sxfr.js} +1 -1
  136. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.CO0Tk47h.js → gitGraphDiagram-UUTBAWPF._kORbCzm.js} +1 -1
  137. package/dist/docs/assets/chunks/{graph.CNe5KbNy.js → graph.PrGRm4KW.js} +1 -1
  138. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.BBhJ1X1B.js → infoDiagram-42DDH7IO.BxhCjiQM.js} +1 -1
  139. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.KSIw9w3I.js → ishikawaDiagram-UXIWVN3A.5ddTis2y.js} +1 -1
  140. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BN2Y5oUJ.js → journeyDiagram-VCZTEJTY.BUStU27-.js} +1 -1
  141. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.2KFuDYn_.js → kanban-definition-6JOO6SKY.CJd1psl3.js} +1 -1
  142. package/dist/docs/assets/chunks/{layout.Demb_pzL.js → layout.DqvbZSML.js} +1 -1
  143. package/dist/docs/assets/chunks/{linear.kYKxzbbR.js → linear.DOmz-1UB.js} +1 -1
  144. package/dist/docs/assets/chunks/{min.DwmCN5dF.js → min.33k2v8dM.js} +1 -1
  145. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.CGlz01QG.js → mindmap-definition-QFDTVHPH.iISCqCXC.js} +1 -1
  146. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.n3qsq4nA.js → pieDiagram-DEJITSTG.BHvVgzmD.js} +1 -1
  147. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CGNJ1GSb.js → quadrantDiagram-34T5L4WZ.CY3w_-Cn.js} +1 -1
  148. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.VhAzHDwQ.js → requirementDiagram-MS252O5E.CHXKQS1v.js} +1 -1
  149. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.DmHA5pW-.js → sankeyDiagram-XADWPNL6.DTtRoGss.js} +1 -1
  150. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23._TC1aKhg.js → sequenceDiagram-FGHM5R23.NnPcQ3eY.js} +1 -1
  151. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.B-kLjV3O.js → stateDiagram-FHFEXIEX.D8DFciH7.js} +1 -1
  152. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.ESAwmMws.js +1 -0
  153. package/dist/docs/assets/chunks/{theme.BaVlHHL-.js → theme.CwkiT-Fo.js} +2 -2
  154. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.CresbphV.js → timeline-definition-GMOUNBTQ._wIWkMU6.js} +1 -1
  155. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.CegHD8Y4.js → vennDiagram-DHZGUBPP.NLVv7R6r.js} +1 -1
  156. package/dist/docs/assets/chunks/{wardley-RL74JXVD.DjCmZrUO.js → wardley-RL74JXVD.DbsCXUZp.js} +1 -1
  157. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.BJ7s1zdZ.js → wardleyDiagram-NUSXRM2D.Dp5uAVDl.js} +1 -1
  158. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.IrEXlemI.js → xychartDiagram-5P7HB3ND.eOEBq4rX.js} +1 -1
  159. package/dist/docs/assets/{deployment.md.DJtuDVLh.js → deployment.md.CIRydNl3.js} +3 -3
  160. package/dist/docs/assets/{deployment.md.DJtuDVLh.lean.js → deployment.md.CIRydNl3.lean.js} +1 -1
  161. package/dist/docs/assets/guides_cloud-agents.md.BdWqmUGb.js +14 -0
  162. package/dist/docs/assets/{guides_cloud-agents.md.CiXAW6on.lean.js → guides_cloud-agents.md.BdWqmUGb.lean.js} +1 -1
  163. package/dist/docs/assets/guides_teams.md.7Lz2sbqB.js +50 -0
  164. package/dist/docs/assets/guides_teams.md.7Lz2sbqB.lean.js +1 -0
  165. package/dist/docs/assets/guides_workload-identity.md.DBV6YkXX.js +82 -0
  166. package/dist/docs/assets/guides_workload-identity.md.DBV6YkXX.lean.js +1 -0
  167. package/dist/docs/assets/{reference_agent-config.md.Bbqf0lgS.js → reference_agent-config.md.CfM1S6Ac.js} +2 -2
  168. package/dist/docs/assets/{reference_agent-config.md.Bbqf0lgS.lean.js → reference_agent-config.md.CfM1S6Ac.lean.js} +1 -1
  169. package/dist/docs/assets/{reference_channels.md.CPWOpdsC.js → reference_channels.md.CRvqgU0n.js} +1 -1
  170. package/dist/docs/assets/{reference_cli.md.DHm6DmYk.js → reference_cli.md.NS6U5a-7.js} +14 -4
  171. package/dist/docs/assets/{reference_cli.md.DHm6DmYk.lean.js → reference_cli.md.NS6U5a-7.lean.js} +1 -1
  172. package/dist/docs/assets/{reference_limits.md.CbdtFr4T.js → reference_limits.md.CW9PTdxr.js} +3 -3
  173. package/dist/docs/assets/{reference_limits.md.CbdtFr4T.lean.js → reference_limits.md.CW9PTdxr.lean.js} +1 -1
  174. package/dist/docs/assets/{reference_schedules.md.RhQ9ZLo1.js → reference_schedules.md.Dd8_d0WG.js} +3 -3
  175. package/dist/docs/assets/{reference_sessions.md.NXVQt9mP.js → reference_sessions.md.CoCyQLEz.js} +2 -2
  176. package/dist/docs/assets/{reference_sessions.md.NXVQt9mP.lean.js → reference_sessions.md.CoCyQLEz.lean.js} +1 -1
  177. package/dist/docs/assets/{reference_skills.md.DzCPNPkG.js → reference_skills.md.SFRZDC41.js} +4 -4
  178. package/dist/docs/assets/{reference_skills.md.DzCPNPkG.lean.js → reference_skills.md.SFRZDC41.lean.js} +1 -1
  179. package/dist/docs/assets/{style.DK0YX1WL.css → style.B7zPxANR.css} +1 -1
  180. package/dist/docs/assets/troubleshooting.md.CsQTleto.js +3 -0
  181. package/dist/docs/assets/{troubleshooting.md.DfKKvW1R.lean.js → troubleshooting.md.CsQTleto.lean.js} +1 -1
  182. package/dist/docs/building-with-agents.html +37 -37
  183. package/dist/docs/changelog.html +37 -37
  184. package/dist/docs/changelog.md +43 -0
  185. package/dist/docs/deployment.html +40 -40
  186. package/dist/docs/deployment.md +14 -0
  187. package/dist/docs/evals.html +37 -37
  188. package/dist/docs/guides/agent-to-agent.html +37 -37
  189. package/dist/docs/guides/bitbucket.html +37 -37
  190. package/dist/docs/guides/cloud-agents.html +43 -38
  191. package/dist/docs/guides/cloud-agents.md +47 -0
  192. package/dist/docs/guides/convert-automation.html +37 -37
  193. package/dist/docs/guides/github.html +37 -37
  194. package/dist/docs/guides/gitlab.html +37 -37
  195. package/dist/docs/guides/improve.html +37 -37
  196. package/dist/docs/guides/jev.html +37 -37
  197. package/dist/docs/guides/mcp-oauth.html +37 -37
  198. package/dist/docs/guides/migrate.html +37 -37
  199. package/dist/docs/guides/opentelemetry.html +37 -37
  200. package/dist/docs/guides/pagerduty.html +37 -37
  201. package/dist/docs/guides/slack.html +37 -37
  202. package/dist/docs/guides/teams.html +109 -0
  203. package/dist/docs/guides/teams.md +384 -0
  204. package/dist/docs/guides/webhooks.html +37 -37
  205. package/dist/docs/guides/workload-identity.html +141 -0
  206. package/dist/docs/guides/workload-identity.md +227 -0
  207. package/dist/docs/hashmap.json +1 -1
  208. package/dist/docs/hillclimbing.html +37 -37
  209. package/dist/docs/index.html +37 -37
  210. package/dist/docs/llms-full.txt +881 -5
  211. package/dist/docs/llms.txt +2 -0
  212. package/dist/docs/quickstart.html +37 -37
  213. package/dist/docs/reference/access.html +36 -36
  214. package/dist/docs/reference/agent-config.html +39 -39
  215. package/dist/docs/reference/agent-config.md +1 -1
  216. package/dist/docs/reference/artifacts.html +37 -37
  217. package/dist/docs/reference/channels.html +38 -38
  218. package/dist/docs/reference/channels.md +1 -0
  219. package/dist/docs/reference/cli.html +50 -40
  220. package/dist/docs/reference/cli.md +116 -0
  221. package/dist/docs/reference/connections.html +37 -37
  222. package/dist/docs/reference/evals.html +37 -37
  223. package/dist/docs/reference/extensions.html +37 -37
  224. package/dist/docs/reference/hooks.html +37 -37
  225. package/dist/docs/reference/http-api.html +37 -37
  226. package/dist/docs/reference/instructions.html +37 -37
  227. package/dist/docs/reference/limits.html +39 -39
  228. package/dist/docs/reference/limits.md +4 -4
  229. package/dist/docs/reference/memory.html +37 -37
  230. package/dist/docs/reference/playground.html +36 -36
  231. package/dist/docs/reference/project-layout.html +37 -37
  232. package/dist/docs/reference/schedules.html +40 -40
  233. package/dist/docs/reference/sessions.html +38 -38
  234. package/dist/docs/reference/sessions.md +13 -0
  235. package/dist/docs/reference/skills.html +40 -40
  236. package/dist/docs/reference/subagents.html +37 -37
  237. package/dist/docs/reference/tools.html +37 -37
  238. package/dist/docs/templates/agentic-owners.html +37 -37
  239. package/dist/docs/templates/reviews.html +37 -37
  240. package/dist/docs/troubleshooting.html +38 -38
  241. package/dist/docs/troubleshooting.md +21 -0
  242. package/dist/evals/run-facts.d.ts.map +1 -1
  243. package/dist/evals/run-facts.js +4 -0
  244. package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.d.ts +12 -0
  245. package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.d.ts.map +1 -0
  246. package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.js +42 -0
  247. package/dist/extensions/cursor-cloud-agents/extension.d.ts +10 -7
  248. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
  249. package/dist/extensions/cursor-cloud-agents/extension.js +3 -2
  250. package/dist/extensions/cursor-cloud-agents/lib/agent-id.d.ts +5 -0
  251. package/dist/extensions/cursor-cloud-agents/lib/agent-id.d.ts.map +1 -0
  252. package/dist/extensions/cursor-cloud-agents/lib/agent-id.js +10 -0
  253. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +57 -3
  254. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -1
  255. package/dist/extensions/cursor-cloud-agents/lib/backend.js +150 -35
  256. package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts +32 -4
  257. package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts.map +1 -1
  258. package/dist/extensions/cursor-cloud-agents/lib/fleet.js +93 -7
  259. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts +24 -7
  260. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts.map +1 -1
  261. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.js +158 -25
  262. package/dist/extensions/cursor-cloud-agents/lib/stop-signal.d.ts +18 -0
  263. package/dist/extensions/cursor-cloud-agents/lib/stop-signal.d.ts.map +1 -0
  264. package/dist/extensions/cursor-cloud-agents/lib/stop-signal.js +27 -0
  265. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -1
  266. package/dist/extensions/cursor-cloud-agents/lib/transcript.js +2 -3
  267. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts +26 -12
  268. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts.map +1 -1
  269. package/dist/extensions/cursor-cloud-agents/lib/watch.js +115 -46
  270. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts +16 -5
  271. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts.map +1 -1
  272. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.js +76 -20
  273. package/dist/extensions/cursor-cloud-agents/skills/handoff.md +2 -2
  274. package/dist/extensions/cursor-cloud-agents/tools/get.js +2 -2
  275. package/dist/extensions/cursor-cloud-agents/tools/launch.js +1 -1
  276. package/dist/extensions.d.ts.map +1 -1
  277. package/dist/extensions.js +18 -3
  278. package/dist/files-backends/agent-store-presigned-url.js +5 -1
  279. package/dist/index.d.ts +1 -0
  280. package/dist/index.d.ts.map +1 -1
  281. package/dist/index.js +1 -0
  282. package/dist/internal/approval-gate.d.ts +6 -1
  283. package/dist/internal/approval-gate.d.ts.map +1 -1
  284. package/dist/internal/approval-gate.js +13 -2
  285. package/dist/internal/authored-loaders.js +1 -1
  286. package/dist/internal/channel-architecture.d.ts.map +1 -1
  287. package/dist/internal/channel-architecture.js +3 -1
  288. package/dist/internal/cli/commands/channels.d.ts +9 -3
  289. package/dist/internal/cli/commands/channels.d.ts.map +1 -1
  290. package/dist/internal/cli/commands/channels.js +193 -4
  291. package/dist/internal/cli/commands/index.d.ts.map +1 -1
  292. package/dist/internal/cli/commands/index.js +6 -1
  293. package/dist/internal/cli/commands/serve.d.ts.map +1 -1
  294. package/dist/internal/cli/commands/serve.js +25 -5
  295. package/dist/internal/cli/dispatch.d.ts.map +1 -1
  296. package/dist/internal/cli/dispatch.js +22 -8
  297. package/dist/internal/cli/flags.d.ts +14 -0
  298. package/dist/internal/cli/flags.d.ts.map +1 -1
  299. package/dist/internal/cli/flags.js +14 -0
  300. package/dist/internal/cli/help.d.ts.map +1 -1
  301. package/dist/internal/cli/help.js +3 -1
  302. package/dist/internal/cli-ax.d.ts.map +1 -1
  303. package/dist/internal/cli-ax.js +6 -3
  304. package/dist/internal/cli-cursor.js +2 -2
  305. package/dist/internal/cli-deploy.d.ts +1 -0
  306. package/dist/internal/cli-deploy.d.ts.map +1 -1
  307. package/dist/internal/cli-deploy.js +19 -1
  308. package/dist/internal/cli-mcp.d.ts.map +1 -1
  309. package/dist/internal/cli-mcp.js +5 -3
  310. package/dist/internal/cli-teams-doctor.d.ts +39 -0
  311. package/dist/internal/cli-teams-doctor.d.ts.map +1 -0
  312. package/dist/internal/cli-teams-doctor.js +508 -0
  313. package/dist/internal/cli-teams-forward.d.ts +84 -0
  314. package/dist/internal/cli-teams-forward.d.ts.map +1 -0
  315. package/dist/internal/cli-teams-forward.js +386 -0
  316. package/dist/internal/cli-teams-package.d.ts +26 -0
  317. package/dist/internal/cli-teams-package.d.ts.map +1 -0
  318. package/dist/internal/cli-teams-package.js +123 -0
  319. package/dist/internal/cli-teams.d.ts +15 -0
  320. package/dist/internal/cli-teams.d.ts.map +1 -0
  321. package/dist/internal/cli-teams.js +253 -0
  322. package/dist/internal/connect-click.d.ts +12 -0
  323. package/dist/internal/connect-click.d.ts.map +1 -0
  324. package/dist/internal/connect-click.js +22 -0
  325. package/dist/internal/continuation-channel.d.ts +5 -1
  326. package/dist/internal/continuation-channel.d.ts.map +1 -1
  327. package/dist/internal/continuation-channel.js +34 -0
  328. package/dist/internal/continuation-identity.d.ts +7 -4
  329. package/dist/internal/continuation-identity.d.ts.map +1 -1
  330. package/dist/internal/continuation-identity.js +66 -1
  331. package/dist/internal/convert-automation/convert-workflow.js +2 -2
  332. package/dist/internal/credential-env-names.d.ts +36 -0
  333. package/dist/internal/credential-env-names.d.ts.map +1 -0
  334. package/dist/internal/credential-env-names.js +68 -0
  335. package/dist/internal/cursor/account-mcp.d.ts +67 -9
  336. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  337. package/dist/internal/cursor/account-mcp.js +206 -25
  338. package/dist/internal/cursor/backend-client.d.ts +10 -1
  339. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  340. package/dist/internal/cursor/backend-client.js +19 -7
  341. package/dist/internal/cursor/cloud-agent-identity.d.ts +81 -0
  342. package/dist/internal/cursor/cloud-agent-identity.d.ts.map +1 -0
  343. package/dist/internal/cursor/cloud-agent-identity.js +224 -0
  344. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  345. package/dist/internal/cursor/credentials.js +3 -1
  346. package/dist/internal/cursor-account-mcp-auth.d.ts +8 -1
  347. package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
  348. package/dist/internal/cursor-account-mcp-auth.js +22 -6
  349. package/dist/internal/deploy-client.d.ts.map +1 -1
  350. package/dist/internal/deploy-client.js +34 -2
  351. package/dist/internal/deploy-manifest.d.ts +51 -3
  352. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  353. package/dist/internal/deploy-manifest.js +96 -7
  354. package/dist/internal/discovery/agent-config.d.ts.map +1 -1
  355. package/dist/internal/discovery/agent-config.js +6 -1
  356. package/dist/internal/discovery/agent.d.ts.map +1 -1
  357. package/dist/internal/discovery/agent.js +2 -1
  358. package/dist/internal/discovery/connections.d.ts +5 -0
  359. package/dist/internal/discovery/connections.d.ts.map +1 -1
  360. package/dist/internal/discovery/connections.js +71 -1
  361. package/dist/internal/discovery/extensions.d.ts.map +1 -1
  362. package/dist/internal/discovery/extensions.js +2 -0
  363. package/dist/internal/discovery/info.d.ts.map +1 -1
  364. package/dist/internal/discovery/info.js +4 -0
  365. package/dist/internal/env-file.d.ts +1 -0
  366. package/dist/internal/env-file.d.ts.map +1 -1
  367. package/dist/internal/env-file.js +18 -17
  368. package/dist/internal/env-prefix.d.ts +11 -0
  369. package/dist/internal/env-prefix.d.ts.map +1 -0
  370. package/dist/internal/env-prefix.js +23 -0
  371. package/dist/internal/event-id-dedupe.d.ts +12 -0
  372. package/dist/internal/event-id-dedupe.d.ts.map +1 -0
  373. package/dist/{channels/slack → internal}/event-id-dedupe.js +7 -4
  374. package/dist/internal/event-mapper.d.ts +7 -2
  375. package/dist/internal/event-mapper.d.ts.map +1 -1
  376. package/dist/internal/event-mapper.js +7 -0
  377. package/dist/internal/expected-delivery-failure.d.ts.map +1 -1
  378. package/dist/internal/expected-delivery-failure.js +3 -0
  379. package/dist/internal/extension-namespace.d.ts +9 -0
  380. package/dist/internal/extension-namespace.d.ts.map +1 -0
  381. package/dist/internal/extension-namespace.js +14 -0
  382. package/dist/internal/guid.d.ts +2 -0
  383. package/dist/internal/guid.d.ts.map +1 -0
  384. package/dist/internal/guid.js +4 -0
  385. package/dist/internal/host-kv-cas.d.ts +13 -0
  386. package/dist/internal/host-kv-cas.d.ts.map +1 -0
  387. package/dist/internal/host-kv-cas.js +26 -0
  388. package/dist/internal/host-kv.d.ts +4 -1
  389. package/dist/internal/host-kv.d.ts.map +1 -1
  390. package/dist/internal/host-kv.js +15 -2
  391. package/dist/internal/hosted-catch-protocol.d.ts +5 -0
  392. package/dist/internal/hosted-catch-protocol.d.ts.map +1 -1
  393. package/dist/internal/hosted-catch-protocol.js +5 -0
  394. package/dist/internal/hosted-catch.d.ts +2 -0
  395. package/dist/internal/hosted-catch.d.ts.map +1 -1
  396. package/dist/internal/hosted-catch.js +6 -1
  397. package/dist/internal/hosted-delivery-protocol.d.ts +4 -0
  398. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  399. package/dist/internal/hosted-delivery-protocol.js +73 -3
  400. package/dist/internal/hosted-delivery.d.ts +9 -3
  401. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  402. package/dist/internal/hosted-delivery.js +14 -3
  403. package/dist/internal/hosted-session-fixture.js +1 -1
  404. package/dist/internal/hosting.d.ts +5 -0
  405. package/dist/internal/hosting.d.ts.map +1 -1
  406. package/dist/internal/hosting.js +7 -1
  407. package/dist/internal/ids.d.ts +2 -0
  408. package/dist/internal/ids.d.ts.map +1 -1
  409. package/dist/internal/ids.js +5 -0
  410. package/dist/internal/install-cursor-skills.d.ts +6 -7
  411. package/dist/internal/install-cursor-skills.d.ts.map +1 -1
  412. package/dist/internal/install-cursor-skills.js +15 -9
  413. package/dist/internal/interview/agent-questions.d.ts +1 -1
  414. package/dist/internal/interview/agent-questions.d.ts.map +1 -1
  415. package/dist/internal/interview/agent-questions.js +4 -3
  416. package/dist/internal/local-control-plane.d.ts.map +1 -1
  417. package/dist/internal/local-control-plane.js +24 -0
  418. package/dist/internal/mcp-allowlist-in-use.d.ts +23 -0
  419. package/dist/internal/mcp-allowlist-in-use.d.ts.map +1 -0
  420. package/dist/internal/mcp-allowlist-in-use.js +93 -0
  421. package/dist/internal/mcp-endpoint.d.ts.map +1 -1
  422. package/dist/internal/mcp-endpoint.js +8 -10
  423. package/dist/internal/mcp-host.d.ts +19 -1
  424. package/dist/internal/mcp-host.d.ts.map +1 -1
  425. package/dist/internal/mcp-host.js +67 -3
  426. package/dist/internal/mcp-oauth.d.ts.map +1 -1
  427. package/dist/internal/mcp-oauth.js +5 -7
  428. package/dist/internal/oidcAudiences.d.ts +22 -0
  429. package/dist/internal/oidcAudiences.d.ts.map +1 -0
  430. package/dist/internal/oidcAudiences.js +35 -0
  431. package/dist/internal/otel/collector.d.ts.map +1 -1
  432. package/dist/internal/otel/collector.js +2 -0
  433. package/dist/internal/platform-timers.d.ts +2 -0
  434. package/dist/internal/platform-timers.d.ts.map +1 -1
  435. package/dist/internal/platform-timers.js +14 -0
  436. package/dist/internal/private-file.d.ts +32 -1
  437. package/dist/internal/private-file.d.ts.map +1 -1
  438. package/dist/internal/private-file.js +209 -7
  439. package/dist/internal/redact-values.d.ts +3 -0
  440. package/dist/internal/redact-values.d.ts.map +1 -0
  441. package/dist/internal/redact-values.js +19 -0
  442. package/dist/internal/reminder-control-plane-protocol.d.ts +7 -1
  443. package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -1
  444. package/dist/internal/reminder-followup-error.d.ts +23 -0
  445. package/dist/internal/reminder-followup-error.d.ts.map +1 -0
  446. package/dist/internal/reminder-followup-error.js +12 -0
  447. package/dist/internal/reminder-runner.d.ts +15 -1
  448. package/dist/internal/reminder-runner.d.ts.map +1 -1
  449. package/dist/internal/reminder-runner.js +95 -21
  450. package/dist/internal/resolved-connections.d.ts.map +1 -1
  451. package/dist/internal/resolved-connections.js +23 -3
  452. package/dist/internal/run-client.js +2 -1
  453. package/dist/internal/run-program.d.ts +31 -0
  454. package/dist/internal/run-program.d.ts.map +1 -0
  455. package/dist/internal/run-program.js +150 -0
  456. package/dist/internal/schedule-runner.d.ts +1 -0
  457. package/dist/internal/schedule-runner.d.ts.map +1 -1
  458. package/dist/internal/schedule-runner.js +10 -1
  459. package/dist/internal/sdk-runner.d.ts +28 -2
  460. package/dist/internal/sdk-runner.d.ts.map +1 -1
  461. package/dist/internal/sdk-runner.js +298 -38
  462. package/dist/internal/server.d.ts.map +1 -1
  463. package/dist/internal/server.js +53 -8
  464. package/dist/internal/session-credential.d.ts +14 -0
  465. package/dist/internal/session-credential.d.ts.map +1 -0
  466. package/dist/internal/session-credential.js +25 -0
  467. package/dist/internal/session-engine.d.ts +140 -6
  468. package/dist/internal/session-engine.d.ts.map +1 -1
  469. package/dist/internal/session-engine.js +583 -93
  470. package/dist/internal/storage-coordinator.d.ts +3 -1
  471. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  472. package/dist/internal/storage-coordinator.js +13 -0
  473. package/dist/internal/storage-roles.d.ts +9 -1
  474. package/dist/internal/storage-roles.d.ts.map +1 -1
  475. package/dist/internal/teams-channel-profile.d.ts +41 -0
  476. package/dist/internal/teams-channel-profile.d.ts.map +1 -0
  477. package/dist/internal/teams-channel-profile.js +91 -0
  478. package/dist/internal/teams-devtunnel.d.ts +55 -0
  479. package/dist/internal/teams-devtunnel.d.ts.map +1 -0
  480. package/dist/internal/teams-devtunnel.js +205 -0
  481. package/dist/internal/teams-tunnel-proxy.d.ts +17 -0
  482. package/dist/internal/teams-tunnel-proxy.d.ts.map +1 -0
  483. package/dist/internal/teams-tunnel-proxy.js +100 -0
  484. package/dist/internal/testing/conversation-identity-vectors.d.ts +7 -1
  485. package/dist/internal/testing/conversation-identity-vectors.d.ts.map +1 -1
  486. package/dist/internal/testing/conversation-identity-vectors.js +67 -0
  487. package/dist/internal/testing/hosted-http.d.ts +15 -0
  488. package/dist/internal/testing/hosted-http.d.ts.map +1 -0
  489. package/dist/internal/testing/hosted-http.js +86 -0
  490. package/dist/internal/testing/teams-activity-fixtures.d.ts +28 -0
  491. package/dist/internal/testing/teams-activity-fixtures.d.ts.map +1 -0
  492. package/dist/internal/testing/teams-activity-fixtures.js +236 -0
  493. package/dist/internal/testing/teams-doctor-fixtures.d.ts +76 -0
  494. package/dist/internal/testing/teams-doctor-fixtures.d.ts.map +1 -0
  495. package/dist/internal/testing/teams-doctor-fixtures.js +216 -0
  496. package/dist/internal/tunnel-process.d.ts +29 -0
  497. package/dist/internal/tunnel-process.d.ts.map +1 -0
  498. package/dist/internal/tunnel-process.js +105 -0
  499. package/dist/internal/turn-context.d.ts +28 -0
  500. package/dist/internal/turn-context.d.ts.map +1 -0
  501. package/dist/internal/turn-context.js +1 -0
  502. package/dist/oidc-token.d.ts +131 -0
  503. package/dist/oidc-token.d.ts.map +1 -0
  504. package/dist/oidc-token.js +221 -0
  505. package/dist/playground/assets/chunk-YOKDWASO-BPO_8GRX.js +115 -0
  506. package/dist/playground/assets/highlighted-body-KPVGNVTW-CxEV-T_f.js +1 -0
  507. package/dist/playground/assets/index-CjFJhCtb.js +62 -0
  508. package/dist/playground/assets/index-vwUVwmk8.css +1 -0
  509. package/dist/playground/assets/mermaid-HWGCJPDP-eK-fpbFn.js +1 -0
  510. package/dist/playground/index.html +2 -2
  511. package/dist/teams-app-package.d.ts +78 -0
  512. package/dist/teams-app-package.d.ts.map +1 -0
  513. package/dist/teams-app-package.js +204 -0
  514. package/dist/tools.d.ts +1 -1
  515. package/dist/tools.d.ts.map +1 -1
  516. package/dist/types.d.ts +271 -2
  517. package/dist/types.d.ts.map +1 -1
  518. package/docs/changelog.md +43 -0
  519. package/docs/deployment.md +14 -0
  520. package/docs/guides/cloud-agents.md +47 -0
  521. package/docs/guides/teams.md +389 -0
  522. package/docs/guides/workload-identity.md +232 -0
  523. package/docs/reference/agent-config.md +1 -1
  524. package/docs/reference/channels.md +1 -0
  525. package/docs/reference/cli.md +116 -0
  526. package/docs/reference/limits.md +4 -4
  527. package/docs/reference/sessions.md +13 -0
  528. package/docs/troubleshooting.md +21 -0
  529. package/package.json +23 -46
  530. package/skills/create-agent/SKILL.md +17 -4
  531. package/skills/debug/SKILL.md +1 -0
  532. package/skills/deploy/SKILL.md +1 -1
  533. package/skills/framework-map/SKILL.md +1 -0
  534. package/skills/setup-teams/SKILL.md +141 -0
  535. package/templates/agentic-owners/bot/lib/owners/parse.ts +1 -0
  536. package/dist/channels/slack/event-id-dedupe.d.ts +0 -10
  537. package/dist/channels/slack/event-id-dedupe.d.ts.map +0 -1
  538. package/dist/docs/assets/changelog.md.DVNB-ApU.js +0 -1
  539. package/dist/docs/assets/chunks/@localSearchIndexroot.DdlR-9Oe.js +0 -1
  540. package/dist/docs/assets/chunks/channel.CdyTxaXV.js +0 -1
  541. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CeUcN6TW.js +0 -1
  542. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CeUcN6TW.js +0 -1
  543. package/dist/docs/assets/chunks/clone.DpIwUbur.js +0 -1
  544. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.HtBkUH4J.js +0 -1
  545. package/dist/docs/assets/guides_cloud-agents.md.CiXAW6on.js +0 -9
  546. package/dist/docs/assets/troubleshooting.md.DfKKvW1R.js +0 -3
  547. package/dist/playground/assets/index-CnFd5R1_.js +0 -62
  548. package/dist/playground/assets/index-DNzRv6G8.css +0 -1
  549. /package/dist/docs/assets/{reference_channels.md.CPWOpdsC.lean.js → reference_channels.md.CRvqgU0n.lean.js} +0 -0
  550. /package/dist/docs/assets/{reference_schedules.md.RhQ9ZLo1.lean.js → reference_schedules.md.Dd8_d0WG.lean.js} +0 -0
@@ -0,0 +1,50 @@
1
+ import{_ as e,c as a,o as t,a3 as i}from"./chunks/framework.BNw1pucY.js";const k=JSON.parse('{"title":"Microsoft Teams","description":"Answer mentions, personal chats, and watched channel posts in Microsoft Teams with your own Azure Bot.","frontmatter":{"title":"Microsoft Teams","description":"Answer mentions, personal chats, and watched channel posts in Microsoft Teams with your own Azure Bot."},"headers":[],"relativePath":"guides/teams.md","filePath":"guides/teams.md"}'),n={name:"guides/teams.md"};function o(h,s,l,p,d,r){return t(),a("div",null,[...s[0]||(s[0]=[i(`<h1 id="microsoft-teams-agents" tabindex="-1">Microsoft Teams agents <a class="header-anchor" href="#microsoft-teams-agents" aria-label="Permalink to &quot;Microsoft Teams agents&quot;">​</a></h1><p>A Teams agent wakes when someone @mentions it in a channel or group chat, messages it in a personal chat, or posts in a channel it watches. It answers in the same reply chain. <code>teamsChannel()</code> takes the same engagement options as <code>slackChannel()</code>, so an agent that already runs in Slack can run in Teams with the same shape of config.</p><p>The agent answers as an Azure Bot that you register and own. Teams sends each message to the bot&#39;s messaging endpoint, and the channel checks the Bot Framework token on every request before it starts a turn.</p><h2 id="set-up-with-the-cli" tabindex="-1">Set up with the CLI <a class="header-anchor" href="#set-up-with-the-cli" aria-label="Permalink to &quot;Set up with the CLI&quot;">​</a></h2><p>The <code>agent-sdk channels teams</code> commands do every step except the clicks in the Azure portal and in Teams:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> channels</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> teams</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> setup</span></span>
2
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">printf</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> %s</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$CLIENT_SECRET</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> channels</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> teams</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> init</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
3
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --app-id</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">microsoft-app-i</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">d</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&gt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --tenant-id</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">app-tenant-i</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">d</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&gt;</span></span>
4
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> channels</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> teams</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> package</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span></span>
5
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dev</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span></span>
6
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> channels</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> teams</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> doctor</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --endpoint</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">printed</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> UR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">L</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&gt;</span></span></code></pre></div><ol><li><code>setup</code> prints the Azure portal steps in <a href="#register-the-azure-bot">Register the Azure Bot</a>.</li><li><code>init</code> writes <code>bot/channels/teams.ts</code> and puts the app id, the client secret, and the tenant id in <code>.env.local</code>. It reads the secret from a hidden prompt or stdin, never from an argument.</li><li><code>package</code> writes <code>helm-teams-app.zip</code>. Upload it in Teams, as <a href="#install-the-bot-in-teams">Install the bot in Teams</a> describes.</li><li><code>dev</code> opens a tunnel and prints the messaging endpoint. Set it on the Azure Bot.</li><li><code>doctor</code> checks the env names, the token, the Azure Bot, and the endpoint, and names the part that fails.</li></ol><p>The <a href="./../reference/cli.html#teams">CLI reference</a> lists every flag. The rest of this guide explains what the commands write and how the channel behaves.</p><h2 id="answer-a-mention-or-personal-chat" tabindex="-1">Answer a mention or personal chat <a class="header-anchor" href="#answer-a-mention-or-personal-chat" aria-label="Permalink to &quot;Answer a mention or personal chat&quot;">​</a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// bot/channels/teams.ts</span></span>
7
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { teamsChannel } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk/channels/teams&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
8
+ <span class="line"></span>
9
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span></code></pre></div><p>By default the agent answers @mentions in channels and group chats, and every message in a personal chat. While a turn runs, Teams shows the typing indicator, and the reply arrives as one message in the reply chain. In a channel, each reply chain is its own conversation. A personal chat and a group chat have no reply chains, so each one is a single conversation.</p><p>The channel reads three variables:</p><table tabindex="0"><thead><tr><th>Variable</th><th>Value</th></tr></thead><tbody><tr><td><code>TEAMS_APP_ID</code></td><td>The Azure Bot&#39;s Microsoft App ID</td></tr><tr><td><code>TEAMS_APP_PASSWORD</code></td><td>A client secret of that app registration</td></tr><tr><td><code>TEAMS_TENANT_ID</code></td><td>Required. The home tenant of your single-tenant Azure Bot</td></tr></tbody></table><p>The Azure Bot is a single-tenant bot in your own tenant, because Azure does not create new multi-tenant bots after July 31, 2025. The channel mints its Bot Connector token in that tenant and ignores activities from any other tenant. To run several agents in one <code>agent-sdk dev</code>, give each its own bot and an <code>envPrefix</code>. <code>channels teams init --prefix HELPDESK</code> writes it for you. The prefix starts with a letter.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ envPrefix: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;HELPDESK&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span>
10
+ <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// HELPDESK_TEAMS_APP_ID, HELPDESK_TEAMS_APP_PASSWORD, HELPDESK_TEAMS_TENANT_ID</span></span></code></pre></div><p>The channel file owns these names. When the file exists, <code>init</code> writes the names it reads, and <code>doctor</code> and <code>package</code> read them from the loaded channel.</p><h2 id="register-the-azure-bot" tabindex="-1">Register the Azure Bot <a class="header-anchor" href="#register-the-azure-bot" aria-label="Permalink to &quot;Register the Azure Bot&quot;">​</a></h2><ol><li>In the Azure portal, create an <strong>Azure Bot</strong> resource. Set <strong>Type of App</strong> to <strong>Single Tenant</strong> and <strong>Creation type</strong> to <strong>Create new Microsoft App ID</strong>.</li><li>Open the bot&#39;s <strong>Configuration</strong> page. Copy <strong>Microsoft App ID</strong> and <strong>App Tenant ID</strong>. <code>init</code> takes them as <code>--app-id</code> and <code>--tenant-id</code>.</li><li>From <strong>Configuration</strong>, open <strong>Manage Password</strong>, add a client secret, and copy its value. Azure shows the value once. <code>init</code> reads it from the hidden prompt or stdin.</li><li>Under <strong>Channels</strong>, add <strong>Microsoft Teams</strong>.</li><li>Set <strong>Messaging endpoint</strong> to the URL in <a href="#messaging-endpoint">Messaging endpoint</a>, or for a hosted deploy, the URL in <a href="#deploy">Deploy</a>.</li></ol><h2 id="install-the-bot-in-teams" tabindex="-1">Install the bot in Teams <a class="header-anchor" href="#install-the-bot-in-teams" aria-label="Permalink to &quot;Install the bot in Teams&quot;">​</a></h2><p>Teams installs a bot from an app package: a zip of <code>manifest.json</code> and two icons. <code>agent-sdk channels teams package</code> builds it from the channel. The <code>bots</code> entry names the Azure Bot by its app ID and the places people can talk to it:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
11
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;id&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&lt;TEAMS_APP_ID&gt;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
12
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;bots&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span></span>
13
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
14
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;botId&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&lt;TEAMS_APP_ID&gt;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
15
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;scopes&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;personal&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;team&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;groupChat&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
16
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;isNotificationOnly&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span></span>
17
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
18
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]</span></span>
19
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>A full manifest also needs <code>manifestVersion</code>, <code>version</code>, <code>developer</code>, <code>name</code>, <code>description</code>, <code>icons</code>, and <code>accentColor</code>; see the <a href="https://learn.microsoft.com/microsoftteams/platform/resources/schema/manifest-schema" target="_blank" rel="noreferrer">app manifest schema</a>. Upload the package in Teams under <strong>Apps</strong> &gt; <strong>Manage your apps</strong> &gt; <strong>Upload an app</strong>, or have a Teams admin publish it to your organization in the Teams admin center. Then add the app to a team, a group chat, or a personal chat.</p><h2 id="wake-on-a-channel-post" tabindex="-1">Wake on a channel post <a class="header-anchor" href="#wake-on-a-channel-post" aria-label="Permalink to &quot;Wake on a channel post&quot;">​</a></h2><p>Teams sends a channel post without a mention only to an app that holds the resource-specific consent permission <code>ChannelMessage.Read.Group</code>. <code>package</code> adds it when the channel sets <code>engagement.channelPosts</code>, and a team owner grants it when they add the app to the team:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
20
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;webApplicationInfo&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: { </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">&quot;id&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&lt;TEAMS_APP_ID&gt;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
21
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;authorization&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
22
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;permissions&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
23
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;resourceSpecific&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [{ </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">&quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;ChannelMessage.Read.Group&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">&quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Application&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }]</span></span>
24
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
25
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
26
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>Then name the channels to watch. Copy a channel&#39;s ID from its <strong>Get link to channel</strong> URL: it&#39;s the <code>19:…@thread.tacv2</code> part.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
27
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> engagement: {</span></span>
28
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> channelPosts: {</span></span>
29
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> allow: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;19:4b7c2f9e1d6a4e8f9a3b5c7d1e2f3a4b@thread.tacv2&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
30
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> posts: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;all&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
31
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
32
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
33
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Watched posts go to <code>onChannelPost</code> when you set it, the same way mentions go to <code>onAppMention</code> and personal chats to <code>onDirectMessage</code>. Return <code>null</code> from a hook to skip a message. <code>posts</code> is <code>&quot;top-level&quot;</code> (the default), <code>&quot;replies&quot;</code>, or <code>&quot;all&quot;</code>. Use <code>allow: [&quot;*&quot;]</code> to watch every channel the app is in, and <code>replies: &quot;joined&quot;</code> to also answer replies in any reply chain the agent already answered. Bot posts stay out unless you set <code>includeBotPosts: true</code>; the agent&#39;s own posts never start a turn.</p><p>To let another bot wake the agent with an @mention, list it in <code>engagement.botMentions.allowFrom</code> as <code>28:&lt;its app ID&gt;</code>. Each thread allows 5 bot wakes an hour and 20 in total by default (<code>maxPerThreadPerHour</code>, <code>maxPerThreadTotal</code>).</p><h2 id="stream-the-reply" tabindex="-1">Stream the reply <a class="header-anchor" href="#stream-the-reply" aria-label="Permalink to &quot;Stream the reply&quot;">​</a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ reply: { mode: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;stream&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } });</span></span></code></pre></div><p>In stream mode the agent posts one message as soon as it starts working. That message names the tool the agent is running until text arrives, then fills in as the reply grows, and it ends as the final answer. Teams limits how often a bot can edit a message, so the channel edits at most once every 1.5 seconds; set <code>updateIntervalMs</code> to change that.</p><h2 id="approve-tool-calls-in-teams" tabindex="-1">Approve tool calls in Teams <a class="header-anchor" href="#approve-tool-calls-in-teams" aria-label="Permalink to &quot;Approve tool calls in Teams&quot;">​</a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ toolApprovals: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span></code></pre></div><p>When a server tool with <code>needsApproval</code> is about to run, the agent posts an Adaptive Card in the thread with the tool&#39;s arguments, secrets redacted, and <strong>Approve</strong> and <strong>Deny</strong> buttons. Anyone who could continue the conversation can decide; set <code>policy: { respondTo: &quot;author&quot; }</code> to limit that, and follow-ups, to the person who started it. After the click, the card shows the decision and who made it.</p><p>For your own cards, handle other <code>Action.Submit</code> clicks in <code>onCardAction</code>, which receives the submitted data and can start a turn in the card&#39;s thread.</p><h2 id="refuse-guests-and-other-tenants" tabindex="-1">Refuse guests and other tenants <a class="header-anchor" href="#refuse-guests-and-other-tenants" aria-label="Permalink to &quot;Refuse guests and other tenants&quot;">​</a></h2><p>By default the channel answers only members and owners of the bot&#39;s tenant. It asks Teams for the sender&#39;s role and tenant. It refuses a guest, an anonymous meeting user, or a person from another organization. This applies when they message the agent and when they click a card. <strong>Approve</strong> and <strong>Deny</strong> are card clicks. A sender with no role is refused. A sender Teams does not list is refused too.</p><p>The agent posts one short reply to a refused sender. It posts at most once per conversation and sender per hour. The default text is &quot;I can only help members of this organization. Ask the agent owner to allow guests.&quot;</p><p>Set <code>policy.refusalMessage</code> to change the default text. Set <code>policy.refusalMessage</code> to <code>false</code> to stay silent. Silence applies to a refused sender and to a sender the lookup could not verify.</p><p>A failed lookup gets the reply &quot;I couldn&#39;t verify your access, try again shortly.&quot; The agent does not reply to a card click from a refused sender. The agent ignores a card click from a bot, including a bot that <code>engagement.botMentions</code> allows. The agent does not reply to an activity from another tenant.</p><p>To let guests and external members in, set <code>blockExternals</code> to <code>false</code>.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ policy: { blockExternals: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } });</span></span></code></pre></div><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
34
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> policy: {</span></span>
35
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refusalMessage: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Ask your team owner to add you to this organization.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
36
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
37
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h2 id="welcome-message" tabindex="-1">Welcome message <a class="header-anchor" href="#welcome-message" aria-label="Permalink to &quot;Welcome message&quot;">​</a></h2><p>When someone installs the app in a conversation, the agent posts one greeting there. Teams reports the install as an <code>installationUpdate</code> activity whose action is <code>add</code>. The greeting does not start a model turn. The agent posts it once per conversation.</p><p>The default text is &quot;Hi! Mention me in a channel, or message me here, to get started.&quot;</p><p>Set <code>welcome</code> to change the greeting. Set <code>welcome</code> to <code>false</code> to turn it off.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
38
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> welcome: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Hi. Mention me when you want help with a laptop.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
39
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h2 id="messaging-endpoint" tabindex="-1">Messaging endpoint <a class="header-anchor" href="#messaging-endpoint" aria-label="Permalink to &quot;Messaging endpoint&quot;">​</a></h2><p>Under <code>agent-sdk dev</code> or self-hosted <code>agent-sdk serve</code>, the Azure Bot&#39;s messaging endpoint is the server&#39;s public origin plus the channel&#39;s path:</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>https://&lt;origin&gt;/&lt;slug&gt;/v1/channels/&lt;channel&gt;</span></span></code></pre></div><p><code>&lt;slug&gt;</code> is the agent&#39;s slug and <code>&lt;channel&gt;</code> is the channel file&#39;s name, so <code>bot/channels/teams.ts</code> in the <code>helm</code> agent answers at <code>https://&lt;origin&gt;/helm/v1/channels/teams</code>. The URL has no trailing slash. With <code>teamsChannel({ path: &quot;/messages&quot; })</code>, the channel appends that path: <code>https://&lt;origin&gt;/helm/v1/channels/teams/messages</code>. A hosted deploy has a different URL; see <a href="#deploy">Deploy</a>.</p><h2 id="test-locally" tabindex="-1">Test locally <a class="header-anchor" href="#test-locally" aria-label="Permalink to &quot;Test locally&quot;">​</a></h2><p>Teams reaches the bot only at a public HTTPS URL. <code>agent-sdk dev</code> opens a <code>cloudflared</code> tunnel and prints the messaging endpoint on the tunnel&#39;s origin:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dev</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span></span></code></pre></div><p>Copy the printed URL into the Azure Bot&#39;s <strong>Messaging endpoint</strong>, then mention the bot in Teams. <code>--tunnel devtunnel</code> keeps one URL across restarts. Next to a plain <code>agent-sdk serve</code>, <code>agent-sdk channels teams forward</code> opens the same tunnel. <code>agent-sdk dev --mode single</code> serves one agent without a slug, so its endpoint is <code>https://&lt;origin&gt;/v1/channels/teams</code>. Without <code>--mode single</code>, the endpoint includes the agent&#39;s slug: <code>https://&lt;origin&gt;/helm/v1/channels/teams</code>.</p><p>To run your own tunnel instead, serve with plain <code>agent-sdk serve</code>, which opens no tunnel, and point <code>cloudflared</code> at its port:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> serve</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --mode</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> single</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --port</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 3978</span></span>
40
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cloudflared</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> tunnel</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --url</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost:3978</span></span></code></pre></div><p>Add <code>--protocol http2</code> to <code>cloudflared</code> if your network blocks QUIC. Set the Azure Bot&#39;s <strong>Messaging endpoint</strong> to the printed <code>&lt;public-url&gt;</code> plus <code>/v1/channels/teams</code>, or <code>&lt;public-url&gt;/helm/v1/channels/teams</code> without <code>--mode single</code>. The built-in tunnel forwards only <code>POST</code> requests to the Teams messaging paths. A tunnel you run yourself exposes every route on the port.</p><p>Requests through a tunnel always get the Bot Framework token check, so only Teams can start turns there. A tunnel adds proxy headers or forwards its public hostname, and the dev exception for unsigned activities refuses both. To replay a saved activity without Teams, POST it to the same path on <code>http://127.0.0.1:&lt;port&gt;</code> from the same machine; <code>agent-sdk dev</code> admits unsigned activities from loopback only.</p><h2 id="deploy" tabindex="-1">Deploy <a class="header-anchor" href="#deploy" aria-label="Permalink to &quot;Deploy&quot;">​</a></h2><p>Hosted, the agent needs its three secrets:</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// bot/agent.ts</span></span>
41
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineAgent } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
42
+ <span class="line"></span>
43
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineAgent</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
44
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> hosting: {</span></span>
45
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> secretNames: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;TEAMS_APP_ID&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;TEAMS_APP_PASSWORD&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;TEAMS_TENANT_ID&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
46
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
47
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Hosting adds the Microsoft hosts that a Teams channel calls (<code>login.microsoftonline.com</code>, <code>login.botframework.com</code>, and <code>smba.trafficmanager.net</code>), so you do not list them in <code>egressDomains</code>. Your team&#39;s network settings still apply to them. If your team restricts egress, its allowlist must include all three hosts, or the agent&#39;s replies fail.</p><p>An <code>envPrefix</code> changes the secret names. With <code>teamsChannel({ envPrefix: &quot;ECHO&quot; })</code>, list <code>ECHO_TEAMS_APP_ID</code>, <code>ECHO_TEAMS_APP_PASSWORD</code>, and <code>ECHO_TEAMS_TENANT_ID</code> in <code>secretNames</code>, and set those names with <code>agent-sdk secret set</code>.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> deploy</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --slug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> helpdesk</span></span>
48
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> secret</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> set</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> helpdesk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> TEAMS_APP_ID</span></span>
49
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> secret</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> set</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> helpdesk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> TEAMS_APP_PASSWORD</span></span>
50
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> secret</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> set</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> helpdesk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> TEAMS_TENANT_ID</span></span></code></pre></div><p><code>agent-sdk deploy</code> prints the hosted messaging endpoint on a <code>public:</code> line that ends in <code>/v1/channels/teams</code>. Set the Azure Bot&#39;s <strong>Messaging endpoint</strong> to that URL, not to the slug URL from local testing. With a custom <code>path</code>, add it after the printed URL.</p><p>On hosting, Cursor checks the Bot Framework token and the tenant before the agent starts. Activities that the channel cannot act on, such as a reaction or an unmentioned post outside <code>channelPosts</code>, stop there and use no compute. Each personal or group chat is one session, and each channel reply chain is one session. Tool approvals work on hosting: an Approve or Deny click reaches the turn that waits for it, and a call that nobody approves in 10 minutes is denied.</p><p>Hosting runs Teams channels only in the commercial Microsoft cloud, and only for teams that have Teams channels turned on. The deploy fails otherwise.</p><h2 id="how-teams-differs-from-slack" tabindex="-1">How Teams differs from Slack <a class="header-anchor" href="#how-teams-differs-from-slack" aria-label="Permalink to &quot;How Teams differs from Slack&quot;">​</a></h2><table tabindex="0"><thead><tr><th></th><th>Slack</th><th>Teams</th></tr></thead><tbody><tr><td>App</td><td>Your Slack app&#39;s bot and app tokens</td><td>Your Azure Bot&#39;s app ID, client secret, and tenant</td></tr><tr><td>Local transport</td><td>Socket Mode, no public URL</td><td><code>agent-sdk dev</code> opens a tunnel to the messaging endpoint</td></tr><tr><td>Watch channel posts</td><td><code>message.channels</code> subscription</td><td><code>ChannelMessage.Read.Group</code> consent at install</td></tr><tr><td>Threads</td><td>Every message can start a thread</td><td>Reply chains in channels; personal and group chats are one conversation each</td></tr><tr><td>Bot-to-bot wakes</td><td><code>maxDepth</code> from message metadata, plus per-thread caps</td><td>Per-thread caps only</td></tr><tr><td>Progress</td><td>Status chip, streaming API, tool and reasoning cards</td><td>Typing indicator, or one edited message in stream mode</td></tr><tr><td>Approvals</td><td>Block Kit buttons</td><td>Adaptive Card buttons</td></tr><tr><td>Hosted sessions</td><td>One per thread</td><td>One per chat, or one per channel reply chain</td></tr><tr><td>Not available in Teams</td><td></td><td>Reactions, file uploads and downloads, suggested prompts, <code>eval</code> commands, edit debounce</td></tr></tbody></table><h2 id="related" tabindex="-1">Related <a class="header-anchor" href="#related" aria-label="Permalink to &quot;Related&quot;">​</a></h2><ul><li><a href="./slack.html">Slack</a></li><li><a href="./webhooks.html">Webhooks</a></li><li><a href="./../deployment.html">Deployment</a></li><li><a href="./../reference/channels.html">Channels reference</a></li></ul>`,74)])])}const g=e(n,[["render",o]]);export{k as __pageData,g as default};
@@ -0,0 +1 @@
1
+ import{_ as e,c as a,o as t,a3 as i}from"./chunks/framework.BNw1pucY.js";const k=JSON.parse('{"title":"Microsoft Teams","description":"Answer mentions, personal chats, and watched channel posts in Microsoft Teams with your own Azure Bot.","frontmatter":{"title":"Microsoft Teams","description":"Answer mentions, personal chats, and watched channel posts in Microsoft Teams with your own Azure Bot."},"headers":[],"relativePath":"guides/teams.md","filePath":"guides/teams.md"}'),n={name:"guides/teams.md"};function o(h,s,l,p,d,r){return t(),a("div",null,[...s[0]||(s[0]=[i("",74)])])}const g=e(n,[["render",o]]);export{k as __pageData,g as default};
@@ -0,0 +1,82 @@
1
+ import{_ as i,c as e,o as t,a3 as a}from"./chunks/framework.BNw1pucY.js";const c=JSON.parse('{"title":"Workload identity (OIDC)","description":"Mint short-lived OIDC tokens from a deployed Agent SDK agent to authenticate with cloud providers and external services without static keys.","frontmatter":{"title":"Workload identity (OIDC)","description":"Mint short-lived OIDC tokens from a deployed Agent SDK agent to authenticate with cloud providers and external services without static keys."},"headers":[],"relativePath":"guides/workload-identity.md","filePath":"guides/workload-identity.md"}'),n={name:"guides/workload-identity.md"};function d(o,s,l,h,r,p){return t(),e("div",null,[...s[0]||(s[0]=[a(`<h1 id="authenticate-deployed-agents-with-oidc" tabindex="-1">Authenticate deployed agents with OIDC <a class="header-anchor" href="#authenticate-deployed-agents-with-oidc" aria-label="Permalink to &quot;Authenticate deployed agents with OIDC&quot;">​</a></h1><p>A deployed Agent SDK agent can mint short-lived OIDC JWTs signed by Cursor and exchange them for temporary cloud credentials or service tokens without storing static access keys in deployment secrets.</p><p>Agent SDK tokens share the <code>https://api.cursor.com</code> issuer, discovery endpoints, signing keys, 5-minute lifetime, socket path, and per-pod rate limits documented in <a href="https://cursor.com/docs/cloud-agent/identity" target="_blank" rel="noreferrer">Cloud Agents OIDC tokens</a>. They differ in four ways:</p><table tabindex="0"><thead><tr><th>Aspect</th><th>Cloud Agents</th><th>Agent SDK deployments</th></tr></thead><tbody><tr><td>Audience allowlist</td><td>Any valid <code>aud</code> string</td><td>Must be declared in <code>hosting.oidc.audiences</code>; undeclared audiences return HTTP <code>400</code>.</td></tr><tr><td>Subject (<code>sub</code>)</td><td><code>cloud_agent_id:&lt;id&gt;</code> (or projected <code>team_id:&lt;id&gt;</code> via <code>sub_claim</code>)</td><td>Always <code>agent_sdk_deployment_id:&lt;deployment-id&gt;</code>. Sending <code>sub_claim</code> returns HTTP <code>400</code>.</td></tr><tr><td>Runtime claim (<code>agent_runtime</code>)</td><td><code>&quot;managed&quot;</code> or <code>&quot;self_hosted&quot;</code></td><td><code>&quot;agent_sdk&quot;</code>.</td></tr><tr><td>Additional claims</td><td>Includes owner, team, repository, branch, and turn claims</td><td>See <a href="#token-claims">Token claims</a>. No owner, team, repository, or session claims.</td></tr></tbody></table><h2 id="declare-allowed-audiences" tabindex="-1">Declare allowed audiences <a class="header-anchor" href="#declare-allowed-audiences" aria-label="Permalink to &quot;Declare allowed audiences&quot;">​</a></h2><p>A deployed agent can only mint tokens for audiences declared in <code>hosting.oidc.audiences</code> in <code>bot/agent.ts</code>. If you omit <code>hosting.oidc.audiences</code>, every mint request fails with HTTP <code>400</code>.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// bot/agent.ts</span></span>
2
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineAgent } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
3
+ <span class="line"></span>
4
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineAgent</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
5
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> hosting: {</span></span>
6
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> egressDomains: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sts.amazonaws.com&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
7
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> oidc: {</span></span>
8
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> audiences: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sts.amazonaws.com&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
9
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
10
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
11
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Minting talks to a local Unix socket, so minting itself needs no egress entry. Calling the relying party to exchange the token still requires its hostname in <code>hosting.egressDomains</code>, such as <code>sts.amazonaws.com</code> (and any AWS service host your agent calls afterward).</p><p>Audience rules:</p><ul><li>List exact audience strings only. Wildcards (<code>*</code>) are rejected.</li><li>Declare at most 8 audiences per deployment.</li><li>Each audience must be 1 to 512 printable ASCII characters with no spaces or control characters.</li><li>Cursor-reserved audiences (such as <code>cursor.com</code> hosts) are rejected at deploy time and at mint time.</li><li>Cursor saves <code>hosting.oidc.audiences</code> when you deploy. Redeploy to add or remove an audience.</li></ul><h2 id="mint-a-token-with-getoidctoken" tabindex="-1">Mint a token with <code>getOidcToken</code> <a class="header-anchor" href="#mint-a-token-with-getoidctoken" aria-label="Permalink to &quot;Mint a token with \`getOidcToken\`&quot;">​</a></h2><p>Import <code>getOidcToken</code> from <code>@grok/agent-sdk</code> and call it inside a tool, channel handler, or callback when your agent needs a token.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// bot/tools/assume_aws_role.ts</span></span>
12
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { getOidcToken, OidcTokenError } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
13
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineTool } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk/tools&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
14
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { z } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;zod&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
15
+ <span class="line"></span>
16
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineTool</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
17
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> description: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Exchange an OIDC token for temporary AWS credentials.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
18
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> inputSchema: z.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">object</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({}),</span></span>
19
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> async</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> execute</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() {</span></span>
20
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> let</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> token</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
21
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> try</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
22
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> result</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> getOidcToken</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sts.amazonaws.com&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
23
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> token </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> result.token;</span></span>
24
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">catch</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (error) {</span></span>
25
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (error </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">instanceof</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> OidcTokenError</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
26
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
27
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ok: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
28
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> code: error.code,</span></span>
29
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> status: error.status </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">??</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
30
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> reason: error.reason </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">??</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
31
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> };</span></span>
32
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
33
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> throw</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> error;</span></span>
34
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
35
+ <span class="line"></span>
36
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> body</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> URLSearchParams</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
37
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Action: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;AssumeRoleWithWebIdentity&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
38
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Version: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;2011-06-15&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
39
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RoleArn: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;arn:aws:iam::123456789012:role/my-agent-role&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
40
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RoleSessionName: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;agent-sdk-session&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
41
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> WebIdentityToken: token,</span></span>
42
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span>
43
+ <span class="line"></span>
44
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> response</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> fetch</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://sts.amazonaws.com/&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, {</span></span>
45
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> method: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;POST&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
46
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> headers: {</span></span>
47
+ <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;content-type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;application/x-www-form-urlencoded&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
48
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> accept: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;application/json&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
49
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
50
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> body,</span></span>
51
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span>
52
+ <span class="line"></span>
53
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">response.ok) {</span></span>
54
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { ok: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, stsStatus: response.status };</span></span>
55
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
56
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { ok: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> };</span></span>
57
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
58
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Call <code>getOidcToken</code> inside a tool, handler, or callback, not at module load time.</p><h3 id="return-value-and-caching" tabindex="-1">Return value and caching <a class="header-anchor" href="#return-value-and-caching" aria-label="Permalink to &quot;Return value and caching&quot;">​</a></h3><p><code>getOidcToken(audience: string)</code> returns <code>Promise&lt;OidcToken&gt;</code>:</p><table tabindex="0"><thead><tr><th>Field</th><th>Type</th><th>Meaning</th></tr></thead><tbody><tr><td><code>token</code></td><td><code>string</code></td><td>Compact RS256-signed JWT. Never log it.</td></tr><tr><td><code>expiresAt</code></td><td><code>Date</code></td><td>Token expiration timestamp from the socket&#39;s <code>expires_at</code> field.</td></tr></tbody></table><p><code>getOidcToken</code> caches one token per audience in memory and refreshes it 60 seconds before <code>expiresAt</code>. Concurrent callers for the same audience share a single in-flight mint request. Each mint request times out after 20 seconds.</p><h3 id="error-handling" tabindex="-1">Error handling <a class="header-anchor" href="#error-handling" aria-label="Permalink to &quot;Error handling&quot;">​</a></h3><p><code>getOidcToken</code> throws <code>OidcTokenError</code> (a subclass of <code>Error</code> with <code>name === &quot;OidcTokenError&quot;</code>) on failure:</p><table tabindex="0"><thead><tr><th>Field</th><th>Type</th><th>Meaning</th></tr></thead><tbody><tr><td><code>code</code></td><td><code>OidcTokenErrorCode</code></td><td>Failure category listed below.</td></tr><tr><td><code>status</code></td><td><code>number | undefined</code></td><td>HTTP status code from the identity socket when an HTTP response was received.</td></tr><tr><td><code>reason</code></td><td><code>string | undefined</code></td><td>Machine-readable <code>error</code> string from the socket&#39;s JSON error body, when present.</td></tr></tbody></table><p><code>OidcTokenErrorCode</code> values:</p><table tabindex="0"><thead><tr><th><code>code</code></th><th>Typical <code>status</code></th><th>Cause</th><th>What to do</th></tr></thead><tbody><tr><td><code>&quot;not_hosted&quot;</code></td><td><code>undefined</code></td><td>No identity socket exists (for example, during local <code>agent-sdk dev</code> or <code>agent-sdk serve</code>).</td><td>Use local credentials in development or skip OIDC locally.</td></tr><tr><td><code>&quot;refused&quot;</code></td><td><code>403</code></td><td>The deployment is not running (stopped or deleted) or OIDC minting is disabled for this deployment.</td><td>Treat as non-retryable. Check deployment status.</td></tr><tr><td><code>&quot;rate_limited&quot;</code></td><td><code>429</code></td><td>The per-pod mint rate limit was exceeded.</td><td>Back off and retry. Prefer <code>getOidcToken</code> caching over repeated raw calls.</td></tr><tr><td><code>&quot;timeout&quot;</code></td><td><code>undefined</code></td><td>The mint request did not finish within 20 seconds.</td><td>Retry with backoff.</td></tr><tr><td><code>&quot;malformed&quot;</code></td><td><code>undefined</code></td><td>The socket returned HTTP <code>200</code> with invalid JSON, missing <code>token</code> or <code>expires_at</code>, or a body larger than 64 KiB.</td><td>Retry or inspect runtime logs.</td></tr><tr><td><code>&quot;failed&quot;</code></td><td><code>400</code>, <code>5xx</code>, or <code>undefined</code></td><td>Another HTTP error or socket transport failure.</td><td>Check <code>status</code>. HTTP <code>400</code> means fix the request or declare the audience in <code>hosting.oidc.audiences</code>; <code>5xx</code> errors are retryable.</td></tr></tbody></table><p>When you request an audience that is not listed in <code>hosting.oidc.audiences</code>, the socket returns HTTP <code>400</code> and <code>getOidcToken</code> throws <code>OidcTokenError</code> with <code>code: &quot;failed&quot;</code> and <code>status: 400</code>. Branch on <code>code</code> and <code>status</code> rather than matching <code>reason</code>, which can change.</p><h2 id="call-the-identity-socket-directly" tabindex="-1">Call the identity socket directly <a class="header-anchor" href="#call-the-identity-socket-directly" aria-label="Permalink to &quot;Call the identity socket directly&quot;">​</a></h2><p>Use the local Unix domain socket directly from shell scripts, non-JavaScript tools, or when you need a <code>nonce</code> claim (which <code>getOidcToken</code> does not accept).</p><p>The socket path is in <code>$CURSOR_AGENT_SOCKET</code>, defaulting to <code>/run/cursor/api.sock</code>. Send <code>POST /v1/tokens/oidc</code> with <code>Content-Type: application/json</code> (maximum body size 4 KB):</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --silent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --show-error</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --fail-with-body</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
59
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --unix-socket</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;\${</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">CURSOR_AGENT_SOCKET</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:-/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">run</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">cursor</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">/</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">api</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">sock</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">}&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
60
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;Content-Type: application/json&#39;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
61
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;aud&quot;:&quot;sts.amazonaws.com&quot;}&#39;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
62
+ <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost/v1/tokens/oidc</span></span></code></pre></div><p>Request fields:</p><ul><li><code>aud</code> (required string): exact audience declared in <code>hosting.oidc.audiences</code>.</li><li><code>nonce</code> (optional string): opaque printable ASCII string with no spaces, up to 512 characters, echoed into the JWT <code>nonce</code> claim.</li></ul><p>Success response (<code>200 OK</code>):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
63
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;token&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;eyJhbGciOiJSUzI1NiIsImtpZCI6Ii4uLiIsInR5cCI6IkpXVCJ9...&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
64
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;expires_at&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1785500000</span></span>
65
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p><code>expires_at</code> is the token expiration in Unix seconds and matches the JWT <code>exp</code> claim.</p><p>An undeclared audience, a Cursor-reserved audience, an invalid <code>aud</code>, or a <code>sub_claim</code> field returns HTTP <code>400</code> with a JSON error object whose <code>error</code> string can change.</p><p>See <a href="https://cursor.com/docs/cloud-agent/identity" target="_blank" rel="noreferrer">Cloud Agents OIDC tokens</a> for the full socket HTTP status code table and per-pod rate limits.</p><h2 id="token-claims" tabindex="-1">Token claims <a class="header-anchor" href="#token-claims" aria-label="Permalink to &quot;Token claims&quot;">​</a></h2><p>Tokens are signed with <code>RS256</code> and include <code>alg</code>, <code>kid</code>, and <code>typ: &quot;JWT&quot;</code> in the header. Every Agent SDK token carries these claims:</p><table tabindex="0"><thead><tr><th>Claim</th><th>Value</th><th>Notes</th></tr></thead><tbody><tr><td><code>iss</code></td><td><code>https://api.cursor.com</code></td><td>Same issuer as Cloud Agents.</td></tr><tr><td><code>sub</code></td><td><code>agent_sdk_deployment_id:&lt;deployment-id&gt;</code></td><td><code>&lt;deployment-id&gt;</code> is the deployment public ID (<code>asd_</code> followed by 32 lowercase hex characters).</td></tr><tr><td><code>aud</code></td><td>Requested audience string</td><td>Always a single string matching an entry in <code>hosting.oidc.audiences</code>.</td></tr><tr><td><code>iat</code></td><td>Unix seconds</td><td>Issued-at time.</td></tr><tr><td><code>nbf</code></td><td><code>iat - 5</code></td><td>Allows 5 seconds of clock skew.</td></tr><tr><td><code>exp</code></td><td><code>iat + 300</code></td><td>Valid for 5 minutes.</td></tr><tr><td><code>jti</code></td><td>UUID</td><td>Unique token ID per mint.</td></tr><tr><td><code>agent_runtime</code></td><td><code>&quot;agent_sdk&quot;</code></td><td>Identifies an Agent SDK deployment token.</td></tr><tr><td><code>nonce</code></td><td>Optional string</td><td>Present only when sent on a raw socket request.</td></tr></tbody></table><h2 id="configure-an-aws-iam-trust-policy" tabindex="-1">Configure an AWS IAM trust policy <a class="header-anchor" href="#configure-an-aws-iam-trust-policy" aria-label="Permalink to &quot;Configure an AWS IAM trust policy&quot;">​</a></h2><ol><li>In AWS IAM, add <code>https://api.cursor.com</code> as an OpenID Connect identity provider with <code>sts.amazonaws.com</code> as an audience (if your AWS account does not already have one).</li><li>Declare <code>&quot;sts.amazonaws.com&quot;</code> in <code>hosting.oidc.audiences</code> and <code>hosting.egressDomains</code>, then deploy your agent.</li><li>Find your deployment&#39;s exact <code>sub</code> claim (<code>agent_sdk_deployment_id:asd_&lt;32 hex chars&gt;</code>). You can read <code>sub</code> from the JWT payload of a minted token during initial setup. Redeploying the same slug keeps the same deployment public ID; deleting and recreating a deployment generates a new one.</li><li>Attach a trust policy to your IAM role that pins both <code>api.cursor.com:aud</code> and <code>api.cursor.com:sub</code> with <code>StringEquals</code>:</li></ol><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
66
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;Version&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;2012-10-17&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
67
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;Statement&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span></span>
68
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
69
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;Effect&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Allow&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
70
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;Principal&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
71
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;Federated&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;arn:aws:iam::123456789012:oidc-provider/api.cursor.com&quot;</span></span>
72
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
73
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;Action&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sts:AssumeRoleWithWebIdentity&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
74
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;Condition&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
75
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;StringEquals&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
76
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;api.cursor.com:aud&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;sts.amazonaws.com&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
77
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;api.cursor.com:sub&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;agent_sdk_deployment_id:asd_3f9c0a7b1d2e4f60a9b8c7d6e5f40312&quot;</span></span>
78
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
79
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
80
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
81
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]</span></span>
82
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>Never replace the <code>sub</code> value with a wildcard such as <code>agent_sdk_deployment_id:*</code>. A wildcard trusts every Agent SDK deployment on Cursor.</p><h2 id="verification-rate-limits-and-trust-model" tabindex="-1">Verification, rate limits, and trust model <a class="header-anchor" href="#verification-rate-limits-and-trust-model" aria-label="Permalink to &quot;Verification, rate limits, and trust model&quot;">​</a></h2><p>For OIDC discovery (<code>https://api.cursor.com/.well-known/openid-configuration</code>), JWKS (<code>https://api.cursor.com/keys</code>), JWT signature verification steps, and per-pod rate limits, see <a href="https://cursor.com/docs/cloud-agent/identity" target="_blank" rel="noreferrer">Cloud Agents OIDC tokens</a>.</p><p>Keep the deployment trust boundary in mind when scoping external roles:</p><ul><li>Any code or tool running inside the deployment pod that can reach the identity socket can mint tokens for any audience declared in <code>hosting.oidc.audiences</code>.</li><li>The platform sets <code>sub</code> from the deployment identity, so one deployment cannot impersonate another.</li><li>Tokens represent the deployment as a whole, not a single session, tool, or end user. Grant the external role only the permissions that the deployment should hold.</li></ul><h2 id="related" tabindex="-1">Related <a class="header-anchor" href="#related" aria-label="Permalink to &quot;Related&quot;">​</a></h2><ul><li><a href="./../deployment.html">Deployment</a></li><li><a href="./../reference/agent-config.html">Agent config</a></li><li><a href="https://cursor.com/docs/cloud-agent/identity" target="_blank" rel="noreferrer">Cloud Agents OIDC tokens</a></li></ul>`,48)])])}const E=i(n,[["render",d]]);export{c as __pageData,E as default};
@@ -0,0 +1 @@
1
+ import{_ as i,c as e,o as t,a3 as a}from"./chunks/framework.BNw1pucY.js";const c=JSON.parse('{"title":"Workload identity (OIDC)","description":"Mint short-lived OIDC tokens from a deployed Agent SDK agent to authenticate with cloud providers and external services without static keys.","frontmatter":{"title":"Workload identity (OIDC)","description":"Mint short-lived OIDC tokens from a deployed Agent SDK agent to authenticate with cloud providers and external services without static keys."},"headers":[],"relativePath":"guides/workload-identity.md","filePath":"guides/workload-identity.md"}'),n={name:"guides/workload-identity.md"};function d(o,s,l,h,r,p){return t(),e("div",null,[...s[0]||(s[0]=[a("",48)])])}const E=i(n,[["render",d]]);export{c as __pageData,E as default};
@@ -1,4 +1,4 @@
1
- import{_ as e,c as t,o as a,a3 as i}from"./chunks/framework.BNw1pucY.js";const k=JSON.parse('{"title":"Agent config","description":"defineAgent at bot/agent.ts: the model, local workspace, and programmatic serving.","frontmatter":{"title":"Agent config","description":"defineAgent at bot/agent.ts: the model, local workspace, and programmatic serving."},"headers":[],"relativePath":"reference/agent-config.md","filePath":"reference/agent-config.md"}'),o={name:"reference/agent-config.md"};function n(l,s,d,r,h,c){return a(),t("div",null,[...s[0]||(s[0]=[i(`<h1 id="agent-config" tabindex="-1">Agent config <a class="header-anchor" href="#agent-config" aria-label="Permalink to &quot;Agent config&quot;">​</a></h1><p><code>bot/agent.ts</code> default-exports <code>defineAgent(config)</code>, which sets the model that runs the agent and the defaults for a local run. Every field is optional on the root agent.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineAgent } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
1
+ import{_ as e,c as t,o as a,a3 as i}from"./chunks/framework.BNw1pucY.js";const k=JSON.parse('{"title":"Agent config","description":"defineAgent at bot/agent.ts: the model, local workspace, and programmatic serving.","frontmatter":{"title":"Agent config","description":"defineAgent at bot/agent.ts: the model, local workspace, and programmatic serving."},"headers":[],"relativePath":"reference/agent-config.md","filePath":"reference/agent-config.md"}'),o={name:"reference/agent-config.md"};function n(d,s,l,r,h,c){return a(),t("div",null,[...s[0]||(s[0]=[i(`<h1 id="agent-config" tabindex="-1">Agent config <a class="header-anchor" href="#agent-config" aria-label="Permalink to &quot;Agent config&quot;">​</a></h1><p><code>bot/agent.ts</code> default-exports <code>defineAgent(config)</code>, which sets the model that runs the agent and the defaults for a local run. Every field is optional on the root agent.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineAgent } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
2
2
  <span class="line"></span>
3
3
  <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineAgent</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
4
4
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model: {</span></span>
@@ -8,7 +8,7 @@ import{_ as e,c as t,o as a,a3 as i}from"./chunks/framework.BNw1pucY.js";const k
8
8
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { id: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;fast&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, value: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;true&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
9
9
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ],</span></span>
10
10
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// optional; this is the default</span></span>
11
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h2 id="agent-fields" tabindex="-1">Agent fields <a class="header-anchor" href="#agent-fields" aria-label="Permalink to &quot;Agent fields&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Field</th><th>Type</th><th>Meaning</th></tr></thead><tbody><tr><td><code>model</code></td><td>string or <code>{ id, params }</code></td><td>Cursor model for turns. Defaults to <code>grok-4.7</code> with <code>reasoning_effort=high</code> and <code>fast=true</code>. Subagents omit it to inherit.</td></tr><tr><td><code>name</code></td><td>string</td><td>Display name. Defaults to the package or directory name.</td></tr><tr><td><code>description</code></td><td>string</td><td>What the agent is for. Required on subagents, where the parent model reads it to decide when to delegate.</td></tr><tr><td><code>instructions</code></td><td>string</td><td>Inline instructions for subagents and generated configs. Prefer <code>instructions.md</code>.</td></tr><tr><td><code>local</code></td><td><code>{ cwd?, workspaceDir?, sandbox? }</code></td><td>Defaults for a local run. See <a href="#local-options">Local options</a>.</td></tr><tr><td><code>hosting</code></td><td><code>{ egressDomains?, secretNames? }</code></td><td>The egress allowlist and expected secret names that <code>agent-sdk deploy</code> reads. Mounted <a href="./extensions.html#build-an-extension">extensions</a> add their own.</td></tr><tr><td><code>concurrency</code></td><td><code>{ maxRunningTurns? }</code></td><td>Agent-wide limit on concurrent turns. See <a href="#concurrency">Concurrency</a>.</td></tr><tr><td><code>builtinTools</code></td><td><code>{ reminders? }</code></td><td>Opt-in tools that Agent SDK provides. See <a href="#built-in-tools">Built-in tools</a>.</td></tr><tr><td><code>tools</code></td><td><code>ToolName[]</code></td><td>Allowlist of built-in tools. Omit it for the full standard toolset. See <a href="#harness-tools">Harness tools</a>.</td></tr><tr><td><code>fs</code></td><td><code>FileSystem</code> or <code>(ctx) =&gt; FileSystem</code></td><td>Custom file tree for the session. <code>root</code> is the deprecated name. See <a href="#custom-filesystem">Custom filesystem</a>.</td></tr><tr><td><code>workspace</code></td><td>string</td><td>With <code>fs</code>, the folder inside the tree the agent works in, and where project rules load from. Defaults to <code>/</code>. For a sandboxed agent without shell, where its session workspace is mounted, <code>/workspace</code> by default.</td></tr><tr><td><code>skills</code></td><td><code>false</code> or <code>(ctx) =&gt; FileSystem</code></td><td>Replaces the skills tree mounted at <code>/agent/skills</code>, or turns that mount off.</td></tr></tbody></table><p>The <code>persistent</code> field was removed. Discovery rejects a config that still sets it, and the error is <code>persistent was removed. Delete it from defineAgent.</code>, so <code>validate</code>, <code>dev</code>, and <code>deploy</code> fail until you delete the field. A deployment that is already running keeps serving until you stop or delete it.</p><h2 id="model" tabindex="-1">Model <a class="header-anchor" href="#model" aria-label="Permalink to &quot;Model&quot;">​</a></h2><p>Set effort and speed with params, not in the id. Use the object form shown above to set params, or a plain string when you don&#39;t need any:</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">model</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;composer-2.5&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span></code></pre></div><h2 id="local-options" tabindex="-1">Local options <a class="header-anchor" href="#local-options" aria-label="Permalink to &quot;Local options&quot;">​</a></h2><p><code>local.workspaceDir</code> points every session at one shared working directory, for agents that work inside an existing checkout. It takes precedence over <code>cwd</code>, and a per-send <code>workspaceDir</code> wins over both. Sessions share that tree, so one turn&#39;s files are visible to the next.</p><p><code>local.sandbox</code> runs the agent inside Cursor&#39;s local sandbox. It&#39;s off by default, so shell commands auto-approve and inherit the serve process environment, including the host&#39;s credentials. Turn it on when turns read untrusted input, such as webhook payloads, PR diffs, or inbound chat. The sandbox limits the tools themselves, so an injected prompt can&#39;t talk the model past it.</p><p>With <code>local.sandbox</code> on, shell commands run without network access, writes and deletes outside the session workspace are refused, and a tool call that needs approval, such as an external MCP call, fails closed. What the agent can read depends on its <code>tools</code>:</p><ul><li><strong>With shell</strong> (or with <code>tools</code> omitted, which includes it), the agent runs on the host disk. Shell commands and the file tools (<code>read</code>, <code>grep</code>, <code>glob</code>, <code>ls</code>) can read any file the serve process can, including credentials on the host.</li><li><strong>With file tools and no shell</strong>, such as <code>tools: [&quot;read&quot;, &quot;grep&quot;]</code>, the agent runs on its session workspace as a tree, mounted at <code>/workspace</code>. Set <a href="#custom-filesystem"><code>workspace</code></a> to mount it elsewhere. Every file tool sees only the workspace and refuses a path outside it, including through a symlink. Running on a tree also turns off what only the host disk provides: Cursor hooks don&#39;t run, so a Slack follow-up waits for the turn to end instead of reaching the running turn; <code>.cursor/mcp.json</code> from the workspace or an enclosing checkout isn&#39;t loaded (connections in <code>bot/</code> still are); host git status doesn&#39;t reach the model; and skills are at <code>/agent/skills</code> instead of <code>.cursor/skills</code>. <code>AGENTS.md</code> and <code>.cursor/rules/</code> in the workspace still load. Tools a tree can&#39;t run, such as <code>readLints</code>, are left out with a warning.</li></ul><p>To keep an agent&#39;s reads inside a tree you choose, give it <a href="#custom-filesystem"><code>fs</code></a> instead.</p><p>A <a href="./tools.html#call-a-tool-without-a-model-turn">direct tool call</a> on a host-disk agent refuses a path outside the session workspace, after symlinks, with <code>Path is outside the workspace</code>, whether or not <code>local.sandbox</code> is on.</p><h3 id="local-cwd" tabindex="-1">Local cwd <a class="header-anchor" href="#local-cwd" aria-label="Permalink to &quot;Local cwd&quot;">​</a></h3><p><code>local.cwd</code> sets the parent directory for local session workspaces. Each session uses <code>&lt;cwd&gt;/&lt;sessionId&gt;</code> unless a per-send <code>workspaceDir</code> overrides it.</p><p>Session workspaces are real Cursor project directories, so the local agent reads <code>AGENTS.md</code> and <code>.cursor</code> config from every ancestor directory. When you omit <code>cwd</code> and the agent sits inside another git repo, such as a monorepo package, Agent SDK uses a per-project directory under <code>~/.cache</code> instead, so the enclosing checkout&#39;s rules, skills, and MCP servers stay out of the turn. An agent at its own git root keeps its workspaces inside the project. Point <code>cwd</code> at a checkout only when the agent should inherit that tree.</p><h2 id="custom-filesystem" tabindex="-1">Custom filesystem <a class="header-anchor" href="#custom-filesystem" aria-label="Permalink to &quot;Custom filesystem&quot;">​</a></h2><p>Set <code>fs</code> and the agent&#39;s file tools (Read, Write, StrReplace, LS, Grep, Glob, Delete) and its subagents work on your tree instead of the host disk. Build it with <code>tempFs</code>, <code>unionFs</code>, <code>overlayFs</code>, <code>readOnlyFs</code>, or your own <code>FileSystem</code>.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineAgent, readOnlyFs, tempFs, unionFs } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
11
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h2 id="agent-fields" tabindex="-1">Agent fields <a class="header-anchor" href="#agent-fields" aria-label="Permalink to &quot;Agent fields&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Field</th><th>Type</th><th>Meaning</th></tr></thead><tbody><tr><td><code>model</code></td><td>string or <code>{ id, params }</code></td><td>Cursor model for turns. Defaults to <code>grok-4.7</code> with <code>reasoning_effort=high</code> and <code>fast=true</code>. Subagents omit it to inherit.</td></tr><tr><td><code>name</code></td><td>string</td><td>Display name. Defaults to the package or directory name.</td></tr><tr><td><code>description</code></td><td>string</td><td>What the agent is for. Required on subagents, where the parent model reads it to decide when to delegate.</td></tr><tr><td><code>instructions</code></td><td>string</td><td>Inline instructions for subagents and generated configs. Prefer <code>instructions.md</code>.</td></tr><tr><td><code>local</code></td><td><code>{ cwd?, workspaceDir?, sandbox? }</code></td><td>Defaults for a local run. See <a href="#local-options">Local options</a>.</td></tr><tr><td><code>hosting</code></td><td><code>{ egressDomains?, secretNames?, oidc? }</code></td><td>The egress allowlist, expected secret names, and <a href="./../guides/workload-identity.html">OIDC token audiences</a> that <code>agent-sdk deploy</code> reads. Mounted <a href="./extensions.html#build-an-extension">extensions</a> add their own egress hosts and secrets.</td></tr><tr><td><code>concurrency</code></td><td><code>{ maxRunningTurns? }</code></td><td>Agent-wide limit on concurrent turns. See <a href="#concurrency">Concurrency</a>.</td></tr><tr><td><code>builtinTools</code></td><td><code>{ reminders? }</code></td><td>Opt-in tools that Agent SDK provides. See <a href="#built-in-tools">Built-in tools</a>.</td></tr><tr><td><code>tools</code></td><td><code>ToolName[]</code></td><td>Allowlist of built-in tools. Omit it for the full standard toolset. See <a href="#harness-tools">Harness tools</a>.</td></tr><tr><td><code>fs</code></td><td><code>FileSystem</code> or <code>(ctx) =&gt; FileSystem</code></td><td>Custom file tree for the session. <code>root</code> is the deprecated name. See <a href="#custom-filesystem">Custom filesystem</a>.</td></tr><tr><td><code>workspace</code></td><td>string</td><td>With <code>fs</code>, the folder inside the tree the agent works in, and where project rules load from. Defaults to <code>/</code>. For a sandboxed agent without shell, where its session workspace is mounted, <code>/workspace</code> by default.</td></tr><tr><td><code>skills</code></td><td><code>false</code> or <code>(ctx) =&gt; FileSystem</code></td><td>Replaces the skills tree mounted at <code>/agent/skills</code>, or turns that mount off.</td></tr></tbody></table><p>The <code>persistent</code> field was removed. Discovery rejects a config that still sets it, and the error is <code>persistent was removed. Delete it from defineAgent.</code>, so <code>validate</code>, <code>dev</code>, and <code>deploy</code> fail until you delete the field. A deployment that is already running keeps serving until you stop or delete it.</p><h2 id="model" tabindex="-1">Model <a class="header-anchor" href="#model" aria-label="Permalink to &quot;Model&quot;">​</a></h2><p>Set effort and speed with params, not in the id. Use the object form shown above to set params, or a plain string when you don&#39;t need any:</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">model</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;composer-2.5&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span></code></pre></div><h2 id="local-options" tabindex="-1">Local options <a class="header-anchor" href="#local-options" aria-label="Permalink to &quot;Local options&quot;">​</a></h2><p><code>local.workspaceDir</code> points every session at one shared working directory, for agents that work inside an existing checkout. It takes precedence over <code>cwd</code>, and a per-send <code>workspaceDir</code> wins over both. Sessions share that tree, so one turn&#39;s files are visible to the next.</p><p><code>local.sandbox</code> runs the agent inside Cursor&#39;s local sandbox. It&#39;s off by default, so shell commands auto-approve and inherit the serve process environment, including the host&#39;s credentials. Turn it on when turns read untrusted input, such as webhook payloads, PR diffs, or inbound chat. The sandbox limits the tools themselves, so an injected prompt can&#39;t talk the model past it.</p><p>With <code>local.sandbox</code> on, shell commands run without network access, writes and deletes outside the session workspace are refused, and a tool call that needs approval, such as an external MCP call, fails closed. What the agent can read depends on its <code>tools</code>:</p><ul><li><strong>With shell</strong> (or with <code>tools</code> omitted, which includes it), the agent runs on the host disk. Shell commands and the file tools (<code>read</code>, <code>grep</code>, <code>glob</code>, <code>ls</code>) can read any file the serve process can, including credentials on the host.</li><li><strong>With file tools and no shell</strong>, such as <code>tools: [&quot;read&quot;, &quot;grep&quot;]</code>, the agent runs on its session workspace as a tree, mounted at <code>/workspace</code>. Set <a href="#custom-filesystem"><code>workspace</code></a> to mount it elsewhere. Every file tool sees only the workspace and refuses a path outside it, including through a symlink. Running on a tree also turns off what only the host disk provides: Cursor hooks don&#39;t run, so a Slack follow-up waits for the turn to end instead of reaching the running turn; <code>.cursor/mcp.json</code> from the workspace or an enclosing checkout isn&#39;t loaded (connections in <code>bot/</code> still are); host git status doesn&#39;t reach the model; and skills are at <code>/agent/skills</code> instead of <code>.cursor/skills</code>. <code>AGENTS.md</code> and <code>.cursor/rules/</code> in the workspace still load. Tools a tree can&#39;t run, such as <code>readLints</code>, are left out with a warning.</li></ul><p>To keep an agent&#39;s reads inside a tree you choose, give it <a href="#custom-filesystem"><code>fs</code></a> instead.</p><p>A <a href="./tools.html#call-a-tool-without-a-model-turn">direct tool call</a> on a host-disk agent refuses a path outside the session workspace, after symlinks, with <code>Path is outside the workspace</code>, whether or not <code>local.sandbox</code> is on.</p><h3 id="local-cwd" tabindex="-1">Local cwd <a class="header-anchor" href="#local-cwd" aria-label="Permalink to &quot;Local cwd&quot;">​</a></h3><p><code>local.cwd</code> sets the parent directory for local session workspaces. Each session uses <code>&lt;cwd&gt;/&lt;sessionId&gt;</code> unless a per-send <code>workspaceDir</code> overrides it.</p><p>Session workspaces are real Cursor project directories, so the local agent reads <code>AGENTS.md</code> and <code>.cursor</code> config from every ancestor directory. When you omit <code>cwd</code> and the agent sits inside another git repo, such as a monorepo package, Agent SDK uses a per-project directory under <code>~/.cache</code> instead, so the enclosing checkout&#39;s rules, skills, and MCP servers stay out of the turn. An agent at its own git root keeps its workspaces inside the project. Point <code>cwd</code> at a checkout only when the agent should inherit that tree.</p><h2 id="custom-filesystem" tabindex="-1">Custom filesystem <a class="header-anchor" href="#custom-filesystem" aria-label="Permalink to &quot;Custom filesystem&quot;">​</a></h2><p>Set <code>fs</code> and the agent&#39;s file tools (Read, Write, StrReplace, LS, Grep, Glob, Delete) and its subagents work on your tree instead of the host disk. Build it with <code>tempFs</code>, <code>unionFs</code>, <code>overlayFs</code>, <code>readOnlyFs</code>, or your own <code>FileSystem</code>.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineAgent, readOnlyFs, tempFs, unionFs } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
12
12
  <span class="line"></span>
13
13
  <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineAgent</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
14
14
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> fs: </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">unionFs</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
@@ -1 +1 @@
1
- import{_ as e,c as t,o as a,a3 as i}from"./chunks/framework.BNw1pucY.js";const k=JSON.parse('{"title":"Agent config","description":"defineAgent at bot/agent.ts: the model, local workspace, and programmatic serving.","frontmatter":{"title":"Agent config","description":"defineAgent at bot/agent.ts: the model, local workspace, and programmatic serving."},"headers":[],"relativePath":"reference/agent-config.md","filePath":"reference/agent-config.md"}'),o={name:"reference/agent-config.md"};function n(l,s,d,r,h,c){return a(),t("div",null,[...s[0]||(s[0]=[i("",57)])])}const u=e(o,[["render",n]]);export{k as __pageData,u as default};
1
+ import{_ as e,c as t,o as a,a3 as i}from"./chunks/framework.BNw1pucY.js";const k=JSON.parse('{"title":"Agent config","description":"defineAgent at bot/agent.ts: the model, local workspace, and programmatic serving.","frontmatter":{"title":"Agent config","description":"defineAgent at bot/agent.ts: the model, local workspace, and programmatic serving."},"headers":[],"relativePath":"reference/agent-config.md","filePath":"reference/agent-config.md"}'),o={name:"reference/agent-config.md"};function n(d,s,l,r,h,c){return a(),t("div",null,[...s[0]||(s[0]=[i("",57)])])}const u=e(o,[["render",n]]);export{k as __pageData,u as default};
@@ -18,4 +18,4 @@ import{_ as t,c as s,o as a,a3 as n}from"./chunks/framework.BNw1pucY.js";const u
18
18
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
19
19
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }),</span></span>
20
20
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ],</span></span>
21
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>This route is <code>POST /v1/channels/&lt;id&gt;/review</code>. Calls for the same pull request pass the same <a href="./sessions.html#session-identifiers">continuation token</a>, so they share one conversation.</p><h2 id="route-responses" tabindex="-1">Route responses <a class="header-anchor" href="#route-responses" aria-label="Permalink to &quot;Route responses&quot;">​</a></h2><p>On Cursor hosting, the deployment answers every custom route with an empty <code>202 Accepted</code> as soon as the request arrives, then runs the handler. The caller never sees the handler&#39;s <code>Response</code>, so a route can&#39;t return a session ID, a result, or an error status. A request that fails the alias token, <code>sharedSecretAuth</code>, or <code>hmacSignatureAuth</code> check still gets <code>401</code>.</p><p>Deliver results through <a href="#events"><code>events</code></a> handlers, a callback to the sender, or a tool the turn calls. Local <code>serve</code> returns the handler&#39;s response, so return <code>new Response(null, { status: 202 })</code> to match hosting.</p><h2 id="route-verbs-and-schemas" tabindex="-1">Route verbs and schemas <a class="header-anchor" href="#route-verbs-and-schemas" aria-label="Permalink to &quot;Route verbs and schemas&quot;">​</a></h2><p>Route paths must begin with <code>/</code>.</p><p><code>GET</code> requires a <code>querySchema</code>.</p><p><code>POST</code>, <code>PUT</code>, and <code>PATCH</code> require a <code>bodySchema</code>. They also accept a <code>querySchema</code>.</p><p><code>DELETE</code> takes a <code>bodySchema</code>, a <code>querySchema</code>, either, or neither.</p><p>Plain JSON Schema objects don&#39;t type-check, so use <code>z.object({})</code> or <code>z.unknown()</code> for an open surface. The host validates input before the handler runs, and declared schemas appear in <code>GET /v1/info</code> for the playground and slash commands.</p><h2 id="handler-arguments" tabindex="-1">Handler arguments <a class="header-anchor" href="#handler-arguments" aria-label="Permalink to &quot;Handler arguments&quot;">​</a></h2><p>A handler receives the Fetch <code>Request</code> and these arguments:</p><table tabindex="0"><thead><tr><th>Member</th><th>Contract</th></tr></thead><tbody><tr><td><code>send(message, options?)</code></td><td>Start or resume a session on this channel</td></tr><tr><td><code>getSession(sessionId)</code></td><td>This channel&#39;s session, or <code>null</code></td></tr><tr><td><code>receive(channel, input)</code></td><td>Hand work to another channel</td></tr><tr><td><code>callTool(name, input, options?)</code></td><td><a href="./tools.html#call-a-tool-without-a-model-turn">Call a server tool</a> without a model turn</td></tr><tr><td><code>body</code>, <code>query</code>, <code>params</code></td><td>Validated inputs and <code>:param</code> path segments</td></tr><tr><td><code>auth</code></td><td>The <code>AuthContext</code> from the route&#39;s auth chain</td></tr><tr><td><code>requestIp</code></td><td>The TCP peer address, or <code>null</code></td></tr><tr><td><code>host</code></td><td>Host services such as MCP, storage, telemetry, and reminders</td></tr><tr><td><code>waitUntil(promise)</code></td><td>Keep work running after the handler returns</td></tr><tr><td><code>sessionUrls(request, sessionId)</code></td><td>Playground and trace URLs for a session</td></tr><tr><td><code>artifacts</code></td><td>List or tag <a href="./artifacts.html">artifacts</a></td></tr></tbody></table><h3 id="send-options" tabindex="-1"><code>send</code> options <a class="header-anchor" href="#send-options" aria-label="Permalink to &quot;\`send\` options&quot;">​</a></h3><table tabindex="0"><thead><tr><th>Option</th><th>Contract</th></tr></thead><tbody><tr><td><code>continuationToken</code></td><td>Channel-local key that resumes its session, or creates one when new</td></tr><tr><td><code>admission</code></td><td><code>&quot;preempt&quot;</code> (the default) interrupts a busy turn. <code>&quot;coalesce&quot;</code> queues behind it</td></tr><tr><td><code>workspaceFiles</code></td><td>Relative files to add before the next turn</td></tr><tr><td><code>workspaceDir</code></td><td>Absolute local working directory</td></tr><tr><td><code>auth</code></td><td>Session principal. Defaults to the request principal</td></tr><tr><td><code>state</code></td><td>Starting channel state for a new session</td></tr><tr><td><code>title</code>, <code>purpose</code>, <code>dryRun</code>, <code>asOf</code></td><td>Set up a new session, as in the <a href="./http-api.html#start-a-session"><code>POST /v1/session</code> body</a></td></tr><tr><td><code>deliveryId</code></td><td>Names this send on the session&#39;s <a href="./sessions.html#track-which-follow-up-reached-the-agent">events</a>, up to 256 characters. Defaults to a fresh <code>dlv_…</code> ID</td></tr></tbody></table><p><code>send</code> returns a <code>ChannelSession</code> with <code>id</code>, the current <code>continuationToken</code>, <code>isNew</code>, and <code>coalesced: true</code> for a coalesced call. On Cursor hosting, it returns the ID before the session exists.</p><h2 id="events" tabindex="-1">Events <a class="header-anchor" href="#events" aria-label="Permalink to &quot;Events&quot;">​</a></h2><p>The <code>events</code> map subscribes the channel to stream events for its sessions. Keys are types from the <a href="./sessions.html#stream-events">event vocabulary</a>, or <code>&quot;*&quot;</code>. Each handler receives <code>(event, channel, ctx)</code> with <code>channel.state</code>, session info, and host services, so it can post progress and replies. <code>state</code> on the channel definition is each new session&#39;s starting JSON, unless a route passes <code>state</code> to <code>send</code>, and handlers update it through <code>channel.state</code>.</p><h2 id="start-and-stop-a-channel" tabindex="-1">Start and stop a channel <a class="header-anchor" href="#start-and-stop-a-channel" aria-label="Permalink to &quot;Start and stop a channel&quot;">​</a></h2><p><code>onStart(args)</code> runs when the channel mounts, and <code>onStop()</code> runs when the host stops. Besides the route helpers, <code>onStart</code> receives <code>emitAssistantMessage(sessionId, text)</code>, which appends assistant text without a model turn, and <code>hasContinuationSession</code>, <code>isContinuationBusy</code>, and <code>interruptContinuation</code>, which check or stop the session behind a token.</p><h2 id="auth-policies" tabindex="-1">Auth policies <a class="header-anchor" href="#auth-policies" aria-label="Permalink to &quot;Auth policies&quot;">​</a></h2><p>Every route runs the channel&#39;s <code>auth</code> array, which defaults to <code>[localDevStrict()]</code>. The first policy to return an <code>AuthContext</code> admits the request, and if every policy returns <code>null</code>, the route answers <code>401</code>.</p><table tabindex="0"><thead><tr><th>Policy</th><th>Admits</th></tr></thead><tbody><tr><td><code>localDevStrict()</code></td><td>Direct loopback requests with a loopback hostname and no forwarding headers</td></tr><tr><td><code>localDev()</code></td><td>The same, with any hostname</td></tr><tr><td><code>loopbackOnly()</code></td><td>Any loopback peer, including relays that add forwarding headers</td></tr><tr><td><code>bearerAuth(tokenOrVerify)</code></td><td>A matching bearer token, or one the verifier accepts</td></tr><tr><td><code>sharedSecretAuth({ header, secret })</code></td><td>A header that matches the named secret</td></tr><tr><td><code>hmacSignatureAuth({ header, secret, prefix?, separator? })</code></td><td>A hex HMAC-SHA256 signature of the raw body under the named secret, or any of several signatures split by <code>separator</code>. The secret can hold up to 32 values, one per line, and any of them verifies</td></tr><tr><td><code>allowAll()</code></td><td>Every caller, as an anonymous principal</td></tr><tr><td><code>publicEndpoint()</code></td><td>Every caller, with no alias token on hosting. The handler must verify the provider&#39;s signature</td></tr></tbody></table><p>Use <code>allowAll()</code> only for a public surface or one protected upstream. <code>publicEndpoint()</code> applies only to custom channel routes and doesn&#39;t open the built-in session or tool API.</p><p>The admitted <code>AuthContext</code> becomes the request principal, which <a href="./sessions.html#session-contents">owns the sessions it creates</a>.</p><p>On a channel without its own <code>auth</code>, <code>--bearer-token</code> swaps the default for <code>bearerAuth(...)</code> and <code>--allow-anonymous</code> swaps it for <code>allowAll()</code>.</p><h2 id="prebuilt-channels" tabindex="-1">Prebuilt channels <a class="header-anchor" href="#prebuilt-channels" aria-label="Permalink to &quot;Prebuilt channels&quot;">​</a></h2><p>Import each one from <code>@grok/agent-sdk/channels/&lt;name&gt;</code>.</p><table tabindex="0"><thead><tr><th>Function</th><th>Details</th></tr></thead><tbody><tr><td><code>slackChannel()</code></td><td><a href="./../guides/slack.html">Slack</a></td></tr><tr><td><code>githubChannel()</code></td><td><a href="./../guides/github.html">GitHub</a></td></tr><tr><td><code>gitlabChannel()</code></td><td><a href="./../guides/gitlab.html">GitLab</a></td></tr><tr><td><code>bitbucketChannel()</code></td><td><a href="./../guides/bitbucket.html">Bitbucket</a></td></tr><tr><td><code>pagerdutyChannel()</code></td><td><a href="./../guides/pagerduty.html">PagerDuty</a></td></tr><tr><td><code>deploymentsChannel()</code></td><td>Deployment events filtered by source, environment, or event name</td></tr></tbody></table><p>Use <code>defineChannel</code> for other platforms, such as Discord.</p><h2 id="handler-results" tabindex="-1">Handler results <a class="header-anchor" href="#handler-results" aria-label="Permalink to &quot;Handler results&quot;">​</a></h2><p>Hooks on the GitHub, GitLab, Bitbucket, and PagerDuty channels, such as <code>onPullRequest</code> or <code>onIncident</code>, return one of three results:</p><table tabindex="0"><thead><tr><th>Return value</th><th>What happens</th></tr></thead><tbody><tr><td><code>{ auth }</code></td><td>Runs the model turn with that auth. It can also set the turn&#39;s <code>message</code>, <code>title</code>, or <code>context</code></td></tr><tr><td><code>{ task }</code></td><td>Runs your function on the host. That function can call <code>send</code> to start a model turn</td></tr><tr><td><code>null</code></td><td>Ignores the event</td></tr></tbody></table><h2 id="hosted-session-keys" tabindex="-1">Hosted session keys <a class="header-anchor" href="#hosted-session-keys" aria-label="Permalink to &quot;Hosted session keys&quot;">​</a></h2><p>On Cursor hosting, each request to a <code>defineChannel</code> route starts a new session unless it carries <code>X-BDK-Session-Key</code>. Requests with the same value on one channel share one session, in arrival order. The handler&#39;s <code>continuationToken</code> doesn&#39;t change that choice, and local <code>serve</code> ignores the header.</p><table tabindex="0"><thead><tr><th>Rule</th><th>Contract</th></tr></thead><tbody><tr><td>Auth</td><td>The alias token or <code>sharedSecretAuth()</code>. Routes admitted by <code>hmacSignatureAuth()</code> or <code>publicEndpoint()</code> answer <code>400</code></td></tr><tr><td>Value</td><td>1 to 256 printable ASCII characters with no space or comma, or the request gets <code>400</code>. Hosting stores the value, so keep secrets and personal data out of it</td></tr><tr><td>Scope</td><td>One channel on one deployment. Prebuilt channels ignore the header</td></tr><tr><td>Retries</td><td>Hosting doesn&#39;t deduplicate. A retry runs a second turn</td></tr></tbody></table><h2 id="related" tabindex="-1">Related <a class="header-anchor" href="#related" aria-label="Permalink to &quot;Related&quot;">​</a></h2><ul><li><a href="./../guides/webhooks.html">Webhooks</a></li><li><a href="./sessions.html">Sessions</a></li></ul>`,43)])])}const k=t(i,[["render",o]]);export{u as __pageData,k as default};
21
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>This route is <code>POST /v1/channels/&lt;id&gt;/review</code>. Calls for the same pull request pass the same <a href="./sessions.html#session-identifiers">continuation token</a>, so they share one conversation.</p><h2 id="route-responses" tabindex="-1">Route responses <a class="header-anchor" href="#route-responses" aria-label="Permalink to &quot;Route responses&quot;">​</a></h2><p>On Cursor hosting, the deployment answers every custom route with an empty <code>202 Accepted</code> as soon as the request arrives, then runs the handler. The caller never sees the handler&#39;s <code>Response</code>, so a route can&#39;t return a session ID, a result, or an error status. A request that fails the alias token, <code>sharedSecretAuth</code>, or <code>hmacSignatureAuth</code> check still gets <code>401</code>.</p><p>Deliver results through <a href="#events"><code>events</code></a> handlers, a callback to the sender, or a tool the turn calls. Local <code>serve</code> returns the handler&#39;s response, so return <code>new Response(null, { status: 202 })</code> to match hosting.</p><h2 id="route-verbs-and-schemas" tabindex="-1">Route verbs and schemas <a class="header-anchor" href="#route-verbs-and-schemas" aria-label="Permalink to &quot;Route verbs and schemas&quot;">​</a></h2><p>Route paths must begin with <code>/</code>.</p><p><code>GET</code> requires a <code>querySchema</code>.</p><p><code>POST</code>, <code>PUT</code>, and <code>PATCH</code> require a <code>bodySchema</code>. They also accept a <code>querySchema</code>.</p><p><code>DELETE</code> takes a <code>bodySchema</code>, a <code>querySchema</code>, either, or neither.</p><p>Plain JSON Schema objects don&#39;t type-check, so use <code>z.object({})</code> or <code>z.unknown()</code> for an open surface. The host validates input before the handler runs, and declared schemas appear in <code>GET /v1/info</code> for the playground and slash commands.</p><h2 id="handler-arguments" tabindex="-1">Handler arguments <a class="header-anchor" href="#handler-arguments" aria-label="Permalink to &quot;Handler arguments&quot;">​</a></h2><p>A handler receives the Fetch <code>Request</code> and these arguments:</p><table tabindex="0"><thead><tr><th>Member</th><th>Contract</th></tr></thead><tbody><tr><td><code>send(message, options?)</code></td><td>Start or resume a session on this channel</td></tr><tr><td><code>getSession(sessionId)</code></td><td>This channel&#39;s session, or <code>null</code></td></tr><tr><td><code>receive(channel, input)</code></td><td>Hand work to another channel</td></tr><tr><td><code>callTool(name, input, options?)</code></td><td><a href="./tools.html#call-a-tool-without-a-model-turn">Call a server tool</a> without a model turn</td></tr><tr><td><code>body</code>, <code>query</code>, <code>params</code></td><td>Validated inputs and <code>:param</code> path segments</td></tr><tr><td><code>auth</code></td><td>The <code>AuthContext</code> from the route&#39;s auth chain</td></tr><tr><td><code>requestIp</code></td><td>The TCP peer address, or <code>null</code></td></tr><tr><td><code>host</code></td><td>Host services such as MCP, storage, telemetry, and reminders</td></tr><tr><td><code>waitUntil(promise)</code></td><td>Keep work running after the handler returns</td></tr><tr><td><code>sessionUrls(request, sessionId)</code></td><td>Playground and trace URLs for a session</td></tr><tr><td><code>artifacts</code></td><td>List or tag <a href="./artifacts.html">artifacts</a></td></tr></tbody></table><h3 id="send-options" tabindex="-1"><code>send</code> options <a class="header-anchor" href="#send-options" aria-label="Permalink to &quot;\`send\` options&quot;">​</a></h3><table tabindex="0"><thead><tr><th>Option</th><th>Contract</th></tr></thead><tbody><tr><td><code>continuationToken</code></td><td>Channel-local key that resumes its session, or creates one when new</td></tr><tr><td><code>admission</code></td><td><code>&quot;preempt&quot;</code> (the default) interrupts a busy turn. <code>&quot;coalesce&quot;</code> queues behind it</td></tr><tr><td><code>workspaceFiles</code></td><td>Relative files to add before the next turn</td></tr><tr><td><code>workspaceDir</code></td><td>Absolute local working directory</td></tr><tr><td><code>auth</code></td><td>Session principal. Defaults to the request principal</td></tr><tr><td><code>state</code></td><td>Starting channel state for a new session</td></tr><tr><td><code>title</code>, <code>purpose</code>, <code>dryRun</code>, <code>asOf</code></td><td>Set up a new session, as in the <a href="./http-api.html#start-a-session"><code>POST /v1/session</code> body</a></td></tr><tr><td><code>deliveryId</code></td><td>Names this send on the session&#39;s <a href="./sessions.html#track-which-follow-up-reached-the-agent">events</a>, up to 256 characters. Defaults to a fresh <code>dlv_…</code> ID</td></tr></tbody></table><p><code>send</code> returns a <code>ChannelSession</code> with <code>id</code>, the current <code>continuationToken</code>, <code>isNew</code>, and <code>coalesced: true</code> for a coalesced call. On Cursor hosting, it returns the ID before the session exists.</p><h2 id="events" tabindex="-1">Events <a class="header-anchor" href="#events" aria-label="Permalink to &quot;Events&quot;">​</a></h2><p>The <code>events</code> map subscribes the channel to stream events for its sessions. Keys are types from the <a href="./sessions.html#stream-events">event vocabulary</a>, or <code>&quot;*&quot;</code>. Each handler receives <code>(event, channel, ctx)</code> with <code>channel.state</code>, session info, and host services, so it can post progress and replies. <code>state</code> on the channel definition is each new session&#39;s starting JSON, unless a route passes <code>state</code> to <code>send</code>, and handlers update it through <code>channel.state</code>.</p><h2 id="start-and-stop-a-channel" tabindex="-1">Start and stop a channel <a class="header-anchor" href="#start-and-stop-a-channel" aria-label="Permalink to &quot;Start and stop a channel&quot;">​</a></h2><p><code>onStart(args)</code> runs when the channel mounts, and <code>onStop()</code> runs when the host stops. Besides the route helpers, <code>onStart</code> receives <code>emitAssistantMessage(sessionId, text)</code>, which appends assistant text without a model turn, and <code>hasContinuationSession</code>, <code>isContinuationBusy</code>, and <code>interruptContinuation</code>, which check or stop the session behind a token.</p><h2 id="auth-policies" tabindex="-1">Auth policies <a class="header-anchor" href="#auth-policies" aria-label="Permalink to &quot;Auth policies&quot;">​</a></h2><p>Every route runs the channel&#39;s <code>auth</code> array, which defaults to <code>[localDevStrict()]</code>. The first policy to return an <code>AuthContext</code> admits the request, and if every policy returns <code>null</code>, the route answers <code>401</code>.</p><table tabindex="0"><thead><tr><th>Policy</th><th>Admits</th></tr></thead><tbody><tr><td><code>localDevStrict()</code></td><td>Direct loopback requests with a loopback hostname and no forwarding headers</td></tr><tr><td><code>localDev()</code></td><td>The same, with any hostname</td></tr><tr><td><code>loopbackOnly()</code></td><td>Any loopback peer, including relays that add forwarding headers</td></tr><tr><td><code>bearerAuth(tokenOrVerify)</code></td><td>A matching bearer token, or one the verifier accepts</td></tr><tr><td><code>sharedSecretAuth({ header, secret })</code></td><td>A header that matches the named secret</td></tr><tr><td><code>hmacSignatureAuth({ header, secret, prefix?, separator? })</code></td><td>A hex HMAC-SHA256 signature of the raw body under the named secret, or any of several signatures split by <code>separator</code>. The secret can hold up to 32 values, one per line, and any of them verifies</td></tr><tr><td><code>allowAll()</code></td><td>Every caller, as an anonymous principal</td></tr><tr><td><code>publicEndpoint()</code></td><td>Every caller, with no alias token on hosting. The handler must verify the provider&#39;s signature</td></tr></tbody></table><p>Use <code>allowAll()</code> only for a public surface or one protected upstream. <code>publicEndpoint()</code> applies only to custom channel routes and doesn&#39;t open the built-in session or tool API.</p><p>The admitted <code>AuthContext</code> becomes the request principal, which <a href="./sessions.html#session-contents">owns the sessions it creates</a>.</p><p>On a channel without its own <code>auth</code>, <code>--bearer-token</code> swaps the default for <code>bearerAuth(...)</code> and <code>--allow-anonymous</code> swaps it for <code>allowAll()</code>.</p><h2 id="prebuilt-channels" tabindex="-1">Prebuilt channels <a class="header-anchor" href="#prebuilt-channels" aria-label="Permalink to &quot;Prebuilt channels&quot;">​</a></h2><p>Import each one from <code>@grok/agent-sdk/channels/&lt;name&gt;</code>.</p><table tabindex="0"><thead><tr><th>Function</th><th>Details</th></tr></thead><tbody><tr><td><code>slackChannel()</code></td><td><a href="./../guides/slack.html">Slack</a></td></tr><tr><td><code>teamsChannel()</code></td><td><a href="./../guides/teams.html">Microsoft Teams</a></td></tr><tr><td><code>githubChannel()</code></td><td><a href="./../guides/github.html">GitHub</a></td></tr><tr><td><code>gitlabChannel()</code></td><td><a href="./../guides/gitlab.html">GitLab</a></td></tr><tr><td><code>bitbucketChannel()</code></td><td><a href="./../guides/bitbucket.html">Bitbucket</a></td></tr><tr><td><code>pagerdutyChannel()</code></td><td><a href="./../guides/pagerduty.html">PagerDuty</a></td></tr><tr><td><code>deploymentsChannel()</code></td><td>Deployment events filtered by source, environment, or event name</td></tr></tbody></table><p>Use <code>defineChannel</code> for other platforms, such as Discord.</p><h2 id="handler-results" tabindex="-1">Handler results <a class="header-anchor" href="#handler-results" aria-label="Permalink to &quot;Handler results&quot;">​</a></h2><p>Hooks on the GitHub, GitLab, Bitbucket, and PagerDuty channels, such as <code>onPullRequest</code> or <code>onIncident</code>, return one of three results:</p><table tabindex="0"><thead><tr><th>Return value</th><th>What happens</th></tr></thead><tbody><tr><td><code>{ auth }</code></td><td>Runs the model turn with that auth. It can also set the turn&#39;s <code>message</code>, <code>title</code>, or <code>context</code></td></tr><tr><td><code>{ task }</code></td><td>Runs your function on the host. That function can call <code>send</code> to start a model turn</td></tr><tr><td><code>null</code></td><td>Ignores the event</td></tr></tbody></table><h2 id="hosted-session-keys" tabindex="-1">Hosted session keys <a class="header-anchor" href="#hosted-session-keys" aria-label="Permalink to &quot;Hosted session keys&quot;">​</a></h2><p>On Cursor hosting, each request to a <code>defineChannel</code> route starts a new session unless it carries <code>X-BDK-Session-Key</code>. Requests with the same value on one channel share one session, in arrival order. The handler&#39;s <code>continuationToken</code> doesn&#39;t change that choice, and local <code>serve</code> ignores the header.</p><table tabindex="0"><thead><tr><th>Rule</th><th>Contract</th></tr></thead><tbody><tr><td>Auth</td><td>The alias token or <code>sharedSecretAuth()</code>. Routes admitted by <code>hmacSignatureAuth()</code> or <code>publicEndpoint()</code> answer <code>400</code></td></tr><tr><td>Value</td><td>1 to 256 printable ASCII characters with no space or comma, or the request gets <code>400</code>. Hosting stores the value, so keep secrets and personal data out of it</td></tr><tr><td>Scope</td><td>One channel on one deployment. Prebuilt channels ignore the header</td></tr><tr><td>Retries</td><td>Hosting doesn&#39;t deduplicate. A retry runs a second turn</td></tr></tbody></table><h2 id="related" tabindex="-1">Related <a class="header-anchor" href="#related" aria-label="Permalink to &quot;Related&quot;">​</a></h2><ul><li><a href="./../guides/webhooks.html">Webhooks</a></li><li><a href="./sessions.html">Sessions</a></li></ul>`,43)])])}const k=t(i,[["render",o]]);export{u as __pageData,k as default};