Fake Agent
FakeAgent is an in-process AG-UI AbstractAgent for frontend work when a backend is not ready.
It emits a canned stream:
RUN_STARTED- optional
REASONING_MESSAGE_* TEXT_MESSAGE_START- one
TEXT_MESSAGE_CONTENTevent per token TEXT_MESSAGE_ENDRUN_FINISHED
It is for demos, story-like development, and tests. It is not a production transport.
#Use the provider
For Angular apps, use provideFakeAgUiAgent().
Your component stays the same as the real backend version:
Switching to a real backend is a provider change:
#Add reasoning
Pass reasoningTokens when you need to exercise reasoning UI.
Reasoning events are emitted before text events and use the same message id, so the reducer stores reasoning and final content on one assistant message.
#Use the class directly
Use FakeAgent directly when a test needs an AG-UI source rather than Angular DI.
That gives you the same Agent contract as provideFakeAgUiAgent().
#Configuration
| Option | Type | Default | Notes |
|---|---|---|---|
tokens | string[] | A short canned greeting | Emitted as text deltas in order. |
reasoningTokens | string[] | [] | Emitted before text deltas. |
delayMs | number | 60 | Delay between events after the initial start delay. |
#What it does not do
FakeAgent does not call a model, execute tools, persist history, or simulate interrupts.
It is deliberately small. Use it to keep UI work moving, not to validate backend behavior.
For backend integration, test against your real AG-UI endpoint and the event map in Event Mapping.