Skip to content

Commit 9604c10

Browse files
committed
chore: require zod 4 for voltagent 3
1 parent c3f032b commit 9604c10

146 files changed

Lines changed: 1200 additions & 919 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/voltagent-3-next.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ VoltAgent 3 aligns the framework with AI SDK v7, moves the published packages to
3838

3939
```bash
4040
pnpm add @voltagent/core@next @voltagent/server-hono@next @voltagent/logger@next
41-
pnpm add ai@^7 @ai-sdk/openai@^4
41+
pnpm add ai@^7 @ai-sdk/openai@^4 zod@^4
4242
```
4343

4444
If your app uses additional VoltAgent packages, keep all `@voltagent/*` packages on the same major/prerelease line:
@@ -97,6 +97,14 @@ Common provider package upgrades:
9797
| `@ai-sdk/amazon-bedrock` | `^5` |
9898
| `@ai-sdk/google-vertex` | `^5` |
9999

100+
### Zod 4-only
101+
102+
VoltAgent 3 requires Zod 4. The framework packages now use `zod@^4` peer ranges, examples and templates install Zod 4, and the old Zod 3 JSON Schema/OpenAPI compatibility fallback has been removed.
103+
104+
```bash
105+
pnpm add zod@^4
106+
```
107+
100108
### Agent usage
101109

102110
The object-style call shape is the preferred API. AI SDK generation options stay at the top level, while VoltAgent runtime concerns live under `voltagent`.
@@ -232,7 +240,8 @@ console.log(result.output);
232240
2. Set `"type": "module"` and replace CommonJS `require()` calls with ESM imports.
233241
3. Upgrade all `@voltagent/*` packages together from the `next` channel.
234242
4. Upgrade `ai` to `^7` and AI SDK provider packages to their v7-compatible majors.
235-
5. Replace `stepCountIs` with `isStepCount`.
236-
6. Prefer `result.stream` over `result.fullStream`.
237-
7. Prefer `output` over `experimental_output`.
238-
8. Prefer object-style agent calls for new code, with VoltAgent runtime options under `voltagent`.
243+
5. Upgrade `zod` to `^4`.
244+
6. Replace `stepCountIs` with `isStepCount`.
245+
7. Prefer `result.stream` over `result.fullStream`.
246+
8. Prefer `output` over `experimental_output`.
247+
9. Prefer object-style agent calls for new code, with VoltAgent runtime options under `voltagent`.

