@threadplane/ag-uiFunctionv0.3.4

injectAgent

Injects the AG-UI agent from Angular's dependency injection container. Use this in components or services provided via provideAgent() (or provideFakeAgent()).

Returns an AgUiAgent — the runtime-neutral Agent contract plus the AG-UI-specific customEvents signal — so customEvents is reachable directly, without casting.

Typed state via AgentRef. Pass the same ref that was supplied to provideAgent(ref, …) to carry the state type through DI without repeating the generic at every call site. The no-arg form defaults to AgUiAgent<Record<string, unknown>>.

import { injectAgent } from '@threadplane/ag-ui';

Declaration · overload 1

export declare function injectAgent(): AgUiAgent;

Returns

AgUiAgent

Examples

Typed state via AgentRef

const agent = injectAgent(TRIP); // AgUiAgent<TripState>

Declaration · overload 2

export declare function injectAgent<T>(ref: AgentRef<T>): AgUiAgent<T>;

Type parameters

T

Parameters

ref · required
AgentRef<T>

Returns

AgUiAgent<T>