chore(atomic): implement MSW mock of agent api#7174
Merged
erocheleau merged 21 commits intomainfrom Apr 14, 2026
Merged
Conversation
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Storybook/MSW mock implementation for the Agent Answer API so atomic-generated-answer can be demoed with agent-id, and refactors the story play functions to avoid query duplication when switching stories.
Changes:
- Added
MockAgentApiMSW handlers for/agents/:agentId/answerand/agents/:agentId/follow-upstreaming responses. - Introduced streaming mock event sequences for “head answer” vs “follow-up” behavior.
- Updated
atomic-generated-answerstories to include the new mock and to submit the query in a way that doesn’t duplicate text across story switches.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Locks the newly added dev dependency for the Agent API event types. |
| packages/atomic/package.json | Adds @ag-ui/client as a devDependency to build Agent API mock events. |
| packages/atomic/storybook-utils/api/agent/mock.ts | New MSW mock API class wiring up Agent answer + follow-up endpoints. |
| packages/atomic/storybook-utils/api/agent/generate-response.ts | New SSE streaming response builder and mocked Agent event payloads. |
| packages/atomic/src/components/search/atomic-generated-answer/atomic-generated-answer.new.stories.tsx | Adds a “With Agent ID” story, registers Agent handlers, and fixes query duplication when switching stories. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Collaborator
louis-bompart
left a comment
There was a problem hiding this comment.
Holding off approval because of the use of JS api instead of user input
SimonMilord
approved these changes
Apr 14, 2026
louis-bompart
approved these changes
Apr 14, 2026
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.
SFINT-6636
In this PR
atomic-generated-answerwhen using anagent-id.SearchingandThinkingsteps to reflect the current behavior of the/answerand/follow-upendpoints.userEventAPIs instead of manual DOM event dispatching.Issue fixed
Screen.Recording.2026-04-13.at.12.24.06.PM.mov
Demo of the new story
Screen.Recording.2026-04-13.at.12.03.49.PM.mov