eve 0.52.2 → 0.52.4

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 (315) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/src/channel/types.d.ts +1 -0
  3. package/dist/src/chunks/{use-eve-agent-1NAM6ftx.js → use-eve-agent-BR8EpIOX.js} +27 -10
  4. package/dist/src/chunks/{use-eve-agent-BEjdhhhK.js → use-eve-agent-XnfjQt1Z.js} +27 -10
  5. package/dist/src/cli/commands/deploy.js +1 -1
  6. package/dist/src/cli/commands/extension-init.d.ts +2 -1
  7. package/dist/src/cli/commands/extension-init.js +1 -1
  8. package/dist/src/cli/commands/init.d.ts +2 -13
  9. package/dist/src/cli/commands/init.js +1 -1
  10. package/dist/src/cli/commands/registry-add-command.d.ts +3 -0
  11. package/dist/src/cli/commands/registry-add-command.js +1 -0
  12. package/dist/src/cli/commands/registry-metadata.d.ts +4 -1
  13. package/dist/src/cli/commands/registry-metadata.js +1 -1
  14. package/dist/src/cli/commands/registry.d.ts +1 -2
  15. package/dist/src/cli/commands/registry.js +1 -1
  16. package/dist/src/cli/dev/run-interactive-ui.d.ts +3 -0
  17. package/dist/src/cli/dev/run-interactive-ui.js +1 -1
  18. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  19. package/dist/src/cli/dev/tui/runner.d.ts +6 -0
  20. package/dist/src/cli/dev/tui/runner.js +1 -1
  21. package/dist/src/cli/dev/tui/setup-commands.d.ts +5 -3
  22. package/dist/src/cli/dev/tui/setup-commands.js +2 -2
  23. package/dist/src/cli/dev/tui/status-line.js +1 -1
  24. package/dist/src/cli/dev/tui/tui.d.ts +4 -0
  25. package/dist/src/cli/dev/tui/tui.js +1 -1
  26. package/dist/src/cli/run.d.ts +1 -1
  27. package/dist/src/cli/run.js +2 -2
  28. package/dist/src/cli/telemetry/index.d.ts +15 -0
  29. package/dist/src/cli/telemetry/index.js +2 -2
  30. package/dist/src/client/session.js +1 -1
  31. package/dist/src/compiled/.vendor-stamp.json +1 -1
  32. package/dist/src/compiler/compile-from-memory.d.ts +1 -0
  33. package/dist/src/compiler/compile-from-memory.js +1 -1
  34. package/dist/src/compiler/extension-compatibility.d.ts +18 -18
  35. package/dist/src/compiler/extension-compatibility.js +1 -1
  36. package/dist/src/context/build-dynamic-tools.d.ts +2 -1
  37. package/dist/src/context/build-dynamic-tools.js +1 -1
  38. package/dist/src/context/dynamic-tool-lifecycle.d.ts +3 -3
  39. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  40. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -1
  41. package/dist/src/context/hook-lifecycle.js +1 -1
  42. package/dist/src/context/keys.d.ts +2 -0
  43. package/dist/src/context/keys.js +1 -1
  44. package/dist/src/evals/reporters/index.d.ts +1 -0
  45. package/dist/src/evals/reporters/index.js +1 -1
  46. package/dist/src/evals/runner/reporters/datadog.d.ts +137 -0
  47. package/dist/src/evals/runner/reporters/datadog.js +3 -0
  48. package/dist/src/eve-channel/index.js +1 -1
  49. package/dist/src/execution/activity-events.d.ts +1 -0
  50. package/dist/src/execution/activity-events.js +1 -1
  51. package/dist/src/execution/node-step.js +1 -1
  52. package/dist/src/execution/parked-delivery-wait.js +1 -1
  53. package/dist/src/execution/sandbox/bindings/vercel-options.d.ts +10 -0
  54. package/dist/src/execution/sandbox/bindings/vercel-options.js +1 -0
  55. package/dist/src/execution/sandbox/bindings/vercel.js +2 -1
  56. package/dist/src/execution/sandbox/prewarm.js +1 -1
  57. package/dist/src/execution/sandbox/shell-quote.d.ts +1 -12
  58. package/dist/src/execution/sandbox/shell-quote.js +1 -1
  59. package/dist/src/execution/session-activity-projection.js +1 -1
  60. package/dist/src/execution/session-activity.js +1 -1
  61. package/dist/src/execution/session-command-inbox.js +1 -1
  62. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  63. package/dist/src/execution/tasks/child/workflow.js +1 -1
  64. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  65. package/dist/src/execution/tasks/parent/task-cancel.d.ts +2 -2
  66. package/dist/src/execution/tasks/parent/task-cancel.js +1 -1
  67. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  68. package/dist/src/execution/tool-auth.d.ts +4 -32
  69. package/dist/src/execution/tool-auth.js +1 -1
  70. package/dist/src/execution/tools/connection-search.js +2 -2
  71. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  72. package/dist/src/execution/tools/subagent/accept-event-step.d.ts +1 -1
  73. package/dist/src/execution/tools/subagent/accept-event-step.js +1 -1
  74. package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
  75. package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
  76. package/dist/src/execution/tools/workflow/ask.d.ts +3 -2
  77. package/dist/src/execution/tools/workflow/ask.js +1 -1
  78. package/dist/src/execution/tools/workflow/authorization-completion.d.ts +3 -0
  79. package/dist/src/execution/tools/workflow/authorization-completion.js +1 -0
  80. package/dist/src/execution/tools/workflow/body.d.ts +2 -0
  81. package/dist/src/execution/tools/workflow/body.js +1 -1
  82. package/dist/src/execution/tools/workflow/step-context.d.ts +31 -0
  83. package/dist/src/execution/tools/workflow/step-context.js +1 -0
  84. package/dist/src/execution/tools/workflow/step-execution.d.ts +3 -0
  85. package/dist/src/execution/tools/workflow/step-execution.js +1 -0
  86. package/dist/src/execution/tools/workflow/step.d.ts +3 -0
  87. package/dist/src/execution/tools/workflow/step.js +1 -0
  88. package/dist/src/execution/turn-workflow-tool-run.js +1 -1
  89. package/dist/src/execution/wire/session-inbox-contract.d.ts +7 -0
  90. package/dist/src/execution/wire/session-inbox-contract.js +1 -1
  91. package/dist/src/execution/wire/session-inbox-resume.d.ts +2 -0
  92. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  93. package/dist/src/execution/workflow-runtime.js +1 -1
  94. package/dist/src/execution/workflow-steps.js +1 -1
  95. package/dist/src/harness/action-presentation.d.ts +13 -0
  96. package/dist/src/harness/action-presentation.js +1 -0
  97. package/dist/src/harness/authorization.d.ts +5 -2
  98. package/dist/src/harness/authorization.js +1 -1
  99. package/dist/src/harness/compaction.js +1 -1
  100. package/dist/src/harness/coordination.js +1 -1
  101. package/dist/src/harness/emission.d.ts +1 -6
  102. package/dist/src/harness/emission.js +1 -1
  103. package/dist/src/harness/execute-tool.d.ts +2 -1
  104. package/dist/src/harness/finish-reason.d.ts +3 -0
  105. package/dist/src/harness/finish-reason.js +1 -0
  106. package/dist/src/harness/provider-tool-schemas.d.ts +1 -0
  107. package/dist/src/harness/provider-tool-schemas.js +1 -1
  108. package/dist/src/harness/step-hooks.js +1 -1
  109. package/dist/src/harness/stream-actions.d.ts +2 -2
  110. package/dist/src/harness/stream-actions.js +1 -1
  111. package/dist/src/harness/tool-call-input-errors.d.ts +4 -3
  112. package/dist/src/harness/tool-call-input-errors.js +1 -1
  113. package/dist/src/harness/tool-loop.js +2 -2
  114. package/dist/src/harness/tool-presentation.d.ts +5 -0
  115. package/dist/src/harness/tool-presentation.js +1 -0
  116. package/dist/src/harness/turn-client-context.d.ts +1 -0
  117. package/dist/src/harness/workflow-lifecycle.d.ts +2 -3
  118. package/dist/src/harness/workflow-lifecycle.js +1 -1
  119. package/dist/src/internal/application/compiled-artifacts.d.ts +3 -0
  120. package/dist/src/internal/application/compiled-artifacts.js +1 -1
  121. package/dist/src/internal/application/package.js +1 -1
  122. package/dist/src/internal/authored-definition/connection.js +1 -1
  123. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  124. package/dist/src/internal/authored-module-conditions.d.ts +2 -0
  125. package/dist/src/internal/authored-module-conditions.js +1 -0
  126. package/dist/src/internal/authored-module-loader.d.ts +3 -0
  127. package/dist/src/internal/authored-module-loader.js +3 -3
  128. package/dist/src/internal/authored-module-map-loader.d.ts +3 -1
  129. package/dist/src/internal/authored-module-map-loader.js +1 -1
  130. package/dist/src/internal/authored-package-boundary.js +1 -1
  131. package/dist/src/internal/authored-runtime-modules.d.ts +2 -0
  132. package/dist/src/internal/authored-runtime-modules.js +1 -1
  133. package/dist/src/internal/bundler/nitro-rolldown.d.ts +1 -0
  134. package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
  135. package/dist/src/internal/nitro/development-generation.d.ts +2 -0
  136. package/dist/src/internal/nitro/development-generation.js +1 -1
  137. package/dist/src/internal/nitro/host/configure-nitro-routes.js +1 -1
  138. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  139. package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
  140. package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
  141. package/dist/src/internal/vercel/build-command.d.ts +2 -1
  142. package/dist/src/internal/vercel/build-command.js +1 -1
  143. package/dist/src/internal/workflow-bundle/builder-support.d.ts +5 -0
  144. package/dist/src/internal/workflow-bundle/builder-support.js +1 -1
  145. package/dist/src/internal/workflow-bundle/builder.js +2 -2
  146. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.d.ts +1 -1
  147. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
  148. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  149. package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +3 -5
  150. package/dist/src/internal/workflow-bundle/workflow-transformer.js +4 -3
  151. package/dist/src/protocol/activity.d.ts +6 -0
  152. package/dist/src/protocol/activity.js +1 -1
  153. package/dist/src/protocol/message.d.ts +13 -1
  154. package/dist/src/protocol/message.js +1 -1
  155. package/dist/src/public/channels/github/checkout.js +1 -1
  156. package/dist/src/public/channels/slack/activity-plan.js +1 -1
  157. package/dist/src/public/channels/slack/activity.js +2 -2
  158. package/dist/src/public/models/openai/chatgpt/credential-store.d.ts +6 -0
  159. package/dist/src/public/models/openai/chatgpt/credential-store.js +1 -0
  160. package/dist/src/public/models/openai/chatgpt/model.d.ts +1 -1
  161. package/dist/src/public/models/openai/chatgpt/oauth.d.ts +20 -0
  162. package/dist/src/public/models/openai/chatgpt/oauth.js +1 -0
  163. package/dist/src/public/models/openai/chatgpt/token-broker.d.ts +4 -3
  164. package/dist/src/public/models/openai/chatgpt/token-broker.js +1 -1
  165. package/dist/src/public/models/openai/chatgpt/transport.d.ts +1 -2
  166. package/dist/src/public/models/openai/index.d.ts +3 -4
  167. package/dist/src/public/tools/index.d.ts +1 -1
  168. package/dist/src/runtime/authorization-context.d.ts +14 -0
  169. package/dist/src/runtime/authorization-context.js +1 -0
  170. package/dist/src/runtime/connections/mcp-client.js +1 -1
  171. package/dist/src/runtime/connections/scoped-authorization.d.ts +18 -2
  172. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  173. package/dist/src/runtime/prompt/compose.js +1 -1
  174. package/dist/src/runtime/resolve-connection.js +1 -1
  175. package/dist/src/runtime/resolve-tool.js +1 -1
  176. package/dist/src/runtime/sandbox/keys.js +1 -1
  177. package/dist/src/runtime/types.d.ts +2 -0
  178. package/dist/src/sandbox/backends/default.d.ts +2 -0
  179. package/dist/src/sandbox/backends/default.js +1 -1
  180. package/dist/src/self-modification/agent.d.ts +5 -2
  181. package/dist/src/self-modification/agent.js +1 -1
  182. package/dist/src/self-modification/config.d.ts +52 -0
  183. package/dist/src/self-modification/config.js +1 -0
  184. package/dist/src/self-modification/credentials.d.ts +18 -0
  185. package/dist/src/self-modification/credentials.js +1 -0
  186. package/dist/src/self-modification/extension/eve-add.d.ts +7 -2
  187. package/dist/src/self-modification/extension/eve-add.js +1 -1
  188. package/dist/src/self-modification/extension/extension.d.ts +46 -1
  189. package/dist/src/self-modification/extension/extension.js +1 -1
  190. package/dist/src/self-modification/extension/instructions.d.ts +1 -3
  191. package/dist/src/self-modification/extension/instructions.js +24 -8
  192. package/dist/src/self-modification/extension/production-registry-add.d.ts +42 -0
  193. package/dist/src/self-modification/extension/production-registry-add.js +1 -0
  194. package/dist/src/self-modification/extension/tools/edit_file.js +1 -1
  195. package/dist/src/self-modification/extension/tools/publish.d.ts +7 -0
  196. package/dist/src/self-modification/extension/tools/publish.js +1 -0
  197. package/dist/src/self-modification/extension/tools/registry_add.d.ts +39 -7
  198. package/dist/src/self-modification/extension/tools/registry_add.js +1 -1
  199. package/dist/src/self-modification/extension/tools/search_registry.d.ts +1 -0
  200. package/dist/src/self-modification/extension/tools/search_registry.js +1 -1
  201. package/dist/src/self-modification/filesystem.js +1 -1
  202. package/dist/src/self-modification/git-workspace.d.ts +31 -0
  203. package/dist/src/self-modification/git-workspace.js +1 -0
  204. package/dist/src/self-modification/git.d.ts +6 -0
  205. package/dist/src/self-modification/git.js +1 -0
  206. package/dist/src/self-modification/github-publisher.d.ts +27 -0
  207. package/dist/src/self-modification/github-publisher.js +2 -0
  208. package/dist/src/self-modification/identifiers.d.ts +4 -0
  209. package/dist/src/self-modification/identifiers.js +1 -0
  210. package/dist/src/self-modification/mode.d.ts +4 -0
  211. package/dist/src/self-modification/mode.js +1 -0
  212. package/dist/src/self-modification/network-policy.d.ts +1 -0
  213. package/dist/src/self-modification/network-policy.js +1 -0
  214. package/dist/src/self-modification/proposal.d.ts +39 -0
  215. package/dist/src/self-modification/proposal.js +2 -0
  216. package/dist/src/self-modification/sandbox.d.ts +25 -1
  217. package/dist/src/self-modification/sandbox.js +1 -1
  218. package/dist/src/self-modification/setup.d.ts +34 -0
  219. package/dist/src/self-modification/setup.js +22 -0
  220. package/dist/src/self-modification/workspace-lock.d.ts +2 -0
  221. package/dist/src/self-modification/workspace-lock.js +1 -0
  222. package/dist/src/setup/flows/chatgpt-auth.d.ts +14 -2
  223. package/dist/src/setup/flows/chatgpt-auth.js +1 -1
  224. package/dist/src/setup/flows/model.d.ts +3 -2
  225. package/dist/src/setup/flows/model.js +1 -1
  226. package/dist/src/setup/flows/provider.js +1 -1
  227. package/dist/src/setup/flows/registry.d.ts +4 -0
  228. package/dist/src/setup/flows/registry.js +1 -1
  229. package/dist/src/setup/integrations/registry.js +1 -1
  230. package/dist/src/setup/integrations/runner.js +1 -1
  231. package/dist/src/setup/integrations/self-modification/setup.d.ts +29 -0
  232. package/dist/src/setup/integrations/self-modification/setup.js +1 -0
  233. package/dist/src/setup/integrations/types.d.ts +2 -0
  234. package/dist/src/setup/integrations/types.js +1 -1
  235. package/dist/src/setup/scaffold/create/project.js +1 -1
  236. package/dist/src/shared/boundary-hook-error.d.ts +4 -0
  237. package/dist/src/shared/boundary-hook-error.js +1 -0
  238. package/dist/src/shared/empty-delivery.js +1 -1
  239. package/dist/src/shared/git.d.ts +16 -0
  240. package/dist/src/shared/git.js +1 -0
  241. package/dist/src/{execution/activity-text.d.ts → shared/presentation-text.d.ts} +1 -1
  242. package/dist/src/shared/presentation-text.js +1 -0
  243. package/dist/src/shared/shell-quote.d.ts +2 -0
  244. package/dist/src/shared/shell-quote.js +1 -0
  245. package/dist/src/shared/vercel-services.js +1 -1
  246. package/dist/src/svelte/index.js +1 -1
  247. package/dist/src/svelte/use-eve-agent.js +1 -1
  248. package/dist/src/tasks/session-index.d.ts +1 -1
  249. package/dist/src/tasks/session-index.js +1 -1
  250. package/dist/src/tasks/session-task-cohorts.d.ts +10 -0
  251. package/dist/src/tasks/session-task-cohorts.js +1 -0
  252. package/dist/src/tools/definition.d.ts +21 -0
  253. package/dist/src/tools/definition.js +1 -1
  254. package/dist/src/tools/durable-callbacks.d.ts +37 -9
  255. package/dist/src/tools/durable-callbacks.js +1 -1
  256. package/dist/src/tools/dynamic.d.ts +2 -1
  257. package/dist/src/tools/framework/agent-contract.js +1 -1
  258. package/dist/src/tools/provided/bash.js +1 -1
  259. package/dist/src/tools/provided/glob.js +1 -1
  260. package/dist/src/tools/provided/grep.js +1 -1
  261. package/dist/src/tools/provided/load-skill.js +1 -1
  262. package/dist/src/tools/provided/read-file.js +1 -1
  263. package/dist/src/tools/provided/web-fetch.js +1 -1
  264. package/dist/src/tools/provided/write-file.js +1 -1
  265. package/dist/src/tools/tool-label.d.ts +1 -0
  266. package/dist/src/tools/tool-label.js +1 -0
  267. package/dist/src/tools/workflow-definition.d.ts +5 -2
  268. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  269. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  270. package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
  271. package/dist/src/tracing/agent-otel-provider.js +2 -2
  272. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  273. package/dist/src/tracing/agent-otel-usage.d.ts +10 -0
  274. package/dist/src/tracing/agent-otel-usage.js +1 -1
  275. package/dist/src/tracing/agent-span-naming.d.ts +1 -0
  276. package/dist/src/tracing/agent-span-naming.js +1 -0
  277. package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
  278. package/dist/src/vue/index.js +1 -1
  279. package/dist/src/vue/use-eve-agent.js +1 -1
  280. package/docs/concepts/default-harness.md +6 -0
  281. package/docs/concepts/sessions-runs-and-streaming.md +6 -0
  282. package/docs/connections/overview.mdx +1 -1
  283. package/docs/evals/reporters.mdx +20 -1
  284. package/docs/guides/client/continuations.mdx +11 -0
  285. package/docs/guides/dynamic-capabilities.md +4 -4
  286. package/docs/guides/hooks.md +1 -1
  287. package/docs/guides/instrumentation.md +40 -1
  288. package/docs/guides/remote-agents.md +2 -0
  289. package/docs/instructions.mdx +1 -1
  290. package/docs/memory/overview.mdx +45 -13
  291. package/docs/reference/cli.md +6 -0
  292. package/docs/reference/telemetry.md +2 -2
  293. package/docs/reference/typescript-api.md +13 -9
  294. package/docs/sandbox.mdx +16 -2
  295. package/docs/subagents/index.mdx +18 -4
  296. package/docs/tools/overview.mdx +44 -2
  297. package/docs/tools/workflows.mdx +67 -2
  298. package/docs/tutorial/connect-a-warehouse.mdx +49 -26
  299. package/docs/tutorial/first-agent.mdx +20 -19
  300. package/docs/tutorial/guard-the-spend.mdx +4 -4
  301. package/docs/tutorial/how-it-runs.mdx +2 -3
  302. package/docs/tutorial/meta.json +2 -2
  303. package/docs/tutorial/query-sample-data.mdx +30 -19
  304. package/docs/tutorial/remember-definitions.mdx +5 -5
  305. package/docs/tutorial/run-analysis.mdx +155 -18
  306. package/docs/tutorial/ship-it.mdx +71 -81
  307. package/docs/tutorial/team-playbooks.mdx +10 -10
  308. package/package.json +17 -1
  309. package/dist/src/execution/activity-text.js +0 -1
  310. package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +0 -9
  311. package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +0 -1
  312. package/dist/src/public/models/openai/chatgpt/codex-app-server.d.ts +0 -40
  313. package/dist/src/public/models/openai/chatgpt/codex-app-server.js +0 -1
  314. package/dist/src/self-modification/extension/source-lock.d.ts +0 -2
  315. package/dist/src/self-modification/extension/source-lock.js +0 -1