docs/ai-sdk-first-vnext-plan.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ This means AI SDK primitives such as `model`, `prompt`, `messages`, `tools`, `ou
2424

2525
## vNext Platform Decision
2626

27-
Decision: VoltAgent vNext will target AI SDK 7, Node.js 22 or later, and ESM-only package output.
27+
Decision: VoltAgent vNext will target AI SDK 7, Zod 4, Node.js 22 or later, and ESM-only package output.
2828

2929
This is an explicit compatibility boundary:
3030

3131
- Set the repository and published package engine requirement to `node >=22`.
32+
- Set published Zod peer ranges to `^4.0.0` and remove Zod 3 fallback code paths.
3233
- Remove CommonJS runtime exports from vNext packages that depend on AI SDK or packages that depend on those packages.
3334
- Prefer `"type": "module"` and ESM package exports for new vNext package metadata.
3435
- Keep TypeScript declaration output for ESM consumers.
@@ -45,6 +46,7 @@ Migration consequence:
4546

4647
- Users on Node.js 20 must stay on the previous VoltAgent major or upgrade Node before adopting vNext.
4748
- Users using `require("@voltagent/core")` must migrate to ESM imports.
49+
- Users pinned to Zod 3 must upgrade to Zod 4 before adopting VoltAgent 3.
4850
- Docs, examples, package exports, and migration guide must call this out clearly.
4951

5052
## Protected Feature Surface
@@ -932,6 +934,7 @@ Each PR should include focused tests and avoid mixing refactors with behavior ch
932934
| Model retry/fallback behavior changes | High | Keep VoltAgent retry loop and add retry/fallback tests |
933935
| CommonJS users break on vNext | High | Make ESM-only and Node.js 22 requirements explicit in package metadata and migration docs |
934936
| Package exports or publint fail after removing CJS output | High | Update export maps package-by-package and run `pnpm publint:all` |
937+
| Zod 3 compatibility fallback hides broken app dependencies | Medium | Make VoltAgent 3 Zod 4-only in peer deps, examples, templates, docs, and converter code paths |
935938
| Third-party providers are not AI SDK 7 compatible | Medium | Audit third-party providers, document incompatibilities, and isolate unsupported provider builders |
936939
| Provider dependency decoupling expands scope | Medium | Deferred; keep existing router and provider dependency behavior unchanged in this plan |
937940
| Server request schemas diverge from core API | Medium | Update schemas and processAgentOptions in same slice |
@@ -949,7 +952,7 @@ Each PR should include focused tests and avoid mixing refactors with behavior ch
949952
- [x] Phase 6 ecosystem packages are updated.
950953
- [x] Phase 7 docs are available; executable codemods are deferred to a separate follow-up.
951954
- [x] Phase 8 release gates are green.
952-
- [ ] Phase 9 AI SDK 7, Node.js 22, ESM-only, and AI SDK-style tool support is complete.
955+
- [ ] Phase 9 AI SDK 7, Zod 4, Node.js 22, ESM-only, and AI SDK-style tool support is complete.
953956

954957
## Current Recommendation
955958

@@ -964,10 +967,11 @@ Proceed in this order:
964967
7. Finish docs/codemod decisions and run release gates.
965968
8. Apply the Node.js 22 and ESM-only package boundary.
966969
9. Upgrade AI SDK dependencies to v7-compatible ranges.
967-
10. Run and review AI SDK v7 codemods.
968-
11. Update the core AI SDK boundary for v7 option, stream, callback, usage, and tool approval changes.
969-
12. Add AI SDK-style `tool()` and direct `ToolSet` support while preserving VoltAgent tool features.
970-
13. Update server, protocol, memory, scorer, docs, examples, and templates.
971-
14. Re-run the full release gates for the AI SDK 7 scope.
970+
10. Move Zod support to Zod 4-only across peers, examples, templates, and compatibility code.
971+
11. Run and review AI SDK v7 codemods.
972+
12. Update the core AI SDK boundary for v7 option, stream, callback, usage, and tool approval changes.
973+
13. Add AI SDK-style `tool()` and direct `ToolSet` support while preserving VoltAgent tool features.
974+
14. Update server, protocol, memory, scorer, docs, examples, and templates.
975+
15. Re-run the full release gates for the AI SDK 7 scope.
972976

973977
This order keeps the vNext direction moving while minimizing the chance of losing existing framework features. Phase 8 was green before the AI SDK 7 scope was added; Phase 9 intentionally reopens the release-gate work for the new runtime and dependency boundary.

examples/base/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@voltagent/logger": "^3.0.0-next.0",
1010
"@voltagent/server-hono": "^3.0.0-next.0",
1111
"ai": "^7.0.0",
12-
"zod": "^3.25.76"
12+
"zod": "^4.1.11"
1313
},
1414
"devDependencies": {
1515
"@types/node": "^24.2.1",

examples/github-repo-analyzer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@voltagent/logger": "^3.0.0-next.0",
1010
"@voltagent/server-hono": "^3.0.0-next.0",
1111
"ai": "^7.0.0",
12-
"zod": "^3.25.76"
12+
"zod": "^4.1.11"
1313
},
1414
"devDependencies": {
1515
"@types/node": "^24.2.1",

examples/github-star-stories/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@voltagent/serverless-hono": "^3.0.0-next.0",
1010
"dotenv": "^16.4.5",
1111
"wrangler": "^3.38.0",
12-
"zod": "^3.25.76"
12+
"zod": "^4.1.11"
1313
},
1414
"devDependencies": {
1515
"@types/node": "^24.2.1",

examples/next-js-chatbot-starter-template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"tailwind-merge": "^3.3.1",
4646
"tokenlens": "^1.3.1",
4747
"use-stick-to-bottom": "^1.1.1",
48-
"zod": "^3.25.76"
48+
"zod": "^4.1.11"
4949
},
5050
"devDependencies": {
5151
"@tailwindcss/postcss": "^4.1.4",

examples/with-a2a-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@voltagent/logger": "^3.0.0-next.0",
88
"@voltagent/server-hono": "^3.0.0-next.0",
99
"ai": "^7.0.0",
10-
"zod": "^3.25.76"
10+
"zod": "^4.1.11"
1111
},
1212
"devDependencies": {
1313
"@types/node": "^24.2.1",

examples/with-ad-creator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"ai": "^7.0.0",
1616
"dotenv": "^16.4.5",
1717
"sharp": "^0.34.4",
18-
"zod": "^3.25.76"
18+
"zod": "^4.1.11"
1919
},
2020
"devDependencies": {
2121
"@biomejs/biome": "^1.9.4",

examples/with-agent-tool/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dependencies": {
77
"@voltagent/core": "^3.0.0-next.0",
88
"ai": "^7.0.0",
9-
"zod": "^3.25.76"
9+
"zod": "^4.1.11"
1010
},
1111
"devDependencies": {
1212
"@types/node": "^24.2.1",

examples/with-airtable/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@voltagent/sdk": "^3.0.0-next.0",
1010
"@voltagent/server-hono": "^3.0.0-next.0",
1111
"ai": "^7.0.0",
12-
"zod": "^3.25.76"
12+
"zod": "^4.1.11"
1313
},
1414
"devDependencies": {
1515
"@types/node": "^24.2.1",

0 commit comments

Comments
 (0)