Self-managed agents
Connect AG-UI agents that you host and secure yourself.
If you host and secure your own AG-UI agent, the frontend can call it directly,
without the CopilotKit runtime. Use
selfManagedAgents in production. For local development, use
agents__unsafe_dev_only in React or agents in Angular.
Production: self-managed agents
selfManagedAgents is the supported configuration option for connecting agents you manage
yourself, for example an HttpAgent pointing at an
AG-UI-compatible backend you own and have already secured:
import { ApplicationConfig } from "@angular/core";
import { HttpAgent } from "@ag-ui/client";
import { provideCopilotKit } from "@copilotkit/angular";
const supportAgent = new HttpAgent({
url: "https://agents.example.com/support",
});
export const appConfig: ApplicationConfig = {
providers: [
provideCopilotKit({
selfManagedAgents: { "support-agent": supportAgent },
}),
],
};Each key is the agentId that chat components and frontend agent APIs use to
address that agent. Self-managed agents use your transport and your security
model. Because the requests don't pass through the CopilotKit runtime, the
runtime's server-side auth, middleware, and routing do not apply. Your agent
endpoint must authenticate and authorize every request.
Open a chat that uses the support-agent agent ID and send a message. The
endpoint at https://agents.example.com/support receives the run, and its reply
streams into the chat.
Part of CopilotKit Intelligence
selfManagedAgents is part of the CopilotKit Intelligence Enterprise
plan. Talk to an
engineer about licensing for
production use.
You can combine selfManagedAgents with runtimeUrl. Runtime-discovered agents
and self-managed agents coexist; address each by its agentId.
Development: local agents
The Angular provider's agents option accepts the same shape for local,
in-browser development:
import { HttpAgent } from "@ag-ui/client";
import { provideCopilotKit } from "@copilotkit/angular";
const localAgent = new HttpAgent({ url: "http://localhost:8000" });
provideCopilotKit({
agents: { "my-agent": localAgent },
})Use agents only for local development and prototyping. For production,
switch to selfManagedAgents after securing the endpoint, or move the agent
behind the runtime.
How they relate
Both sources feed the same client-side agent registry. When both are supplied
they are merged, and selfManagedAgents wins on a key collision:
// effective agents ≈ { ...agents, ...selfManagedAgents }If at least one agent is registered through either provider option, the frontend configuration check passes.
selfManagedAgents | Local agents | |
|---|---|---|
| Intended for | Production, agents you manage | Local dev / prototyping |
| Auth | Your responsibility | Your responsibility |
| Runtime middleware / routing | Not applied | Not applied |
| Precedence on collision | Wins | Overridden by selfManagedAgents |
How is this guide?