@@ -79,8 +79,8 @@ or days later, the run resumes, deploys, and returns. The model sees one tool re
79
79
  `start`, `getRun`, and `resumeHook` from `workflow/api` belong in steps. Your app does not install
80
80
  the SDK; for types, new projects list `eve/workflow-modules` in the tsconfig `types`.
81
81
  - In the body, `ctx` has `session`, `callId`, `toolName`, `abortSignal`, `agent`, and `ask`.
82
- `getSandbox`, `getSkill`, `getToken`, and `requireAuth` are not part of `WorkflowToolContext`.
83
- Read credentials from `process.env` in a step; session-scoped workflow authorization is not yet available.
82
+ `getToken` and `requireAuth` work inside a `"use step"` helper that receives `ctx` as a direct argument;
83
+ they throw in the workflow body. `getSandbox` and `getSkill` remain unavailable.
84
84
  - The tool's input must be a JSON object. Workflow bodies are for static tools under `agent/tools/`,
85
85
  not tools returned from `defineDynamic` resolvers.
86
86
 
@@ -93,6 +93,12 @@ tool object, a channel handler, or a schedule handler fails the build. To start
93
93
  channel or schedule, use the [channel operations](/docs/channels/custom#channel-operations-and-session-handles)
94
94
  or [schedule handler](/docs/schedules#handler-form-run) APIs.
95
95
 
96
+ Workflow imports resolve `paths` aliases from your application's `tsconfig.json` or
97
+ `jsconfig.json`, including when the application is a workspace package. eve includes only
98
+ workflow and step modules reachable from the agent's runtime modules. Unrelated workflows
99
+ in the host application stay outside the agent bundle. An unresolved workflow import fails
100
+ the build with the missing import in the error.
101
+
96
102
  ### Migrate an existing workflow tool
97
103
 
98
104
  Replace `defineTool` with `defineWorkflowTool`, keep the executor's `"use workflow"` directive,
@@ -148,6 +154,65 @@ Answering resumes the body in either mode.
148
154
  Promise or Node.js timer inside a step also does not create a durable workflow suspension; use
149
155
  the workflow operations for waits that must survive a restart.
150
156
 
157
+ ## Authorize inside a step
158
+
159
+ Pass `ctx` directly to a step helper and call `ctx.getToken(provider)` there. User-scoped providers
160
+ resolve as whoever launched this workflow tool, even if another person speaks in the session while it waits.
161
+ The provider declaration and the API request both stay inside the step:
162
+
163
+ ```ts
164
+ import { connect } from "@vercel/connect/eve";
165
+ import type { WorkflowToolContext } from "eve/tools";
166
+
167
+ async function readRepository(ctx: WorkflowToolContext, repository: string) {
168
+ "use step";
169
+ const provider = connect("github/my-agent");
170
+ const { token } = await ctx.getToken(provider);
171
+ const response = await fetch(`https://api.github.com/repos/${repository}`, {
172
+ headers: { Authorization: `Bearer ${token}` },
173
+ });
174
+ if (response.status === 401) ctx.requireAuth(provider);
175
+ if (!response.ok) throw new Error(`GitHub returned ${response.status}`);
176
+ return response.json();
177
+ }
178
+ ```
179
+
180
+ Connections discovered through `connection_search`, ordinary tools, and workflow steps use the same
181
+ authorization machinery for requester identity, token caching, callback completion, and rejection
182
+ after sign-in. The execution runtime owns the wait: an agent returns to its model after authorization,
183
+ while a workflow retries the interrupted step and continues the authored body.
184
+
185
+ The workflow body calls `await readRepository(ctx, repository)`.
186
+
187
+ <Callout type="warning" title="Keep tokens out of step results">
188
+ Step results enter the workflow's durable history, so do not return the token from the helper.
189
+ eve's token cache stays inside the step. The step input is recorded too and, after sign-in,
190
+ carries the provider's callback parameters, such as a one-time authorization code. This matches
191
+ how agent turns record callbacks. Bearer tokens are never written.
192
+ </Callout>
193
+
194
+ When sign-in is required, the step attempt ends and the workflow waits on its own callback hook,
195
+ without holding compute. The channel renders the sign-in challenge. After the callback, eve retries
196
+ **the whole interrupted step**, resolves the token, and continues. Previously completed steps are
197
+ not rerun. Resolve auth before other side effects in that step, and make operations before
198
+ `requireAuth` safe to retry. A token rejected immediately after sign-in fails instead of prompting
199
+ again. Provider declarations can be shared imports, but context must be passed directly, not nested
200
+ inside another argument or captured in a closure.
201
+
202
+ After a successful callback exchange, eve records a completion marker before returning to authored
203
+ code. If that code later fails and the step retries, eve reads the token from the provider instead
204
+ of exchanging the same callback again. The provider must persist the grant or token; the marker
205
+ itself contains no credentials.
206
+
207
+ A background task becomes `input_required` during sign-in. The callback resumes that task; it does
208
+ not rely on the launching agent turn still being active. Cancelling an authorization wait withdraws
209
+ its callback. Cancellation uses the existing turn or task cancellation path rather than a separate
210
+ authorization completion event.
211
+
212
+ Background workflow authorization requires a new session after upgrading. In older sessions,
213
+ `ctx.getToken` and `ctx.requireAuth` fail immediately with an instruction to start a new session.
214
+ Blocking workflows and background workflows without auth are unaffected.
215
+
151
216
  ## Ask a human: `ctx.ask`
152
217
 
153
218
  ```ts
