Add AGUIMock — AG-UI protocol mock#100
Merged
Merged
Conversation
commit: |
jpr5
force-pushed
the
feat/agui-mock
branch
3 times, most recently
from
April 9, 2026 23:12
9a90085 to
76067f0
Compare
All 33 AG-UI event types, 11 convenience builders, fluent registration API, SSE streaming with disconnect handling, and record/replay with tee streaming and proxy-only mode.
32 unit tests (core, builders, edge cases, record/replay) plus 8 schema drift tests comparing against canonical @ag-ui/core Zod schemas.
New AGUIMock docs page. Remove section bar from all pages (dead code). Update homepage feature grid and competitive matrix with AG-UI. Add AG-UI schema drift CI workflow.
jpr5
added a commit
that referenced
this pull request
Jul 15, 2026
## Summary
- New `AGUIMock` class implementing the AG-UI (Agent-to-UI) protocol —
the SSE event streaming protocol CopilotKit uses between agents and the
frontend
- All 33 AG-UI event types supported (lifecycle, text, tool calls,
state, activity, reasoning, special, deprecated)
- 11 event builder functions for common patterns (text response, tool
call, state update, reasoning, activity, etc.)
- Fluent registration API: `onMessage()`, `onRun()`, `onToolCall()`,
`onStateKey()`, `onReasoning()`, `onPredicate()`
- Record & replay with tee streaming — proxy to real AG-UI agents,
record event streams as fixtures, replay on subsequent requests
- Proxy-only mode (`--agui-proxy-only`) — forward without saving or
caching
- Standalone and mountable modes (mount at `/agui` on LLMock)
- Config file, suite, and CLI support (`--agui-record`,
`--agui-upstream`, `--agui-proxy-only`)
## Use case
Frontend developers can test CopilotKit UI components without a running
agent backend. Point the frontend at aimock's `/agui` endpoint and get
deterministic AG-UI event streams from fixtures. For demos, use
proxy-only mode with canned fixtures for repeatable scenarios while
proxying unknown traffic to the real agent.
```ts
const agui = new AGUIMock();
agui.onMessage("hello", "Hi! How can I help?");
agui.onToolCall(/search/, "web_search", '{"q":"test"}', { result: "[]" });
agui.enableRecording({ upstream: "http://localhost:8000/agent", proxyOnly: true });
const llm = new LLMock();
llm.mount("/agui", agui);
await llm.start();
```
## New files
- `src/agui-types.ts` — 33 event type definitions, fixture/match types
- `src/agui-handler.ts` — matching, 11 builders, SSE writer
- `src/agui-mock.ts` — AGUIMock class (Mountable)
- `src/agui-recorder.ts` — record/replay with tee streaming, proxy-only
mode
- `src/agui-stub.ts` — barrel exports
- `src/__tests__/agui-mock.test.ts` — 32 tests
## Modified files
- `src/config-loader.ts` — AGUIConfig support
- `src/suite.ts` — agui option in MockSuite
- `src/index.ts` — AG-UI exports
- `src/cli.ts` — AG-UI recording flags
## Test plan
- [x] 32 new tests (core 14, builders 5, edge cases 7, record/replay 6)
- [x] All 2246 tests pass
- [x] Build passes
- [x] 3-round CR loop converged at 0 findings
🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Summary
AGUIMockclass implementing the AG-UI (Agent-to-UI) protocol — the SSE event streaming protocol CopilotKit uses between agents and the frontendonMessage(),onRun(),onToolCall(),onStateKey(),onReasoning(),onPredicate()--agui-proxy-only) — forward without saving or caching/aguion LLMock)--agui-record,--agui-upstream,--agui-proxy-only)Use case
Frontend developers can test CopilotKit UI components without a running agent backend. Point the frontend at aimock's
/aguiendpoint and get deterministic AG-UI event streams from fixtures. For demos, use proxy-only mode with canned fixtures for repeatable scenarios while proxying unknown traffic to the real agent.New files
src/agui-types.ts— 33 event type definitions, fixture/match typessrc/agui-handler.ts— matching, 11 builders, SSE writersrc/agui-mock.ts— AGUIMock class (Mountable)src/agui-recorder.ts— record/replay with tee streaming, proxy-only modesrc/agui-stub.ts— barrel exportssrc/__tests__/agui-mock.test.ts— 32 testsModified files
src/config-loader.ts— AGUIConfig supportsrc/suite.ts— agui option in MockSuitesrc/index.ts— AG-UI exportssrc/cli.ts— AG-UI recording flagsTest plan
🤖 Generated with Claude Code