Skip to content

Commit b00d36b

Browse files
BenTaylorDevclaude
andcommitted
feat(integrations): framework-agnostic _intelligence activation overlay
docker-compose (postgres + redis + intelligence/composite) with its load-bearing init-db SQL, a .env.intelligence fragment (appended on activation), and a README. Framework-agnostic; consumed by copilotkit init -i / add-intelligence. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e66e652 commit b00d36b

4 files changed

Lines changed: 144 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Appended by `copilotkit add-intelligence`
2+
COPILOTKIT_LICENSE_TOKEN=
3+
INTELLIGENCE_API_URL=http://localhost:4201
4+
INTELLIGENCE_GATEWAY_WS_URL=ws://localhost:4401
5+
INTELLIGENCE_API_KEY=cpk_sPRVSEED_seed0privat0longtoken00
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# `_intelligence/` — CopilotKit Intelligence Activation Overlay
2+
3+
This directory is the **framework-agnostic** overlay consumed by `copilotkit init -i` and
4+
`copilotkit add-intelligence`. It contains everything needed to run the CopilotKit Intelligence
5+
stack locally, independent of which framework template your project uses.
6+
7+
## Assets
8+
9+
### `docker-compose.yml`
10+
11+
Starts three services:
12+
13+
- **postgres** — relational store used by the Intelligence runtime
14+
- **redis** — cache and pub/sub broker
15+
- **`ghcr.io/copilotkit/intelligence/composite`** — the all-in-one Intelligence container (app-api
16+
on 4201, realtime-gateway on 4401, thread-culler, and a db-migrations oneshot)
17+
18+
Bring the stack up with:
19+
20+
```bash
21+
docker compose up -d --wait
22+
```
23+
24+
### `.env.intelligence`
25+
26+
A fragment of environment variables appended to your project's `.env` when you run
27+
`copilotkit add-intelligence`. It wires the scaffolded app to the local stack:
28+
29+
```
30+
COPILOTKIT_LICENSE_TOKEN=
31+
INTELLIGENCE_API_URL=http://localhost:4201
32+
INTELLIGENCE_GATEWAY_WS_URL=ws://localhost:4401
33+
INTELLIGENCE_API_KEY=cpk_sPRVSEED_seed0privat0longtoken00
34+
```
35+
36+
`INTELLIGENCE_API_KEY` is pre-seeded with the local-dev value the bundled composite
37+
container expects. To activate Intelligence, set `COPILOTKIT_LICENSE_TOKEN` (server-side
38+
secret, from your CopilotKit dashboard); each base template's runtime wires Intelligence
39+
from that token (see the per-framework dormant wiring below). The stack runs locally once
40+
the token is set.
41+
42+
## Framework independence
43+
44+
This overlay is **not tied to any specific framework template**. The per-framework dormant
45+
runtime wiring (e.g. the `CopilotRuntime` provider, route handler, and hook configuration)
46+
lives in each base template. The overlay only supplies the Docker stack and the env-key
47+
fragment that activates it.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Framework-agnostic CopilotKit Intelligence activation overlay.
2+
#
3+
# Starts postgres, redis, and the all-in-one intelligence composite
4+
# container (runs app-api, realtime-gateway, thread-culler, and the
5+
# db-migrations oneshot internally under s6-overlay).
6+
#
7+
# Usage:
8+
# docker compose up -d --wait
9+
#
10+
# Then start the app services on the host:
11+
# npm run dev
12+
13+
name: copilotkit-intelligence
14+
15+
services:
16+
# ---------------------------------------------------------------------------
17+
# Infrastructure
18+
# ---------------------------------------------------------------------------
19+
20+
postgres:
21+
image: postgres:16-alpine
22+
ports:
23+
- "${POSTGRES_HOST_PORT:-5432}:5432"
24+
environment:
25+
POSTGRES_USER: intelligence
26+
POSTGRES_PASSWORD: intelligence
27+
POSTGRES_DB: postgres
28+
volumes:
29+
- postgres-data:/var/lib/postgresql/data
30+
- ./docker/init-db:/docker-entrypoint-initdb.d:ro
31+
healthcheck:
32+
test: ["CMD-SHELL", "pg_isready -U intelligence -d postgres"]
33+
interval: 5s
34+
timeout: 3s
35+
retries: 5
36+
restart: unless-stopped
37+
networks:
38+
- intelligence
39+
40+
redis:
41+
image: redis:7-alpine
42+
ports:
43+
- "${REDIS_HOST_PORT:-6379}:6379"
44+
volumes:
45+
- redis-data:/data
46+
healthcheck:
47+
test: ["CMD", "redis-cli", "ping"]
48+
interval: 5s
49+
timeout: 3s
50+
retries: 5
51+
restart: unless-stopped
52+
networks:
53+
- intelligence
54+
55+
# ---------------------------------------------------------------------------
56+
# Intelligence composite (app-api + realtime-gateway + thread-culler +
57+
# db-migrations, all in one container under s6-overlay)
58+
# ---------------------------------------------------------------------------
59+
60+
intelligence:
61+
image: ghcr.io/copilotkit/intelligence/composite:0.1.0
62+
ports:
63+
- "${APP_API_HOST_PORT:-4201}:4201"
64+
- "${REALTIME_GATEWAY_HOST_PORT:-4401}:4401"
65+
environment:
66+
DATABASE_URL: postgresql://intelligence:intelligence@postgres:5432/intelligence_app
67+
REDIS_URL: redis://redis:6379
68+
AUTH_SECRET: local-dev-secret-must-be-at-least-32-chars
69+
RUNNER_AUTH_SECRET: dev-runner-secret
70+
SECRET_KEY_BASE: local-realtime-gateway-secret-key-base-at-least-64-bytes-long-for-dev
71+
DEFAULT_ORGANIZATION_ID: casa-de-erlang
72+
COPILOTKIT_LICENSE_TOKEN: "${COPILOTKIT_LICENSE_TOKEN:-}"
73+
THREAD_STALE_HOURS: "${THREAD_STALE_HOURS:-3}"
74+
THREAD_CULL_BATCH_SIZE: "${THREAD_CULL_BATCH_SIZE:-1000}"
75+
depends_on:
76+
postgres:
77+
condition: service_healthy
78+
redis:
79+
condition: service_healthy
80+
restart: unless-stopped
81+
networks:
82+
- intelligence
83+
84+
volumes:
85+
postgres-data:
86+
redis-data:
87+
88+
networks:
89+
intelligence:
90+
driver: bridge
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CREATE DATABASE intelligence_app;
2+
CREATE DATABASE intelligence_app_shadow;

0 commit comments

Comments
 (0)