@@ -1,58 +1,81 @@
1
1
  ---
2
- title: "Connect a Warehouse"
3
- description: "Part 4 of the Build an Agent tutorial. Let each user connect their own warehouse over an OAuth MCP via Vercel Connect."
2
+ title: "Connect a Warehouse (Optional)"
3
+ description: "Optional follow-up to the Build an Agent tutorial. Let each user connect their own warehouse over an OAuth MCP via Vercel Connect."
4
4
  ---
5
5
 
6
- The sample dataset got the analytics assistant running, but it's a stand-in. Now point the agent at a real warehouse and let each user connect their own by signing in through their browser. That's what a connection is for. It's an MCP server the model reaches through tools, with auth that eve drives for you.
6
+ Complete [the tutorial with sample data](./first-agent) first. When you have a warehouse with an MCP server, you can connect it to the analytics assistant and let each user sign in through their browser. That's what a connection is for. It's an MCP server the model reaches through tools, with auth that eve drives for you.
7
7
 
8
- This step depends on Vercel Connect, which is in private beta. No Connect access? Keep the Step 3 sample dataset and read this step for the connection model. Steps 5 through 9 work against the sample dataset, so you can complete the tutorial without a warehouse.
8
+ [Vercel Connect is generally available](https://vercel.com/changelog/vercel-connect-secure-access-to-external-services-for-your-agents). You can complete the tutorial with the [sample dataset](./query-sample-data); Connect is only needed for the OAuth integration shown on this page.
9
9
 
10
- The filename sets the runtime name. Put the file at `agent/connections/warehouse.ts` and it registers as `"warehouse"`, with its tools surfaced as `warehouse__<tool>`.
10
+ ## Before you start
11
+
12
+ This integration needs:
13
+
14
+ - A warehouse account and a working MCP server for that warehouse, with its full endpoint URL. Connect manages credentials; it does not create a warehouse or turn a SQL database into an MCP server.
15
+ - Permission to authorize that server, with read-only access to the data you want the agent to query.
16
+ - A Vercel account and a linked project for Connect.
17
+ - An authenticated user on the eve session. Complete the route-auth setup in [Ship it](./ship-it#replace-placeholderauth) before trying per-user OAuth from a web app.
18
+
19
+ If you are working through the tutorial for the first time, keep `run_sql` and [continue to Run analysis](./run-analysis). You can add this integration later.
20
+
21
+ ## Register the connector
22
+
23
+ Run these commands from `analytics-assistant/`. Replace the example URL with your MCP server's actual endpoint, including its path:
24
+
25
+ ```bash
26
+ npm install @vercel/connect
27
+ npx vercel@latest link
28
+ npx vercel@latest connect create "https://your-warehouse.example/mcp" --name warehouse
29
+ ```
30
+
31
+ Follow the provider-specific registration prompts. Copy the **connector UID returned by the CLI**. The display name `warehouse` is not the connector UID. Attach the returned connector to this project, then pull the local environment:
32
+
33
+ ```bash
34
+ npx vercel@latest connect attach "<returned-connector-uid>" --yes
35
+ npx vercel@latest env pull
36
+ ```
37
+
38
+ `vercel env pull` provides `VERCEL_OIDC_TOKEN` for local requests to Connect. That token identifies your Vercel project; it does not sign an end user into the app. The steps below use the authenticated deployment from [Ship it](./ship-it#replace-placeholderauth). The [Connect reference](https://vercel.com/docs/connect) covers service-specific setup and project attachments.
11
39
 
12
40
  ## Declare the connection
13
41
 
14
- The warehouse exposes a generic SQL MCP behind OAuth. Pass `connect()` from `@vercel/connect/eve` as the auth, and Vercel Connect handles the OAuth flow, stores the tokens, and refreshes them for you:
42
+ Create `agent/connections/warehouse.ts`. Replace both the endpoint URL and connector UID below with the values you just configured:
15
43
 
16
44
  ```ts title="agent/connections/warehouse.ts"
17
45
  import { connect } from "@vercel/connect/eve";
18
46
  import { defineMcpClientConnection } from "eve/connections";
19
47
 
20
48
  export default defineMcpClientConnection({
21
- url: "https://mcp.your-warehouse.example/sse",
49
+ url: "https://your-warehouse.example/mcp",
22
50
  description: "The team's data warehouse: run read-only SQL and list tables and columns.",
23
- auth: connect("warehouse"),
51
+ auth: connect("<returned-connector-uid>"),
24
52
  });
25
53
  ```
26
54
 
27
- `"warehouse"` is the UID you chose when registering the Connect client. By default this OAuth is user-scoped. Each end-user authorizes in their own browser, and eve resolves that user's token before every tool call.
55
+ The filename registers the eve connection as `"warehouse"`, with tools named `warehouse__<tool>`. This eve name is independent of the Connect connector UID. The remote server determines which tools exist; check its tool inventory and read-only permissions before using it.
28
56
 
29
- Before testing the warehouse from a web app, make sure the eve channel route auth maps your signed-in app user to `principalType: "user"`. A Connect-backed connection can only start per-user OAuth when the active session already has an authenticated user principal. If route auth still only accepts `localDev()`, a runtime token, or a placeholder guard, the first warehouse tool call fails with `reason: "principal_required"` instead of showing the sign-in challenge.
57
+ `connect("...")` is user-scoped by default. Each end-user authorizes in their own browser, and eve resolves that user's token before a tool call. The eve channel's route auth must map the signed-in app user to `principalType: "user"`. `localDev()`, a runtime token, or a placeholder guard cannot supply that identity; those sessions fail with `reason: "principal_required"` before OAuth starts. For a shared app credential, see [app vs. user auth](../connections#choose-app-vs-user-auth).
30
58
 
31
- Once Connect is enabled on your account, wire it up:
59
+ ## Deploy and try it
32
60
 
33
- 1. Install the package: `npm install @vercel/connect`.
34
- 2. Create the Connect client: `vercel connect create <type> --name warehouse`.
35
- 3. Link the client to your project.
36
- 4. Run `vercel link` and `vercel env pull` so `VERCEL_OIDC_TOKEN` is available locally.
61
+ Deploy the updated app so the authenticated web app includes the new connection:
37
62
 
38
- For the full reference, see [MCP connections](../connections/mcp).
39
-
40
- ## What the user sees
63
+ ```bash
64
+ npx vercel@latest deploy
65
+ ```
41
66
 
42
- Ask a question that needs the warehouse:
67
+ Open the new HTTPS preview URL, sign in with the credentials configured in [Ship it](./ship-it#replace-placeholderauth), and create a new session. The tutorial's development server bypasses the browser login and uses `localDev()`; restarting `npm run dev` alone does not provide the user identity this connection requires.
43
68
 
44
- ```text
45
- How many enterprise customers signed up last month?
46
- ```
69
+ From your authenticated web app, ask the agent to inspect the warehouse's available tables and then query a table you have access to. Use the server's schema rather than assuming it has the tutorial's `orders` and `customers` tables.
47
70
 
48
- The first time, the model picks a warehouse tool but there's no token yet, so the turn parks and the channel shows a "Sign in" affordance. You authorize in the browser, and once the OAuth callback completes, the turn resumes from exactly that step (the durable parking from [Step 2](./how-it-runs)) and the query runs. Later calls in the session reuse the cached per-user token, so there's no prompt.
71
+ If the user has not authorized the connector, the turn parks and the channel shows a sign-in link. Complete authorization in the browser; after the callback succeeds, the turn resumes and retries the tool call. Later calls use the existing grant while it remains valid. See [MCP connection troubleshooting](../connections/mcp#troubleshooting) if registration succeeds but the tool cannot connect.
49
72
 
50
73
  ## The token never reaches the model
51
74
 
52
- Right before each request to the MCP server, eve resolves the bearer and sends it as `Authorization: Bearer <token>`. The model only ever sees tool names, descriptions, and results. The credential stays out of its reach.
75
+ Right before each request to the MCP server, eve resolves the bearer and sends it as `Authorization: Bearer <token>`. The model sees tool names, descriptions, and results. The credential stays in the app runtime.
53
76
 
54
- If you want more control, gate the connection behind approval (`approval: once()`) or narrow which tools the model sees (`tools.allow`). See [MCP connections](../connections/mcp).
77
+ Gate the connection behind approval (`approval: once()`) or narrow which tools the model sees (`tools.allow`) when needed. See [MCP connections](../connections/mcp).
55
78
 
56
- → Next: [Run analysis](./run-analysis)
79
+ → Return to the tutorial: [Run analysis](./run-analysis)
57
80
 
58
81
  Learn more: [MCP connections](../connections/mcp) · [Authentication](../guides/auth-and-route-protection)
@@ -1,16 +1,22 @@
1
1
  ---
2
2
  title: "Your First Agent"
3
- description: "Part 1 of the Build an Agent tutorial. Scaffold the analytics assistant, give it an analyst persona, run it, and ask a question."
3
+ description: "Scaffold the analytics assistant, give it an analyst persona, run it, and ask a question."
4
4
  ---
5
5
 
6
- The Build an Agent tutorial constructs one app end to end, a data analytics assistant. You ask in natural language, and over the next nine steps it learns to query a warehouse, run analysis in a sandbox, remember your team's metric definitions, and refuse to exceed your query budget without asking.
6
+ For a bespoke learning experience, start with the [eve template gallery](https://eve.dev/templates) or ask your coding agent to build your use case. For example:
7
7
 
8
- Step 1 gets it talking. The scaffold bundles a small sample dataset, so your first question works with zero setup.
8
+ - “Build an eve Slack agent that answers questions from our team’s documentation.”
9
+ - “Build an eve incident-response agent that investigates alerts using our observability tools.”
10
+ - “Build an eve GitHub maintainer that triages issues and summarizes pull requests.”
11
+
12
+ If you prefer a step-by-step walkthrough, continue with this tutorial. It constructs one app end to end: a data analytics assistant. You ask in natural language, and over eight steps it learns to query sample data, run analysis in a sandbox, remember your team's metric definitions, and refuse to exceed your query budget without asking.
13
+
14
+ Step 1 gets it talking. In Step 3 you create a small local dataset that you use throughout the tutorial. You can complete the tutorial without a warehouse or Vercel Connect account. [Connect a warehouse](./connect-a-warehouse) is an optional follow-up once your agent works.
9
15
 
10
16
  ## Prerequisites
11
17
 
12
18
  - Node 24 or newer and npm.
13
- - A model credential. The scaffold's default model goes through the [Vercel AI Gateway](../getting-started), so you need `AI_GATEWAY_API_KEY` (or `VERCEL_OIDC_TOKEN` pulled via `vercel link`). A direct provider model like `anthropic("claude-opus-4-8")` instead needs that provider's AI SDK package and key, here `@ai-sdk/anthropic` and `ANTHROPIC_API_KEY`.
19
+ - A working model credential, configured through [Getting Started](../getting-started). Keep the model and credential you already tested there.
14
20
 
15
21
  If you have not run eve before, complete [Getting Started](../getting-started) first. Without a credential, "Run the agent" below fails when the runtime tries to reach the model; the dev TUI's `/model` flow walks you through pasting a key or linking a project.
16
22
 
@@ -21,24 +27,19 @@ npx eve@latest init analytics-assistant
21
27
  cd analytics-assistant
22
28
  ```
23
29
 
24
- The command writes the starter agent with eve's default model and built-in HTTP API
25
- channel (`agent/channels/eve.ts`), installs dependencies, initializes Git, and
26
- starts the development server. Stop the server before continuing with the edits
27
- below. It does not create a Vercel project or deploy. `init` creates the
30
+ The command writes the starter agent and built-in HTTP API channel
31
+ (`agent/channels/eve.ts`), installs dependencies, initializes Git, and offers
32
+ to start the development server. Stop the server if you started it before
33
+ continuing with the edits below. It does not create a Vercel project or deploy. `init` creates the
28
34
  `analytics-assistant/` directory, so `cd` into it before running further
29
35
  commands.
30
36
 
31
- ## Set the model
32
-
33
- `agent/agent.ts` holds the model and config. Use a capable model for analysis work:
37
+ ## Keep your configured model
34
38
 
35
- ```ts
36
- import { defineAgent } from "eve";
37
-
38
- export default defineAgent({
39
- model: "anthropic/claude-opus-4.8",
40
- });
41
- ```
39
+ `agent/agent.ts` holds the model and config. Use the same model and credentials
40
+ that worked in Getting Started. The tutorial does not require switching providers.
41
+ If you need to configure this new project, use `/model` in the dev TUI before
42
+ sending your first question.
42
43
 
43
44
  ## Give it an analyst persona
44
45
 
@@ -53,7 +54,7 @@ You are a senior data analyst. You answer questions about the team's data.
53
54
  the data, say so plainly.
54
55
  ```
55
56
 
56
- Instructions are identity and standing rules. On-demand procedures belong in skills (Step 7), and actions belong in tools (Step 3). See [Instructions](../instructions).
57
+ Instructions are identity and standing rules. On-demand procedures belong in skills (Step 6), and actions belong in tools (Step 3). See [Instructions](../instructions).
57
58
 
58
59
  ## Run the agent
59
60
 
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  title: "Guard the Spend"
3
- description: "Part 8 of the Build an Agent tutorial. Gate expensive queries with cost-based approval. The agent pauses, asks, and resumes."
3
+ description: "Part 7 of the Build an Agent tutorial. Gate expensive queries with cost-based approval. The agent pauses, asks, and resumes."
4
4
  ---
5
5
 
6
- A single warehouse query can scan terabytes and run up the bill. So before the analytics assistant fires off an expensive scan, make it stop and check with you. The agent pauses, asks you, and resumes with your answer. That's human-in-the-loop, and you wire it up with one field on the tool.
6
+ Use the sample dataset to practice an approval before a tool runs. The example assigns a simulated scan cost to each query; it does not incur warehouse charges. Make the analytics assistant stop and check with you before a query exceeds that threshold. The agent pauses, asks you, and resumes with your answer. That's human-in-the-loop, and you wire it up with one field on the tool.
7
7
 
8
8
  `approval` runs before `execute`. Return `"user-approval"` and the turn parks on an approval request; you answer, and the run picks up from that exact step. The function gets the tool input, so you can make the decision cost-based.
9
9
 
10
10
  ## Estimate, then gate
11
11
 
12
- This step keeps `run_sql` on the Step 3 sample dataset so you can demo the gate locally. With a real warehouse you'd gate the warehouse connection tool from Step 4 the same way, on a dry-run byte estimate instead of the toy heuristic below.
12
+ This step keeps `run_sql` on the Step 3 sample dataset so you can demo the gate locally. If you later [connect a warehouse](./connect-a-warehouse), use the provider's dry-run estimate to decide when approval is needed.
13
13
 
14
14
  Add a cheap estimator and gate `run_sql` on it:
15
15
 
@@ -30,7 +30,7 @@ const THRESHOLD_GB = 50;
30
30
 
31
31
  export default defineTool({
32
32
  description: "Run a read-only SQL query against the analytics tables.",
33
- inputSchema: z.object({ sql: z.string() }),
33
+ inputSchema: z.object({ sql: z.string().max(10_000) }),
34
34
  // Cost-based gate: only the expensive queries need a human yes.
35
35
  approval: ({ toolInput }) =>
36
36
  estimateScanGb(toolInput?.sql ?? "") > THRESHOLD_GB ? "user-approval" : "not-applicable",
@@ -15,9 +15,8 @@ Each turn runs as a durable workflow, and eve saves progress at every step. Comp
15
15
 
16
16
  That's why the features in the rest of this tutorial work the way they do:
17
17
 
18
- - The warehouse sign-in in Step 4 parks the turn until you authorize in the browser. A few minutes is fine.
19
- - The metric glossary in Step 6 survives across turns. State is checkpointed at step boundaries, so it sticks.
20
- - The spend approval in Step 8 pauses the turn on your yes/no, then picks up exactly where it left off.
18
+ - The metric glossary in Step 5 survives across turns. State is checkpointed at step boundaries, so it sticks.
19
+ - The spend approval in Step 7 pauses the turn on your yes/no, then picks up exactly where it left off.
21
20
 
22
21
  You author capabilities, including tools, instructions, channels, and skills. eve drives the model-to-tool loop and decides when a turn continues, waits, or ends. You never write that loop yourself.
23
22
 
@@ -5,11 +5,11 @@
5
5
  "first-agent",
6
6
  "how-it-runs",
7
7
  "query-sample-data",
8
- "connect-a-warehouse",
9
8
  "run-analysis",
10
9
  "remember-definitions",
11
10
  "team-playbooks",
12
11
  "guard-the-spend",
13
- "ship-it"
12
+ "ship-it",
13
+ "connect-a-warehouse"
14
14
  ]
15
15
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: "Query Sample Data"
3
- description: "Part 3 of the Build an Agent tutorial. Add a run_sql tool over the bundled sample dataset and watch the tool loop."
3
+ description: "Part 3 of the Build an Agent tutorial. Add a run_sql tool over a local sample dataset and watch the tool loop."
4
4
  ---
5
5
 
6
6
  The analytics assistant can hold a conversation, but it can't see a single row of data. Give it a tool. A tool is the action primitive. Typed input goes in, your code runs, structured output comes back. The name the model sees is the filename, so `agent/tools/run_sql.ts` becomes the tool `run_sql`.
@@ -14,27 +14,21 @@ npm install sql.js
14
14
  npm install --save-dev @types/sql.js
15
15
  ```
16
16
 
17
- `sql.js` loads its WebAssembly binary from the installed package at runtime. Keep the package external so the binary remains next to its JavaScript:
17
+ `sql.js` loads its WebAssembly binary from the installed package at runtime. Keep the package external so the binary remains next to its JavaScript. Add this `build` property inside your existing `defineAgent({ ... })` in `agent/agent.ts`, keeping your configured `model` and its imports:
18
18
 
19
- ```ts title="agent/agent.ts" {5-7}
20
- import { defineAgent } from "eve";
21
-
22
- export default defineAgent({
23
- model: "anthropic/claude-opus-4.8",
24
- build: {
25
- externalDependencies: ["sql.js"],
26
- },
27
- });
19
+ ```ts
20
+ build: {
21
+ externalDependencies: ["sql.js"],
22
+ },
28
23
  ```
29
24
 
30
25
  Restart the dev server after changing `externalDependencies`. eve reads this setting when the server starts.
31
26
 
32
27
  ## A tiny sample dataset
33
28
 
34
- Store a small in-memory dataset under `agent/lib/`. Keep it tiny. This is throwaway scaffolding, not the real warehouse (that comes in Step 4).
29
+ Create `agent/lib/sample-db.ts` with the dataset below. These four orders and three customers supply the data for every remaining tutorial step. No database server, account, or connection string is needed. The dataset is recreated when the app restarts.
35
30
 
36
31
  ```ts title="agent/lib/sample-db.ts"
37
- // A toy SQLite-in-memory stand-in. Swap for your real warehouse in Step 4.
38
32
  import initSqlJs from "sql.js";
39
33
 
40
34
  const SEED = `
@@ -60,12 +54,27 @@ async function db() {
60
54
 
61
55
  export async function runReadOnlySql(sql: string) {
62
56
  const database = await db();
63
- const [result] = database.exec(sql);
64
- if (!result) return { columns: [], rows: [] as unknown[][] };
65
- return { columns: result.columns, rows: result.values };
57
+ const query = `SELECT * FROM (\n${sql.trim().replace(/;$/, "")}\n) LIMIT 501`;
58
+ const statement = database.prepare(query);
59
+ try {
60
+ // prepare() accepts the first statement; reject any unparsed trailing SQL.
61
+ if (statement.getSQL() !== query) {
62
+ throw new Error("Provide a single SELECT query.");
63
+ }
64
+ const columns = statement.getColumnNames();
65
+ const rows: unknown[][] = [];
66
+ while (rows.length < 501 && statement.step()) rows.push(statement.get());
67
+ return { columns, rows };
68
+ } finally {
69
+ statement.free();
70
+ }
66
71
  }
67
72
  ```
68
73
 
74
+ The outer `SELECT` lets SQLite accept queries, including `WITH` queries, while rejecting writes and configuration statements. The helper prepares one statement, rejects trailing SQL, and reads at most 501 rows. The extra row lets the tool report that its 500-row output was truncated. It frees the statement even when a query fails.
75
+
76
+ This is an in-memory tutorial database. A row limit does not bound the work needed to compute a query; use database-enforced read-only permissions and query timeouts when adapting the tool to a production database.
77
+
69
78
  ## Define the run_sql tool
70
79
 
71
80
  ```ts title="agent/tools/run_sql.ts"
@@ -78,7 +87,7 @@ export default defineTool({
78
87
  "Run a read-only SQL query against the analytics tables (orders, customers) " +
79
88
  "and return the columns and rows.",
80
89
  inputSchema: z.object({
81
- sql: z.string().describe("A single read-only SELECT statement."),
90
+ sql: z.string().max(10_000).describe("A single read-only SELECT statement."),
82
91
  }),
83
92
  async execute({ sql }) {
84
93
  const { columns, rows } = await runReadOnlySql(sql);
@@ -98,8 +107,10 @@ Restart the dev server with `npm run dev` and ask:
98
107
  Which customer has spent the most, and how much?
99
108
  ```
100
109
 
101
- Watch the loop play out in the TUI. The model emits a `run_sql` call, eve runs your `execute`, and the rows come back as a tool result. The model reads them and answers with a real number. eve drove the whole loop. All you supplied was the tool.
110
+ Watch the loop play out in the TUI. The model emits a `run_sql` call, eve runs your `execute`, and the rows come back as a tool result. The model reads them and answers with a real number. The result is Globex with 9,900 cents ($99.00). The amounts are stored in cents, so divide by 100 when reporting dollars. eve drove the whole loop; you supplied the tool.
111
+
112
+ Keep `run_sql` and the sample database for the rest of the tutorial. When you have your own data service, [Connect a warehouse](./connect-a-warehouse) explains the optional integration.
102
113
 
103
- → Next: [Connect a warehouse](./connect-a-warehouse)
114
+ → Next: [Run analysis](./run-analysis)
104
115
 
105
116
  Learn more: [Tools](../tools)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: "Remember Definitions"
3
- description: "Part 6 of the Build an Agent tutorial. Use defineState to remember the team's metric glossary across turns."
3
+ description: "Part 5 of the Build an Agent tutorial. Use defineState to remember the team's metric glossary across turns."
4
4
  ---
5
5
 
6
6
  Every team has house definitions for the analytics assistant. "Active" means a purchase in the last 30 days, revenue is net of refunds, a "week" starts Monday. Re-explaining all of that on every turn is a waste. State gives the agent a place to keep them.
@@ -55,15 +55,15 @@ export default defineTool({
55
55
  ## See it persist
56
56
 
57
57
  ```text
58
- > For us, an active customer is one with a purchase in the last 30 days.
58
+ > For this dataset, a high-value customer has at least $50 in total orders.
59
59
  Remember that.
60
- → calls define_metric("active customer", "purchase in the last 30 days")
60
+ → calls define_metric("high-value customer", "at least $50 in total orders")
61
61
 
62
- > How many active customers do we have?
62
+ > How many high-value customers do we have?
63
63
  → recalls the definition, writes the matching SQL, answers
64
64
  ```
65
65
 
66
- The second turn is a separate turn in the same session, yet the definition is still there. State checkpoints at step boundaries, so it's the same durability from [Step 2](./how-it-runs), now applied to your own data.
66
+ The sample data has two high-value customers: Acme ($57) and Globex ($99). This definition works with the same fixed dataset whenever you run the tutorial. The second turn is a separate turn in the same session, yet the definition is still there. State checkpoints at step boundaries, so it's the same durability from [Step 2](./how-it-runs), now applied to your own data.
67
67
 
68
68
  State is scoped to a session and isolated per agent, so a subagent starts with fresh state and never sees the parent's. Need to reset something each turn? Call `update(() => fresh)` in a lifecycle hook. More in [State](../concepts/state).
69
69