provideAgent()
provideAgent() registers the singleton AG-UI agent configuration for every injectAgent() call in an Angular application. Call it once in bootstrapApplication or an ApplicationConfig to wire up the endpoint URL, optional identifiers, custom headers, and telemetry.
injectAgent() itself takes no arguments — all configuration flows through provideAgent().
#Configuration options
| Option | Type | Description |
|---|---|---|
url | string | HTTP endpoint for the AG-UI backend agent. Required. |
agentId | string | Optional agent identifier forwarded to the backend. |
threadId | string | Optional thread identifier for session continuity. |
headers | Record<string, string> | Optional custom HTTP headers included on every request. |
telemetry | AgentRuntimeTelemetrySink | false | Optional app-owned telemetry sink. No telemetry is emitted unless this is provided. |
#Static vs factory config
Pass a plain AgentConfig object when the URL is known up front. Pass a () => AgentConfig factory when the config depends on runtime DI state — the factory runs inside an Angular injection context, so it may call inject() to read services or environment tokens.
#Singleton model
A single provideAgent({...}) call configures the entire application. Every injectAgent() call resolves to the same configured agent.