@copilotkit/angular 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.attw.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "ignoreRules": ["cjs-resolves-to-esm", "no-resolution", "untyped-resolution"],
3
+ "excludeEntrypoints": ["./styles.css"]
4
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Tawkit Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,326 @@
1
+ # CopilotKit for Angular
2
+
3
+ Angular bindings for CopilotKit core and AG-UI agents. This package provides services, directives, and utilities for building custom, headless Copilot UIs.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # npm
9
+ npm install @copilotkit/angular
10
+ ```
11
+
12
+ Peer dependencies you provide in your app:
13
+
14
+ - `@angular/core` and `@angular/common` (19, 20, or 21)
15
+ - `@angular/cdk` (match your Angular major)
16
+ - `rxjs`
17
+
18
+ ## Quick start
19
+
20
+ ### 1) Provide CopilotKit
21
+
22
+ Configure runtime and tools in your app config:
23
+
24
+ ```ts
25
+ import { ApplicationConfig } from "@angular/core";
26
+ import { provideCopilotKit } from "@copilotkit/angular";
27
+
28
+ export const appConfig: ApplicationConfig = {
29
+ providers: [
30
+ provideCopilotKit({
31
+ runtimeUrl: "http://localhost:3001/api/copilotkit",
32
+ headers: { Authorization: "Bearer ..." },
33
+ properties: { app: "demo" },
34
+ }),
35
+ ],
36
+ };
37
+ ```
38
+
39
+ ### 2) Build a custom UI with `injectAgentStore`
40
+
41
+ ```ts
42
+ import { Component, inject, signal } from "@angular/core";
43
+ import { Message } from "@ag-ui/client";
44
+ import { CopilotKit, injectAgentStore } from "@copilotkit/angular";
45
+ import { randomUUID } from "@copilotkit/shared";
46
+
47
+ @Component({
48
+ template: `
49
+ @for (let message of messages(); track message.id) {
50
+ <div>
51
+ <em>{{ message.role }}</em>
52
+ <p>{{ message.content }}</p>
53
+ </div>
54
+ }
55
+
56
+ <input
57
+ [value]="input()"
58
+ (input)="input.set($any($event.target).value)"
59
+ (keyup.enter)="send()"
60
+ />
61
+ <button (click)="send()" [disabled]="store().isRunning()">Send</button>
62
+ `,
63
+ })
64
+ export class HeadlessChatComponent {
65
+ readonly copilotKit = inject(CopilotKit);
66
+ readonly store = injectAgentStore("default");
67
+ readonly messages = this.store().messages;
68
+
69
+ readonly input = signal("");
70
+
71
+ async send() {
72
+ const content = this.input().trim();
73
+ if (!content) return;
74
+
75
+ const agent = this.store().agent;
76
+
77
+ agent.addMessage({
78
+ id: randomUUID(),
79
+ role: "user",
80
+ content,
81
+ });
82
+
83
+ this.input.set("");
84
+
85
+ await this.copilotKit.core.runAgent({ agent });
86
+ }
87
+ }
88
+ ```
89
+
90
+ The `agent` is an AG-UI `AbstractAgent`. Refer to your AG-UI agent implementation for available methods and message formats.
91
+
92
+ ## Core configuration
93
+
94
+ ### `CopilotKitConfig`
95
+
96
+ `provideCopilotKit` accepts a `CopilotKitConfig` object:
97
+
98
+ ```ts
99
+ export interface CopilotKitConfig {
100
+ runtimeUrl?: string;
101
+ headers?: Record<string, string>;
102
+ licenseKey?: string;
103
+ properties?: Record<string, unknown>;
104
+ agents?: Record<string, AbstractAgent>;
105
+ tools?: ClientTool[];
106
+ renderToolCalls?: RenderToolCallConfig[];
107
+ frontendTools?: FrontendToolConfig[];
108
+ humanInTheLoop?: HumanInTheLoopConfig[];
109
+ }
110
+ ```
111
+
112
+ - `runtimeUrl`: URL to your CopilotKit runtime.
113
+ - `headers`: Default headers sent to the runtime.
114
+ - `properties`: Arbitrary props forwarded to agent runs.
115
+ - `agents`: Local, in-browser agents keyed by `agentId`.
116
+ - `tools`: Tool definitions advertised to the runtime (no handler).
117
+ - `renderToolCalls`: Components to render tool calls in the UI.
118
+ - `frontendTools`: Client-side tools with handlers.
119
+ - `humanInTheLoop`: Tools that pause for user input.
120
+
121
+ ### Injection helpers
122
+
123
+ - `provideCopilotKit(config)`: Provider for `CopilotKitConfig`.
124
+
125
+ ## `CopilotKit` service
126
+
127
+ ### Readonly signals
128
+
129
+ - `agents`: `Signal<Record<string, AbstractAgent>>`
130
+ - `runtimeConnectionStatus`: `Signal<CopilotKitCoreRuntimeConnectionStatus>`
131
+ - `runtimeUrl`: `Signal<string | undefined>`
132
+ - `runtimeTransport`: `Signal<CopilotRuntimeTransport>` (`"rest" | "single"`)
133
+ - `headers`: `Signal<Record<string, string>>`
134
+ - `toolCallRenderConfigs`: `Signal<RenderToolCallConfig[]>`
135
+ - `clientToolCallRenderConfigs`: `Signal<FrontendToolConfig[]>`
136
+ - `humanInTheLoopToolRenderConfigs`: `Signal<HumanInTheLoopConfig[]>`
137
+
138
+ ### Methods
139
+
140
+ - `getAgent(agentId: string): AbstractAgent | undefined`
141
+ - `addFrontendTool(config: FrontendToolConfig & { injector: Injector }): void`
142
+ - `addRenderToolCall(config: RenderToolCallConfig): void`
143
+ - `addHumanInTheLoop(config: HumanInTheLoopConfig): void`
144
+ - `removeTool(toolName: string, agentId?: string): void`
145
+ - `updateRuntime(options: { runtimeUrl?: string; runtimeTransport?: CopilotRuntimeTransport; headers?: Record<string,string>; properties?: Record<string, unknown>; agents?: Record<string, AbstractAgent>; }): void`
146
+
147
+ ### Advanced
148
+
149
+ - `core`: The underlying `CopilotKitCore` instance.
150
+
151
+ ## Agents
152
+
153
+ ### `injectAgentStore`
154
+
155
+ ```ts
156
+ const store = injectAgentStore("default");
157
+ // or: injectAgentStore(signal(agentId))
158
+ ```
159
+
160
+ Returns a `Signal<AgentStore>`. The store exposes:
161
+
162
+ - `agent`: `AbstractAgent`
163
+ - `messages`: `Signal<Message[]>`
164
+ - `state`: `Signal<any>`
165
+ - `isRunning`: `Signal<boolean>`
166
+ - `teardown()`: Clean up subscriptions
167
+
168
+ If the agent is not available locally but a `runtimeUrl` is configured, a proxy agent is created while the runtime connects. If the agent still cannot be resolved, an error is thrown that includes the configured runtime and known agent IDs.
169
+
170
+ ### `CopilotkitAgentFactory`
171
+
172
+ Advanced factory for creating `AgentStore` signals. Most apps should use `injectAgentStore` instead.
173
+
174
+ ## Agent context
175
+
176
+ ### `connectAgentContext`
177
+
178
+ Connect AG-UI context to the runtime (auto-cleanup when the effect is destroyed):
179
+
180
+ ```ts
181
+ import { connectAgentContext } from "@copilotkit/angular";
182
+
183
+ connectAgentContext({
184
+ description: "User preferences",
185
+ value: { theme: "dark" },
186
+ });
187
+ ```
188
+
189
+ You must call it within an injection context (e.g., inside a component constructor or `runInInjectionContext`), or pass an explicit `Injector`:
190
+
191
+ ```ts
192
+ connectAgentContext(contextSignal, { injector });
193
+ ```
194
+
195
+ ## Tools and tool rendering
196
+
197
+ ### Types
198
+
199
+ ```ts
200
+ export interface RenderToolCallConfig<Args> {
201
+ name: string; // tool name, or "*" for wildcard
202
+ args: z.ZodType<Args>; // Zod schema for args
203
+ component: Type<ToolRenderer<Args>>;
204
+ agentId?: string; // optional agent scope
205
+ }
206
+
207
+ export interface FrontendToolConfig<Args> {
208
+ name: string;
209
+ description: string;
210
+ parameters: z.ZodType<Args>;
211
+ component?: Type<ToolRenderer<Args>>; // optional UI renderer
212
+ handler: (args: Args, context: FrontendToolHandlerContext) => Promise<unknown>;
213
+ agentId?: string;
214
+ }
215
+
216
+ export interface HumanInTheLoopConfig<Args> {
217
+ name: string;
218
+ description: string;
219
+ parameters: z.ZodType<Args>;
220
+ component: Type<HumanInTheLoopToolRenderer<Args>>;
221
+ agentId?: string;
222
+ }
223
+
224
+ export type ClientTool<Args> = Omit<FrontendTool<Args>, \"handler\"> & {
225
+ renderer?: Type<ToolRenderer<Args>>;
226
+ };
227
+ ```
228
+
229
+ Renderer components receive a signal:
230
+
231
+ ```ts
232
+ export interface ToolRenderer<Args> {
233
+ toolCall: Signal<AngularToolCall<Args>>;
234
+ }
235
+
236
+ export interface HumanInTheLoopToolRenderer<Args> {
237
+ toolCall: Signal<HumanInTheLoopToolCall<Args>>; // includes respond(result)
238
+ }
239
+ ```
240
+
241
+ `AngularToolCall` / `HumanInTheLoopToolCall` expose `args`, `status` (`"in-progress" | "executing" | "complete"`), and `result`.
242
+
243
+ ### Register tools with DI
244
+
245
+ These helpers auto-remove tools when the current injection context is destroyed:
246
+ Call them from an injection context (e.g., a component constructor, directive, or `runInInjectionContext`).
247
+
248
+ ```ts
249
+ import {
250
+ registerFrontendTool,
251
+ registerRenderToolCall,
252
+ registerHumanInTheLoop,
253
+ } from "@copilotkit/angular";
254
+ import { z } from "zod";
255
+
256
+ registerFrontendTool({
257
+ name: "lookup",
258
+ description: "Fetch a record",
259
+ parameters: z.object({ id: z.string() }),
260
+ handler: async ({ id }) => ({ id, ok: true }),
261
+ });
262
+
263
+ registerRenderToolCall({
264
+ name: "*", // wildcard renderer
265
+ args: z.any(),
266
+ component: MyToolCallRenderer,
267
+ });
268
+
269
+ registerHumanInTheLoop({
270
+ name: "approval",
271
+ description: "Request approval",
272
+ parameters: z.object({ reason: z.string() }),
273
+ component: ApprovalRenderer,
274
+ });
275
+ ```
276
+
277
+ ### Configure tools in `provideCopilotKit`
278
+
279
+ ```ts
280
+ provideCopilotKit({
281
+ frontendTools: [
282
+ /* FrontendToolConfig[] */
283
+ ],
284
+ renderToolCalls: [
285
+ /* RenderToolCallConfig[] */
286
+ ],
287
+ humanInTheLoop: [
288
+ /* HumanInTheLoopConfig[] */
289
+ ],
290
+ tools: [
291
+ /* ClientTool[] */
292
+ ],
293
+ });
294
+ ```
295
+
296
+ `tools` are advertised to the runtime. If you include `renderer` + `parameters` on a `ClientTool`, CopilotKit will also register a renderer for tool calls.
297
+
298
+ ## `RenderToolCalls` component
299
+
300
+ `RenderToolCalls` renders tool call components under an assistant message based on registered render configs.
301
+
302
+ ```html
303
+ <copilot-render-tool-calls
304
+ [message]="assistantMessage"
305
+ [messages]="messages"
306
+ [isLoading]="isRunning"
307
+ ></copilot-render-tool-calls>
308
+ ```
309
+
310
+ Inputs:
311
+
312
+ - `message`: `AssistantMessage` (must include `toolCalls`)
313
+ - `messages`: full `Message[]` list (used to find tool results)
314
+ - `isLoading`: whether the agent is currently running
315
+
316
+ Tool arguments are parsed with `partialJSONParse`, so incomplete JSON during streaming still renders.
317
+
318
+ ## Runtime notes
319
+
320
+ - Set `runtimeUrl` to your CopilotKit runtime endpoint.
321
+ - If you need to change runtime settings at runtime, call `CopilotKit.updateRuntime(...)`.
322
+ - `runtimeTransport` supports `"rest"` or `"single"` (SSE single-stream transport).
323
+
324
+ ## Not documented here
325
+
326
+ This package also exports a full set of chat UI components under `src/lib/components/chat`. Those APIs are intentionally omitted from this README.
package/dist/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Tawkit Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/dist/README.md ADDED
@@ -0,0 +1,326 @@
1
+ # CopilotKit for Angular
2
+
3
+ Angular bindings for CopilotKit core and AG-UI agents. This package provides services, directives, and utilities for building custom, headless Copilot UIs.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # npm
9
+ npm install @copilotkit/angular
10
+ ```
11
+
12
+ Peer dependencies you provide in your app:
13
+
14
+ - `@angular/core` and `@angular/common` (19, 20, or 21)
15
+ - `@angular/cdk` (match your Angular major)
16
+ - `rxjs`
17
+
18
+ ## Quick start
19
+
20
+ ### 1) Provide CopilotKit
21
+
22
+ Configure runtime and tools in your app config:
23
+
24
+ ```ts
25
+ import { ApplicationConfig } from "@angular/core";
26
+ import { provideCopilotKit } from "@copilotkit/angular";
27
+
28
+ export const appConfig: ApplicationConfig = {
29
+ providers: [
30
+ provideCopilotKit({
31
+ runtimeUrl: "http://localhost:3001/api/copilotkit",
32
+ headers: { Authorization: "Bearer ..." },
33
+ properties: { app: "demo" },
34
+ }),
35
+ ],
36
+ };
37
+ ```
38
+
39
+ ### 2) Build a custom UI with `injectAgentStore`
40
+
41
+ ```ts
42
+ import { Component, inject, signal } from "@angular/core";
43
+ import { Message } from "@ag-ui/client";
44
+ import { CopilotKit, injectAgentStore } from "@copilotkit/angular";
45
+ import { randomUUID } from "@copilotkit/shared";
46
+
47
+ @Component({
48
+ template: `
49
+ @for (let message of messages(); track message.id) {
50
+ <div>
51
+ <em>{{ message.role }}</em>
52
+ <p>{{ message.content }}</p>
53
+ </div>
54
+ }
55
+
56
+ <input
57
+ [value]="input()"
58
+ (input)="input.set($any($event.target).value)"
59
+ (keyup.enter)="send()"
60
+ />
61
+ <button (click)="send()" [disabled]="store().isRunning()">Send</button>
62
+ `,
63
+ })
64
+ export class HeadlessChatComponent {
65
+ readonly copilotKit = inject(CopilotKit);
66
+ readonly store = injectAgentStore("default");
67
+ readonly messages = this.store().messages;
68
+
69
+ readonly input = signal("");
70
+
71
+ async send() {
72
+ const content = this.input().trim();
73
+ if (!content) return;
74
+
75
+ const agent = this.store().agent;
76
+
77
+ agent.addMessage({
78
+ id: randomUUID(),
79
+ role: "user",
80
+ content,
81
+ });
82
+
83
+ this.input.set("");
84
+
85
+ await this.copilotKit.core.runAgent({ agent });
86
+ }
87
+ }
88
+ ```
89
+
90
+ The `agent` is an AG-UI `AbstractAgent`. Refer to your AG-UI agent implementation for available methods and message formats.
91
+
92
+ ## Core configuration
93
+
94
+ ### `CopilotKitConfig`
95
+
96
+ `provideCopilotKit` accepts a `CopilotKitConfig` object:
97
+
98
+ ```ts
99
+ export interface CopilotKitConfig {
100
+ runtimeUrl?: string;
101
+ headers?: Record<string, string>;
102
+ licenseKey?: string;
103
+ properties?: Record<string, unknown>;
104
+ agents?: Record<string, AbstractAgent>;
105
+ tools?: ClientTool[];
106
+ renderToolCalls?: RenderToolCallConfig[];
107
+ frontendTools?: FrontendToolConfig[];
108
+ humanInTheLoop?: HumanInTheLoopConfig[];
109
+ }
110
+ ```
111
+
112
+ - `runtimeUrl`: URL to your CopilotKit runtime.
113
+ - `headers`: Default headers sent to the runtime.
114
+ - `properties`: Arbitrary props forwarded to agent runs.
115
+ - `agents`: Local, in-browser agents keyed by `agentId`.
116
+ - `tools`: Tool definitions advertised to the runtime (no handler).
117
+ - `renderToolCalls`: Components to render tool calls in the UI.
118
+ - `frontendTools`: Client-side tools with handlers.
119
+ - `humanInTheLoop`: Tools that pause for user input.
120
+
121
+ ### Injection helpers
122
+
123
+ - `provideCopilotKit(config)`: Provider for `CopilotKitConfig`.
124
+
125
+ ## `CopilotKit` service
126
+
127
+ ### Readonly signals
128
+
129
+ - `agents`: `Signal<Record<string, AbstractAgent>>`
130
+ - `runtimeConnectionStatus`: `Signal<CopilotKitCoreRuntimeConnectionStatus>`
131
+ - `runtimeUrl`: `Signal<string | undefined>`
132
+ - `runtimeTransport`: `Signal<CopilotRuntimeTransport>` (`"rest" | "single"`)
133
+ - `headers`: `Signal<Record<string, string>>`
134
+ - `toolCallRenderConfigs`: `Signal<RenderToolCallConfig[]>`
135
+ - `clientToolCallRenderConfigs`: `Signal<FrontendToolConfig[]>`
136
+ - `humanInTheLoopToolRenderConfigs`: `Signal<HumanInTheLoopConfig[]>`
137
+
138
+ ### Methods
139
+
140
+ - `getAgent(agentId: string): AbstractAgent | undefined`
141
+ - `addFrontendTool(config: FrontendToolConfig & { injector: Injector }): void`
142
+ - `addRenderToolCall(config: RenderToolCallConfig): void`
143
+ - `addHumanInTheLoop(config: HumanInTheLoopConfig): void`
144
+ - `removeTool(toolName: string, agentId?: string): void`
145
+ - `updateRuntime(options: { runtimeUrl?: string; runtimeTransport?: CopilotRuntimeTransport; headers?: Record<string,string>; properties?: Record<string, unknown>; agents?: Record<string, AbstractAgent>; }): void`
146
+
147
+ ### Advanced
148
+
149
+ - `core`: The underlying `CopilotKitCore` instance.
150
+
151
+ ## Agents
152
+
153
+ ### `injectAgentStore`
154
+
155
+ ```ts
156
+ const store = injectAgentStore("default");
157
+ // or: injectAgentStore(signal(agentId))
158
+ ```
159
+
160
+ Returns a `Signal<AgentStore>`. The store exposes:
161
+
162
+ - `agent`: `AbstractAgent`
163
+ - `messages`: `Signal<Message[]>`
164
+ - `state`: `Signal<any>`
165
+ - `isRunning`: `Signal<boolean>`
166
+ - `teardown()`: Clean up subscriptions
167
+
168
+ If the agent is not available locally but a `runtimeUrl` is configured, a proxy agent is created while the runtime connects. If the agent still cannot be resolved, an error is thrown that includes the configured runtime and known agent IDs.
169
+
170
+ ### `CopilotkitAgentFactory`
171
+
172
+ Advanced factory for creating `AgentStore` signals. Most apps should use `injectAgentStore` instead.
173
+
174
+ ## Agent context
175
+
176
+ ### `connectAgentContext`
177
+
178
+ Connect AG-UI context to the runtime (auto-cleanup when the effect is destroyed):
179
+
180
+ ```ts
181
+ import { connectAgentContext } from "@copilotkit/angular";
182
+
183
+ connectAgentContext({
184
+ description: "User preferences",
185
+ value: { theme: "dark" },
186
+ });
187
+ ```
188
+
189
+ You must call it within an injection context (e.g., inside a component constructor or `runInInjectionContext`), or pass an explicit `Injector`:
190
+
191
+ ```ts
192
+ connectAgentContext(contextSignal, { injector });
193
+ ```
194
+
195
+ ## Tools and tool rendering
196
+
197
+ ### Types
198
+
199
+ ```ts
200
+ export interface RenderToolCallConfig<Args> {
201
+ name: string; // tool name, or "*" for wildcard
202
+ args: z.ZodType<Args>; // Zod schema for args
203
+ component: Type<ToolRenderer<Args>>;
204
+ agentId?: string; // optional agent scope
205
+ }
206
+
207
+ export interface FrontendToolConfig<Args> {
208
+ name: string;
209
+ description: string;
210
+ parameters: z.ZodType<Args>;
211
+ component?: Type<ToolRenderer<Args>>; // optional UI renderer
212
+ handler: (args: Args, context: FrontendToolHandlerContext) => Promise<unknown>;
213
+ agentId?: string;
214
+ }
215
+
216
+ export interface HumanInTheLoopConfig<Args> {
217
+ name: string;
218
+ description: string;
219
+ parameters: z.ZodType<Args>;
220
+ component: Type<HumanInTheLoopToolRenderer<Args>>;
221
+ agentId?: string;
222
+ }
223
+
224
+ export type ClientTool<Args> = Omit<FrontendTool<Args>, \"handler\"> & {
225
+ renderer?: Type<ToolRenderer<Args>>;
226
+ };
227
+ ```
228
+
229
+ Renderer components receive a signal:
230
+
231
+ ```ts
232
+ export interface ToolRenderer<Args> {
233
+ toolCall: Signal<AngularToolCall<Args>>;
234
+ }
235
+
236
+ export interface HumanInTheLoopToolRenderer<Args> {
237
+ toolCall: Signal<HumanInTheLoopToolCall<Args>>; // includes respond(result)
238
+ }
239
+ ```
240
+
241
+ `AngularToolCall` / `HumanInTheLoopToolCall` expose `args`, `status` (`"in-progress" | "executing" | "complete"`), and `result`.
242
+
243
+ ### Register tools with DI
244
+
245
+ These helpers auto-remove tools when the current injection context is destroyed:
246
+ Call them from an injection context (e.g., a component constructor, directive, or `runInInjectionContext`).
247
+
248
+ ```ts
249
+ import {
250
+ registerFrontendTool,
251
+ registerRenderToolCall,
252
+ registerHumanInTheLoop,
253
+ } from "@copilotkit/angular";
254
+ import { z } from "zod";
255
+
256
+ registerFrontendTool({
257
+ name: "lookup",
258
+ description: "Fetch a record",
259
+ parameters: z.object({ id: z.string() }),
260
+ handler: async ({ id }) => ({ id, ok: true }),
261
+ });
262
+
263
+ registerRenderToolCall({
264
+ name: "*", // wildcard renderer
265
+ args: z.any(),
266
+ component: MyToolCallRenderer,
267
+ });
268
+
269
+ registerHumanInTheLoop({
270
+ name: "approval",
271
+ description: "Request approval",
272
+ parameters: z.object({ reason: z.string() }),
273
+ component: ApprovalRenderer,
274
+ });
275
+ ```
276
+
277
+ ### Configure tools in `provideCopilotKit`
278
+
279
+ ```ts
280
+ provideCopilotKit({
281
+ frontendTools: [
282
+ /* FrontendToolConfig[] */
283
+ ],
284
+ renderToolCalls: [
285
+ /* RenderToolCallConfig[] */
286
+ ],
287
+ humanInTheLoop: [
288
+ /* HumanInTheLoopConfig[] */
289
+ ],
290
+ tools: [
291
+ /* ClientTool[] */
292
+ ],
293
+ });
294
+ ```
295
+
296
+ `tools` are advertised to the runtime. If you include `renderer` + `parameters` on a `ClientTool`, CopilotKit will also register a renderer for tool calls.
297
+
298
+ ## `RenderToolCalls` component
299
+
300
+ `RenderToolCalls` renders tool call components under an assistant message based on registered render configs.
301
+
302
+ ```html
303
+ <copilot-render-tool-calls
304
+ [message]="assistantMessage"
305
+ [messages]="messages"
306
+ [isLoading]="isRunning"
307
+ ></copilot-render-tool-calls>
308
+ ```
309
+
310
+ Inputs:
311
+
312
+ - `message`: `AssistantMessage` (must include `toolCalls`)
313
+ - `messages`: full `Message[]` list (used to find tool results)
314
+ - `isLoading`: whether the agent is currently running
315
+
316
+ Tool arguments are parsed with `partialJSONParse`, so incomplete JSON during streaming still renders.
317
+
318
+ ## Runtime notes
319
+
320
+ - Set `runtimeUrl` to your CopilotKit runtime endpoint.
321
+ - If you need to change runtime settings at runtime, call `CopilotKit.updateRuntime(...)`.
322
+ - `runtimeTransport` supports `"rest"` or `"single"` (SSE single-stream transport).
323
+
324
+ ## Not documented here
325
+
326
+ This package also exports a full set of chat UI components under `src/lib/components/chat`. Those APIs are intentionally omitted from this README.