{"record":{"id":"c7ea28720537bff0","repo":"CopilotKit/CopilotKit","slug":"learning-requires-the-intelligence-runtime-pas","errorCode":null,"errorMessage":"`ɵlearning` requires the Intelligence runtime (pass `intelligence`); Learning Containers are not available in SSE mode.","messagePattern":"`ɵlearning` requires the Intelligence runtime \\(pass `intelligence`\\); Learning Containers are not available in SSE mode\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/runtime/src/v2/runtime/core/runtime.ts","lineNumber":469,"sourceCode":"{\n  readonly intelligence = undefined;\n  readonly mode = RUNTIME_MODE_SSE;\n\n  constructor(options: CopilotSseRuntimeOptions) {\n    // Runtime guard mirroring the discriminated-union type: the SSE runtime has\n    // no Intelligence delivery path, so `channels` cannot be honored here. The\n    // type forbids it, but a JS / `as any` caller passing `{ agents, channels }`\n    // would otherwise land here and have `channels` silently dropped — fail\n    // loud instead.\n    const channels = (options as { channels?: unknown[] }).channels;\n    if (Array.isArray(channels) && channels.length > 0) {\n      throw new Error(\n        \"`channels` requires the Intelligence runtime (pass `intelligence`); \" +\n          \"Intelligence Channels are not available in SSE mode.\",\n      );\n    }\n    if ((options as { ɵlearning?: unknown }).ɵlearning !== undefined) {\n      throw new Error(\n        \"`ɵlearning` requires the Intelligence runtime (pass `intelligence`); \" +\n          \"Learning Containers are not available in SSE mode.\",\n      );\n    }\n    super(options, options.runner ?? new InMemoryAgentRunner());\n  }\n}\n\nexport class CopilotIntelligenceRuntime\n  extends BaseCopilotRuntime\n  implements CopilotIntelligenceRuntimeLike\n{\n  readonly intelligence: CopilotKitIntelligence;\n  readonly identifyUser?: IdentifyUserCallback;\n  readonly generateThreadNames: boolean;\n  readonly lockTtlSeconds: number;\n  readonly lockKeyPrefix?: string;\n  readonly lockHeartbeatIntervalSeconds: number;","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/CopilotKit/CopilotKit/blob/68fbe97d87420bd84e8196965c71bd6e394a3f7a/packages/runtime/src/v2/runtime/core/runtime.ts#L451-L487","documentation":"Learning Containers (ɵlearning) require the Intelligence runtime for durability and delivery. The SSE-mode constructor has no such path; passing ɵlearning there would silently no-op, so it throws. Like channels, this only reaches JS/`as any` callers because the types forbid it.","triggerScenarios":"Constructing the SSE runtime (no intelligence option) with an ɵlearning property present, via plain JS, `as any`, or a shared options object.","commonSituations":"Migrating from Intelligence mode to SSE mode and leaving the learning config in place, or copying a full options blob from an Intelligence example into an SSE app.","solutions":["Pass intelligence to enable Learning Containers","Or delete ɵlearning from the options object when constructing the SSE runtime","Avoid `as any`; let the discriminated options types catch this at compile time"],"exampleFix":"// before\nconst opts = { agents, ɵlearning: { containerId: 'kb' } };\nnew CopilotRuntime(opts as any);\n// after\nnew CopilotRuntime({ agents, intelligence: { apiKey, wsUrl }, ɵlearning: { containerId: 'kb' } });","handlingStrategy":"type-guard","validationCode":"if (!options.intelligence && options.ɵlearning !== undefined) {\n  throw new Error('learning requires intelligence');\n}","typeGuard":"function isSseOptions(o: CopilotRuntimeOptions): o is CopilotSseRuntimeOptions {\n  return (o as any).intelligence === undefined;\n}","tryCatchPattern":null,"preventionTips":["Strip Intelligence-only options when constructing the SSE runtime","Avoid `as any` on options objects"],"tags":["runtime","learning","configuration","typescript"],"backgroundTag":"invalid-configuration-combination","analyzedSha":"68fbe97d87420bd84e8196965c71bd6e394a3f7a","analyzedAt":"2026-08-27T04:03:26.537Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}