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.
- package/CHANGELOG.md +33 -0
- package/dist/src/channel/types.d.ts +1 -0
- package/dist/src/chunks/{use-eve-agent-1NAM6ftx.js → use-eve-agent-BR8EpIOX.js} +27 -10
- package/dist/src/chunks/{use-eve-agent-BEjdhhhK.js → use-eve-agent-XnfjQt1Z.js} +27 -10
- package/dist/src/cli/commands/deploy.js +1 -1
- package/dist/src/cli/commands/extension-init.d.ts +2 -1
- package/dist/src/cli/commands/extension-init.js +1 -1
- package/dist/src/cli/commands/init.d.ts +2 -13
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/registry-add-command.d.ts +3 -0
- package/dist/src/cli/commands/registry-add-command.js +1 -0
- package/dist/src/cli/commands/registry-metadata.d.ts +4 -1
- package/dist/src/cli/commands/registry-metadata.js +1 -1
- package/dist/src/cli/commands/registry.d.ts +1 -2
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/run-interactive-ui.d.ts +3 -0
- package/dist/src/cli/dev/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +6 -0
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +5 -3
- package/dist/src/cli/dev/tui/setup-commands.js +2 -2
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/tui.d.ts +4 -0
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/run.d.ts +1 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/cli/telemetry/index.d.ts +15 -0
- package/dist/src/cli/telemetry/index.js +2 -2
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiler/compile-from-memory.d.ts +1 -0
- package/dist/src/compiler/compile-from-memory.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +18 -18
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/context/build-dynamic-tools.d.ts +2 -1
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.d.ts +3 -3
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/context/dynamic-tool-metadata.d.ts +1 -1
- package/dist/src/context/hook-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +2 -0
- package/dist/src/context/keys.js +1 -1
- package/dist/src/evals/reporters/index.d.ts +1 -0
- package/dist/src/evals/reporters/index.js +1 -1
- package/dist/src/evals/runner/reporters/datadog.d.ts +137 -0
- package/dist/src/evals/runner/reporters/datadog.js +3 -0
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/execution/activity-events.d.ts +1 -0
- package/dist/src/execution/activity-events.js +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-options.d.ts +10 -0
- package/dist/src/execution/sandbox/bindings/vercel-options.js +1 -0
- package/dist/src/execution/sandbox/bindings/vercel.js +2 -1
- package/dist/src/execution/sandbox/prewarm.js +1 -1
- package/dist/src/execution/sandbox/shell-quote.d.ts +1 -12
- package/dist/src/execution/sandbox/shell-quote.js +1 -1
- package/dist/src/execution/session-activity-projection.js +1 -1
- package/dist/src/execution/session-activity.js +1 -1
- package/dist/src/execution/session-command-inbox.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/tasks/parent/task-cancel.d.ts +2 -2
- package/dist/src/execution/tasks/parent/task-cancel.js +1 -1
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/tool-auth.d.ts +4 -32
- package/dist/src/execution/tool-auth.js +1 -1
- package/dist/src/execution/tools/connection-search.js +2 -2
- package/dist/src/execution/tools/sleep-workflow.js +1 -1
- package/dist/src/execution/tools/subagent/accept-event-step.d.ts +1 -1
- package/dist/src/execution/tools/subagent/accept-event-step.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
- package/dist/src/execution/tools/workflow/ask.d.ts +3 -2
- package/dist/src/execution/tools/workflow/ask.js +1 -1
- package/dist/src/execution/tools/workflow/authorization-completion.d.ts +3 -0
- package/dist/src/execution/tools/workflow/authorization-completion.js +1 -0
- package/dist/src/execution/tools/workflow/body.d.ts +2 -0
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/step-context.d.ts +31 -0
- package/dist/src/execution/tools/workflow/step-context.js +1 -0
- package/dist/src/execution/tools/workflow/step-execution.d.ts +3 -0
- package/dist/src/execution/tools/workflow/step-execution.js +1 -0
- package/dist/src/execution/tools/workflow/step.d.ts +3 -0
- package/dist/src/execution/tools/workflow/step.js +1 -0
- package/dist/src/execution/turn-workflow-tool-run.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +7 -0
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-resume.d.ts +2 -0
- package/dist/src/execution/wire/session-inbox-resume.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/action-presentation.d.ts +13 -0
- package/dist/src/harness/action-presentation.js +1 -0
- package/dist/src/harness/authorization.d.ts +5 -2
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/compaction.js +1 -1
- package/dist/src/harness/coordination.js +1 -1
- package/dist/src/harness/emission.d.ts +1 -6
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +2 -1
- package/dist/src/harness/finish-reason.d.ts +3 -0
- package/dist/src/harness/finish-reason.js +1 -0
- package/dist/src/harness/provider-tool-schemas.d.ts +1 -0
- package/dist/src/harness/provider-tool-schemas.js +1 -1
- package/dist/src/harness/step-hooks.js +1 -1
- package/dist/src/harness/stream-actions.d.ts +2 -2
- package/dist/src/harness/stream-actions.js +1 -1
- package/dist/src/harness/tool-call-input-errors.d.ts +4 -3
- package/dist/src/harness/tool-call-input-errors.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tool-presentation.d.ts +5 -0
- package/dist/src/harness/tool-presentation.js +1 -0
- package/dist/src/harness/turn-client-context.d.ts +1 -0
- package/dist/src/harness/workflow-lifecycle.d.ts +2 -3
- package/dist/src/harness/workflow-lifecycle.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.d.ts +3 -0
- package/dist/src/internal/application/compiled-artifacts.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/authored-module-conditions.d.ts +2 -0
- package/dist/src/internal/authored-module-conditions.js +1 -0
- package/dist/src/internal/authored-module-loader.d.ts +3 -0
- package/dist/src/internal/authored-module-loader.js +3 -3
- package/dist/src/internal/authored-module-map-loader.d.ts +3 -1
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/authored-runtime-modules.d.ts +2 -0
- package/dist/src/internal/authored-runtime-modules.js +1 -1
- package/dist/src/internal/bundler/nitro-rolldown.d.ts +1 -0
- package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
- package/dist/src/internal/nitro/development-generation.d.ts +2 -0
- package/dist/src/internal/nitro/development-generation.js +1 -1
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/internal/vercel/build-command.d.ts +2 -1
- package/dist/src/internal/vercel/build-command.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +5 -0
- package/dist/src/internal/workflow-bundle/builder-support.js +1 -1
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/internal/workflow-bundle/dynamic-tool-transform.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +3 -5
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +4 -3
- package/dist/src/protocol/activity.d.ts +6 -0
- package/dist/src/protocol/activity.js +1 -1
- package/dist/src/protocol/message.d.ts +13 -1
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/public/channels/github/checkout.js +1 -1
- package/dist/src/public/channels/slack/activity-plan.js +1 -1
- package/dist/src/public/channels/slack/activity.js +2 -2
- package/dist/src/public/models/openai/chatgpt/credential-store.d.ts +6 -0
- package/dist/src/public/models/openai/chatgpt/credential-store.js +1 -0
- package/dist/src/public/models/openai/chatgpt/model.d.ts +1 -1
- package/dist/src/public/models/openai/chatgpt/oauth.d.ts +20 -0
- package/dist/src/public/models/openai/chatgpt/oauth.js +1 -0
- package/dist/src/public/models/openai/chatgpt/token-broker.d.ts +4 -3
- package/dist/src/public/models/openai/chatgpt/token-broker.js +1 -1
- package/dist/src/public/models/openai/chatgpt/transport.d.ts +1 -2
- package/dist/src/public/models/openai/index.d.ts +3 -4
- package/dist/src/public/tools/index.d.ts +1 -1
- package/dist/src/runtime/authorization-context.d.ts +14 -0
- package/dist/src/runtime/authorization-context.js +1 -0
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/scoped-authorization.d.ts +18 -2
- package/dist/src/runtime/connections/scoped-authorization.js +1 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-connection.js +1 -1
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/runtime/sandbox/keys.js +1 -1
- package/dist/src/runtime/types.d.ts +2 -0
- package/dist/src/sandbox/backends/default.d.ts +2 -0
- package/dist/src/sandbox/backends/default.js +1 -1
- package/dist/src/self-modification/agent.d.ts +5 -2
- package/dist/src/self-modification/agent.js +1 -1
- package/dist/src/self-modification/config.d.ts +52 -0
- package/dist/src/self-modification/config.js +1 -0
- package/dist/src/self-modification/credentials.d.ts +18 -0
- package/dist/src/self-modification/credentials.js +1 -0
- package/dist/src/self-modification/extension/eve-add.d.ts +7 -2
- package/dist/src/self-modification/extension/eve-add.js +1 -1
- package/dist/src/self-modification/extension/extension.d.ts +46 -1
- package/dist/src/self-modification/extension/extension.js +1 -1
- package/dist/src/self-modification/extension/instructions.d.ts +1 -3
- package/dist/src/self-modification/extension/instructions.js +24 -8
- package/dist/src/self-modification/extension/production-registry-add.d.ts +42 -0
- package/dist/src/self-modification/extension/production-registry-add.js +1 -0
- package/dist/src/self-modification/extension/tools/edit_file.js +1 -1
- package/dist/src/self-modification/extension/tools/publish.d.ts +7 -0
- package/dist/src/self-modification/extension/tools/publish.js +1 -0
- package/dist/src/self-modification/extension/tools/registry_add.d.ts +39 -7
- package/dist/src/self-modification/extension/tools/registry_add.js +1 -1
- package/dist/src/self-modification/extension/tools/search_registry.d.ts +1 -0
- package/dist/src/self-modification/extension/tools/search_registry.js +1 -1
- package/dist/src/self-modification/filesystem.js +1 -1
- package/dist/src/self-modification/git-workspace.d.ts +31 -0
- package/dist/src/self-modification/git-workspace.js +1 -0
- package/dist/src/self-modification/git.d.ts +6 -0
- package/dist/src/self-modification/git.js +1 -0
- package/dist/src/self-modification/github-publisher.d.ts +27 -0
- package/dist/src/self-modification/github-publisher.js +2 -0
- package/dist/src/self-modification/identifiers.d.ts +4 -0
- package/dist/src/self-modification/identifiers.js +1 -0
- package/dist/src/self-modification/mode.d.ts +4 -0
- package/dist/src/self-modification/mode.js +1 -0
- package/dist/src/self-modification/network-policy.d.ts +1 -0
- package/dist/src/self-modification/network-policy.js +1 -0
- package/dist/src/self-modification/proposal.d.ts +39 -0
- package/dist/src/self-modification/proposal.js +2 -0
- package/dist/src/self-modification/sandbox.d.ts +25 -1
- package/dist/src/self-modification/sandbox.js +1 -1
- package/dist/src/self-modification/setup.d.ts +34 -0
- package/dist/src/self-modification/setup.js +22 -0
- package/dist/src/self-modification/workspace-lock.d.ts +2 -0
- package/dist/src/self-modification/workspace-lock.js +1 -0
- package/dist/src/setup/flows/chatgpt-auth.d.ts +14 -2
- package/dist/src/setup/flows/chatgpt-auth.js +1 -1
- package/dist/src/setup/flows/model.d.ts +3 -2
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/provider.js +1 -1
- package/dist/src/setup/flows/registry.d.ts +4 -0
- package/dist/src/setup/flows/registry.js +1 -1
- package/dist/src/setup/integrations/registry.js +1 -1
- package/dist/src/setup/integrations/runner.js +1 -1
- package/dist/src/setup/integrations/self-modification/setup.d.ts +29 -0
- package/dist/src/setup/integrations/self-modification/setup.js +1 -0
- package/dist/src/setup/integrations/types.d.ts +2 -0
- package/dist/src/setup/integrations/types.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/boundary-hook-error.d.ts +4 -0
- package/dist/src/shared/boundary-hook-error.js +1 -0
- package/dist/src/shared/empty-delivery.js +1 -1
- package/dist/src/shared/git.d.ts +16 -0
- package/dist/src/shared/git.js +1 -0
- package/dist/src/{execution/activity-text.d.ts → shared/presentation-text.d.ts} +1 -1
- package/dist/src/shared/presentation-text.js +1 -0
- package/dist/src/shared/shell-quote.d.ts +2 -0
- package/dist/src/shared/shell-quote.js +1 -0
- package/dist/src/shared/vercel-services.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/session-index.d.ts +1 -1
- package/dist/src/tasks/session-index.js +1 -1
- package/dist/src/tasks/session-task-cohorts.d.ts +10 -0
- package/dist/src/tasks/session-task-cohorts.js +1 -0
- package/dist/src/tools/definition.d.ts +21 -0
- package/dist/src/tools/definition.js +1 -1
- package/dist/src/tools/durable-callbacks.d.ts +37 -9
- package/dist/src/tools/durable-callbacks.js +1 -1
- package/dist/src/tools/dynamic.d.ts +2 -1
- package/dist/src/tools/framework/agent-contract.js +1 -1
- package/dist/src/tools/provided/bash.js +1 -1
- package/dist/src/tools/provided/glob.js +1 -1
- package/dist/src/tools/provided/grep.js +1 -1
- package/dist/src/tools/provided/load-skill.js +1 -1
- package/dist/src/tools/provided/read-file.js +1 -1
- package/dist/src/tools/provided/web-fetch.js +1 -1
- package/dist/src/tools/provided/write-file.js +1 -1
- package/dist/src/tools/tool-label.d.ts +1 -0
- package/dist/src/tools/tool-label.js +1 -0
- package/dist/src/tools/workflow-definition.d.ts +5 -2
- package/dist/src/tracing/agent-action-instrumentation.js +1 -1
- package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-session-context.js +1 -1
- package/dist/src/tracing/agent-otel-usage.d.ts +10 -0
- package/dist/src/tracing/agent-otel-usage.js +1 -1
- package/dist/src/tracing/agent-span-naming.d.ts +1 -0
- package/dist/src/tracing/agent-span-naming.js +1 -0
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/default-harness.md +6 -0
- package/docs/concepts/sessions-runs-and-streaming.md +6 -0
- package/docs/connections/overview.mdx +1 -1
- package/docs/evals/reporters.mdx +20 -1
- package/docs/guides/client/continuations.mdx +11 -0
- package/docs/guides/dynamic-capabilities.md +4 -4
- package/docs/guides/hooks.md +1 -1
- package/docs/guides/instrumentation.md +40 -1
- package/docs/guides/remote-agents.md +2 -0
- package/docs/instructions.mdx +1 -1
- package/docs/memory/overview.mdx +45 -13
- package/docs/reference/cli.md +6 -0
- package/docs/reference/telemetry.md +2 -2
- package/docs/reference/typescript-api.md +13 -9
- package/docs/sandbox.mdx +16 -2
- package/docs/subagents/index.mdx +18 -4
- package/docs/tools/overview.mdx +44 -2
- package/docs/tools/workflows.mdx +67 -2
- package/docs/tutorial/connect-a-warehouse.mdx +49 -26
- package/docs/tutorial/first-agent.mdx +20 -19
- package/docs/tutorial/guard-the-spend.mdx +4 -4
- package/docs/tutorial/how-it-runs.mdx +2 -3
- package/docs/tutorial/meta.json +2 -2
- package/docs/tutorial/query-sample-data.mdx +30 -19
- package/docs/tutorial/remember-definitions.mdx +5 -5
- package/docs/tutorial/run-analysis.mdx +155 -18
- package/docs/tutorial/ship-it.mdx +71 -81
- package/docs/tutorial/team-playbooks.mdx +10 -10
- package/package.json +17 -1
- package/dist/src/execution/activity-text.js +0 -1
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +0 -9
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +0 -1
- package/dist/src/public/models/openai/chatgpt/codex-app-server.d.ts +0 -40
- package/dist/src/public/models/openai/chatgpt/codex-app-server.js +0 -1
- package/dist/src/self-modification/extension/source-lock.d.ts +0 -2
- package/dist/src/self-modification/extension/source-lock.js +0 -1
package/docs/tools/workflows.mdx
CHANGED
|
@@ -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
|
-
`
|
|
83
|
-
|
|
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: "
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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://
|
|
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("
|
|
51
|
+
auth: connect("<returned-connector-uid>"),
|
|
24
52
|
});
|
|
25
53
|
```
|
|
26
54
|
|
|
27
|
-
`"warehouse"`
|
|
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
|
-
|
|
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
|
-
|
|
59
|
+
## Deploy and try it
|
|
32
60
|
|
|
33
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
63
|
+
```bash
|
|
64
|
+
npx vercel@latest deploy
|
|
65
|
+
```
|
|
41
66
|
|
|
42
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
→
|
|
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: "
|
|
3
|
+
description: "Scaffold the analytics assistant, give it an analyst persona, run it, and ask a question."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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.
|
|
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
|
|
19
|
-
- The
|
|
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
|
|
package/docs/tutorial/meta.json
CHANGED
|
@@ -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
|
|
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
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
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: [
|
|
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
|
|
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
|
|
58
|
+
> For this dataset, a high-value customer has at least $50 in total orders.
|
|
59
59
|
Remember that.
|
|
60
|
-
→ calls define_metric("
|
|
60
|
+
→ calls define_metric("high-value customer", "at least $50 in total orders")
|
|
61
61
|
|
|
62
|
-
> How many
|
|
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
|
|