Skip to content

Replace @ag-ui/client with minimal local SSE agent implementation#7158

Draft
Copilot wants to merge 2 commits intoSFINT-6610from
copilot/analyze-ag-ui-client-usage
Draft

Replace @ag-ui/client with minimal local SSE agent implementation#7158
Copilot wants to merge 2 commits intoSFINT-6610from
copilot/analyze-ag-ui-client-usage

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

✅ Checklist

  • 🧪 The component is unit tested
  • 🧪 The component includes E2E tests
  • 🗑️ Old Cypress tests exclusive to the component are removed
  • 📖 The component is documented in storybook with an .mdx file
  • ♿ The component complies with the Web Content Accessibility Guidelines.
  • 🌐 All strings intended for humans or assistive technology must be localized with i18n.
  • 📦 The Lit component is exported in the appropriate index.ts and lazy-index.ts files.
  • 🎨 CSS parts are documented still accessible.
  • 🦥 Slotted Content, public methods and properties are documented
  • 🔄 The component outputs the same Angular output as before with Stencil
  • 🏷️ The component declares the component type in the HTMLElementTagNameMap

@ag-ui/client (0.0.45) pulls in @ag-ui/core, @ag-ui/encoder, @ag-ui/proto, rxjs, zod, uuid, compare-versions, fast-json-patch, and untruncate-json. We use ~6 of its 30+ subscriber callbacks, none of its middleware/legacy/proto/rxjs machinery, and only the SSE code path.

What's used vs. what's provided

Used Not used
HttpAgent (constructor, requestInit() override, runAgent(), abortRun()) RxJS Observable pipeline, middleware chain, proto/binary parsing
RunAgentInput.forwardedProps threadId, runId, tools, context, messages, state
6 subscriber callbacks 25+ other callbacks, state mutation system, message tracking

New sse-agent module (packages/headless/.../agents/sse-agent/)

  • event-types.tsEventType enum + 6 event interfaces (RunStarted, RunFinished, RunError, TextMessageStart, TextMessageContent, Custom)
  • agent-subscriber.tsAgentSubscriber interface, RunAgentInput type
  • sse-parser.ts — Async generator SSE parser (data: lines → JSON objects)
  • http-agent.tsHttpAgent: fetch → SSE parse → dispatch to subscriber
  • index.ts — Barrel

Migration

All 6 consumer files updated from import ... from '@ag-ui/client'import ... from '../sse-agent/index.js'. The AgentSubscriber contract is identical for the callbacks we use, so strategy files and their tests required only import path changes.

Tests

21 new tests (8 SSE parser, 13 HttpAgent). All 23 existing agent tests pass unchanged.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Create sse-agent module with minimal HttpAgent, SSE parser, event types and subscriber interface
- Update answer-agent and follow-up-agent to use local sse-agent module
- Update strategy files and tests to use local AgentSubscriber type
- Remove @ag-ui/client dependency from package.json
- Add unit tests for SSE parser and HttpAgent (21 new tests)
- All 44 tests pass, build succeeds, linting passes

Co-authored-by: louis-bompart <12366410+louis-bompart@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze requirements for ag-ui-client implementation Replace @ag-ui/client with minimal local SSE agent implementation Feb 20, 2026
Copilot AI requested a review from louis-bompart February 20, 2026 21:00
Copilot AI temporarily deployed to Prerelease (CDN) February 20, 2026 21:03 Inactive
@github-actions
Copy link

🔗 Scratch Orgs ready to test this PR:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants