provideFakeAgent
Registers an in-process FakeAgent under AGENT.
Use for offline demos and development. Drop-in replacement for provideAgent({ url }) when no real backend is available.
Pass script to stream exact AG-UI events instead of the canned token
reply — the adapter reduces them into toolCalls(), state(),
customEvents(), and interrupt() exactly as it would real wire events,
and emits each one on rawEvents$.
import { provideFakeAgent } from '@threadplane/ag-ui';Declaration · overload 1
export declare function provideFakeAgent(config?: AgUiFakeAgentConfig): Provider[];Parameters
config· optionalAgUiFakeAgentConfig
Returns
Provider[]Examples
TestBed.configureTestingModule({
providers: [provideFakeAgent({ tokens: ['Hello from the fake agent'] })],
});Scripted tool call
TestBed.configureTestingModule({
providers: [provideFakeAgent({
delayMs: 0,
script: [{
when: 'initial',
events: [
{ type: EventType.TOOL_CALL_START, toolCallId: 't1', toolCallName: 'get_weather' },
{ type: EventType.TOOL_CALL_ARGS, toolCallId: 't1', delta: '{"city":"SF"}' },
{ type: EventType.TOOL_CALL_END, toolCallId: 't1' },
] as BaseEvent[],
}],
})],
});