@cursor/july 0.1.92 → 0.1.94

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 (448) hide show
  1. package/AGENTS.md +8 -20
  2. package/README.md +115 -182
  3. package/dist/channels/deployments/deployments-channel.d.ts +7 -0
  4. package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
  5. package/dist/channels/deployments/deployments-channel.js +26 -2
  6. package/dist/channels/deployments/types.d.ts +8 -0
  7. package/dist/channels/deployments/types.d.ts.map +1 -1
  8. package/dist/channels/github/github-channel.d.ts +3 -0
  9. package/dist/channels/github/github-channel.d.ts.map +1 -1
  10. package/dist/channels/github/github-channel.js +28 -56
  11. package/dist/channels/slack/attachments.js +2 -2
  12. package/dist/channels/slack/dispatch.d.ts +0 -7
  13. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  14. package/dist/channels/slack/dispatch.js +4 -7
  15. package/dist/channels/slack/eval-directive.d.ts +5 -12
  16. package/dist/channels/slack/eval-directive.d.ts.map +1 -1
  17. package/dist/channels/slack/eval-directive.js +8 -19
  18. package/dist/channels/slack/index.d.ts +0 -6
  19. package/dist/channels/slack/index.d.ts.map +1 -1
  20. package/dist/channels/slack/index.js +0 -6
  21. package/dist/channels/slack/setup.d.ts +4 -4
  22. package/dist/channels/slack/setup.d.ts.map +1 -1
  23. package/dist/channels/slack/setup.js +8 -15
  24. package/dist/channels/slack/slack-channel.d.ts +6 -13
  25. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  26. package/dist/channels/slack/slack-channel.js +15 -101
  27. package/dist/channels/slack/types.d.ts +12 -79
  28. package/dist/channels/slack/types.d.ts.map +1 -1
  29. package/dist/channels/slack/types.js +1 -15
  30. package/dist/client.d.ts +14 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +12 -0
  33. package/dist/connections.d.ts +18 -9
  34. package/dist/connections.d.ts.map +1 -1
  35. package/dist/connections.js +17 -8
  36. package/dist/continuation.d.ts +1 -1
  37. package/dist/continuation.js +1 -1
  38. package/dist/docs/404.html +2 -2
  39. package/dist/docs/ab.html +8 -8
  40. package/dist/docs/ab.md +7 -13
  41. package/dist/docs/assets/{ab.md.CVzWxLoB.js → ab.md.DJo5r4R-.js} +4 -4
  42. package/dist/docs/assets/{ab.md.CVzWxLoB.lean.js → ab.md.DJo5r4R-.lean.js} +1 -1
  43. package/dist/docs/assets/{app.Bci6CM9E.js → app.CFDEas4I.js} +1 -1
  44. package/dist/docs/assets/building-with-agents.md.DI4mEzlt.js +13 -0
  45. package/dist/docs/assets/{building-with-agents.md.DH8A_cHA.lean.js → building-with-agents.md.DI4mEzlt.lean.js} +1 -1
  46. package/dist/docs/assets/chunks/@localSearchIndexroot.DU3U2Ij2.js +1 -0
  47. package/dist/docs/assets/chunks/{VPLocalSearchBox.BCPT6xA-.js → VPLocalSearchBox.B1IIYpYS.js} +1 -1
  48. package/dist/docs/assets/chunks/{theme.BEA8BF3c.js → theme.Ct4NSiLm.js} +2 -2
  49. package/dist/docs/assets/concepts.md.lwAgBIMI.js +1 -0
  50. package/dist/docs/assets/{concepts.md.CRfU3bVg.lean.js → concepts.md.lwAgBIMI.lean.js} +1 -1
  51. package/dist/docs/assets/{deployment.md.DX_hc3ze.js → deployment.md.D9msOFOW.js} +9 -14
  52. package/dist/docs/assets/{deployment.md.DX_hc3ze.lean.js → deployment.md.D9msOFOW.lean.js} +1 -1
  53. package/dist/docs/assets/{evals.md.a0SMN6r9.js → evals.md.lfJoEVc8.js} +6 -6
  54. package/dist/docs/assets/{evals.md.a0SMN6r9.lean.js → evals.md.lfJoEVc8.lean.js} +1 -1
  55. package/dist/docs/assets/{guides_agent-to-agent.md.BCeVdJRJ.js → guides_agent-to-agent.md.BDb0t1QV.js} +2 -2
  56. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.js +9 -0
  57. package/dist/docs/assets/guides_cloud-runtime.md.CkYbjnAX.lean.js +1 -0
  58. package/dist/docs/assets/{guides_convert-automation.md.D06eIzea.js → guides_convert-automation.md.B4sjlodG.js} +2 -2
  59. package/dist/docs/assets/{guides_github.md.Cdt1s2QC.js → guides_github.md.Cnh2mL4a.js} +5 -5
  60. package/dist/docs/assets/{guides_github.md.Cdt1s2QC.lean.js → guides_github.md.Cnh2mL4a.lean.js} +1 -1
  61. package/dist/docs/assets/{guides_mcp-oauth.md.Du0f7pGU.js → guides_mcp-oauth.md.DPYmBCbV.js} +7 -9
  62. package/dist/docs/assets/{guides_mcp-oauth.md.Du0f7pGU.lean.js → guides_mcp-oauth.md.DPYmBCbV.lean.js} +1 -1
  63. package/dist/docs/assets/{guides_slack.md.DiUmk_Oi.js → guides_slack.md.C32HsdKk.js} +7 -13
  64. package/dist/docs/assets/guides_slack.md.C32HsdKk.lean.js +1 -0
  65. package/dist/docs/assets/{guides_webhooks.md.BpnIdO0i.js → guides_webhooks.md.DKdA43Qm.js} +2 -2
  66. package/dist/docs/assets/{hillclimbing.md.ywF3yDAd.js → hillclimbing.md.DhESf3OO.js} +1 -1
  67. package/dist/docs/assets/index.md.DRakGHFe.js +5 -0
  68. package/dist/docs/assets/{index.md.BAaMXLFd.lean.js → index.md.DRakGHFe.lean.js} +1 -1
  69. package/dist/docs/assets/{quickstart.md.DsrarzEg.js → quickstart.md.Nj_LjW_a.js} +2 -2
  70. package/dist/docs/assets/{reference_agent-config.md.Bqylgw50.js → reference_agent-config.md.Cp_x38Nl.js} +3 -3
  71. package/dist/docs/assets/{reference_channels.md.DQZjCnyh.js → reference_channels.md.Cd2f2iyV.js} +2 -2
  72. package/dist/docs/assets/{reference_channels.md.DQZjCnyh.lean.js → reference_channels.md.Cd2f2iyV.lean.js} +1 -1
  73. package/dist/docs/assets/{reference_cli.md.B7GkAJRC.js → reference_cli.md.Cw6_ICYG.js} +10 -11
  74. package/dist/docs/assets/{reference_cli.md.B7GkAJRC.lean.js → reference_cli.md.Cw6_ICYG.lean.js} +1 -1
  75. package/dist/docs/assets/{reference_connections.md.DYidrb-j.js → reference_connections.md.BH8Oc0D0.js} +7 -7
  76. package/dist/docs/assets/{reference_connections.md.DYidrb-j.lean.js → reference_connections.md.BH8Oc0D0.lean.js} +1 -1
  77. package/dist/docs/assets/reference_hooks.md.a8BJxMR5.js +14 -0
  78. package/dist/docs/assets/{reference_hooks.md.B9FSgdDe.lean.js → reference_hooks.md.a8BJxMR5.lean.js} +1 -1
  79. package/dist/docs/assets/reference_http-api.md.D89k1mdm.js +11 -0
  80. package/dist/docs/assets/reference_http-api.md.D89k1mdm.lean.js +1 -0
  81. package/dist/docs/assets/{reference_instructions.md.DhNCOl7r.js → reference_instructions.md.CR7XSsGk.js} +3 -3
  82. package/dist/docs/assets/{reference_instructions.md.DhNCOl7r.lean.js → reference_instructions.md.CR7XSsGk.lean.js} +1 -1
  83. package/dist/docs/assets/reference_playground.md.DnX5nL-B.js +1 -0
  84. package/dist/docs/assets/reference_playground.md.DnX5nL-B.lean.js +1 -0
  85. package/dist/docs/assets/reference_project-layout.md.Bv4KOtlB.js +19 -0
  86. package/dist/docs/assets/{reference_prompt.md.DZUMtLPD.js → reference_prompt.md.DnaD5dNK.js} +1 -1
  87. package/dist/docs/assets/{reference_schedules.md.DNipebiG.js → reference_schedules.md.DI_JrHgq.js} +1 -1
  88. package/dist/docs/assets/reference_sessions.md.D0mIh4KK.js +1 -0
  89. package/dist/docs/assets/{reference_sessions.md.tUFzz98S.lean.js → reference_sessions.md.D0mIh4KK.lean.js} +1 -1
  90. package/dist/docs/assets/{reference_skills.md.B5ZEuHfG.js → reference_skills.md.8son6Hjm.js} +4 -4
  91. package/dist/docs/assets/{reference_subagents.md.Xoav0AII.js → reference_subagents.md.CfsIloPm.js} +1 -1
  92. package/dist/docs/assets/{reference_tools.md.wpaJtHn6.js → reference_tools.md.BHeXn2id.js} +3 -3
  93. package/dist/docs/assets/{reference_tools.md.wpaJtHn6.lean.js → reference_tools.md.BHeXn2id.lean.js} +1 -1
  94. package/dist/docs/assets/scaffolding-agents.md.D7UUkWw0.js +1 -0
  95. package/dist/docs/assets/{scaffolding-agents.md.CRDDUtYJ.lean.js → scaffolding-agents.md.D7UUkWw0.lean.js} +1 -1
  96. package/dist/docs/assets/{storage.md.JbjlHWZ6.js → storage.md.BOHeqk2M.js} +5 -5
  97. package/dist/docs/assets/{storage.md.JbjlHWZ6.lean.js → storage.md.BOHeqk2M.lean.js} +1 -1
  98. package/dist/docs/assets/{templates_agentic-owners.md.DSJSIpWU.js → templates_agentic-owners.md.DqtPdm6f.js} +2 -2
  99. package/dist/docs/assets/{templates_pr-autofixer.md.1HAR3RXE.js → templates_pr-autofixer.md.DU7dQpor.js} +2 -2
  100. package/dist/docs/assets/{templates_pr-autofixer.md.1HAR3RXE.lean.js → templates_pr-autofixer.md.DU7dQpor.lean.js} +1 -1
  101. package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.js → templates_security-reviewer.md.CTa7u_l1.js} +2 -2
  102. package/dist/docs/assets/{templates_security-reviewer.md.ByFyRta2.lean.js → templates_security-reviewer.md.CTa7u_l1.lean.js} +1 -1
  103. package/dist/docs/assets/troubleshooting.md.Ctv3T8C2.js +1 -0
  104. package/dist/docs/assets/{troubleshooting.md.DYECCZiJ.lean.js → troubleshooting.md.Ctv3T8C2.lean.js} +1 -1
  105. package/dist/docs/building-with-agents.html +7 -7
  106. package/dist/docs/building-with-agents.md +5 -11
  107. package/dist/docs/concepts.html +5 -8
  108. package/dist/docs/concepts.md +13 -17
  109. package/dist/docs/deployment.html +13 -18
  110. package/dist/docs/deployment.md +9 -30
  111. package/dist/docs/design/agsh.md +406 -0
  112. package/dist/docs/evals.html +10 -10
  113. package/dist/docs/evals.md +16 -37
  114. package/dist/docs/guides/agent-to-agent.html +6 -6
  115. package/dist/docs/guides/agent-to-agent.md +3 -3
  116. package/dist/docs/guides/cloud-runtime.html +6 -6
  117. package/dist/docs/guides/cloud-runtime.md +9 -25
  118. package/dist/docs/guides/convert-automation.html +7 -7
  119. package/dist/docs/guides/convert-automation.md +4 -4
  120. package/dist/docs/guides/github.html +9 -9
  121. package/dist/docs/guides/github.md +16 -28
  122. package/dist/docs/guides/human-in-the-loop.html +4 -4
  123. package/dist/docs/guides/mcp-oauth.html +11 -13
  124. package/dist/docs/guides/mcp-oauth.md +14 -22
  125. package/dist/docs/guides/opentelemetry.html +5 -5
  126. package/dist/docs/guides/slack.html +11 -17
  127. package/dist/docs/guides/slack.md +13 -50
  128. package/dist/docs/guides/webhooks.html +6 -6
  129. package/dist/docs/guides/webhooks.md +3 -3
  130. package/dist/docs/hashmap.json +1 -1
  131. package/dist/docs/hillclimbing.html +6 -6
  132. package/dist/docs/hillclimbing.md +1 -1
  133. package/dist/docs/index.html +6 -6
  134. package/dist/docs/index.md +0 -36
  135. package/dist/docs/llms-full.txt +965 -3633
  136. package/dist/docs/llms.txt +3 -18
  137. package/dist/docs/quickstart.html +6 -6
  138. package/dist/docs/quickstart.md +3 -4
  139. package/dist/docs/reference/agent-config.html +8 -8
  140. package/dist/docs/reference/agent-config.md +10 -15
  141. package/dist/docs/reference/artifacts.html +4 -4
  142. package/dist/docs/reference/channels.html +6 -6
  143. package/dist/docs/reference/channels.md +20 -31
  144. package/dist/docs/reference/cli.html +14 -15
  145. package/dist/docs/reference/cli.md +29 -38
  146. package/dist/docs/reference/connections.html +11 -11
  147. package/dist/docs/reference/connections.md +24 -25
  148. package/dist/docs/reference/hooks.html +6 -6
  149. package/dist/docs/reference/hooks.md +12 -17
  150. package/dist/docs/reference/http-api.html +7 -7
  151. package/dist/docs/reference/http-api.md +25 -37
  152. package/dist/docs/reference/instructions.html +6 -6
  153. package/dist/docs/reference/instructions.md +1 -1
  154. package/dist/docs/reference/playground.html +5 -5
  155. package/dist/docs/reference/playground.md +14 -19
  156. package/dist/docs/reference/project-layout.html +9 -7
  157. package/dist/docs/reference/project-layout.md +7 -3
  158. package/dist/docs/reference/prompt.html +6 -6
  159. package/dist/docs/reference/prompt.md +1 -1
  160. package/dist/docs/reference/schedules.html +6 -6
  161. package/dist/docs/reference/schedules.md +1 -2
  162. package/dist/docs/reference/sessions.html +5 -12
  163. package/dist/docs/reference/sessions.md +8 -19
  164. package/dist/docs/reference/skills.html +8 -8
  165. package/dist/docs/reference/skills.md +3 -3
  166. package/dist/docs/reference/subagents.html +6 -6
  167. package/dist/docs/reference/subagents.md +2 -2
  168. package/dist/docs/reference/tools.html +8 -8
  169. package/dist/docs/reference/tools.md +30 -19
  170. package/dist/docs/scaffolding-agents.html +5 -5
  171. package/dist/docs/scaffolding-agents.md +4 -5
  172. package/dist/docs/storage.html +9 -9
  173. package/dist/docs/storage.md +37 -80
  174. package/dist/docs/templates/agentic-owners.html +7 -7
  175. package/dist/docs/templates/agentic-owners.md +2 -2
  176. package/dist/docs/templates/demo.html +4 -4
  177. package/dist/docs/templates/pr-autofixer.html +6 -6
  178. package/dist/docs/templates/pr-autofixer.md +7 -9
  179. package/dist/docs/templates/security-reviewer.html +5 -5
  180. package/dist/docs/templates/security-reviewer.md +2 -3
  181. package/dist/docs/templates/triage.html +4 -4
  182. package/dist/docs/troubleshooting.html +5 -5
  183. package/dist/docs/troubleshooting.md +8 -8
  184. package/dist/index.d.ts +1 -1
  185. package/dist/index.d.ts.map +1 -1
  186. package/dist/index.js +1 -1
  187. package/dist/internal/advertise-tools.d.ts +11 -0
  188. package/dist/internal/advertise-tools.d.ts.map +1 -1
  189. package/dist/internal/advertise-tools.js +47 -9
  190. package/dist/internal/authored-alias-hooks.d.ts +14 -11
  191. package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
  192. package/dist/internal/authored-alias-hooks.js +14 -11
  193. package/dist/internal/authored-loaders.d.ts +7 -6
  194. package/dist/internal/authored-loaders.d.ts.map +1 -1
  195. package/dist/internal/authored-loaders.js +14 -10
  196. package/dist/internal/cli-deploy.d.ts +1 -1
  197. package/dist/internal/cli-deploy.js +5 -5
  198. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  199. package/dist/internal/cli-mcp-oauth.js +7 -4
  200. package/dist/internal/continuation-channel.d.ts +6 -3
  201. package/dist/internal/continuation-channel.d.ts.map +1 -1
  202. package/dist/internal/continuation-channel.js +44 -40
  203. package/dist/internal/continuation-identity.d.ts +17 -16
  204. package/dist/internal/continuation-identity.d.ts.map +1 -1
  205. package/dist/internal/continuation-identity.js +109 -36
  206. package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
  207. package/dist/internal/convert-automation/convert-workflow.js +26 -15
  208. package/dist/internal/convert-automation/slug.d.ts +0 -2
  209. package/dist/internal/convert-automation/slug.d.ts.map +1 -1
  210. package/dist/internal/convert-automation/slug.js +0 -8
  211. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  212. package/dist/internal/cursor/account-mcp.js +5 -1
  213. package/dist/internal/deploy-manifest.d.ts +2 -2
  214. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  215. package/dist/internal/deploy-manifest.js +4 -9
  216. package/dist/internal/discovery.d.ts.map +1 -1
  217. package/dist/internal/discovery.js +91 -13
  218. package/dist/internal/distribution.d.ts +4 -3
  219. package/dist/internal/distribution.d.ts.map +1 -1
  220. package/dist/internal/distribution.js +4 -3
  221. package/dist/internal/hosted-delivery-protocol.d.ts +38 -0
  222. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -0
  223. package/dist/internal/hosted-delivery-protocol.js +70 -0
  224. package/dist/internal/hosted-delivery.d.ts +35 -0
  225. package/dist/internal/hosted-delivery.d.ts.map +1 -0
  226. package/dist/internal/hosted-delivery.js +239 -0
  227. package/dist/internal/http-channel.d.ts.map +1 -1
  228. package/dist/internal/http-channel.js +1 -1
  229. package/dist/internal/mcp-endpoint.js +3 -3
  230. package/dist/internal/mcp-host.d.ts +8 -7
  231. package/dist/internal/mcp-host.d.ts.map +1 -1
  232. package/dist/internal/mcp-host.js +8 -7
  233. package/dist/internal/peer-connections.d.ts.map +1 -1
  234. package/dist/internal/peer-connections.js +5 -1
  235. package/dist/internal/playground/static.d.ts +0 -3
  236. package/dist/internal/playground/static.d.ts.map +1 -1
  237. package/dist/internal/resolved-connections.d.ts.map +1 -1
  238. package/dist/internal/resolved-connections.js +5 -7
  239. package/dist/internal/review-comments.d.ts +186 -63
  240. package/dist/internal/review-comments.d.ts.map +1 -1
  241. package/dist/internal/review-comments.js +350 -168
  242. package/dist/internal/server.d.ts.map +1 -1
  243. package/dist/internal/server.js +134 -175
  244. package/dist/internal/session-engine.d.ts +50 -10
  245. package/dist/internal/session-engine.d.ts.map +1 -1
  246. package/dist/internal/session-engine.js +221 -68
  247. package/dist/internal/shallow-clone.d.ts +8 -2
  248. package/dist/internal/shallow-clone.d.ts.map +1 -1
  249. package/dist/internal/shallow-clone.js +17 -10
  250. package/dist/internal/tool-catalog.d.ts +31 -0
  251. package/dist/internal/tool-catalog.d.ts.map +1 -0
  252. package/dist/internal/tool-catalog.js +67 -0
  253. package/dist/playground/assets/{index-DDvyC2z6.js → index-B3JCyigB.js} +2 -2
  254. package/dist/playground/index.html +1 -1
  255. package/dist/types.d.ts +81 -40
  256. package/dist/types.d.ts.map +1 -1
  257. package/dist/types.js +19 -0
  258. package/docs/README.md +0 -36
  259. package/docs/ab.md +7 -13
  260. package/docs/building-with-agents.md +5 -11
  261. package/docs/concepts.md +13 -17
  262. package/docs/deployment.md +9 -30
  263. package/docs/design/agsh.md +406 -0
  264. package/docs/evals.md +16 -37
  265. package/docs/guides/agent-to-agent.md +3 -3
  266. package/docs/guides/cloud-runtime.md +9 -25
  267. package/docs/guides/convert-automation.md +4 -4
  268. package/docs/guides/github.md +16 -28
  269. package/docs/guides/mcp-oauth.md +14 -22
  270. package/docs/guides/slack.md +14 -51
  271. package/docs/guides/webhooks.md +3 -3
  272. package/docs/hillclimbing.md +1 -1
  273. package/docs/quickstart.md +3 -4
  274. package/docs/reference/agent-config.md +10 -15
  275. package/docs/reference/channels.md +20 -31
  276. package/docs/reference/cli.md +29 -38
  277. package/docs/reference/connections.md +24 -25
  278. package/docs/reference/hooks.md +12 -17
  279. package/docs/reference/http-api.md +26 -38
  280. package/docs/reference/instructions.md +1 -1
  281. package/docs/reference/playground.md +14 -19
  282. package/docs/reference/project-layout.md +7 -3
  283. package/docs/reference/prompt.md +1 -1
  284. package/docs/reference/schedules.md +1 -2
  285. package/docs/reference/sessions.md +8 -19
  286. package/docs/reference/skills.md +3 -3
  287. package/docs/reference/subagents.md +2 -2
  288. package/docs/reference/tools.md +30 -19
  289. package/docs/scaffolding-agents.md +4 -5
  290. package/docs/storage.md +37 -80
  291. package/docs/templates/agentic-owners.md +2 -2
  292. package/docs/templates/pr-autofixer.md +7 -9
  293. package/docs/templates/security-reviewer.md +2 -3
  294. package/docs/troubleshooting.md +8 -8
  295. package/package.json +16 -2
  296. package/skills/create-agent/SKILL.md +6 -13
  297. package/skills/debug/SKILL.md +2 -4
  298. package/skills/evals/SKILL.md +1 -1
  299. package/skills/framework-map/SKILL.md +3 -2
  300. package/skills/mcp-auth/SKILL.md +10 -13
  301. package/skills/setup-slack/SKILL.md +21 -137
  302. package/src/channels/deployments/deployments-channel.ts +32 -2
  303. package/src/channels/deployments/types.ts +8 -0
  304. package/src/channels/github/github-channel.ts +71 -21
  305. package/src/channels/slack/attachments.ts +2 -2
  306. package/src/channels/slack/dispatch.ts +2 -16
  307. package/src/channels/slack/eval-directive.ts +8 -27
  308. package/src/channels/slack/index.ts +0 -6
  309. package/src/channels/slack/setup.ts +8 -15
  310. package/src/channels/slack/slack-channel.ts +14 -125
  311. package/src/channels/slack/types.ts +12 -96
  312. package/src/client.ts +23 -0
  313. package/src/connections.ts +20 -7
  314. package/src/continuation.ts +1 -1
  315. package/src/index.ts +2 -0
  316. package/src/internal/advertise-tools.ts +45 -7
  317. package/src/internal/authored-alias-hooks.ts +14 -11
  318. package/src/internal/authored-loaders.ts +14 -10
  319. package/src/internal/cli-deploy.ts +5 -5
  320. package/src/internal/cli-mcp-oauth.ts +6 -4
  321. package/src/internal/continuation-channel.ts +62 -45
  322. package/src/internal/continuation-identity.ts +123 -38
  323. package/src/internal/convert-automation/convert-workflow.ts +29 -17
  324. package/src/internal/convert-automation/slug.ts +0 -9
  325. package/src/internal/cursor/account-mcp.ts +4 -1
  326. package/src/internal/deploy-manifest.ts +5 -9
  327. package/src/internal/discovery.ts +107 -13
  328. package/src/internal/distribution.ts +4 -3
  329. package/src/internal/fixtures/units-server.ts +52 -0
  330. package/src/internal/hosted-delivery-protocol.ts +114 -0
  331. package/src/internal/hosted-delivery.ts +359 -0
  332. package/src/internal/http-channel.ts +0 -2
  333. package/src/internal/mcp-endpoint.ts +3 -3
  334. package/src/internal/mcp-host.ts +8 -7
  335. package/src/internal/peer-connections.ts +4 -1
  336. package/src/internal/playground/static.ts +1 -3
  337. package/src/internal/resolved-connections.ts +8 -10
  338. package/src/internal/review-comments.ts +542 -229
  339. package/src/internal/server.ts +180 -253
  340. package/src/internal/session-engine.ts +279 -70
  341. package/src/internal/shallow-clone.ts +30 -16
  342. package/src/internal/tool-catalog.ts +106 -0
  343. package/src/types.ts +99 -40
  344. package/templates/pr-autofixer/agent/channels/slack.ts +8 -2
  345. package/templates/triage/README.md +2 -1
  346. package/templates/triage/overlays/jira/agent/mcp-connections/tracker.ts +0 -1
  347. package/templates/triage/overlays/linear/agent/mcp-connections/tracker.ts +0 -1
  348. package/dist/channels/slack/cursor-account.d.ts +0 -87
  349. package/dist/channels/slack/cursor-account.d.ts.map +0 -1
  350. package/dist/channels/slack/cursor-account.js +0 -100
  351. package/dist/docs/assets/building-with-agents.md.DH8A_cHA.js +0 -13
  352. package/dist/docs/assets/chunks/@localSearchIndexroot.Dv-Q0XtU.js +0 -1
  353. package/dist/docs/assets/concepts.md.CRfU3bVg.js +0 -4
  354. package/dist/docs/assets/example-agents_approval-buddy.md.DNL83puR.js +0 -10
  355. package/dist/docs/assets/example-agents_approval-buddy.md.DNL83puR.lean.js +0 -1
  356. package/dist/docs/assets/example-agents_benny.md.C40vHRLc.js +0 -7
  357. package/dist/docs/assets/example-agents_benny.md.C40vHRLc.lean.js +0 -1
  358. package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.js +0 -11
  359. package/dist/docs/assets/example-agents_bugbot.md.BRGMi9O2.lean.js +0 -1
  360. package/dist/docs/assets/example-agents_codebase-wiki.md.Dftj_tPp.js +0 -8
  361. package/dist/docs/assets/example-agents_codebase-wiki.md.Dftj_tPp.lean.js +0 -1
  362. package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.js +0 -8
  363. package/dist/docs/assets/example-agents_codeowners-review.md.Bfta-lBU.lean.js +0 -1
  364. package/dist/docs/assets/example-agents_concierge.md.MrKpQndp.js +0 -23
  365. package/dist/docs/assets/example-agents_concierge.md.MrKpQndp.lean.js +0 -1
  366. package/dist/docs/assets/example-agents_fsd.md.ZWHWWZPE.js +0 -15
  367. package/dist/docs/assets/example-agents_fsd.md.ZWHWWZPE.lean.js +0 -1
  368. package/dist/docs/assets/example-agents_index.md.QZ8mhr6n.js +0 -2
  369. package/dist/docs/assets/example-agents_index.md.QZ8mhr6n.lean.js +0 -1
  370. package/dist/docs/assets/example-agents_knowledge-base.md.DqKqHQ9u.js +0 -11
  371. package/dist/docs/assets/example-agents_knowledge-base.md.DqKqHQ9u.lean.js +0 -1
  372. package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.js +0 -10
  373. package/dist/docs/assets/example-agents_oncall.md.DK4XkYTd.lean.js +0 -1
  374. package/dist/docs/assets/example-agents_security-reviewer.md.Bai6D0Ee.js +0 -19
  375. package/dist/docs/assets/example-agents_security-reviewer.md.Bai6D0Ee.lean.js +0 -1
  376. package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.js +0 -5
  377. package/dist/docs/assets/example-agents_slack-agent.md.D7Kdj5BV.lean.js +0 -1
  378. package/dist/docs/assets/example-agents_weather-agent.md.lVEAbWFf.js +0 -25
  379. package/dist/docs/assets/example-agents_weather-agent.md.lVEAbWFf.lean.js +0 -1
  380. package/dist/docs/assets/guides_cloud-runtime.md.BSMLIBHr.js +0 -9
  381. package/dist/docs/assets/guides_cloud-runtime.md.BSMLIBHr.lean.js +0 -1
  382. package/dist/docs/assets/guides_slack.md.DiUmk_Oi.lean.js +0 -1
  383. package/dist/docs/assets/index.md.BAaMXLFd.js +0 -5
  384. package/dist/docs/assets/reference_hooks.md.B9FSgdDe.js +0 -14
  385. package/dist/docs/assets/reference_http-api.md.CSHVobzG.js +0 -11
  386. package/dist/docs/assets/reference_http-api.md.CSHVobzG.lean.js +0 -1
  387. package/dist/docs/assets/reference_playground.md.Dfb92yQf.js +0 -1
  388. package/dist/docs/assets/reference_playground.md.Dfb92yQf.lean.js +0 -1
  389. package/dist/docs/assets/reference_project-layout.md.CwkSbEWT.js +0 -17
  390. package/dist/docs/assets/reference_sessions.md.tUFzz98S.js +0 -8
  391. package/dist/docs/assets/scaffolding-agents.md.CRDDUtYJ.js +0 -1
  392. package/dist/docs/assets/troubleshooting.md.DYECCZiJ.js +0 -1
  393. package/dist/docs/example-agents/approval-buddy.html +0 -36
  394. package/dist/docs/example-agents/approval-buddy.md +0 -266
  395. package/dist/docs/example-agents/benny.html +0 -33
  396. package/dist/docs/example-agents/benny.md +0 -182
  397. package/dist/docs/example-agents/bugbot.html +0 -37
  398. package/dist/docs/example-agents/bugbot.md +0 -229
  399. package/dist/docs/example-agents/codebase-wiki.html +0 -34
  400. package/dist/docs/example-agents/codebase-wiki.md +0 -170
  401. package/dist/docs/example-agents/codeowners-review.html +0 -34
  402. package/dist/docs/example-agents/codeowners-review.md +0 -192
  403. package/dist/docs/example-agents/concierge.html +0 -49
  404. package/dist/docs/example-agents/concierge.md +0 -201
  405. package/dist/docs/example-agents/fsd.html +0 -41
  406. package/dist/docs/example-agents/fsd.md +0 -329
  407. package/dist/docs/example-agents/index.html +0 -28
  408. package/dist/docs/example-agents/index.md +0 -102
  409. package/dist/docs/example-agents/knowledge-base.html +0 -37
  410. package/dist/docs/example-agents/knowledge-base.md +0 -168
  411. package/dist/docs/example-agents/oncall.html +0 -36
  412. package/dist/docs/example-agents/oncall.md +0 -212
  413. package/dist/docs/example-agents/security-reviewer.html +0 -45
  414. package/dist/docs/example-agents/security-reviewer.md +0 -265
  415. package/dist/docs/example-agents/slack-agent.html +0 -31
  416. package/dist/docs/example-agents/slack-agent.md +0 -142
  417. package/dist/docs/example-agents/weather-agent.html +0 -51
  418. package/dist/docs/example-agents/weather-agent.md +0 -296
  419. package/dist/internal/cursor-slack-relay.d.ts +0 -96
  420. package/dist/internal/cursor-slack-relay.d.ts.map +0 -1
  421. package/dist/internal/cursor-slack-relay.js +0 -176
  422. package/docs/example-agents/approval-buddy.md +0 -271
  423. package/docs/example-agents/benny.md +0 -187
  424. package/docs/example-agents/bugbot.md +0 -234
  425. package/docs/example-agents/codebase-wiki.md +0 -175
  426. package/docs/example-agents/codeowners-review.md +0 -197
  427. package/docs/example-agents/concierge.md +0 -206
  428. package/docs/example-agents/fsd.md +0 -334
  429. package/docs/example-agents/index.md +0 -107
  430. package/docs/example-agents/knowledge-base.md +0 -173
  431. package/docs/example-agents/oncall.md +0 -217
  432. package/docs/example-agents/security-reviewer.md +0 -270
  433. package/docs/example-agents/slack-agent.md +0 -147
  434. package/docs/example-agents/weather-agent.md +0 -301
  435. package/src/channels/slack/cursor-account.ts +0 -202
  436. package/src/internal/cursor-slack-relay.ts +0 -249
  437. /package/dist/docs/assets/{guides_agent-to-agent.md.BCeVdJRJ.lean.js → guides_agent-to-agent.md.BDb0t1QV.lean.js} +0 -0
  438. /package/dist/docs/assets/{guides_convert-automation.md.D06eIzea.lean.js → guides_convert-automation.md.B4sjlodG.lean.js} +0 -0
  439. /package/dist/docs/assets/{guides_webhooks.md.BpnIdO0i.lean.js → guides_webhooks.md.DKdA43Qm.lean.js} +0 -0
  440. /package/dist/docs/assets/{hillclimbing.md.ywF3yDAd.lean.js → hillclimbing.md.DhESf3OO.lean.js} +0 -0
  441. /package/dist/docs/assets/{quickstart.md.DsrarzEg.lean.js → quickstart.md.Nj_LjW_a.lean.js} +0 -0
  442. /package/dist/docs/assets/{reference_agent-config.md.Bqylgw50.lean.js → reference_agent-config.md.Cp_x38Nl.lean.js} +0 -0
  443. /package/dist/docs/assets/{reference_project-layout.md.CwkSbEWT.lean.js → reference_project-layout.md.Bv4KOtlB.lean.js} +0 -0
  444. /package/dist/docs/assets/{reference_prompt.md.DZUMtLPD.lean.js → reference_prompt.md.DnaD5dNK.lean.js} +0 -0
  445. /package/dist/docs/assets/{reference_schedules.md.DNipebiG.lean.js → reference_schedules.md.DI_JrHgq.lean.js} +0 -0
  446. /package/dist/docs/assets/{reference_skills.md.B5ZEuHfG.lean.js → reference_skills.md.8son6Hjm.lean.js} +0 -0
  447. /package/dist/docs/assets/{reference_subagents.md.Xoav0AII.lean.js → reference_subagents.md.CfsIloPm.lean.js} +0 -0
  448. /package/dist/docs/assets/{templates_agentic-owners.md.DSJSIpWU.lean.js → templates_agentic-owners.md.DqtPdm6f.lean.js} +0 -0
