When upgrading to @convex-dev/agent v0.7, you are moving to AI SDK 7 at runtime. This requires updating Node.js, core dependencies, and provider packages simultaneously to avoid type incompatibilities. Existing messages saved by v0.6 remain readable, but new streams will use the AI SDK 7 UIMessageChunk format.
Prerequisites
- Node.js: Version 22 or newer is required.
- Dependency Management: Avoid using
--force during installation, as mixed AI SDK major versions can cause incompatible model, tool, and message types.
Step 1: Update Dependencies
Update @convex-dev/agent and the core AI SDK packages:
pnpm add @convex-dev/agent@^0.7.0 ai@^7.0.0 \
@ai-sdk/provider@^4.0.0 @ai-sdk/provider-utils@^5.0.0
Update your official provider packages to v4:
pnpm add @ai-sdk/openai@^4.0.0 @ai-sdk/anthropic@^4.0.0 \
@ai-sdk/google@^4.0.0 @ai-sdk/groq@^4.0.0
Note for RAG users: If using @convex-dev/rag with Agent, ensure you use an AI SDK 7-compatible RAG release (>= 0.8.0.alpha.0).
Step 2: Rename system to instructions
While system is temporarily accepted, it is deprecated. Use instructions for top-level model guidance in the Agent constructor and in generateText calls.
const agent = new Agent(components.agent, {
languageModel: openai("gpt-5"),
instructions: "You are a helpful assistant.",
});
await agent.generateText(ctx, { threadId }, {
prompt: "Hello",
instructions: "Answer concisely.",
});
Note: Stored system messages are still supported. If you pass system messages within an assembled history, you must set allowSystemInMessages: true.
Step 3: Update AI SDK Types and Callbacks
Agent's generation, streaming, tool, usage, warning, and provider types now use AI SDK 7. You must update custom callbacks or wrappers that previously relied on AI SDK 6 types.
Key changes to implement:
- Use
mediaType for AI SDK image and file parts. - Update custom tools and provider options to their AI SDK 7 forms.
- Review code consuming usage, warnings, response metadata, or step results, as these now follow AI SDK 7 shapes.
maxSteps is still supported, and stopWhen remains the preferred AI SDK API.
Step 4: Verify the Migration
Run the TypeScript compiler and tests to ensure no type mismatches exist:
pnpm exec tsc --noEmit
pnpm test