Skip to content

Commit e66e652

Browse files
BenTaylorDevclaude
andcommitted
feat(integrations/langgraph-python): dormant env-gated Intelligence runtime wiring
When COPILOTKIT_LICENSE_TOKEN is set, wire CopilotKitIntelligence + identifyUser + licenseToken (marker-fenced for opt-out); otherwise InMemoryAgentRunner — today's behavior, unchanged. Document the optional Intelligence env keys (commented) in .env.example. No visible change to the example until a license is provided. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6c834f8 commit e66e652

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
AGENT_URL=http://localhost:8123
2-
OPENAI_API_KEY=
2+
OPENAI_API_KEY=
3+
4+
# --- CopilotKit Intelligence (optional; set COPILOTKIT_LICENSE_TOKEN to enable) ---
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-python/src/app/api/copilotkit/[[...slug]]/route.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
CopilotRuntime,
3+
CopilotKitIntelligence,
34
createCopilotEndpoint,
45
InMemoryAgentRunner,
56
} from "@copilotkit/runtime/v2";
@@ -17,7 +18,22 @@ const defaultAgent = new LangGraphAgent({
1718

1819
const runtime = new CopilotRuntime({
1920
agents: { default: defaultAgent },
20-
runner: new InMemoryAgentRunner(),
21+
// --- copilotkit:intelligence (remove this block to opt out) ---
22+
...(process.env.COPILOTKIT_LICENSE_TOKEN
23+
? {
24+
intelligence: new CopilotKitIntelligence({
25+
apiKey: process.env.INTELLIGENCE_API_KEY ?? "",
26+
apiUrl: process.env.INTELLIGENCE_API_URL ?? "http://localhost:4201",
27+
wsUrl:
28+
process.env.INTELLIGENCE_GATEWAY_WS_URL ?? "ws://localhost:4401",
29+
}),
30+
// Demo stub — replace with your real auth-derived user identity before any
31+
// multi-user deployment, or all users share one thread history.
32+
identifyUser: () => ({ id: "demo-user", name: "Demo User" }),
33+
licenseToken: process.env.COPILOTKIT_LICENSE_TOKEN,
34+
}
35+
: { runner: new InMemoryAgentRunner() }),
36+
// --- /copilotkit:intelligence ---
2137
openGenerativeUI: true,
2238
a2ui: {
2339
injectA2UITool: false,

0 commit comments

Comments
 (0)