Upgrade Agent Files

Every project needs some of these changes. They cover agent.ts, connections, tools, sandboxes, memory providers, and the modules your agent imports. Most of them fail eve build or your typecheck with a message that names the fix, so work through the errors with this page open. Sections start with the changes most projects need.

This page is part of Upgrade to 1.0.

Export defineAgent from every agent.ts

Every local agent.ts, root or subagent, must export the value defineAgent returns. A dynamic subagent resolver that selects a local agent must also return defineAgent({...}), defineRemoteAgent(...), or null.

export default { model: "anthropic/claude-sonnet-5" };
import { defineAgent } from "eve";
export default defineAgent({ model: "anthropic/claude-sonnet-5" });

Create sentinels only with defineDynamic(), disableTool(), and disableRoute(). DynamicSentinel, DisabledToolSentinel, and DisabledRouteSentinel are opaque, and hand-written objects of the same shape are rejected.

Wrap connections in their protocol helper

eve doesn't assume a plain exported object is an MCP connection. Wrap each connection in defineMcpClientConnection or defineOpenAPIConnection. For a dynamic connection, call the helper inside its factory. See Connections.

export default { url: "https://issues.example/mcp" };
import { defineMcpClientConnection } from "eve/connections";
export default defineMcpClientConnection({ url: "https://issues.example/mcp" });

Replace connection auth's credentialOwner with principalType: "app" | "user". With getToken alone, an omitted principalType means "app"; set "user" for per-user tokens. See connection credential ownership.

Rename compaction.thresholdPercent

Rename the field and keep its value. Despite its old name, the value was always a fraction from 0 through 1, not a percentage, so 0.7 stays 0.7. The default stays 0.9. See Compaction.

export default defineAgent({
  compaction: { thresholdPercent: 0.7 },
  compaction: { threshold: 0.7 },
});

To turn off the token-usage limit, including one inherited from a parent agent, set limits.sessionUsage: false.

Update tool approvals and built-in tools

  • Remove approvalKey and reads of ApprovalContext.approvedTools. When the decision depends on the tool's input, write an approval policy instead. once() remembers the latest approval or denial of each tool for the rest of the session. A custom policy that wraps once() must return its decision unchanged, or the remembered answer is neither reused nor recorded. See Tool approvals.
  • Export the built-in tool definitions askQuestion, noReply, and sleep directly instead of calling askQuestion(), noReply(), or sleep().
  • grep lists matching files by default. Set outputMode: "content" when the caller needs the matching lines. See Built-in tools.

Choose one sandbox layout and install your tools

If both agent/sandbox.ts and agent/sandbox/ exist, move the definition to agent/sandbox/sandbox.ts. A standalone agent/sandbox.ts still works. See Sandbox layout.

eve's default sandbox image, which the Vercel and Docker sandboxes use, doesn't include pnpm or pip. If your agent needs them, install them in the sandbox prepare callback:

  • For pnpm, run npm install -g pnpm.
  • For pip, run sudo apt-get install -y python3-venv and use the pip inside a virtual environment. Ubuntu's system Python refuses pip install.

Expect the sandbox template to rebuild once after the upgrade. See Docker sandbox.

Move imports

BeforeAfter
defineWorkspaceAgent, WorkspaceAgentDefinition, WorkspaceAgentTransport from eveeve/experimental/workspace
experimental_runDiscordGatewayRelay from eve/channels/discord/gatewayrunDiscordGatewayRelay from eve/experimental/channels/discord/gateway
JustBashCommand, JustBashFilesystem from eve/sandbox/just-basheve/experimental/sandbox/just-bash
eve/tools/agent-routereve/tools/agent_router
eve/computer-use and its subpathseve/extensions/computer-use and the matching subpaths
eve/self-modification, eve/self-modification/localeve/extensions/self-modification/local
eve/self-modification/remoteeve/extensions/self-modification/remote
Datadog from eve/evalsdatadogReporter from eve/evals/reporters
MessageResponse, MessageResultDelivery, DeliveryResult from eve/sessions
StreamOptions, GetEventStreamOptionsSessionStreamOptions from eve/sessions
SpanProcessor, SpanExporter, SpanProcessorOrName from OpenTelemetryeve/instrumentation/otel
grep from eve/extensions/code/toolsgrep from eve/tools/grep
eve/self-modification/config, eve/setup, eve/setup/scaffoldNo public replacement

The agents/<name>/ workspace layout and withEve from eve/vercel are stable. JustBashSandbox, autoInstall, and prepare stay on eve/sandbox/just-bash, but customCommands and filesystem move under experimental:

export const environment = JustBashSandbox.environment({
  customCommands: [today],
  experimental: { customCommands: [today] },
});

Use eve's own types

eve's authoring and configuration types don't expose AI SDK, zod, OpenTelemetry, or channel-adapter types. Any AI SDK language model or OpenTelemetry processor still type-checks where eve accepts one, so most projects only change annotations:

  • Annotate agent model fields with EveLanguageModel from eve or eve/models. anthropic(), openai(), chatgpt(), and mockModel() still return AI SDK language models.
  • Declare specificationVersion: "v4" on DecisionModel instances. decide() takes signal instead of abortSignal and returns only answers and usage.
  • Import TokenUsage, the record limits.sessionUsage callbacks receive, from eve.
  • Import LinqWebhookVerifier from eve/channels/linq, and PhotonIMessageWebhookVerifier and PhotonProjectCredentials from eve/channels/photon.

