Skip to content

Commit de02e9c

Browse files
authored
Merge branch 'main' into fix/2667-langgraph-agui-agent-dict-repr
2 parents fb613ad + e9cb7df commit de02e9c

4,387 files changed

Lines changed: 401561 additions & 589178 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.

.changeset/config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.4/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"access": "public",
6+
"baseBranch": "origin/main",
7+
"fixed": [["@copilotkit/*", "@copilotkitnext/*"]],
8+
"ignore": [
9+
"*",
10+
"@copilotkit-examples/*",
11+
"!@copilotkit-storybook/*",
12+
"@copilotkitnext/angular-demo",
13+
"@copilotkitnext/angular-demo-server",
14+
"@copilotkitnext/docs",
15+
"@apps/node"
16+
],
17+
"linked": [],
18+
"updateInternalDependencies": "patch"
19+
}

.changeset/fifty-cobras-pull.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@copilotkit/a2ui-renderer": patch
3+
"@copilotkitnext/react": patch
4+
---
5+
6+
feat: move a2ui message renderer to v2s react package
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@copilotkit/react-textarea": patch
3+
---
4+
5+
fix: restore focus to textarea when hitting Escape in CMD+K popup

.changeset/floppy-birds-sink.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@copilotkit/runtime": minor
3+
"@copilotkitnext/agent": minor
4+
"@copilotkitnext/react": minor
5+
"@copilotkit/react-core": minor
6+
---
7+
8+
Add support for Standard Schema (instead of just Zod)

.changeset/mighty-bags-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@copilotkit/a2ui-renderer": patch
3+
---
4+
5+
feat: set default a2ui theme to fit cpk main theme

.changeset/odd-planets-deliver.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@copilotkitnext/react": patch
3+
---
4+
5+
feat: eagerly create default A2UI renderer when middleware is enabled

.changeset/pre.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"mode": "pre",
3+
"tag": "next",
4+
"initialVersions": {
5+
"@copilotkit-examples/chat-with-your-data": "0.1.0",
6+
"@copilotkit-examples/form-filling": "0.1.0",
7+
"next-openai": "1.4.10-next.0",
8+
"next-pages-router": "1.4.10-next.0",
9+
"node-express": "1.4.10-next.0",
10+
"node-http": "1.4.10-next.0",
11+
"@copilotkit-examples/research-canvas": "0.1.0",
12+
"@copilotkit-examples/state-machine": "0.1.0",
13+
"@copilotkit-examples/travel": "0.1.0",
14+
"@copilotkitnext/angular-demo": "0.0.0",
15+
"@copilotkitnext/angular-demo-server": "0.0.0",
16+
"@copilotkit-storybook/angular": "0.0.4",
17+
"@copilotkitnext/docs": "0.1.7",
18+
"langgraph-js-starter": "0.1.3",
19+
"agent-langraph-interrupt": "0.0.1",
20+
"web-langraph-interrupt": "0.1.0",
21+
"@copilotkitnext/next-pages-router": "1.53.0",
22+
"@apps/node": "0.0.1",
23+
"@copilotkitnext/node-express": "1.53.0",
24+
"demo": "0.1.4-next.0",
25+
"@copilotkit-storybook/react": "0.0.0",
26+
"@copilotkit/a2ui-renderer": "1.53.0",
27+
"eslint-config-custom": "1.4.11",
28+
"@copilotkit/react-core": "1.53.0",
29+
"@copilotkit/react-textarea": "1.53.0",
30+
"@copilotkit/react-ui": "1.53.0",
31+
"@copilotkit/runtime": "1.53.0",
32+
"@copilotkit/runtime-client-gql": "1.53.0",
33+
"@copilotkit/sdk-js": "1.53.0",
34+
"@copilotkit/shared": "1.53.0",
35+
"tailwind-config": "1.4.11",
36+
"tsconfig": "1.4.11",
37+
"@copilotkitnext/agent": "1.53.0",
38+
"@copilotkitnext/angular": "1.53.0",
39+
"@copilotkitnext/core": "1.53.0",
40+
"@copilotkitnext/demo-agents": "1.53.0",
41+
"@copilotkitnext/eslint-config": "1.53.0",
42+
"@copilotkitnext/react": "1.53.0",
43+
"@copilotkitnext/runtime": "1.53.0",
44+
"@copilotkitnext/shared": "1.53.0",
45+
"@copilotkitnext/sqlite-runner": "1.53.0",
46+
"@copilotkitnext/typescript-config": "1.53.0",
47+
"@copilotkit/voice": "1.53.0",
48+
"@copilotkitnext/web-inspector": "1.53.0"
49+
},
50+
"changesets": [
51+
"fifty-cobras-pull",
52+
"fix-escape-key-focus-loss-399",
53+
"floppy-birds-sink",
54+
"mighty-bags-sneeze",
55+
"odd-planets-deliver",
56+
"slimy-zoos-accept"
57+
]
58+
}

.changeset/slimy-zoos-accept.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@copilotkit/react-core": patch
3+
---
4+
5+
Fixed hook render registrations lost under React Strict Mode.