@@ -1,15 +0,0 @@
1
- import{_ as t,c as s,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const u=JSON.parse('{"title":"Hand PR triage to managed remote agents","description":"Coordinate local chat, per-PR remote sessions, GitHub wake buffering, workflow MCP enrollment, durable affinity, findings, and reminders.","frontmatter":{"title":"Hand PR triage to managed remote agents","description":"Coordinate local chat, per-PR remote sessions, GitHub wake buffering, workflow MCP enrollment, durable affinity, findings, and reminders."},"headers":[],"relativePath":"example-agents/fsd.md","filePath":"example-agents/fsd.md"}'),o={name:"example-agents/fsd.md"};function n(r,e,l,d,h,c){return a(),s("div",null,[...e[0]||(e[0]=[i(`<h1 id="hand-pr-triage-to-managed-remote-agents" tabindex="-1">Hand PR triage to managed remote agents <a class="header-anchor" href="#hand-pr-triage-to-managed-remote-agents" aria-label="Permalink to &quot;Hand PR triage to managed remote agents&quot;">​</a></h1><p>The remote PR coordinator keeps chat and routing on the local serve host, then hands each pull request to a managed remote agent with a real checkout. The same remote conversation resumes when a user drives the PR again, GitHub reports a change, or a merge-conflict reminder fires.</p><p>This example is Cursor-internal. For your own repos, scaffold <a href="./../templates/pr-autofixer.html">PR autofixer</a> instead.</p><p>The workflow backend enrolls each remote run with a workflow MCP. Its tools and the host&#39;s findings routes read and write the same external findings service.</p><p>Use this example when repository work is too heavy or concurrent for local worktrees, but the host should still own intake, session identity, policy, and bookkeeping.</p><p><a href="./../../examples/fsd/">Browse the current coordinator source.</a></p><h2 id="resume-one-remote-agent-across-every-pr-wake" tabindex="-1">Resume one remote agent across every PR wake <a class="header-anchor" href="#resume-one-remote-agent-across-every-pr-wake" aria-label="Permalink to &quot;Resume one remote agent across every PR wake&quot;">​</a></h2><p>The coordinator uses a hybrid runtime:</p><ul><li>Ordinary playground and Slack chat run locally.</li><li>The <code>drive_pr</code> server tool creates a remote session for one PR.</li><li>The remote worker gets the repository and PR reference.</li><li>An <code>agent.bound</code> hook records the remote run id and enrolls the run into a workflow MCP.</li><li>Webhooks and reminders resume the same remote agent through durable PR-to-agent affinity.</li></ul><p>No other example moves one logical conversation across local chat, remote execution, event wakes, and timed follow-ups.</p><h2 id="follow-a-chat-request" tabindex="-1">Follow a chat request <a class="header-anchor" href="#follow-a-chat-request" aria-label="Permalink to &quot;Follow a chat request&quot;">​</a></h2><ol><li>A user asks local chat or Slack to drive a PR.</li><li>The root model calls <code>drive_pr</code> with the PR, mode, and optional hint.</li><li>The tool calls <code>ctx.send(&quot;drive&quot;, ...)</code> with a per-session <code>cloud</code> block to attach the PR.</li><li>The Agent SDK creates or resumes the <code>drive</code> session keyed by <code>pr:owner/repo#N</code>.</li><li>The remote runtime provisions the agent and emits <code>agent.bound</code>.</li><li>The enrollment hook writes PR affinity and calls the workflow backend to attach run-scoped MCP tools.</li><li><code>drive_pr</code> waits for remote binding, then returns the agent id and URL. If binding exceeds its wait window, those fields can be <code>null</code> while work continues.</li><li>The remote agent reads the host-prepared PR brief, checks unresolved state, and records findings through the workflow MCP.</li><li>The host forwards a validated fallback output block when MCP wasn&#39;t available for the turn.</li></ol><p>The local chat agent doesn&#39;t have the target checkout, <code>gh</code>, <code>git</code>, or the workflow MCP. Its job is coordination.</p><p>A request for a merged or closed PR finishes before provisioning. That result has <code>status: &quot;finished&quot;</code> and no remote session.</p><h2 id="map-the-framework-features" tabindex="-1">Map the framework features <a class="header-anchor" href="#map-the-framework-features" aria-label="Permalink to &quot;Map the framework features&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Capability</th><th>Source</th><th>Role</th></tr></thead><tbody><tr><td>Hybrid config</td><td><a href="../../examples/fsd/agent/agent.ts"><code>agent/agent.ts</code></a></td><td>Keep chat local, set remote-runtime defaults, disable automatic PR creation, and isolate local harness workspaces.</td></tr><tr><td>Root instructions</td><td><a href="./../../examples/fsd/agent/instructions.html"><code>agent/instructions.md</code></a></td><td>Separate local coordination from remote triage and define suggest/apply policy.</td></tr><tr><td>Drive tool</td><td><a href="../../examples/fsd/agent/tools/drive_pr.ts"><code>agent/tools/drive_pr.ts</code></a></td><td>Hand a chat request to the <code>drive</code> channel and wait for remote binding.</td></tr><tr><td>Drive channel</td><td><a href="../../examples/fsd/agent/channels/drive.ts"><code>agent/channels/drive.ts</code></a></td><td>Start remote work and expose findings read/write routes.</td></tr><tr><td>GitHub channel</td><td><a href="../../examples/fsd/agent/channels/github.ts"><code>agent/channels/github.ts</code></a></td><td>Buffer PR, comment, review, check, and status wakes.</td></tr><tr><td>Slack channel</td><td><a href="../../examples/fsd/agent/channels/slack.ts"><code>agent/channels/slack.ts</code></a></td><td>Route Slack requests to the local coordinator.</td></tr><tr><td>Hooks</td><td><a href="../../examples/fsd/agent/hooks/enroll-fsd.ts"><code>agent/hooks/enroll-fsd.ts</code></a>, <a href="../../examples/fsd/agent/hooks/record-outputs.ts"><code>agent/hooks/record-outputs.ts</code></a></td><td>Bind remote identity, enroll MCP, and forward fallback findings.</td></tr><tr><td>Affinity and buffering</td><td><a href="../../examples/fsd/agent/lib/pr-affinity.ts"><code>agent/lib/pr-affinity.ts</code></a>, <a href="../../examples/fsd/agent/lib/webhook-buffer.ts"><code>agent/lib/webhook-buffer.ts</code></a></td><td>Persist PR identity, sticky mode, and pending wakes.</td></tr><tr><td>Reminders</td><td><a href="../../examples/fsd/agent/lib/merge-conflict-watch.ts"><code>agent/lib/merge-conflict-watch.ts</code></a></td><td>Recheck merge conflicts every 30 minutes.</td></tr><tr><td>Workflow client</td><td><a href="../../examples/fsd/agent/lib/fsd-platform.ts"><code>agent/lib/fsd-platform.ts</code></a></td><td>Enroll external runs and read or record findings.</td></tr><tr><td>Storage</td><td><a href="../../examples/fsd/agent/storage.ts"><code>agent/storage.ts</code></a></td><td>Persist sessions and events with <code>cursorHostedStorage</code>.</td></tr></tbody></table><p>The coordinator has no authored skill, subagent, MCP connection, static schedule, A/B experiment, eval, or tool approval.</p><p>The workflow MCP is dynamic. Backend enrollment attaches it to the remote run, so there is no file under <code>agent/mcp-connections/</code>.</p><h2 id="understand-local-and-remote-workspaces" tabindex="-1">Understand local and remote workspaces <a class="header-anchor" href="#understand-local-and-remote-workspaces" aria-label="Permalink to &quot;Understand local and remote workspaces&quot;">​</a></h2><p>The root config sets <code>runtime: &quot;local&quot;</code> because <code>drive_pr</code> is a server tool. It also supplies remote-runtime defaults through the <code>cloud</code> configuration:</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;">local</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
2
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> cwd</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">join</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">homedir</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(), </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;.cache&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;agent-serve&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;fsd&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">),</span></span>
3
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">},</span></span>
4
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cloud</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
5
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> env</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: { </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;cloud&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
6
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> autoCreatePR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
7
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">},</span></span></code></pre></div><p>The local cwd sits outside the monorepo, so inherited repository instructions don&#39;t affect coordinator chat.</p><p>Remote sessions get a repository attachment with the target PR. The worker starts from the PR base and creates an automation side branch from the PR head only when code context or a fix is needed. The serve host never checks out target code.</p><h2 id="prepare-access" tabindex="-1">Prepare access <a class="header-anchor" href="#prepare-access" aria-label="Permalink to &quot;Prepare access&quot;">​</a></h2><p>You need:</p><ul><li>Node 22.13 or newer.</li><li>An agent-runtime user credential.</li><li>Access to a managed remote runtime.</li><li>Access to the target GitHub PR.</li><li>Access to the workflow backend and findings store.</li></ul><p>Keep the affinity and webhook-buffer files on durable storage for a long-lived host.</p><h2 id="validate-without-starting-remote-work" tabindex="-1">Validate without starting remote work <a class="header-anchor" href="#validate-without-starting-remote-work" aria-label="Permalink to &quot;Validate without starting remote work&quot;">​</a></h2><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;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/fsd</span></span>
8
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/fsd</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span>
9
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> github</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> events</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/fsd</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span></code></pre></div><p>These commands inspect discovery and declared GitHub events. They don&#39;t provision a remote agent.</p><h2 id="choose-suggest-or-apply" tabindex="-1">Choose suggest or apply <a class="header-anchor" href="#choose-suggest-or-apply" aria-label="Permalink to &quot;Choose suggest or apply&quot;">​</a></h2><p>Every PR has a sticky mode:</p><table tabindex="0"><thead><tr><th>Mode</th><th>Required remote behavior</th></tr></thead><tbody><tr><td><code>suggest</code></td><td>May create verified commits on the VM&#39;s local side branch. Instructions require no pushes, comments, PR edits, or workflow actions. Records exact fixes and actions as findings for the owner.</td></tr><tr><td><code>apply</code></td><td>Pushes verified fixes to the existing PR head and may update metadata, reply to threads, mark a draft ready, rebase, or rerun CI.</td></tr></tbody></table><p>The remote instructions forbid merging, enabling auto-merge, force-pushing, and opening a new PR in both modes. <code>autoCreatePR: false</code> also disables the SDK&#39;s automatic PR creation. The other restrictions are prompt policy, not a deterministic host gate. <code>suggest</code> is the default.</p><p>The selected mode is stored beside PR affinity. Webhooks and reminders reuse it. Re-driving a PR can change the host-side mode. Backend enrollment records the mode at first enrollment, so each later host prompt repeats the current authoritative mode.</p><div class="caution custom-block github-alert"><p class="custom-block-title">CAUTION</p><p><code>apply</code> writes to the user&#39;s PR branch and triggers CI. Use <code>suggest</code> for development. Both modes provision a billed remote agent and can write structured findings to the findings service. <code>drive_pr</code> has no approval gate, and suggest/apply restrictions depend on the remote agent following its instructions.</p></div><h2 id="start-a-suggest-mode-drive" tabindex="-1">Start a suggest-mode drive <a class="header-anchor" href="#start-a-suggest-mode-drive" aria-label="Permalink to &quot;Start a suggest-mode drive&quot;">​</a></h2><p>Run the host:</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;"> examples/fsd</span></span></code></pre></div><p>From chat:</p><blockquote><p>Drive <a href="https://github.com/owner/repo/pull/123" target="_blank" rel="noreferrer">https://github.com/owner/repo/pull/123</a> in suggest mode.</p></blockquote><p>Or call the coordinator tool:</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;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> drive_pr</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
10
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/fsd</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
11
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;pr&quot;:&quot;https://github.com/owner/repo/pull/123&quot;,&quot;mode&quot;:&quot;suggest&quot;}&#39;</span></span></code></pre></div><p>For an open PR, the tool waits up to 60 seconds for remote binding and returns:</p><ul><li>the normalized PR label,</li><li>session and continuation ids,</li><li>the remote-agent id and URL when binding completes in that window,</li><li><code>status: &quot;started&quot;</code>, and</li><li>the merge-conflict reminder id.</li></ul><p>It doesn&#39;t wait for findings. A slow binding can return <code>null</code> identifiers. Open the returned agent URL when present to follow the remote run.</p><h2 id="use-the-http-drive-surface" tabindex="-1">Use the HTTP drive surface <a class="header-anchor" href="#use-the-http-drive-surface" aria-label="Permalink to &quot;Use the HTTP drive surface&quot;">​</a></h2><p>The custom channel starts the same orchestration:</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;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
12
- <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://127.0.0.1:3000/fsd/v1/channels/drive/</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
13
- <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>
14
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;pr&quot;:&quot;owner/repo#123&quot;,&quot;mode&quot;:&quot;suggest&quot;}&#39;</span></span></code></pre></div><p>This route returns as soon as the channel session exists. The remote-agent id can still be <code>null</code> at that point. Triage continues in the background.</p><p>Read findings later:</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;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
15
- <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;http://127.0.0.1:3000/fsd/v1/channels/drive/findings?pr=owner/repo%23123&#39;</span></span></code></pre></div><p>The external findings service is the source of truth. The local host doesn&#39;t keep a second findings database.</p><p>The channel also exposes <code>POST /findings</code> as a testing surface. It validates outputs, then writes them to the findings service for a PR already bound by this host. The route has no approval gate. Keep it under the default loopback auth or another trusted boundary.</p><h2 id="keep-one-remote-agent-per-pr" tabindex="-1">Keep one remote agent per PR <a class="header-anchor" href="#keep-one-remote-agent-per-pr" aria-label="Permalink to &quot;Keep one remote agent per PR&quot;">​</a></h2><p>Within the <code>drive</code> channel, the stable continuation token <code>pr:owner/repo#N</code> resumes the same session. GitHub sessions are scoped to another channel, so a continuation token alone can&#39;t bridge them.</p><p>The enrollment hook closes that gap:</p><ol><li>Read the PR from the continuation token or host-authored session title.</li><li>Record PR to <code>sdkAgentId</code> affinity after <code>agent.bound</code>.</li><li>Seed later sessions with the same remote id.</li><li>Retry workflow MCP enrollment after a completed turn when the first RPC failed.</li></ol><p>This lets Slack, HTTP drive, GitHub, and reminders talk to one remote conversation without sharing one channel session.</p><h2 id="buffer-github-wakes" tabindex="-1">Buffer GitHub wakes <a class="header-anchor" href="#buffer-github-wakes" aria-label="Permalink to &quot;Buffer GitHub wakes&quot;">​</a></h2><p>The GitHub channel handles pull requests, comments, reviews, check suites, check runs, and selected status events. It doesn&#39;t send payload details to the model. It asks the remote agent to refresh live source of truth.</p><p>The buffer:</p><ul><li>groups events by PR,</li><li>waits three seconds for a burst to settle,</li><li>re-buffers while CI settles,</li><li>skips a flush when the PR session is busy,</li><li>tries to write its snapshot before acknowledging a wake, and</li><li>restores pending entries when the channel starts.</li></ul><p>Closing a PR discards its pending entry and cancels its reminders.</p><p>Snapshot persistence is best-effort. Write failures are swallowed silently, so a delivery can still be acknowledged without a durable snapshot.</p><p>This is the high-volume counterpart to a direct <code>{ auth }</code> GitHub wake. See <a href="./../guides/github.html#handle-high-event-volume">GitHub</a> for the reusable pattern.</p><h2 id="add-merge-conflict-checks" tabindex="-1">Add merge-conflict checks <a class="header-anchor" href="#add-merge-conflict-checks" aria-label="Permalink to &quot;Add merge-conflict checks&quot;">​</a></h2><p>Starting a drive arms one recurring reminder per PR. Every 30 minutes the host checks mergeability:</p><ul><li>closed or merged stops the reminder,</li><li>clean skips delivery,</li><li>conflicting sends a follow-up to the owning session, and</li><li>a busy session skips the wake.</li></ul><p>This uses runtime reminders, not a static <code>agent/schedules/</code> file. The host creates, lists, replaces, and cancels reminders through <code>host.reminders</code>. Development mode doesn&#39;t fire reminder timers automatically. Dispatch one through the dev reminder endpoint for a manual proof, or use non-dev <code>serve</code> to run the 30-minute cadence.</p><p>The reminder&#39;s <code>run</code> handler lives in memory. After a host restart, the Agent SDK disarms it with <code>handler_lost_on_restart</code>; a later drive or webhook path can arm a fresh handler. Persisted reminder metadata alone doesn&#39;t keep the check running.</p><h2 id="record-findings-with-mcp-or-a-fallback" tabindex="-1">Record findings with MCP or a fallback <a class="header-anchor" href="#record-findings-with-mcp-or-a-fallback" aria-label="Permalink to &quot;Record findings with MCP or a fallback&quot;">​</a></h2><p>After enrollment, the remote agent receives workflow tools for:</p><ul><li>recording and updating outputs,</li><li>listing current outputs,</li><li>reading PR metadata,</li><li>reading CI state, and</li><li>reading review comments.</li></ul><p>The main output is a structured workflow suggestion or code-change reference. The remote prompt requires findings as soon as each action becomes clear.</p><p>If enrollment races or MCP is unavailable, the agent writes one fenced fallback JSON block. The host validates allowed kinds, actions, statuses, and the 140-character finding body before forwarding it to the same findings service. The output hook catches fallback blocks from webhook and reminder turns.</p><h2 id="verify-the-host-logic" tabindex="-1">Verify the host logic <a class="header-anchor" href="#verify-the-host-logic" aria-label="Permalink to &quot;Verify the host logic&quot;">​</a></h2><p>The coordinator has no filesystem evals. Its unit tests cover mode parsing, drive orchestration, affinity, webhook durability, CI settlement, output parsing, reminders, and Slack configuration:</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;">pnpm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> exec</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> vitest</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/fsd/agent/lib</span></span></code></pre></div><p>Use those tests for host policy. Use a dedicated test PR and suggest mode for the end-to-end remote path.</p><h2 id="build-another-hybrid-coordinator" tabindex="-1">Build another hybrid coordinator <a class="header-anchor" href="#build-another-hybrid-coordinator" aria-label="Permalink to &quot;Build another hybrid coordinator&quot;">​</a></h2><p>Use this architecture when each work item needs a real checkout:</p><ol><li>Keep conversational intake local.</li><li>Open a remote session only after the request identifies a work item.</li><li>Give the work item a stable continuation key.</li><li>Persist its remote-agent id for cross-channel resume.</li><li>Coalesce noisy events before spending another turn.</li><li>Put the current mode and permissions in every host prompt.</li><li>Record outputs incrementally in a durable sink.</li><li>Add reminders for state requiring periodic rechecks.</li></ol><h2 id="where-to-go-next" tabindex="-1">Where to go next <a class="header-anchor" href="#where-to-go-next" aria-label="Permalink to &quot;Where to go next&quot;">​</a></h2><ul><li><a href="./../guides/cloud-runtime.html">Cloud runtime</a></li><li><a href="./../guides/github.html">GitHub</a></li><li><a href="./../guides/webhooks.html">Webhooks and custom channels</a></li><li><a href="./../reference/schedules.html">Schedules and reminders</a></li><li><a href="./../reference/sessions.html">Sessions and streaming</a></li><li><a href="./../deployment.html">Deployment</a></li></ul>`,85)])])}const k=t(o,[["render",n]]);export{u as __pageData,k as default};
@@ -1 +0,0 @@
1
- import{_ as t,c as s,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const u=JSON.parse('{"title":"Hand PR triage to managed remote agents","description":"Coordinate local chat, per-PR remote sessions, GitHub wake buffering, workflow MCP enrollment, durable affinity, findings, and reminders.","frontmatter":{"title":"Hand PR triage to managed remote agents","description":"Coordinate local chat, per-PR remote sessions, GitHub wake buffering, workflow MCP enrollment, durable affinity, findings, and reminders."},"headers":[],"relativePath":"example-agents/fsd.md","filePath":"example-agents/fsd.md"}'),o={name:"example-agents/fsd.md"};function n(r,e,l,d,h,c){return a(),s("div",null,[...e[0]||(e[0]=[i("",85)])])}const k=t(o,[["render",n]]);export{u as __pageData,k as default};
@@ -1,2 +0,0 @@
1
- import{_ as t,c as a,o as r,ag as o}from"./chunks/framework.BCISBCiQ.js";const m=JSON.parse('{"title":"Choose the right Agent SDK example","description":"Compare all twelve example agents by runtime, channels, tools, state, and the framework pattern each one teaches.","frontmatter":{"title":"Choose the right Agent SDK example","description":"Compare all twelve example agents by runtime, channels, tools, state, and the framework pattern each one teaches."},"headers":[],"relativePath":"example-agents/index.md","filePath":"example-agents/index.md"}'),s={name:"example-agents/index.md"};function n(i,e,d,l,h,c){return r(),a("div",null,[...e[0]||(e[0]=[o(`<h1 id="choose-the-right-agent-sdk-example" tabindex="-1">Choose the right Agent SDK example <a class="header-anchor" href="#choose-the-right-agent-sdk-example" aria-label="Permalink to &quot;Choose the right Agent SDK example&quot;">​</a></h1><p>The examples progress from one-channel assistants to durable, event-driven workflows. Start with the smallest agent for your use case. Each guide explains its request flow, framework features, verification path, and reusable design.</p><p>The source projects live under <a href="./../../examples/"><code>examples/</code></a>. Run the commands below from <code>packages/agent-serve</code>. See <a href="/docs/#run-the-cli">Run the CLI</a> if the <code>agent-sdk</code> command isn&#39;t installed.</p><h2 id="compare-the-examples" tabindex="-1">Compare the examples <a class="header-anchor" href="#compare-the-examples" aria-label="Permalink to &quot;Compare the examples&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Agent</th><th>Runtime</th><th>Intake</th><th>Framework focus</th><th>What sets it apart</th></tr></thead><tbody><tr><td><a href="./weather-agent.html">Weather agent</a></td><td>Cloud</td><td>HTTP and two Slack transports</td><td>Tools, stdio MCP, skill, subagent, schedule, hooks, A/B, and evals</td><td>It demonstrates the broad cloud-runtime surface in one domain.</td></tr><tr><td><a href="./slack-agent.html">Slack agent</a></td><td>Local</td><td>Account-linked Slack</td><td>Channel identity, threads, and suggested prompts</td><td>It reaches Slack without authored tools.</td></tr><tr><td><a href="./concierge.html">Concierge</a></td><td>Local</td><td>Built-in HTTP</td><td>Peer MCP and multi-agent serving</td><td>It delegates to a separate agent with its own tools, sessions, and context.</td></tr><tr><td><a href="./benny.html">Playbook router</a></td><td>Local with repo context</td><td>Two Slack transports</td><td>Channel watching, inherited skills, custom cwd, and an eval</td><td>An allowlisted Slack channel becomes an intake queue for repo playbooks.</td></tr><tr><td><a href="./oncall.html">Alert investigator</a></td><td>Local</td><td>Watched Slack alerts channel</td><td>Bot-post channel watching, per-thread debounce, reminder tools, and host Slack calls</td><td>Every alert gets a thread-pinned investigation that schedules its own re-checks.</td></tr><tr><td><a href="./bugbot.html">PR evidence reviewer</a></td><td>Local</td><td>Custom HTTP and Slack</td><td>Host tool, skill, seeded workspaces, and an eval</td><td>The model receives a prepared diff-first evidence tree instead of a checkout.</td></tr><tr><td><a href="./approval-buddy.html">Approval Buddy</a></td><td>Local</td><td>GitHub and Slack</td><td>Policy tools, two subagents, durable storage, and evals</td><td>Code decides whether a PR may be approved. Reviews stay informational.</td></tr><tr><td><a href="./security-reviewer.html">Security Reviewer</a></td><td>Local host pipeline</td><td>GitHub and chat</td><td>Staged tools, parallel SDK agents, progress UI, durable storage, A/B, and evals</td><td>Lives in <code>factory/security-reviewer/</code>. Reviewers and triage overlap while the playground shows every stage.</td></tr><tr><td><a href="./fsd.html">Remote PR coordinator</a></td><td>Local coordinator and remote PR sessions</td><td>HTTP, GitHub, and Slack</td><td>Remote handoff, hooks, affinity, buffering, reminders, and workflow MCP</td><td>One remote conversation follows a PR across chat, webhooks, and timed wakes.</td></tr><tr><td><a href="./knowledge-base.html">Knowledge base</a></td><td>Local</td><td>Built-in HTTP chat</td><td>Durable host-side state, a conventions skill, a schedule, unit tests, and evals</td><td>People curate shared facts in chat, and fresh sessions retrieve them from markdown.</td></tr><tr><td><a href="./codebase-wiki.html">Codebase wiki</a></td><td>Local</td><td>GitHub and chat</td><td>Task-dispatch webhooks, seeded digests, a mapping skill, a schedule, and evals</td><td>Merged PRs accumulate into per-feature wiki pages with a daily digest.</td></tr><tr><td><a href="./codeowners-review.html">Codeowners review</a></td><td>Local</td><td>GitHub, chat, and fixtures</td><td>Ownership routing in code, playbook data files, parallel subagents, and evals</td><td>Each product area reviews with its own playbook, and verdicts aggregate mechanically.</td></tr></tbody></table><h2 id="pick-a-learning-path" tabindex="-1">Pick a learning path <a class="header-anchor" href="#pick-a-learning-path" aria-label="Permalink to &quot;Pick a learning path&quot;">​</a></h2><p>Use this order when you want to learn the Agent SDK one capability at a time:</p><ol><li>Start with <a href="./weather-agent.html">Weather agent</a> to explore the filesystem conventions and cloud runtime.</li><li>Strip the project back to <a href="./slack-agent.html">Slack agent</a> to see the minimum channel surface.</li><li>Read <a href="./benny.html">Playbook router</a> when Slack should route requests into repo playbooks.</li><li>Continue to <a href="./oncall.html">Alert investigator</a> when the intake is bot posts and the agent must pace its own engagement and re-checks.</li><li>Add composition with <a href="./concierge.html">Concierge</a>.</li><li>Study <a href="./bugbot.html">PR evidence reviewer</a> before giving a model repository evidence.</li><li>Move policy into code with <a href="./approval-buddy.html">Approval Buddy</a>.</li><li>Compare <a href="./security-reviewer.html">Security Reviewer</a> and <a href="./fsd.html">Remote PR coordinator</a> for host-side versus remote PR work.</li><li>See parallel subagent delegation carry team judgment in <a href="./codeowners-review.html">Codeowners review</a>.</li><li>Curate team context through conversation with <a href="./knowledge-base.html">Knowledge base</a>, then let GitHub events maintain product documentation in <a href="./codebase-wiki.html">Codebase wiki</a>.</li></ol><h2 id="common-prerequisites" tabindex="-1">Common prerequisites <a class="header-anchor" href="#common-prerequisites" aria-label="Permalink to &quot;Common prerequisites&quot;">​</a></h2><p>All examples require:</p><ul><li>Node 22.13 or newer. Don&#39;t run the Agent SDK under Bun.</li><li>Workspace dependencies installed.</li><li>An agent-runtime credential for model turns.</li></ul><p>Several examples need more:</p><ul><li>Account-linked Slack channels require a connected host account.</li><li>Alert investigator needs a dedicated Socket Mode app with channel-post events and membership in the watched alerts channel.</li><li>GitHub examples require access to the target repository. Codebase wiki and Codeowners review call the host <code>gh</code> CLI for PR data; the codeowners fixtures run without network.</li><li>Example agents use <code>cursorHostedStorage</code> (<code>agent/storage.ts</code>) for Cursor-hosted session storage (control-plane proxy).</li><li>Remote PR coordinator starts remote agent sessions and needs access to its workflow backend.</li></ul><p>Each guide lists its own credentials, services, and side effects.</p><h2 id="validate-any-example" tabindex="-1">Validate any example <a class="header-anchor" href="#validate-any-example" aria-label="Permalink to &quot;Validate any example&quot;">​</a></h2><p>Discovery commands don&#39;t start a model turn:</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;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span></span>
2
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span></code></pre></div><p>Start one development server with <code>agent-sdk dev examples/&lt;name&gt;</code>. Concierge depends on Weather agent, so its guide creates an isolated two-project mount. Don&#39;t mount the whole examples directory to test one agent; several advanced examples subscribe to live GitHub events.</p><h2 id="read-by-framework-feature" tabindex="-1">Read by framework feature <a class="header-anchor" href="#read-by-framework-feature" aria-label="Permalink to &quot;Read by framework feature&quot;">​</a></h2><ul><li><a href="./../concepts.html">Concepts</a> explains filesystem discovery and runtime boundaries.</li><li><a href="./../reference/project-layout.html">Project layout</a> lists every authored folder.</li><li><a href="./../reference/tools.html">Tools</a>, <a href="./../reference/channels.html">channels</a>, and <a href="./../reference/connections.html">MCP connections</a> cover the core extension points.</li><li><a href="./../evals.html">Evals</a> and <a href="./../ab.html">live A/B metrics</a> cover measured iteration.</li><li><a href="./../deployment.html">Deployment</a> covers credentials, auth, storage, and hosting.</li></ul>`,20)])])}const u=t(s,[["render",n]]);export{m as __pageData,u as default};
@@ -1 +0,0 @@
1
- import{_ as t,c as a,o as r,ag as o}from"./chunks/framework.BCISBCiQ.js";const m=JSON.parse('{"title":"Choose the right Agent SDK example","description":"Compare all twelve example agents by runtime, channels, tools, state, and the framework pattern each one teaches.","frontmatter":{"title":"Choose the right Agent SDK example","description":"Compare all twelve example agents by runtime, channels, tools, state, and the framework pattern each one teaches."},"headers":[],"relativePath":"example-agents/index.md","filePath":"example-agents/index.md"}'),s={name:"example-agents/index.md"};function n(i,e,d,l,h,c){return r(),a("div",null,[...e[0]||(e[0]=[o("",20)])])}const u=t(s,[["render",n]]);export{m as __pageData,u as default};
@@ -1,11 +0,0 @@
1
- import{_ as a,c as s,o as t,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Build a team knowledge base through conversation","description":"Teach an agent about people, systems, decisions, and preferences; store that knowledge as markdown and retrieve it in fresh sessions.","frontmatter":{"title":"Build a team knowledge base through conversation","description":"Teach an agent about people, systems, decisions, and preferences; store that knowledge as markdown and retrieve it in fresh sessions."},"headers":[],"relativePath":"example-agents/knowledge-base.md","filePath":"example-agents/knowledge-base.md"}'),n={name:"example-agents/knowledge-base.md"};function l(o,e,d,r,h,p){return t(),s("div",null,[...e[0]||(e[0]=[i(`<h1 id="build-a-team-knowledge-base-through-conversation" tabindex="-1">Build a team knowledge base through conversation <a class="header-anchor" href="#build-a-team-knowledge-base-through-conversation" aria-label="Permalink to &quot;Build a team knowledge base through conversation&quot;">​</a></h1><p>Knowledge base turns conversations into shared team context. Teach the agent about people, systems, decisions, and standing preferences. Three server tools read, search, and write human-readable markdown pages; a conventions skill shapes each write; and a daily schedule merges duplicates and rebuilds the index. A fresh session retrieves what an earlier conversation captured.</p><p>Use this project when people should curate organizational knowledge through chat. Use <a href="./codebase-wiki.html">Codebase wiki</a> when merged PRs should maintain feature documentation instead.</p><p><a href="./../../examples/knowledge-base/">Browse the knowledge base source.</a></p><h2 id="keep-shared-knowledge-on-the-filesystem" tabindex="-1">Keep shared knowledge on the filesystem <a class="header-anchor" href="#keep-shared-knowledge-on-the-filesystem" aria-label="Permalink to &quot;Keep shared knowledge on the filesystem&quot;">​</a></h2><p>The knowledge base lives outside any session workspace, in <code>.agent-serve/wiki/</code> by default. <code>KNOWLEDGE_BASE_DIR</code> overrides the location, and the tools resolve it on every call, so tests and evals can point the same code at a temp directory.</p><p>The store enforces its own safety:</p><ul><li>Page ids are one to three lowercase kebab-case segments, so a page id can&#39;t escape the wiki directory.</li><li>Pages cap at 64 KiB. Oversized writes fail with instructions to split the page.</li><li><code>wiki_write</code> replaces whole pages. The instructions require reading a page before updating it, so rewrites carry existing facts forward.</li></ul><p>Every page is plain markdown. You can open the wiki in an editor, review it in a PR, or grep it.</p><h2 id="follow-a-fact-through-the-agent" tabindex="-1">Follow a fact through the agent <a class="header-anchor" href="#follow-a-fact-through-the-agent" aria-label="Permalink to &quot;Follow a fact through the agent&quot;">​</a></h2><ol><li>You tell the agent something durable: a system, an owner, a standing preference.</li><li>The instructions require a <code>wiki_search</code> before claiming knowledge and a <code>wiki_write</code> after learning something worth keeping.</li><li>The <code>wiki-conventions</code> skill picks the page id (<code>staging-database</code>, <code>people/jane-doe</code>), the page shape, and the dated fact format.</li><li>The tool writes the page under the durable wiki root and returns whether it created or updated the page.</li><li>A later session, on any channel, finds the fact with <code>wiki_search</code> and cites the knowledge-base page in its answer.</li></ol><p>Ephemeral chatter stays out. The instructions tell the model to skip one-off questions and to ask before saving anything borderline.</p><h2 id="map-the-knowledge-base-files" tabindex="-1">Map the knowledge-base files <a class="header-anchor" href="#map-the-knowledge-base-files" aria-label="Permalink to &quot;Map the knowledge-base files&quot;">​</a></h2><table tabindex="0"><thead><tr><th>File</th><th>Purpose</th></tr></thead><tbody><tr><td><a href="../../examples/knowledge-base/agent/agent.ts"><code>agent/agent.ts</code></a></td><td>Selects the local runtime and model.</td></tr><tr><td><a href="./../../examples/knowledge-base/agent/instructions.html"><code>agent/instructions.md</code></a></td><td>Sets the read-before-answer and save-after-learning policy.</td></tr><tr><td><a href="../../examples/knowledge-base/agent/lib/wiki-store.ts"><code>agent/lib/wiki-store.ts</code></a></td><td>Validates page ids, lists, reads, writes, and searches the knowledge base.</td></tr><tr><td><a href="../../examples/knowledge-base/agent/tools/wiki_read.ts"><code>agent/tools/wiki_read.ts</code></a></td><td>Reads one page or lists every page with titles and timestamps.</td></tr><tr><td><a href="../../examples/knowledge-base/agent/tools/wiki_search.ts"><code>agent/tools/wiki_search.ts</code></a></td><td>Searches titles and bodies with per-page match lines.</td></tr><tr><td><a href="../../examples/knowledge-base/agent/tools/wiki_write.ts"><code>agent/tools/wiki_write.ts</code></a></td><td>Creates or replaces a page and reports created versus updated.</td></tr><tr><td><a href="./../../examples/knowledge-base/agent/skills/wiki-conventions.html"><code>agent/skills/wiki-conventions.md</code></a></td><td>Names pages, shapes them, and dates every fact.</td></tr><tr><td><a href="./../../examples/knowledge-base/agent/schedules/gardener.html"><code>agent/schedules/gardener.md</code></a></td><td>Merges duplicates, rebuilds the index, and flags stale facts daily.</td></tr><tr><td><a href="../../examples/knowledge-base/agent/lib/wiki-store.test.ts"><code>agent/lib/wiki-store.test.ts</code></a></td><td>Unit-tests slug safety and store round-trips.</td></tr><tr><td><a href="../../examples/knowledge-base/agent/storage.ts"><code>agent/storage.ts</code></a></td><td>Persists sessions and events with <code>cursorHostedStorage</code>.</td></tr><tr><td><a href="../../examples/knowledge-base/evals/evals.config.ts"><code>evals/evals.config.ts</code></a></td><td>Caps eval run concurrency.</td></tr><tr><td><a href="../../examples/knowledge-base/evals/knowledge.eval.ts"><code>evals/knowledge.eval.ts</code></a></td><td>Seeds a temp knowledge base and gates recall, save, and no-write decisions.</td></tr></tbody></table><p>There is no authored channel, MCP connection, subagent, hook, or A/B experiment. The wiki directory is the durable knowledge store.</p><h2 id="prepare-the-example" tabindex="-1">Prepare the example <a class="header-anchor" href="#prepare-the-example" aria-label="Permalink to &quot;Prepare the example&quot;">​</a></h2><p>You need:</p><ul><li>Node 22.13 or newer.</li><li>An agent-runtime credential for model turns.</li></ul><p>Nothing else. The wiki is created on first write.</p><h2 id="validate-the-surface" tabindex="-1">Validate the surface <a class="header-anchor" href="#validate-the-surface" aria-label="Permalink to &quot;Validate the surface&quot;">​</a></h2><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;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/knowledge-base</span></span>
2
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/knowledge-base</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span></code></pre></div><p>The manifest should report three server tools, one skill, and one schedule.</p><h2 id="exercise-the-store-without-a-model-turn" tabindex="-1">Exercise the store without a model turn <a class="header-anchor" href="#exercise-the-store-without-a-model-turn" aria-label="Permalink to &quot;Exercise the store without a model turn&quot;">​</a></h2><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;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> wiki_write</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
3
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/knowledge-base</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
4
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;page&quot;:&quot;staging-database&quot;,&quot;content&quot;:&quot;# Staging database\\n\\n- Port: 6432 (recorded 2026-07-19)\\n&quot;}&#39;</span></span>
5
- <span class="line"></span>
6
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> wiki_search</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
7
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/knowledge-base</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
8
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;query&quot;:&quot;6432&quot;}&#39;</span></span>
9
- <span class="line"></span>
10
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> wiki_read</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/knowledge-base</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{}&#39;</span></span></code></pre></div><p>Invalid page ids fail fast. Try <code>{&quot;page&quot;:&quot;../escape&quot;}</code> and the tool returns the validation error instead of touching the filesystem.</p><h2 id="prove-recall-across-sessions" tabindex="-1">Prove recall across sessions <a class="header-anchor" href="#prove-recall-across-sessions" aria-label="Permalink to &quot;Prove recall across sessions&quot;">​</a></h2><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;"> examples/knowledge-base</span></span></code></pre></div><p>Teach it something in the playground:</p><blockquote><p>Remember: our staging database is Postgres at staging-db.internal.example.com, port 6432 via PgBouncer. Jane Doe owns it.</p></blockquote><p>The trace shows the conventions skill load, then <code>wiki_write</code> calls for <code>staging-database</code>, <code>people/jane-doe</code>, and <code>index</code>. Start a new session and ask:</p><blockquote><p>What port does our staging database use, and who owns it?</p></blockquote><p>The fresh session finds the answer with <code>wiki_search</code> and <code>wiki_read</code> and cites the pages. The conversation history is empty; the wiki is the source of truth.</p><h2 id="run-the-gardener" tabindex="-1">Run the gardener <a class="header-anchor" href="#run-the-gardener" aria-label="Permalink to &quot;Run the gardener&quot;">​</a></h2><p>The <code>gardener</code> schedule fires at 06:00 UTC and rewrites the wiki for consistency: merge near-duplicate pages, rebuild <code>index</code>, and flag facts older than 90 days. Under <code>agent-sdk dev</code>, timers don&#39;t auto-fire. Trigger it by hand:</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;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://127.0.0.1:3000/knowledge-base/v1/dev/schedules/gardener</span></span></code></pre></div><h2 id="run-the-evals" tabindex="-1">Run the evals <a class="header-anchor" href="#run-the-evals" aria-label="Permalink to &quot;Run the evals&quot;">​</a></h2><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;"> eval</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/knowledge-base</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --list</span></span>
11
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> eval</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/knowledge-base</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> knowledge/recall</span></span></code></pre></div><p>The eval file seeds a temp directory through <code>KNOWLEDGE_BASE_DIR</code> inside the cases, so the durable knowledge base never sees test data. <code>knowledge/recall</code> proves the fact comes from disk, not the conversation. <code>knowledge/save</code> gates the write decision, and <code>knowledge/no-write-on-ephemera</code> proves small talk stays out of the knowledge base.</p><h2 id="reuse-the-knowledge-base-pattern" tabindex="-1">Reuse the knowledge-base pattern <a class="header-anchor" href="#reuse-the-knowledge-base-pattern" aria-label="Permalink to &quot;Reuse the knowledge-base pattern&quot;">​</a></h2><p>Copy this shape when an agent needs durable, inspectable team knowledge:</p><ul><li>Resolve the storage root lazily behind an environment override.</li><li>Validate identifiers in the store, not in the prompt.</li><li>Put naming and structure conventions in a skill so writes stay consistent.</li><li>Add a consolidation schedule instead of letting pages rot.</li></ul><h2 id="where-to-go-next" tabindex="-1">Where to go next <a class="header-anchor" href="#where-to-go-next" aria-label="Permalink to &quot;Where to go next&quot;">​</a></h2><ul><li><a href="./../reference/tools.html">Tools</a></li><li><a href="./../reference/skills.html">Skills</a></li><li><a href="./../reference/schedules.html">Schedules</a></li><li><a href="./../evals.html">Evals</a></li></ul>`,43)])])}const g=a(n,[["render",l]]);export{k as __pageData,g as default};
@@ -1 +0,0 @@
1
- import{_ as a,c as s,o as t,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Build a team knowledge base through conversation","description":"Teach an agent about people, systems, decisions, and preferences; store that knowledge as markdown and retrieve it in fresh sessions.","frontmatter":{"title":"Build a team knowledge base through conversation","description":"Teach an agent about people, systems, decisions, and preferences; store that knowledge as markdown and retrieve it in fresh sessions."},"headers":[],"relativePath":"example-agents/knowledge-base.md","filePath":"example-agents/knowledge-base.md"}'),n={name:"example-agents/knowledge-base.md"};function l(o,e,d,r,h,p){return t(),s("div",null,[...e[0]||(e[0]=[i("",43)])])}const g=a(n,[["render",l]]);export{k as __pageData,g as default};
@@ -1,10 +0,0 @@
1
- import{_ as t,c as a,o as s,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Investigate every alert in its own Slack thread","description":"Watch a bot-fed alerts channel, react when the agent locks in, coalesce thread chatter behind a quiet window, and let the agent schedule its own re-checks.","frontmatter":{"title":"Investigate every alert in its own Slack thread","description":"Watch a bot-fed alerts channel, react when the agent locks in, coalesce thread chatter behind a quiet window, and let the agent schedule its own re-checks."},"headers":[],"relativePath":"example-agents/oncall.md","filePath":"example-agents/oncall.md"}'),n={name:"example-agents/oncall.md"};function l(o,e,h,r,d,c){return s(),a("div",null,[...e[0]||(e[0]=[i(`<h1 id="investigate-every-alert-in-its-own-slack-thread" tabindex="-1">Investigate every alert in its own Slack thread <a class="header-anchor" href="#investigate-every-alert-in-its-own-slack-thread" aria-label="Permalink to &quot;Investigate every alert in its own Slack thread&quot;">​</a></h1><p>This agent is an on-call teammate. Alert feeds post into an alerts channel as bots. Each new alert dispatches an investigation session pinned to that post&#39;s thread: the agent reacts 👀 the moment it locks in, investigates immediately, and posts brief findings backed by evidence it observed. Replies in the thread reach it only after the thread has been quiet for about a minute, and reminder tools let it wake itself later to re-check a baseline or confirm an alert cleared.</p><p>Use this example when alerts land in Slack and you want one thread-scoped investigation per alert, with an agent that paces its own engagement instead of answering every message.</p><p><a href="./../../examples/oncall/">Browse the current alert-investigator source.</a></p><h2 id="follow-an-alert" tabindex="-1">Follow an alert <a class="header-anchor" href="#follow-an-alert" aria-label="Permalink to &quot;Follow an alert&quot;">​</a></h2><ol><li>An alert feed (Alertmanager, PagerDuty, Datadog) posts a new top-level message in the watched alerts channel.</li><li>The channel watch accepts it. <code>includeBotPosts</code> lets bot authors through; the agent&#39;s own posts always stay dropped.</li><li>The handler reacts 👀 on the alert post and sets &quot;Investigating…&quot; typing. The reaction is the lock-in signal: this alert has an owner.</li><li>The Agent SDK creates a session keyed to the alert&#39;s thread and dispatches immediately. New alerts get no debounce.</li><li>The agent reads the alert, gathers evidence, and posts findings to the thread once it has a hypothesis.</li><li>People discuss in the thread. Replies buffer per thread and dispatch as one coalesced follow-up after roughly a minute of quiet.</li><li>The agent arms reminders for anything that needs time and posts interim updates when new evidence changes the picture.</li></ol><p>Mentions and DMs skip the watch entirely and behave like ordinary chat.</p><h2 id="map-the-files" tabindex="-1">Map the files <a class="header-anchor" href="#map-the-files" aria-label="Permalink to &quot;Map the files&quot;">​</a></h2><table tabindex="0"><thead><tr><th>File</th><th>Purpose</th></tr></thead><tbody><tr><td><a href="../../examples/oncall/agent/agent.ts"><code>agent/agent.ts</code></a></td><td>Names the agent and keeps harness workspaces outside any monorepo checkout.</td></tr><tr><td><a href="./../../examples/oncall/agent/instructions.html"><code>agent/instructions.md</code></a></td><td>Engagement rules, the investigation loop, and the message discipline.</td></tr><tr><td><a href="../../examples/oncall/agent/channels/slack-app.ts"><code>agent/channels/slack-app.ts</code></a></td><td>Dedicated Socket Mode app: watch configuration and handler wiring.</td></tr><tr><td><a href="../../examples/oncall/agent/lib/alert-watch.ts"><code>agent/lib/alert-watch.ts</code></a></td><td>The engagement policy: lock in on new alerts, coalesce replies.</td></tr><tr><td><a href="../../examples/oncall/agent/lib/thread-debounce.ts"><code>agent/lib/thread-debounce.ts</code></a></td><td>Per-thread quiet window.</td></tr><tr><td><a href="../../examples/oncall/agent/lib/alerts.ts"><code>agent/lib/alerts.ts</code></a></td><td>Dispatch classification, prompt building, and thread addressing.</td></tr><tr><td><a href="../../examples/oncall/agent/lib/slack-api.ts"><code>agent/lib/slack-api.ts</code></a></td><td>Reactions and thread posts on this agent&#39;s own token pair.</td></tr><tr><td><a href="../../examples/oncall/agent/tools/reminders_create.ts"><code>agent/tools/reminders_create.ts</code></a></td><td>Self-scheduled wakes bound to the thread (plus <code>reminders_list</code> and <code>reminders_cancel</code>).</td></tr><tr><td><a href="../../examples/oncall/agent/tools/post_thread_update.ts"><code>agent/tools/post_thread_update.ts</code></a></td><td>Interim updates to the thread mid-turn.</td></tr><tr><td><a href="../../examples/oncall/agent/storage.ts"><code>agent/storage.ts</code></a></td><td>Persists sessions and events with <code>cursorHostedStorage</code>.</td></tr><tr><td><a href="../../examples/oncall/evals/evals.config.ts"><code>evals/evals.config.ts</code></a></td><td>Caps eval run concurrency.</td></tr><tr><td><a href="../../examples/oncall/evals/smoke.eval.ts"><code>evals/smoke.eval.ts</code></a></td><td>Checks identity and the reminder-tool route.</td></tr></tbody></table><h2 id="let-bot-posts-through-the-watch" tabindex="-1">Let bot posts through the watch <a class="header-anchor" href="#let-bot-posts-through-the-watch" aria-label="Permalink to &quot;Let bot posts through the watch&quot;">​</a></h2><p>Channel watching drops bot-authored posts by default so two agents can never feed each other. Alert channels invert the assumption: the posts worth watching come from bots. <code>channelPosts.includeBotPosts</code> opts in per channel:</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;">engagement</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
2
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> channelPosts</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
3
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> allow</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;#alerts&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
4
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> posts</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;all&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
5
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> includeBotPosts</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
6
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
7
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">},</span></span></code></pre></div><p>Loop safety survives the opt-in. The pack matches the watching app&#39;s own posts by the <code>bot_id</code> and bot user id from <code>auth.test</code> and drops them, so the agent&#39;s findings never re-dispatch it. Posts that mention the bot stay on the mention path.</p><p><code>posts: &quot;all&quot;</code> also delivers thread replies. The handler, not the pack, decides their pace.</p><h2 id="pace-the-engagement" tabindex="-1">Pace the engagement <a class="header-anchor" href="#pace-the-engagement" aria-label="Permalink to &quot;Pace the engagement&quot;">​</a></h2><p>The example runs two rhythms:</p><ul><li>A new alert dispatches immediately.</li><li>Thread replies produce one engagement per lull.</li></ul><p>The pack&#39;s <code>debounceMs</code> is per message; it exists to let edits settle. This agent needs a per-thread window instead, so the handler owns it (<a href="../../examples/oncall/agent/lib/thread-debounce.ts"><code>lib/thread-debounce.ts</code></a>). Every reply restarts a 60-second timer keyed by thread. Superseded waiters resolve <code>null</code> and the handler returns <code>null</code> for them. When the thread goes quiet, the newest waiter receives the whole batch and dispatches one follow-up that lists every message with mentionable attribution.</p><p>Two details make the window matter. A follow-up that arrives while a turn runs preempts that turn (latest message wins), so engaging per message would keep cancelling the investigation. And @mentions bypass the window through Slack&#39;s mention path, so a person who needs the agent now still gets it now.</p><h2 id="schedule-your-own-re-checks" tabindex="-1">Schedule your own re-checks <a class="header-anchor" href="#schedule-your-own-re-checks" aria-label="Permalink to &quot;Schedule your own re-checks&quot;">​</a></h2><p>Investigations rarely finish in one pass. A baseline comparison needs 20 minutes of data. An alert that cleared may re-fire. The example hands the model three tools over <code>host.reminders</code>:</p><ul><li><code>reminders_create</code> arms a one-shot (<code>delay: &quot;20m&quot;</code>) or recurring (<code>every: &quot;30m&quot;</code> with a plain-language stop condition) wake bound to the thread&#39;s conversation.</li><li><code>reminders_list</code> shows the thread&#39;s standing watches.</li><li><code>reminders_cancel</code> disarms one, and refuses ids that belong to another thread&#39;s conversation.</li></ul><p>When a reminder fires, its prompt returns to the same session as a follow-up turn, and the reply lands in the alert thread. The instructions keep wake prompts generic (re-read live state instead of replaying stale numbers) and wake replies to one line, for example &quot;re-checked p99 on api-gateway: 120ms, back at baseline, cancelling the watch.&quot;</p><p>Keep these tool filenames if you copy the design: the framework&#39;s reminder fire prompt tells the model to call <code>reminders_cancel</code> by name when a stop condition is set.</p><h2 id="alert-people-mid-investigation" tabindex="-1">Alert people mid-investigation <a class="header-anchor" href="#alert-people-mid-investigation" aria-label="Permalink to &quot;Alert people mid-investigation&quot;">​</a></h2><p>The final reply of each turn posts to the thread on its own. <code>post_thread_update</code> covers evidence that shouldn&#39;t wait for the turn to finish: it posts a one-or-two-sentence update through the agent&#39;s token, with <code>&lt;@USERID&gt;</code> mentions for the people who need to act. The instructions restrict it to changes in hypothesis, severity, or blast radius. Progress narration doesn&#39;t qualify.</p><h2 id="connect-the-slack-app" tabindex="-1">Connect the Slack app <a class="header-anchor" href="#connect-the-slack-app" aria-label="Permalink to &quot;Connect the Slack app&quot;">​</a></h2><p>Channel watching is Socket Mode only, so this example uses a dedicated app:</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;"> slack</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> create</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/oncall</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --name</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;Oncall&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --channel-posts</span></span>
8
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> slack</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> doctor</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --prefix</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ONCALL</span></span></code></pre></div><p><code>--channel-posts</code> prefills channel-watch events (<code>message.channels</code> / <code>message.groups</code>). Invite the bot to each watched channel after the wizard finishes.</p><p><code>ONCALL_ALERTS_CHANNELS</code> sets the watch list as comma-separated ids or <code>#names</code>. It defaults to <code>#alerts</code>.</p><p>Wire observability MCP servers under <code>agent/mcp-connections/</code> so evidence gathering reaches your logs, metrics, and dashboards. The example ships none; without them the agent works from the alert text, its links, and the thread.</p><h2 id="validate-and-start-the-server" tabindex="-1">Validate and start the server <a class="header-anchor" href="#validate-and-start-the-server" aria-label="Permalink to &quot;Validate and start the server&quot;">​</a></h2><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;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/oncall</span></span>
9
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/oncall</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span>
10
- <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;"> examples/oncall</span></span></code></pre></div><p>The info output lists four server tools and the watched channel on the <code>slack-app</code> channel. Missing tokens leave that channel idle without stopping the server.</p><p>In dev mode, reminder timers don&#39;t auto-fire. List and fire them by hand through the dev routes described in <a href="./../reference/schedules.html#dispatch-and-dev-mode">Schedules and reminders</a>.</p><h2 id="test-the-policy-without-slack" tabindex="-1">Test the policy without Slack <a class="header-anchor" href="#test-the-policy-without-slack" aria-label="Permalink to &quot;Test the policy without Slack&quot;">​</a></h2><p>The engagement policy is plain code with unit tests:</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;">pnpm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> exec</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> vitest</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/oncall</span></span></code></pre></div><p>The integration test drives a synthetic Events API delivery through the real parse, watch, and dispatch plumbing. It asserts a bot alert dispatches pinned to its thread after the lock-in reaction, the agent&#39;s own posts never loop, and replies coalesce behind the quiet window.</p><p>The smoke eval spends a model turn:</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;"> eval</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/oncall</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> smoke</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span></code></pre></div><p>It checks identity and the reminder-tool route lexically. It doesn&#39;t prove Slack delivery or reaction behavior; the unit tests cover the dispatch side, and a live check needs the dedicated app connected.</p><h2 id="build-an-alert-investigator" tabindex="-1">Build an alert investigator <a class="header-anchor" href="#build-an-alert-investigator" aria-label="Permalink to &quot;Build an alert investigator&quot;">​</a></h2><p>Use this structure when a bot feed should drive thread-scoped work:</p><ol><li>Watch the feed channel with <code>includeBotPosts: true</code> and a narrow allowlist.</li><li>Acknowledge on the triggering post before dispatching, so people see ownership without opening the thread.</li><li>Dispatch new items immediately; coalesce thread chatter behind a per-thread quiet window.</li><li>Give the agent reminder tools for anything that needs time, and make cancel discipline part of the instructions.</li><li>Keep every posted message brief and tied to evidence the agent saw.</li></ol><h2 id="where-to-go-next" tabindex="-1">Where to go next <a class="header-anchor" href="#where-to-go-next" aria-label="Permalink to &quot;Where to go next&quot;">​</a></h2><ul><li><a href="./../guides/slack.html">Slack</a></li><li><a href="./../reference/schedules.html">Schedules and reminders</a></li><li><a href="./../reference/tools.html">Tools</a></li><li><a href="./benny.html">Playbook router</a> for the human-post variant of channel watching</li></ul>`,48)])])}const g=t(n,[["render",l]]);export{k as __pageData,g as default};
@@ -1 +0,0 @@
1
- import{_ as t,c as a,o as s,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Investigate every alert in its own Slack thread","description":"Watch a bot-fed alerts channel, react when the agent locks in, coalesce thread chatter behind a quiet window, and let the agent schedule its own re-checks.","frontmatter":{"title":"Investigate every alert in its own Slack thread","description":"Watch a bot-fed alerts channel, react when the agent locks in, coalesce thread chatter behind a quiet window, and let the agent schedule its own re-checks."},"headers":[],"relativePath":"example-agents/oncall.md","filePath":"example-agents/oncall.md"}'),n={name:"example-agents/oncall.md"};function l(o,e,h,r,d,c){return s(),a("div",null,[...e[0]||(e[0]=[i("",48)])])}const g=t(n,[["render",l]]);export{k as __pageData,g as default};
@@ -1,19 +0,0 @@
1
- import{_ as t,c as s,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const u=JSON.parse('{"title":"Run staged security reviews from GitHub events","description":"Orchestrate parallel reviewer agents, streamed triage, deterministic stages, live playground progress, durable sessions, and severity A/B metrics.","frontmatter":{"title":"Run staged security reviews from GitHub events","description":"Orchestrate parallel reviewer agents, streamed triage, deterministic stages, live playground progress, durable sessions, and severity A/B metrics."},"headers":[],"relativePath":"example-agents/security-reviewer.md","filePath":"example-agents/security-reviewer.md"}'),r={name:"example-agents/security-reviewer.md"};function n(l,e,o,h,d,p){return a(),s("div",null,[...e[0]||(e[0]=[i(`<h1 id="run-staged-security-reviews-from-github-events" tabindex="-1">Run staged security reviews from GitHub events <a class="header-anchor" href="#run-staged-security-reviews-from-github-events" aria-label="Permalink to &quot;Run staged security reviews from GitHub events&quot;">​</a></h1><p>Security Reviewer turns a pull request into a staged host-side review. One tool prepares the diff and selects modules. A second fans out specialized reviewers and triages candidates as they arrive. A third deduplicates the confirmed findings, writes artifacts, and may publish a GitHub review.</p><p>Use this example when the workflow needs several model workers, but the host must own orchestration, progress, artifacts, and the final write.</p><p>Source lives under <a href="./../../../../factory/security-reviewer/"><code>factory/security-reviewer/</code></a> (factory agent, not under <code>examples/</code>).</p><p>Want one model turn and one comment? Scaffold the <a href="./../templates/security-reviewer.html">security-reviewer template</a>.</p><p><a href="./../../../../factory/security-reviewer/">Browse the Security Reviewer source.</a></p><h2 id="run-a-three-stage-host-pipeline" tabindex="-1">Run a three-stage host pipeline <a class="header-anchor" href="#run-a-three-stage-host-pipeline" aria-label="Permalink to &quot;Run a three-stage host pipeline&quot;">​</a></h2><p>Security Reviewer is a pipeline, not one long agent turn:</p><table tabindex="0"><thead><tr><th>Stage</th><th>Tool</th><th>Result</th></tr></thead><tbody><tr><td>Prepare</td><td><code>prepare_review</code></td><td>Fetch metadata and diff, create a <code>runId</code>, and select security modules.</td></tr><tr><td>Review and triage</td><td><code>run_reviewers</code></td><td>Run module reviewers in parallel and start triage as each candidate arrives.</td></tr><tr><td>Finalize</td><td><code>finalize_review</code></td><td>Apply thresholds, deduplicate findings, write artifacts, and optionally post a review.</td></tr></tbody></table><p><code>run_triage</code> remains available as a compatibility stage. In the normal flow, triage has already completed inside <code>run_reviewers</code>, so it reports existing results. If candidates exist without triage output, it starts triage workers and writes their state.</p><p>The configured root agent chooses and sequences tools in chat. The review workers use a model selected by the host pipeline. They are created programmatically with the agent SDK, not discovered from <code>agent/subagents/</code>.</p><h2 id="follow-a-github-review" tabindex="-1">Follow a GitHub review <a class="header-anchor" href="#follow-a-github-review" aria-label="Permalink to &quot;Follow a GitHub review&quot;">​</a></h2><ol><li>A pull request event starts a review and opens a playground session.</li><li>The playground shows reviewer and triage progress.</li><li>Confirmed findings appear in the PR review.</li><li>A GitHub Check reports completion or a processing failure.</li></ol><h2 id="map-the-framework-features" tabindex="-1">Map the framework features <a class="header-anchor" href="#map-the-framework-features" aria-label="Permalink to &quot;Map the framework features&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Capability</th><th>Source</th><th>Role</th></tr></thead><tbody><tr><td>Root agent</td><td><a href="../../../../factory/security-reviewer/agent/agent.ts"><code>agent/agent.ts</code></a>, <a href="./../../../../factory/security-reviewer/agent/instructions.html"><code>agent/instructions.md</code></a></td><td>Configure local chat and explain the three-stage contract.</td></tr><tr><td>Server tools</td><td><a href="./../../../../factory/security-reviewer/agent/tools/"><code>agent/tools/</code></a></td><td>Expose each review stage to chat and host orchestration.</td></tr><tr><td>GitHub channel</td><td><a href="../../../../factory/security-reviewer/agent/channels/github.ts"><code>agent/channels/github.ts</code></a></td><td>Filter wakes, run background tasks, and publish status.</td></tr><tr><td>Progress channel</td><td><a href="../../../../factory/security-reviewer/agent/channels/asr-progress.ts"><code>agent/channels/asr-progress.ts</code></a></td><td>Serve live reviewer and triage state by <code>runId</code>.</td></tr><tr><td>Playground renderer</td><td><a href="./../../../../factory/security-reviewer/agent/playground/tools/run_reviewers.tsx.html"><code>agent/playground/tools/run_reviewers.tsx</code></a></td><td>Replace the generic tool chip with live module rows.</td></tr><tr><td>SDK review pipeline</td><td><a href="../../../../factory/security-reviewer/agent/lib/review-stages.ts"><code>review-stages.ts</code></a>, <a href="../../../../packages/security-review-lib/src/index.ts"><code>@anysphere/security-review-lib</code></a></td><td>Select modules, call model workers, triage, deduplicate, and write artifacts.</td></tr><tr><td>Storage</td><td><a href="../../../../factory/security-reviewer/agent/storage.ts"><code>agent/storage.ts</code></a></td><td>Persist framework sessions with <code>cursorHostedStorage</code> (lazy restore).</td></tr><tr><td>A/B</td><td><a href="../../../../factory/security-reviewer/agent/ab.ts"><code>agent/ab.ts</code></a></td><td>Compare all-severity versus high-only GitHub comments.</td></tr><tr><td>Eval</td><td><a href="./../../../../factory/security-reviewer/evals/"><code>evals/</code></a></td><td>Check stage-tool presence against a pinned sample.</td></tr></tbody></table><p>There is no Slack channel, authored skill, discovered subagent, MCP connection, schedule, reminder, hook, tool approval, or cloud runtime.</p><h2 id="prepare-the-host" tabindex="-1">Prepare the host <a class="header-anchor" href="#prepare-the-host" aria-label="Permalink to &quot;Prepare the host&quot;">​</a></h2><p>You need:</p><ul><li>Node 22.13 or newer.</li><li>An agent-runtime credential for the root turn and review workers.</li><li>GitHub read access for preparation.</li><li>GitHub write access for webhook-driven reviews and Checks.</li></ul><p>The pipeline exposes settings for:</p><ul><li>the worker model,</li><li>reviewer and triage parallelism,</li><li>reviewer, triage, duplicate-gate, and final-dedupe timeouts, and</li><li>prior-comment loading.</li></ul><p>The active names live beside the orchestration in <a href="../../../../factory/security-reviewer/agent/lib/review-stages.ts"><code>review-stages.ts</code></a>.</p><h2 id="validate-the-discovered-agent" tabindex="-1">Validate the discovered agent <a class="header-anchor" href="#validate-the-discovered-agent" aria-label="Permalink to &quot;Validate the discovered agent&quot;">​</a></h2><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;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span></span>
2
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span>
3
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> eval</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --list</span></span></code></pre></div><p><code>validate</code> should pass. <code>info</code> and <code>eval --list</code> should match the capabilities mapped above.</p><h2 id="know-the-chat-path-s-write-boundary" tabindex="-1">Know the chat path&#39;s write boundary <a class="header-anchor" href="#know-the-chat-path-s-write-boundary" aria-label="Permalink to &quot;Know the chat path&#39;s write boundary&quot;">​</a></h2><p>In chat, the root instructions ask the model to use this order:</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>prepare_review -&gt; run_reviewers -&gt; finalize_review</span></span></code></pre></div><p>They also ask the model to set <code>postComment: true</code> only on request. This is prompt policy, not a deterministic safety gate. The model chooses tool arguments, and <code>finalize_review</code> has no human approval. Use the direct stage calls below when a no-post proof must be enforced.</p><h2 id="call-stages-directly-without-publishing" tabindex="-1">Call stages directly without publishing <a class="header-anchor" href="#call-stages-directly-without-publishing" aria-label="Permalink to &quot;Call stages directly without publishing&quot;">​</a></h2><p>Call each stage and pass <code>postComment: false</code> yourself:</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;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> prepare_review</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
4
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
5
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;prUrl&quot;:&quot;https://github.com/owner/repo/pull/123&quot;}&#39;</span></span>
6
- <span class="line"></span>
7
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run_reviewers</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
8
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
9
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;runId&quot;:&quot;&lt;run-id&gt;&quot;}&#39;</span></span>
10
- <span class="line"></span>
11
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> finalize_review</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
12
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
13
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;runId&quot;:&quot;&lt;run-id&gt;&quot;,&quot;postComment&quot;:false}&#39;</span></span></code></pre></div><p>Review state lives under the project&#39;s run-artifact directory, so later stages can open the prepared <code>runId</code>.</p><div class="caution custom-block github-alert"><p class="custom-block-title">CAUTION</p><p><code>finalize_review</code> with <code>postComment: true</code> writes to GitHub. The webhook path always requests that write. Chat instructions alone don&#39;t prevent it.</p></div><h2 id="watch-parallel-work-in-the-playground" tabindex="-1">Watch parallel work in the playground <a class="header-anchor" href="#watch-parallel-work-in-the-playground" aria-label="Permalink to &quot;Watch parallel work in the playground&quot;">​</a></h2><p>Run the dev server:</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;"> ../../factory/security-reviewer</span></span></code></pre></div><p>Open the printed playground and start a review. The custom <code>run_reviewers</code> renderer polls the progress channel&#39;s <code>GET /:runId</code> route.</p><p>It refreshes every 500 ms while the stage runs. Each row shows a reviewer module&#39;s state, candidates, reviewed areas, and failure. A second section shows triage jobs and confirmed or rejected counts.</p><p>This is an authored playground extension. The Agent SDK discovers it by the tool name, so the generic <code>run_reviewers</code> chip becomes a domain-specific view without changing the framework playground.</p><h2 id="fan-out-reviewers-while-triage-starts" tabindex="-1">Fan out reviewers while triage starts <a class="header-anchor" href="#fan-out-reviewers-while-triage-starts" aria-label="Permalink to &quot;Fan out reviewers while triage starts&quot;">​</a></h2><p>Module selection uses repository and path rules. The current module set covers:</p><ul><li>agent tooling trust boundaries,</li><li>privileged service RPCs,</li><li>product-specific security risks,</li><li>dependency and supply-chain changes,</li><li>deployment and infrastructure code,</li><li>filesystem and workspace boundaries,</li><li>privacy, and</li><li>general security review.</li></ul><p>Selected modules may run more than once. Candidates pass through a duplicate gate, then bounded triage. Reviewer or triage failures can produce partial results. A final dedupe failure stops finalization.</p><p>The pipeline writes JSONL journals as work completes. Final artifacts include the review bundle, patch, reviewer outputs, candidates, triage decisions, findings, accounting, and audit events.</p><h2 id="separate-session-storage-from-review-artifacts" tabindex="-1">Separate session storage from review artifacts <a class="header-anchor" href="#separate-session-storage-from-review-artifacts" aria-label="Permalink to &quot;Separate session storage from review artifacts&quot;">​</a></h2><p><code>defineStorage</code> + <code>cursorHostedStorage</code> sends Agent SDK session and event records to Cursor-hosted Bugbot storage through the control-plane proxy. Security Reviewer sets <code>restore: &quot;off&quot;</code> so startup doesn&#39;t load old review sessions in bulk. A continuation lookup can still fetch a needed session.</p><p>The staged review files are separate from session storage. Session-store durability doesn&#39;t preserve those files. All stages for one <code>runId</code> must see the same filesystem.</p><p>This split is useful when conversation history needs shared durability but large review artifacts belong on attached storage or an object store.</p><h2 id="compare-live-comment-variants" tabindex="-1">Compare live comment variants <a class="header-anchor" href="#compare-live-comment-variants" aria-label="Permalink to &quot;Compare live comment variants&quot;">​</a></h2><p>The comment-severity experiment uses sticky session assignment with a 5% holdout:</p><ul><li><code>control</code> posts every finding.</li><li><code>treatment</code> posts only high and critical findings.</li></ul><p>Finalization enforces the comment filter. The treatment also adds an instruction overlay asking chat and playground summaries to lead with high and critical findings. Full artifacts, <code>finalResponse</code>, and finding counts still include every finding. Stage-tool counters appear in the playground A/B view. Local sample and snapshot files persist under <code>.agent-serve/</code>.</p><p>When a treatment session has only low or medium findings, the filtered review body currently says no vulnerabilities were found even though artifacts and status retain findings. Account for that mismatch before using this experiment as a publishing policy.</p><p>Eval sessions skip A/B enrollment.</p><h2 id="test-the-github-channel-carefully" tabindex="-1">Test the GitHub channel carefully <a class="header-anchor" href="#test-the-github-channel-carefully" aria-label="Permalink to &quot;Test the GitHub channel carefully&quot;">​</a></h2><p>The channel uses the host&#39;s Cursor account repository scope. It wakes on <code>opened</code> and <code>synchronize</code>, skips drafts, and posts its own GitHub Check.</p><p>Inspect its event surface:</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;"> github</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> events</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
14
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
15
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span></code></pre></div><p>Replay reaches the full publishing path:</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:#24292E;--shiki-dark:#E1E4E8;">TEST_PR_URL</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">https://github.com/your-org/allowlisted-test-repo/pull/123</span></span>
16
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> github</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> replay</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
17
- <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$TEST_PR_URL</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
18
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
19
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --action</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> opened</span></span></code></pre></div><p>Set <code>TEST_PR_URL</code> to a PR in the channel&#39;s configured repository allowlist. Run the command only against a PR intended for test reviews. It posts a GitHub Check and may post findings.</p><h2 id="inspect-the-eval-before-running-it" tabindex="-1">Inspect the eval before running it <a class="header-anchor" href="#inspect-the-eval-before-running-it" aria-label="Permalink to &quot;Inspect the eval before running it&quot;">​</a></h2><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;"> eval</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ../../factory/security-reviewer</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --list</span></span></code></pre></div><p>The case gates the review flow and prevents comment posting. It still fetches the live PR, so it needs GitHub access.</p><h2 id="build-another-staged-pipeline" tabindex="-1">Build another staged pipeline <a class="header-anchor" href="#build-another-staged-pipeline" aria-label="Permalink to &quot;Build another staged pipeline&quot;">​</a></h2><p>Use staged host orchestration when:</p><ul><li>each phase needs its own timeout and artifact,</li><li>model workers should run in bounded parallel,</li><li>later work can start as soon as partial results arrive,</li><li>a webhook must acknowledge before the work finishes, or</li><li>operators need live progress beyond one tool spinner.</li></ul><p>Keep external writes in finalization. Pass a <code>runId</code> between stages, journal progress before publishing, and make partial-worker failures visible in the result.</p><h2 id="where-to-go-next" tabindex="-1">Where to go next <a class="header-anchor" href="#where-to-go-next" aria-label="Permalink to &quot;Where to go next&quot;">​</a></h2><ul><li><a href="./../guides/github.html">GitHub</a></li><li><a href="./../reference/tools.html">Tools</a></li><li><a href="./../reference/channels.html">Channels</a></li><li><a href="./../reference/playground.html">Playground</a></li><li><a href="./../storage.html">Storage</a></li><li><a href="./../ab.html">Live A/B metrics</a></li><li><a href="./../evals.html">Evals</a></li></ul>`,71)])])}const g=t(r,[["render",n]]);export{u as __pageData,g as default};
@@ -1 +0,0 @@
1
- import{_ as t,c as s,o as a,ag as i}from"./chunks/framework.BCISBCiQ.js";const u=JSON.parse('{"title":"Run staged security reviews from GitHub events","description":"Orchestrate parallel reviewer agents, streamed triage, deterministic stages, live playground progress, durable sessions, and severity A/B metrics.","frontmatter":{"title":"Run staged security reviews from GitHub events","description":"Orchestrate parallel reviewer agents, streamed triage, deterministic stages, live playground progress, durable sessions, and severity A/B metrics."},"headers":[],"relativePath":"example-agents/security-reviewer.md","filePath":"example-agents/security-reviewer.md"}'),r={name:"example-agents/security-reviewer.md"};function n(l,e,o,h,d,p){return a(),s("div",null,[...e[0]||(e[0]=[i("",71)])])}const g=t(r,[["render",n]]);export{u as __pageData,g as default};
@@ -1,5 +0,0 @@
1
- import{_ as a,c as t,o as s,ag as n}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Put a minimal agent in Slack","description":"Use account-linked Slack routing, thread continuity, identity, and suggested prompts with one small channel.","frontmatter":{"title":"Put a minimal agent in Slack","description":"Use account-linked Slack routing, thread continuity, identity, and suggested prompts with one small channel."},"headers":[],"relativePath":"example-agents/slack-agent.md","filePath":"example-agents/slack-agent.md"}'),i={name:"example-agents/slack-agent.md"};function l(o,e,h,r,d,c){return s(),t("div",null,[...e[0]||(e[0]=[n(`<h1 id="put-a-minimal-agent-in-slack" tabindex="-1">Put a minimal agent in Slack <a class="header-anchor" href="#put-a-minimal-agent-in-slack" aria-label="Permalink to &quot;Put a minimal agent in Slack&quot;">​</a></h1><p>Slack agent is the smallest channel example. It has one runtime config, one instruction file, and one authored channel. A teammate mentions the agent, the local runtime harness runs a turn, and the answer returns to the same Slack thread.</p><p>Use it to learn the minimum needed for a Slack agent before adding tools, workflows, or a dedicated app.</p><p><a href="./../../examples/slack-agent/">Browse the Slack agent source.</a></p><h2 id="keep-the-slack-channel-small" tabindex="-1">Keep the Slack channel small <a class="header-anchor" href="#keep-the-slack-channel-small" aria-label="Permalink to &quot;Keep the Slack channel small&quot;">​</a></h2><p>Slack agent delegates transport details to the host connection. The authored file selects the account-linked transport, gives the agent a single-token router name and icon, and supplies suggested prompts.</p><p>The complete channel lives in <a href="../../examples/slack-agent/agent/channels/slack.ts"><code>agent/channels/slack.ts</code></a>. The framework supplies message intake, thread-scoped sessions, delivery, status updates, and suggested prompts.</p><h2 id="follow-a-slack-message" tabindex="-1">Follow a Slack message <a class="header-anchor" href="#follow-a-slack-message" aria-label="Permalink to &quot;Follow a Slack message&quot;">​</a></h2><ol><li>A user mentions the agent or sends the host app a direct message naming it.</li><li>The Slack relay selects this channel by its single-token <code>agentName</code>.</li><li>The Agent SDK maps the Slack channel and thread timestamp to a continuation key.</li><li>The local harness runs with <a href="./../../examples/slack-agent/agent/instructions.html"><code>instructions.md</code></a>.</li><li>The response returns to the triggering thread.</li><li>A later message in the same thread resumes the durable session.</li></ol><p>The prompt asks for concise threaded replies. It doesn&#39;t define domain policy or tool routing.</p><h2 id="map-the-slack-agent-files" tabindex="-1">Map the Slack agent files <a class="header-anchor" href="#map-the-slack-agent-files" aria-label="Permalink to &quot;Map the Slack agent files&quot;">​</a></h2><table tabindex="0"><thead><tr><th>File</th><th>Purpose</th></tr></thead><tbody><tr><td><a href="../../examples/slack-agent/package.json"><code>package.json</code></a></td><td>Declares the example package and Agent SDK dependency.</td></tr><tr><td><a href="../../examples/slack-agent/agent/agent.ts"><code>agent/agent.ts</code></a></td><td>Names the agent and selects the model. The omitted <code>runtime</code> defaults to local.</td></tr><tr><td><a href="./../../examples/slack-agent/agent/instructions.html"><code>agent/instructions.md</code></a></td><td>Sets the always-on response style.</td></tr><tr><td><a href="../../examples/slack-agent/agent/channels/slack.ts"><code>agent/channels/slack.ts</code></a></td><td>Connects the signed-in host account to Slack.</td></tr><tr><td><a href="../../examples/slack-agent/agent/storage.ts"><code>agent/storage.ts</code></a></td><td>Persists sessions and events with <code>cursorHostedStorage</code>.</td></tr></tbody></table><p>There are no authored tools, skills, MCP connections, subagents, schedules, hooks, A/B experiments, or evals. This small surface is the lesson.</p><h2 id="connect-the-host" tabindex="-1">Connect the host <a class="header-anchor" href="#connect-the-host" aria-label="Permalink to &quot;Connect the host&quot;">​</a></h2><p>You need:</p><ul><li>Node 22.13 or newer.</li><li>An agent-runtime credential.</li><li>Slack connected through the selected channel transport.</li></ul><p>Sign in and confirm the active account:</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;"> login</span></span>
2
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> whoami</span></span></code></pre></div><p>The selected transport owns Slack credential setup. See the <a href="./../guides/slack.html">Slack guide</a> for account-linked and dedicated-app options.</p><h2 id="validate-and-start-the-server" tabindex="-1">Validate and start the server <a class="header-anchor" href="#validate-and-start-the-server" aria-label="Permalink to &quot;Validate and start the server&quot;">​</a></h2><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;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/slack-agent</span></span>
3
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/slack-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</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;"> dev</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/slack-agent</span></span></code></pre></div><p>The dev command prints the playground URL. It also mounts the Slack channel and waits for relayed messages.</p><p>In Slack, address the configured host app and router name, then send:</p><blockquote><p><code>&lt;host-app mention&gt; &lt;router name&gt;</code> Explain the Agent SDK in three bullets.</p></blockquote><p>Reply in the generated thread:</p><blockquote><p>Make the second bullet simpler.</p></blockquote><p>The second message reaches the same session. You can open that session in the playground to inspect the received message, model events, final reply, and usage.</p><h2 id="test-without-slack" tabindex="-1">Test without Slack <a class="header-anchor" href="#test-without-slack" aria-label="Permalink to &quot;Test without Slack&quot;">​</a></h2><p>Every project gets the built-in HTTP channel even when no HTTP file exists. Run a one-shot turn through it:</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;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/slack-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
5
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --message</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;Explain the Agent SDK simply.&quot;</span></span></code></pre></div><p>The same project also exposes an MCP endpoint. Since this agent has no server tools, its MCP surface contains <code>ask</code> and <code>check</code>, but not <code>call_tool</code>.</p><p>These automatic surfaces let you test the prompt from the CLI and let another agent delegate to it later. The authored Slack channel only changes how work arrives and where replies go.</p><h2 id="know-when-to-add-a-dedicated-app" tabindex="-1">Know when to add a dedicated app <a class="header-anchor" href="#know-when-to-add-a-dedicated-app" aria-label="Permalink to &quot;Know when to add a dedicated app&quot;">​</a></h2><p>An account-linked Slack transport is a fit for mentions, direct messages, thread continuity, and agent-branded replies. Move to a dedicated Socket Mode channel when you need:</p><ul><li>top-level channel watching,</li><li>interactive approval buttons,</li><li>a separate bot identity, or</li><li>Slack app events unsupported by the account-linked relay.</li></ul><p>Compare this example with <a href="./benny.html">Playbook router</a>, which adds allowlisted channel watching, and <a href="./weather-agent.html">Weather agent</a>, which adds approval buttons through a second Slack channel.</p><h2 id="turn-the-channel-into-your-own-slack-agent" tabindex="-1">Turn the channel into your own Slack agent <a class="header-anchor" href="#turn-the-channel-into-your-own-slack-agent" aria-label="Permalink to &quot;Turn the channel into your own Slack agent&quot;">​</a></h2><p>Copy the three authored files, then change:</p><ul><li><code>name</code> in <code>agent.ts</code> for the harness identity,</li><li><code>agentName</code> in <code>slack.ts</code> for the single-token router name,</li><li>the instructions for your domain, and</li><li>suggested prompts for the tasks teammates should try.</li></ul><p>Keep <code>agentName</code> free of whitespace. Use PascalCase for multiword names.</p><h2 id="where-to-go-next" tabindex="-1">Where to go next <a class="header-anchor" href="#where-to-go-next" aria-label="Permalink to &quot;Where to go next&quot;">​</a></h2><ul><li><a href="./../guides/slack.html">Slack</a></li><li><a href="./../reference/channels.html">Channels</a></li><li><a href="./../reference/sessions.html">Sessions and streaming</a></li><li><a href="./../reference/playground.html">Playground</a></li></ul>`,42)])])}const g=a(i,[["render",l]]);export{k as __pageData,g as default};
@@ -1 +0,0 @@
1
- import{_ as a,c as t,o as s,ag as n}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Put a minimal agent in Slack","description":"Use account-linked Slack routing, thread continuity, identity, and suggested prompts with one small channel.","frontmatter":{"title":"Put a minimal agent in Slack","description":"Use account-linked Slack routing, thread continuity, identity, and suggested prompts with one small channel."},"headers":[],"relativePath":"example-agents/slack-agent.md","filePath":"example-agents/slack-agent.md"}'),i={name:"example-agents/slack-agent.md"};function l(o,e,h,r,d,c){return s(),t("div",null,[...e[0]||(e[0]=[n("",42)])])}const g=a(i,[["render",l]]);export{k as __pageData,g as default};
@@ -1,25 +0,0 @@
1
- import{_ as s,c as a,o as t,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Explore the full Agent SDK surface with a weather agent","description":"Trace cloud tools, MCP, channels, skills, subagents, schedules, hooks, A/B metrics, and evals through one agent.","frontmatter":{"title":"Explore the full Agent SDK surface with a weather agent","description":"Trace cloud tools, MCP, channels, skills, subagents, schedules, hooks, A/B metrics, and evals through one agent."},"headers":[],"relativePath":"example-agents/weather-agent.md","filePath":"example-agents/weather-agent.md"}'),n={name:"example-agents/weather-agent.md"};function h(o,e,l,r,d,p){return t(),a("div",null,[...e[0]||(e[0]=[i(`<h1 id="explore-the-full-agent-sdk-surface-with-a-weather-agent" tabindex="-1">Explore the full Agent SDK surface with a weather agent <a class="header-anchor" href="#explore-the-full-agent-sdk-surface-with-a-weather-agent" aria-label="Permalink to &quot;Explore the full Agent SDK surface with a weather agent&quot;">​</a></h1><p>The weather agent is the broadest small example in the repository. It fetches live conditions and forecasts, converts units through MCP, writes notes in a session workspace, and runs from HTTP, Slack, a schedule, and the MCP endpoint.</p><p>Use this project when you want to see how the Agent SDK&#39;s filesystem pieces fit together before you design a larger agent.</p><p><a href="./../../examples/weather-agent/">Browse the weather agent source.</a></p><h2 id="see-the-runtime-features-together" tabindex="-1">See the runtime features together <a class="header-anchor" href="#see-the-runtime-features-together" aria-label="Permalink to &quot;See the runtime features together&quot;">​</a></h2><p>Most examples focus on one feature. Weather agent puts the major runtime features side by side:</p><table tabindex="0"><thead><tr><th>Capability</th><th>Source</th><th>Role</th></tr></thead><tbody><tr><td>Root config and instructions</td><td><a href="../../examples/weather-agent/agent/agent.ts"><code>agent/agent.ts</code></a>, <a href="./../../examples/weather-agent/agent/instructions.html"><code>agent/instructions.md</code></a></td><td>Select the cloud runtime and route each request.</td></tr><tr><td>Server tools</td><td><a href="./../../examples/weather-agent/agent/tools/"><code>agent/tools/</code></a></td><td>Fetch Open-Meteo data and call MCP from the serve host.</td></tr><tr><td>Agent tool</td><td><a href="../../examples/weather-agent/agent/tools/save_weather_note.ts"><code>save_weather_note.ts</code></a></td><td>Run a Python script inside the session workspace.</td></tr><tr><td>Stdio MCP</td><td><a href="../../examples/weather-agent/agent/mcp-connections/units.ts"><code>units.ts</code></a>, <a href="../../examples/weather-agent/agent/mcp-connections/probe.ts"><code>probe.ts</code></a></td><td>Expose conversion tools to the model, host tools, and channel handlers. Author VM-side probe tools as TypeScript <code>execute</code> functions.</td></tr><tr><td>Custom HTTP</td><td><a href="../../examples/weather-agent/agent/channels/webhook.ts"><code>webhook.ts</code></a></td><td>Start a turn or call MCP without a model turn.</td></tr><tr><td>Slack</td><td><a href="../../examples/weather-agent/agent/channels/slack.ts"><code>slack.ts</code></a>, <a href="../../examples/weather-agent/agent/channels/slack-app.ts"><code>slack-app.ts</code></a></td><td>Compare account-linked chat with a dedicated app.</td></tr><tr><td>Skill and subagent</td><td><a href="./../../examples/weather-agent/agent/skills/forecast.html"><code>forecast.md</code></a>, <a href="./../../examples/weather-agent/agent/subagents/researcher/"><code>researcher/</code></a></td><td>Load a procedure on demand or delegate broad research.</td></tr><tr><td>Schedule and hooks</td><td><a href="./../../examples/weather-agent/agent/schedules/heartbeat.html"><code>heartbeat.md</code></a>, <a href="../../examples/weather-agent/agent/hooks/audit.ts"><code>audit.ts</code></a>, <a href="../../examples/weather-agent/agent/hooks/journal.ts"><code>journal.ts</code></a></td><td>Start recurring tasks, log usage, and save turn summaries.</td></tr><tr><td>A/B and evals</td><td><a href="../../examples/weather-agent/agent/ab.ts"><code>agent/ab.ts</code></a>, <a href="./../../examples/weather-agent/evals/"><code>evals/</code></a></td><td>Compare a sticky variant and protect tool routing with regression cases.</td></tr></tbody></table><h2 id="follow-one-request" tabindex="-1">Follow one request <a class="header-anchor" href="#follow-one-request" aria-label="Permalink to &quot;Follow one request&quot;">​</a></h2><p>A current-weather question takes this path:</p><ol><li>The built-in HTTP channel, Slack, or the custom <code>/report</code> route creates a durable session.</li><li><code>instructions.md</code> tells the model to call <code>get_weather</code> instead of guessing.</li><li>The server tool geocodes the city, fetches Open-Meteo, validates the response, and returns normalized fields.</li><li>The agent writes a short answer. The Agent SDK records every event in the session stream.</li><li>The audit hook observes <code>turn.completed</code>. If the session joined the A/B experiment, the collector updates its metrics too.</li></ol><p>Forecasts route to <code>get_forecast</code>. Unit conversions route to <code>convert_temperature</code>, which calls the <code>units</code> MCP server through <code>ctx.host.mcp</code>. Climate history and broad comparisons route to the <code>researcher</code> subagent.</p><h2 id="prepare-the-example" tabindex="-1">Prepare the example <a class="header-anchor" href="#prepare-the-example" aria-label="Permalink to &quot;Prepare the example&quot;">​</a></h2><p>You need:</p><ul><li>Node 22.13 or newer.</li><li>An agent-runtime credential.</li><li>Network access to Open-Meteo.</li><li>Python 3 for <code>save_weather_note</code>.</li></ul><p>The project mounts an account-linked Slack channel. The Agent SDK checks the connection at startup, so sign in even when you plan to call a deterministic tool.</p><p>The optional dedicated Slack app also needs a token pair. <code>agent-sdk slack create --dir examples/weather-agent</code> provisions the app and writes the tokens for you (see the <a href="./../guides/slack.html#set-it-up">Slack guide</a>); with hand-minted tokens, export them instead:</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:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> WEATHER_AGENT_SLACK_BOT_TOKEN</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">xoxb-...</span></span>
2
- <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> WEATHER_AGENT_SLACK_APP_TOKEN</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">xapp-...</span></span>
3
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> slack</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> doctor</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --prefix</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> WEATHER_AGENT</span></span></code></pre></div><p>Without those two tokens, the dedicated channel stays idle. The account-linked channel still works.</p><h2 id="inspect-before-running" tabindex="-1">Inspect before running <a class="header-anchor" href="#inspect-before-running" aria-label="Permalink to &quot;Inspect before running&quot;">​</a></h2><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;"> validate</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</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;"> info</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</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;"> eval</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --list</span></span></code></pre></div><p><code>validate</code> should pass. <code>info</code> and <code>eval --list</code> should match the capabilities described above.</p><h2 id="call-the-typed-tools" tabindex="-1">Call the typed tools <a class="header-anchor" href="#call-the-typed-tools" aria-label="Permalink to &quot;Call the typed tools&quot;">​</a></h2><p>Start with the current-weather server tool:</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;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> get_weather</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
6
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
7
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;city&quot;:&quot;New York City&quot;}&#39;</span></span></code></pre></div><p><code>defineTool</code> gives the input a Zod schema. The Agent SDK validates the JSON before <code>execute</code> runs. The result includes the matched place, condition, temperature, humidity, wind, gusts, and precipitation.</p><p>Try the forecast:</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;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> get_forecast</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
8
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
9
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;city&quot;:&quot;Lisbon&quot;,&quot;days&quot;:5}&#39;</span></span></code></pre></div><p>The tool accepts one to seven days. Shared Open-Meteo code lives under <code>agent/lib/</code>, so the Agent SDK imports it without discovering another tool.</p><h2 id="compare-server-and-agent-execution" tabindex="-1">Compare server and agent execution <a class="header-anchor" href="#compare-server-and-agent-execution" aria-label="Permalink to &quot;Compare server and agent execution&quot;">​</a></h2><p>Most weather tools use the default <code>execution: &quot;server&quot;</code>. Their TypeScript runs inside the serve host and can reach <code>ctx.host</code> services.</p><p><code>save_weather_note</code> uses <code>execution: &quot;agent&quot;</code> instead. The Agent SDK materializes its script into the agent environment. The script reads JSON from stdin and appends to <code>weather-notes.md</code> in that session&#39;s workspace:</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;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
10
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --message</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;Save a note that Boston is cold and windy.&quot;</span></span></code></pre></div><p>Each session gets its own workspace. Saving a note doesn&#39;t edit the authored example.</p><p>This split matters on cloud. Server tools stay on the Agent SDK host. Agent tools run inside the cloud workspace.</p><h2 id="verify-tool-execution-on-the-agent-vm" tabindex="-1">Verify tool execution on the agent VM <a class="header-anchor" href="#verify-tool-execution-on-the-agent-vm" aria-label="Permalink to &quot;Verify tool execution on the agent VM&quot;">​</a></h2><p>Ask the agent to call <code>probe_cloud_tool</code> on the <code>probe</code> MCP server. <code>agent/mcp-connections/probe.ts</code> authors that tool as TypeScript. The Agent SDK packages it as stdio MCP so a cloud VM with no checkout of this example can still run it. The model lists the server and calls the tool; it does not write a <code>.sh</code>.</p><p>A real call writes <code>vm-tool-observations/&lt;id&gt;.json</code> in the agent cwd and returns hostname, cwd, and pid. Stream events show <code>probe:probe_cloud_tool</code>, not <code>shell</code>.</p><p>A local <code>.agent-serve/tools/probe_cloud_tool.sh</code> or a marker under <code>probes/</code> means the model invented a substitute.</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;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
11
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --message</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;Test custom tool execution from this cloud agent. Call probe_cloud_tool.&quot;</span></span></code></pre></div><h2 id="use-mcp-connections-in-three-places" tabindex="-1">Use MCP connections in three places <a class="header-anchor" href="#use-mcp-connections-in-three-places" aria-label="Permalink to &quot;Use MCP connections in three places&quot;">​</a></h2><p><code>agent/mcp-connections/units.ts</code> starts a local stdio server. The filename makes its server name <code>units</code>. The Agent SDK exposes it to:</p><ul><li>the model as MCP tools,</li><li>server tools through <code>ctx.host.mcp</code>, and</li><li>channel handlers through <code>host.mcp</code>.</li></ul><p><code>probe</code> is a second stdio connection. Its tools are TypeScript <code>execute</code> functions; the Agent SDK packages them so a cloud VM can spawn the server without this checkout. The model calls <code>probe_cloud_tool</code> directly; no host tool wraps it.</p><p><code>convert_temperature</code> demonstrates the server-tool path:</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;"> call</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> convert_temperature</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
12
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
13
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --input</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;value&quot;:72,&quot;from&quot;:&quot;F&quot;}&#39;</span></span></code></pre></div><p>The custom channel demonstrates the handler path. Start the dev server:</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;"> examples/weather-agent</span></span></code></pre></div><p>Then call MCP deterministically through <code>/convert</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;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
14
- <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://127.0.0.1:3000/weather-agent/v1/channels/webhook/convert</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
15
- <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>
16
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;value&quot;:20,&quot;from&quot;:&quot;C&quot;}&#39;</span></span></code></pre></div><p>No model chooses a tool in this route. The handler calls the MCP server and returns its result.</p><h2 id="keep-conversation-state-in-a-custom-channel" tabindex="-1">Keep conversation state in a custom channel <a class="header-anchor" href="#keep-conversation-state-in-a-custom-channel" aria-label="Permalink to &quot;Keep conversation state in a custom channel&quot;">​</a></h2><p><code>POST /report</code> starts a model turn and waits for it:</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;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
17
- <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://127.0.0.1:3000/weather-agent/v1/channels/webhook/report</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
18
- <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>
19
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;message&quot;:&quot;What is the weather in Paris?&quot;}&#39;</span></span></code></pre></div><p>The response includes a <code>key</code>. Send it back on the next request to continue the same session:</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;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
20
- <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://127.0.0.1:3000/weather-agent/v1/channels/webhook/report</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
21
- <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>
22
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;message&quot;:&quot;How about tomorrow?&quot;,&quot;key&quot;:&quot;&lt;key&gt;&quot;}&#39;</span></span></code></pre></div><p>This is the custom-channel version of a continuation token. See <a href="./../guides/webhooks.html">webhooks and custom channels</a> for route schemas, authentication, and asynchronous handlers.</p><h2 id="load-procedures-and-delegate-research" tabindex="-1">Load procedures and delegate research <a class="header-anchor" href="#load-procedures-and-delegate-research" aria-label="Permalink to &quot;Load procedures and delegate research&quot;">​</a></h2><p>The forecast skill gives the root agent an on-demand procedure. The Agent SDK advertises the skill&#39;s description, then the harness loads its content when the request matches.</p><p>The <code>researcher</code> directory is an SDK subagent. Its description tells the parent when to delegate. It inherits the parent&#39;s execution surface, but gets its own instructions:</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;"> run</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
23
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --message</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;Compare record summer temperatures across Paris, London, and Rome.&quot;</span></span></code></pre></div><p>Use a skill when the same agent needs a procedure. Use a subagent when the parent should hand a bounded task to a specialist. The <a href="./../reference/subagents.html">subagents reference</a> explains the current inheritance limits.</p><h2 id="trigger-the-schedule-and-inspect-the-hook" tabindex="-1">Trigger the schedule and inspect the hook <a class="header-anchor" href="#trigger-the-schedule-and-inspect-the-hook" aria-label="Permalink to &quot;Trigger the schedule and inspect the hook&quot;">​</a></h2><p>The heartbeat schedule runs at 09:00 UTC on weekdays. Automatic schedule timers stay off under <code>--dev</code>, so dispatch it manually:</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;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
24
- <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://127.0.0.1:3000/weather-agent/v1/dev/schedules/heartbeat</span></span></code></pre></div><p>It creates a task session to check San Francisco, New York, and London. The audit hook logs usage after each completed turn. Hooks observe recorded events; their failures don&#39;t fail the turn.</p><h2 id="measure-variants-and-regressions" tabindex="-1">Measure variants and regressions <a class="header-anchor" href="#measure-variants-and-regressions" aria-label="Permalink to &quot;Measure variants and regressions&quot;">​</a></h2><p>The <code>weather-tool-efficiency</code> A/B experiment assigns sessions by a sticky hash:</p><ul><li><code>control</code> returns current conditions in Fahrenheit.</li><li><code>treatment</code> adds a brief Celsius instruction and changes <code>get_weather</code> to return Celsius fields.</li></ul><p>Samples and aggregate snapshots persist under <code>.agent-serve/</code>. The treatment only changes current conditions; <code>get_forecast</code> still returns Fahrenheit. Treat the branch as an example of <code>ctx.session.abs</code>, not a complete unit policy.</p><p>List and run the evals:</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;"> eval</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --list</span></span>
25
- <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> eval</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> examples/weather-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --json</span></span></code></pre></div><p>The suite covers weather and forecast routing, the local converter, workspace notes, and the VM-side probe.</p><h2 id="turn-the-weather-tour-into-your-own-agent" tabindex="-1">Turn the weather tour into your own agent <a class="header-anchor" href="#turn-the-weather-tour-into-your-own-agent" aria-label="Permalink to &quot;Turn the weather tour into your own agent&quot;">​</a></h2><p>Keep the shape and replace the domain:</p><ul><li>Swap Open-Meteo tools for your typed service clients.</li><li>Keep deterministic transforms behind direct server tools or MCP.</li><li>Use an agent tool only when code must run in the agent workspace.</li><li>Put reusable procedures in skills and narrow specialist work into subagents.</li><li>Add a channel only when the external surface needs its own identity, continuation key, or delivery behavior.</li></ul><h2 id="where-to-go-next" tabindex="-1">Where to go next <a class="header-anchor" href="#where-to-go-next" aria-label="Permalink to &quot;Where to go next&quot;">​</a></h2><ul><li><a href="./../reference/tools.html">Tools</a></li><li><a href="./../reference/connections.html">MCP connections</a></li><li><a href="./../guides/human-in-the-loop.html">Human-in-the-loop approvals</a></li><li><a href="./../guides/slack.html">Slack</a></li><li><a href="./../reference/schedules.html">Schedules and reminders</a></li><li><a href="./../evals.html">Evals</a></li><li><a href="./../ab.html">Live A/B metrics</a></li></ul>`,77)])])}const g=s(n,[["render",h]]);export{k as __pageData,g as default};
@@ -1 +0,0 @@
1
- import{_ as s,c as a,o as t,ag as i}from"./chunks/framework.BCISBCiQ.js";const k=JSON.parse('{"title":"Explore the full Agent SDK surface with a weather agent","description":"Trace cloud tools, MCP, channels, skills, subagents, schedules, hooks, A/B metrics, and evals through one agent.","frontmatter":{"title":"Explore the full Agent SDK surface with a weather agent","description":"Trace cloud tools, MCP, channels, skills, subagents, schedules, hooks, A/B metrics, and evals through one agent."},"headers":[],"relativePath":"example-agents/weather-agent.md","filePath":"example-agents/weather-agent.md"}'),n={name:"example-agents/weather-agent.md"};function h(o,e,l,r,d,p){return t(),a("div",null,[...e[0]||(e[0]=[i("",77)])])}const g=s(n,[["render",h]]);export{k as __pageData,g as default};