test: add structured output integration tests#588
Open
jsamuel1 wants to merge 3 commits intostrands-agents:mainfrom
Open
test: add structured output integration tests#588jsamuel1 wants to merge 3 commits intostrands-agents:mainfrom
jsamuel1 wants to merge 3 commits intostrands-agents:mainfrom
Conversation
34d8a8f to
ce99923
Compare
jsamuel1
added a commit
to jsamuel1/sdk-typescript
that referenced
this pull request
Mar 3, 2026
Combines the following feature branches: - feat/summarizing-conversation-manager (PR strands-agents#524) - feat/structured-output-integ-tests (PR strands-agents#588) - feat/interrupt-system (PR strands-agents#586) - feat/swarm-multi-agent (PR strands-agents#587) - feat/graph-multi-agent (PR strands-agents#594) All 1277 unit tests pass. No type errors.
ce99923 to
ced227a
Compare
ced227a to
72da482
Compare
Add integration tests for structured output with Zod schemas: - Test typed result matching zod schema via invoke() - Test structured output via streaming with stream() - Validates schema fields (string, number) and content correctness
72da482 to
1eaf4e2
Compare
pgrayy
reviewed
Mar 23, 2026
test/integ/agent.test.ts
Outdated
| await collectGenerator(agent.stream('What was the result?')) | ||
| }) | ||
|
|
||
| describe.skipIf(!supports.tools)('Structured Output', () => { |
Member
There was a problem hiding this comment.
We have an invoke structured output test above on line 508. It technically tests the stream path as well. It wouldn't hurt to have a stream test but if so, could you place it under the existing describe block.
Contributor
Author
There was a problem hiding this comment.
Done — moved both tests into the existing describe('Structured Output') block alongside the validated output test.
Consolidate the two separate Structured Output describe blocks into one per reviewer feedback. The streaming and typed schema tests now live alongside the existing validated output test. --- Prompt: Review PR comments and address feedback
pgrayy
reviewed
Mar 27, 2026
test/integ/agent.test.ts
Outdated
| expect(result.structuredOutput).toStrictEqual({ answer: 4 }) | ||
| }) | ||
|
|
||
| it('returns typed result matching zod schema', async () => { |
Member
There was a problem hiding this comment.
We already have a test for the invoke case above.
Contributor
Author
There was a problem hiding this comment.
Done — removed the duplicate invoke test. Only the streaming test remains as the new addition.
The existing 'returns validated structured output' test already covers the invoke path. Keep only the streaming test as the new addition per reviewer feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add integration tests for structured output with Zod schemas, validating the feature works end-to-end with real model providers.
Changes
agent.invoke()agent.stream()Testing
test/integ/agent.test.ts