fix: allow andAgent schema to accept Output.* specs (arrays, choi…#965
Conversation
…ces, json, text)
🦋 Changeset detectedLatest commit: 087f722 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. [Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/VoltAgent/voltagent/new/fix/and-agent-output?filename=.changeset/tiny-pans-allow.md&value=---%0A%22%40voltagent%2Fcore%22%3A%20patch%0A---%0A%0Afix%3A%20allow%20%60andAgent%60%20schema%20to%20accept%20%60Output.*%60%20specs%20(arrays%2C%20choi%E2%80%A6%0A) |
📝 WalkthroughWalkthroughAdds support for Output.* specs from the AI SDK to andAgent, enabling non-object structured outputs (arrays, choices, json, text) alongside Zod schemas. Introduces OutputSpec, AgentOutputSchema, and InferAgentOutput types with a runtime isOutputSpec guard to conditionally wrap schemas. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
This comment has been minimized.
This comment has been minimized.
Deploying voltagent with
|
| Latest commit: |
087f722
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ae51530a.voltagent.pages.dev |
| Branch Preview URL: | https://fix-and-agent-output.voltagent.pages.dev |
…ces, json, text)
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
What is the new behavior?
fixes (issue)
Notes for reviewers
Summary by cubic
andAgent now accepts ai-sdk Output.* specs (array, choice, json, text) as schemas, not just Zod objects. This fixes #964 and enables non-object step outputs with correct type inference.
Written for commit 087f722. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.