Use defineDynamic for dynamic capabilities

Define a dynamic model, tool, skill, subagent, or instruction as defineDynamic(ctx => value), a function eve calls to resolve the value at runtime. Replace lifecycle event maps with that function.

  • Replace defineDurableCallback and defineDurableSchema wrappers with ordinary functions and schemas.
  • Cache results from external services with ctx.memo(key, fn). The result must be JSON.
  • A dynamic model, a dynamic subagent config, or a ctx.agent(name, { model }) override reads its context window from the model catalog recorded at build time. For a model that catalog doesn't list, return modelContextWindowTokens or rebuild.

See Dynamic capabilities.

Update memory providers

  • eve recalls memory before each turn and gives it to the model outside the conversation history, so compaction never summarizes it. Remove memory visibility options.
  • A memory provider can capture history before compaction rewrites it. If that capture fails, the compaction doesn't happen.
  • Type memory provider tools as MemoryToolSet, a map of defineTool() values, instead of MemoryToolDefinition.

See Memory providers.

Configure GitHub access in the git extension

If git({ github }) gets GitHub tokens through Vercel Connect, its github.authorize callback is the only check on which repositories and commands the agent can use. Every gh call runs only when authorize returns true.

  • Set github.principalType, which is required: "app" for GitHub App installation tokens, or "user" for the caller's own token.
  • Remove github.org and enforce the same restriction in authorize, as in the example below.
  • The gh tool takes an optional repository instead of permissions, and it runs any gh or git subcommand. If your policy depends on the command, check argv in authorize.
agent/extensions/git.ts
import git from "eve/extensions/git";

import { brokerGitHubLease } from "../lib/github";

export default git({
  github: {
    connector: "github/my-agent",
    broker: brokerGitHubLease,
    principalType: "app",
    authorize: ({ owner }) => owner.toLowerCase() === "acme",
  },
});

See Control access with authorize.

Remove the code extension's worker option

The code extension adds no code__worker subagent, and code() rejects a worker option. Remove worker from your code extension mount. To hand a slice of work to a child agent, use the built-in agent tool. If an agent/tools/agent.ts override disables that tool so delegation goes to code__worker, delete the override.

agent/extensions/code.ts
import code from "eve/extensions/code";

export default code({
  vercel: { connector: "vercel/acme-bot" },
  worker: { model: "openai/gpt-5.6-terra-fast", reasoning: "high" },
});

Replace the code extension's apply_patch tool

The code extension no longer adds code__apply_patch. Every agent gets the default edit_file tool, which takes path and a list of { oldText, newText } edits instead of a patch. Move an override of the old tool, whether agent/tools/code__apply_patch.ts or agent/extensions/code/tools/apply_patch.ts, to agent/tools/edit_file.ts and spread editFile from eve/tools/edit_file. A wrapper that reads input.patch needs to read input.path and input.edits instead. A mount with another file name, such as agent/extensions/coding.ts, used the coding__apply_patch name; move it the same way.

An override that only disables the old tool fails eve build with disables a slot with no lower-precedence source. To keep the agent from editing files, disable edit_file instead:

agent/tools/edit_file.ts
import { disableTool } from "eve/tools";

export default disableTool();

Workflow imports

Workflow tools import the Workflow SDK through eve. Import durable primitives from eve/workflow and run and hook operations from eve/workflow/api. Bare workflow and workflow/* imports fail the build.

import { createHook, sleep, FatalError } from "workflow";
import { createHook, sleep, FatalError } from "eve/workflow";
import { start, getRun, resumeHook } from "workflow/api";
import { start, getRun, resumeHook } from "eve/workflow/api";

eve/workflow exports createHook, createWebhook, sleep, FatalError, RetryableError, and getWorkflowMetadata. eve/workflow/api exports start, getRun, and resumeHook. Other Workflow SDK subpaths, helpers, and options aren't available, and these exports use eve's own types:

  • getHookByToken is removed. Pass a deterministic token to createHook({ token }), then resume the hook with resumeHook(token, payload), which resolves to void.
  • start(workflow, args?) takes a "use workflow" function, not a source string. It takes no options such as deploymentId or world, because eve runs the workflow on the agent's own queue and deployment.
  • start and getRun return a WorkflowRun with only runId, status, returnValue, and cancel().
  • agent and ask aren't exported. Use defineWorkflowTool() from eve/tools, and call ctx.agent(name).send(message) or ctx.ask(request) in its executor.
const hook = await getHookByToken(token);
await resumeHook(hook, payload);
await resumeHook(token, payload);

Annotate with WorkflowHook, WorkflowWebhook, and WorkflowMetadata from eve/workflow, and WorkflowRun and WorkflowRunStatus from eve/workflow/api. Call eve/workflow/api operations from routes or "use step" helpers, not from replayed workflow bodies. Don't install another Workflow SDK; both entries use eve's bundled copy. You can remove eve/workflow-modules from tsconfig types and reference directives. See Workflow imports.

Replace removed helpers

RemovedUse instead
isDisabledToolSentinel from eve/toolsExport disableTool() from a tool file.
isDisabledRouteSentinel from eve/channelsExport disableRoute() from a route file.
isInstrumentationDisabled from eve/instrumentationExport disableInstrumentation().
failureOf from eve/clientfailure(view, turnId) from eve/events.
answerFromText from eve/channelsParse your channel's input and answer through its session handle; see Custom channels.
defaultOnAgentSession from eve/channels/linearOmit onAgentSession to use the built-in callback.