Skip to content

Commit a9d807d

Browse files
authored
feat(integrations): add Intelligence threads to langgraph-fastapi (CopilotKit#5197)
## Summary - add env-gated CopilotKitIntelligence runtime wiring to langgraph-fastapi while preserving the FastAPI-specific LangGraphHttpAgent path - add the shared Threads drawer/locked panel UI and threadId wiring for the canvas/chat demo - bump langgraph-fastapi CopilotKit deps to 1.59.1, add its package-lock, and document local Intelligence env vars - remove the temporary langgraph-fastapi parity allowances for now-verbatim Threads/page/next files - add a focused batch-2 migration contract test for langgraph-fastapi ## Verification - confirmed the new migration test failed before implementation - pnpm exec vitest run scripts/__tests__/integration-intelligence-migration.test.ts - pnpm parity:verify --target=langgraph-fastapi (90 ok, 1 existing next-env.d.ts warning, 0 errors) - npm run build (in examples/integrations/langgraph-fastapi) - pnpm exec oxfmt --check <touched TS/TSX/JSON files> - git diff --check - commit hook: check-binaries, sync-lockfile, lint-fix, test-and-check-packages, commitlint - manual licensed Threads smoke test with local Intelligence composite: - copied /Users/mothra/Projects/test-signups4/.env into the example .env and supplied a valid local OPENAI_API_KEY - docker compose up -d --wait from /Users/mothra/Projects/test-signups4 - seeded demo-user / 1_demo-user in cpki.users - started dev with exported .env: set -a; . ./.env; set +a; npm run dev - /api/copilotkit/info returned mode=intelligence, licenseStatus=valid, version=1.59.1 - /api/copilotkit/threads?agentId=default returned 200 - licensed Threads UI visible - selected/restored persisted thread - created a fresh thread, sent a todo request, agent response rendered, todo state updated - refreshed and selected the named thread again; chat history, tool calls, assistant response, and todo state restored ## Notes - Targets the PR CopilotKit#5151 lineage branch because batch-2 depends on the Intelligence foundation from ENT-679. - The first manual smoke attempt failed because the copied local env had an empty OPENAI_API_KEY; after replacing it in the ignored example .env and restarting, the fresh smoke passed.
2 parents f4fa8e5 + d38bac4 commit a9d807d

13 files changed

Lines changed: 22046 additions & 14 deletions

File tree

examples/integrations/_parity/manifest.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@
151151
"src/app/api/copilotkit/**",
152152
"docker/Dockerfile.agent",
153153
"docker-compose.test.yml",
154-
"scripts/**",
155-
"src/components/threads-drawer/**",
156-
"src/app/page.tsx",
157-
"next.config.ts"
154+
"scripts/**"
158155
],
159156
"packageJsonOverrides": {
160157
"scripts.dev:agent": "cd agent && uv run main.py",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
AGENT_URL=http://localhost:8000
2+
OPENAI_API_KEY=
3+
4+
# --- CopilotKit Intelligence (optional; set COPILOTKIT_LICENSE_TOKEN to enable Threads — server + UI) ---
5+
# COPILOTKIT_LICENSE_TOKEN=
6+
# INTELLIGENCE_API_URL=http://localhost:4201
7+
# INTELLIGENCE_GATEWAY_WS_URL=ws://localhost:4401
8+
# INTELLIGENCE_API_KEY= # local dev: see examples/integrations/_intelligence/.env.intelligence for the seed value

examples/integrations/langgraph-fastapi/next.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import type { NextConfig } from "next";
33
const nextConfig: NextConfig = {
44
output: "standalone",
55
serverExternalPackages: ["@copilotkit/runtime"],
6+
env: {
7+
// The public Threads UI flag is DERIVED from the server-side license token.
8+
// Set COPILOTKIT_LICENSE_TOKEN (only) to enable Threads — do not set this flag
9+
// directly. NOTE: NEXT_PUBLIC_* resolves at BUILD time while the runtime reads
10+
// the token per-request, so the UI gate and runtime agree only when the token is
11+
// present at build time (the standard `next dev` / host-build flow). For a
12+
// standalone/Docker image built without the token and injected at runtime, set
13+
// COPILOTKIT_LICENSE_TOKEN at build time too (or gate the UI at runtime) so the
14+
// baked flag reflects it.
15+
NEXT_PUBLIC_COPILOTKIT_THREADS_ENABLED: process.env.COPILOTKIT_LICENSE_TOKEN
16+
? "true"
17+
: "false",
18+
},
619
typescript: {
720
// Docker route override uses HttpAgent which has a type mismatch with CopilotRuntime
821
ignoreBuildErrors: true,

0 commit comments

Comments
 (0)