.claude/docs/architecture.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Architecture & Packages
2+
3+
## Three-Layer Architecture
4+
5+
```
6+
Frontend (React/Angular/Vanilla) → Runtime (Express/Hono server) → Agent (LangGraph/CrewAI/BuiltIn/Custom)
7+
```
8+
9+
All layers communicate via the **AG-UI protocol** — an event-based standard streamed over SSE.
10+
11+
## V1 vs V2
12+
13+
V2 (`@copilotkitnext/`) is the real implementation. V1 (`@copilotkit/`) is the public API that wraps V2 internally. New features always go in V2. If V1 compatibility is needed, create a thin re-export or wrapper in the corresponding V1 package.
14+
15+
## V2 Packages
16+
17+
- **shared**: Common utilities, types, and constants used across all other packages.
18+
- **core**: The `CopilotKitCore` orchestrator — the central brain on the frontend. Manages the agent registry, tool registry, context store, and event subscriptions. All framework packages (React, Angular, Vanilla) wrap this.
19+
- **react**: React hooks (`useAgent`, `useFrontendTool`, `useAgentContext`, etc.) and `CopilotKitProvider`. Hooks are thin wrappers that register/unregister with `CopilotKitCore` on mount/unmount.
20+
- **angular**: Angular DI tokens, services, and signal-based state. Same concepts as React but using Angular patterns (`inject()`, signals, `AgentStore`).
21+
- **runtime**: The server-side `CopilotRuntime` class that receives HTTP requests and delegates to agents. Provides Express and Hono adapters. Contains the `AgentRunner` abstraction for managing thread/conversation state.
22+
- **agent**: The `BuiltInAgent` — a default agent implementation powered by the Vercel AI SDK. Used when developers don't bring their own agent framework.
23+
- **voice**: Voice input and transcription support.
24+
- **web-inspector**: A debug console (Lit web component) for inspecting agent communication in development.
25+
- **sqlite-runner**: An `AgentRunner` implementation that persists thread state to SQLite instead of memory.
26+
27+
## V1 Packages
28+
29+
- **react-core**: The public `<CopilotKit>` provider and hooks. Internally delegates to V2 core.
30+
- **react-ui**: Chat UI components — `CopilotChat`, `CopilotPopup`, `CopilotSidebar`, `CopilotPanel`.
31+
- **react-textarea**: The `CopilotTextarea` component for AI-assisted text editing.
32+
- **shared**: Shared types and telemetry utilities.
33+
- **runtime**: Server-side runtime with GraphQL server and LLM adapters.
34+
- **runtime-client-gql**: urql-based GraphQL client for frontend-to-runtime communication.
35+
- **sdk-js**: Helpers for LangGraph/LangChain agent integration.
36+
37+
## Request Lifecycle
38+
39+
1. **Init**: Frontend creates `CopilotKitCore` → fetches agent info from runtime → creates a `ProxiedAgent` instance per remote agent.
40+
2. **User sends message**: Message is added to the agent, then `runAgent()` is called.
41+
3. **HTTP request**: A POST is sent to the runtime with a `RunAgentInput` payload containing messages, registered tools, context, threadId, and state.
42+
4. **Runtime processing**: Request middleware runs → agent is resolved and cloned → `AgentRunner` executes the agent.
43+
5. **SSE stream back**: Agent emits AG-UI events streamed to the frontend: run lifecycle events, text message chunks (streaming), and optional tool call events.
44+
6. **Frontend tool execution**: When the agent calls a frontend tool, Core looks up the handler in its registry, executes it locally in the browser, and sends the result back to the agent which continues processing.
45+
7. **UI update**: Core updates its message store and notifies subscribers → React/Angular re-renders.
46+
47+
## Core Concepts
48+
49+
### AG-UI Protocol
50+
51+
All agent↔UI communication is event-based. Events follow a structured lifecycle: `RUN_STARTED``STEP_STARTED` → message/tool events → `STEP_FINISHED``RUN_FINISHED`. Events are streamed over SSE and validated with Zod schemas. The `EventType` enum in `@ag-ui/core` defines all event types.
52+
53+
### ProxiedAgent
54+
55+
The frontend representation of a remote agent. Implements the `AbstractAgent` interface but translates calls into HTTP requests to the runtime, streaming SSE events back. Created automatically when the runtime reports available agents.
56+
57+
### AgentRunner
58+
59+
An abstract class on the runtime side responsible for managing thread state (conversation history, agent state). The default `InMemoryAgentRunner` is ephemeral; `SQLiteAgentRunner` provides persistence. Custom runners can be built for any storage backend.
60+
61+
### Tool Registration
62+
63+
Tools can be **frontend tools** (handler runs in the browser, registered via `useFrontendTool`) or **backend tools** (handler runs on the server, defined in the agent config). Tools can be scoped to a specific agent via `agentId`, or available to all agents by omitting it.
64+
65+
### Context
66+
67+
Application data sent alongside messages to give agents awareness of the current UI state. Registered via `useAgentContext(description, data)` where data is any JSON-serializable value. Automatically included in every agent run.
68+
69+
### Multi-Agent
70+
71+
Multiple agents can be registered in a single `CopilotRuntime`. Each agent gets its own endpoint, message thread, state, and optionally scoped tools. The frontend selects which agent to interact with via `useAgent({ agentId })`.
72+
73+
### Middleware
74+
75+
`CopilotRuntime` supports `beforeRequestMiddleware` and `afterRequestMiddleware` for cross-cutting concerns like authentication, logging, and request/response transformation.

0 commit comments

Comments
 (0)