---
title: "CopilotKit"
description: "The root Angular service that exposes CopilotKit agents, tools, runtime state, and suggestions as signals"
---
## Overview
`CopilotKit` is the central injectable service for `@copilotkit/angular`. It is `providedIn: "root"`, so a single instance is shared across your application. It builds and owns the underlying `CopilotKitCore` from the [`CopilotKitConfig`](/reference/angular/functions/provideCopilotKit#parameters) you registered with [`provideCopilotKit`](/reference/angular/functions/provideCopilotKit), exposes reactive runtime state as Angular [signals](https://angular.dev/guide/signals), and provides methods to register tools, manage suggestions, and update the runtime connection.
This is the Angular equivalent of React's `useCopilotKit()`. In most apps you do not call its methods directly. The injectable functions such as [`registerFrontendTool`](/reference/angular/functions/registerFrontendTool), [`registerRenderToolCall`](/reference/angular/functions/registerRenderToolCall), and [`registerHumanInTheLoop`](/reference/angular/functions/registerHumanInTheLoop) wrap it and add automatic cleanup. Inject the service when you need direct access to its signals or the `core` instance.
## Accessing the service
Inject it from any injection context, for example a component or service.
```ts title="src/app/status.component.ts"
import { Component, inject } from "@angular/core";
import { CopilotKit } from "@copilotkit/angular";
@Component({
selector: "app-status",
standalone: true,
template: `
`,
})
export class StatusComponent {
protected readonly copilotKit = inject(CopilotKit);
}
```
## Signals
All reactive state is exposed as read-only Angular signals. Read a signal by calling it, for example `copilotKit.agents()`.
The agents currently registered, keyed by agent id. Updated when the core's
agents change.
The current runtime connection status: `Disconnected`, `Connecting`,
`Connected`, or `Error`.
The current runtime URL, or `undefined` when none is configured.
The active runtime transport: `"rest"`, `"single"`, or `"auto"`. Defaults to
`"auto"`.
The HTTP headers currently sent with runtime requests.
Suggestions keyed by agent id. Each value is
`{ suggestions: Suggestion[]; isLoading: boolean }`.
All registered tool call renderers, including built-in renderers (for example
A2UI).
All registered client (frontend) tools, including built-in tools (for example
the open generative UI tool when enabled).
All registered human-in-the-loop tool configs.
All registered activity message renderers, including built-in renderers.
## Properties
The underlying `CopilotKitCore` instance from `@copilotkit/core`. Use it for
lower-level operations that the service does not wrap, such as adding context
or subscribing to core events.
## Methods
Register a client-side tool. The handler is rebound to run inside the provided
`injector`, so it can use `inject()`. Prefer
[`registerFrontendTool`](/reference/angular/functions/registerFrontendTool),
which supplies the injector and removes the tool on destroy.
Register a renderer for a tool call. Prefer
[`registerRenderToolCall`](/reference/angular/functions/registerRenderToolCall)
for automatic cleanup.
Register a renderer for an agent activity message type.
Register a human-in-the-loop tool. The tool pauses the run until the user
responds. Prefer
[`registerHumanInTheLoop`](/reference/angular/functions/registerHumanInTheLoop)
for automatic cleanup.
Add a suggestions configuration and return its id.
Remove a previously added suggestions configuration by id.
Return the current suggestions for an agent as
`{ suggestions, isLoading }`. Reads from `suggestionsByAgent` first, falling
back to the core.
Regenerate the suggestions for an agent.
Clear the current suggestions for an agent.
Remove a tool by name (optionally scoped to an `agentId`) and drop its
matching client tool, human-in-the-loop, and tool call render configs.
Return the agent registered under `agentId`, or `undefined`.
Update the runtime connection at runtime. `options` may include `runtimeUrl`,
`runtimeTransport`, `headers`, `properties`, `agents`, and
`selfManagedAgents`. Only the fields you pass are applied; `runtimeUrl`,
`runtimeTransport`, and `headers` also update the corresponding signals.
## Usage
### Read agents and connection status in a template
```ts title="src/app/agents-panel.component.ts"
import { Component, inject } from "@angular/core";
import { CopilotKit } from "@copilotkit/angular";
@Component({
selector: "app-agents-panel",
standalone: true,
template: `