@copilotkitnext/runtime 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.cursor/rules/runtime.always.mdc +9 -0
  2. package/.turbo/turbo-build.log +22 -0
  3. package/.turbo/turbo-check-types.log +4 -0
  4. package/.turbo/turbo-lint.log +56 -0
  5. package/.turbo/turbo-test$colon$coverage.log +149 -0
  6. package/.turbo/turbo-test.log +107 -0
  7. package/LICENSE +11 -0
  8. package/README-RUNNERS.md +78 -0
  9. package/dist/index.d.mts +245 -0
  10. package/dist/index.d.ts +245 -0
  11. package/dist/index.js +1873 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/index.mjs +1841 -0
  14. package/dist/index.mjs.map +1 -0
  15. package/eslint.config.mjs +3 -0
  16. package/package.json +62 -0
  17. package/src/__tests__/get-runtime-info.test.ts +117 -0
  18. package/src/__tests__/handle-run.test.ts +69 -0
  19. package/src/__tests__/handle-transcribe.test.ts +289 -0
  20. package/src/__tests__/in-process-agent-runner-messages.test.ts +599 -0
  21. package/src/__tests__/in-process-agent-runner.test.ts +726 -0
  22. package/src/__tests__/middleware.test.ts +432 -0
  23. package/src/__tests__/routing.test.ts +257 -0
  24. package/src/endpoint.ts +150 -0
  25. package/src/handler.ts +3 -0
  26. package/src/handlers/get-runtime-info.ts +50 -0
  27. package/src/handlers/handle-connect.ts +144 -0
  28. package/src/handlers/handle-run.ts +156 -0
  29. package/src/handlers/handle-transcribe.ts +126 -0
  30. package/src/index.ts +8 -0
  31. package/src/middleware.ts +232 -0
  32. package/src/runner/__tests__/enterprise-runner.test.ts +992 -0
  33. package/src/runner/__tests__/event-compaction.test.ts +253 -0
  34. package/src/runner/__tests__/in-memory-runner.test.ts +483 -0
  35. package/src/runner/__tests__/sqlite-runner.test.ts +975 -0
  36. package/src/runner/agent-runner.ts +27 -0
  37. package/src/runner/enterprise.ts +653 -0
  38. package/src/runner/event-compaction.ts +250 -0
  39. package/src/runner/in-memory.ts +322 -0
  40. package/src/runner/index.ts +0 -0
  41. package/src/runner/sqlite.ts +481 -0
  42. package/src/runtime.ts +53 -0
  43. package/src/transcription-service/transcription-service-openai.ts +29 -0
  44. package/src/transcription-service/transcription-service.ts +11 -0
  45. package/tsconfig.json +13 -0
  46. package/tsup.config.ts +11 -0
  47. package/vitest.config.mjs +15 -0
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Conventions for the runtime package.
3
+ globs: "*"
4
+ alwaysApply: true
5
+ ---
6
+
7
+ - Node-targeted code compiled from `src/` to `dist/` using TypeScript.
8
+ - Vitest tests reside in `src/__tests__/` and use Node environment.
9
+ - Exported APIs live under `src/index.ts`.
@@ -0,0 +1,22 @@
1
+
2
+ > @copilotkitnext/runtime@0.0.0 build /Users/mme/Code/CopilotKit2/packages/runtime
3
+ > tsup
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.0
8
+ CLI Using tsup config: /Users/mme/Code/CopilotKit2/packages/runtime/tsup.config.ts
9
+ CLI Target: es2022
10
+ CLI Cleaning output folder
11
+ CJS Build start
12
+ ESM Build start
13
+ ESM dist/index.mjs 55.89 KB
14
+ ESM dist/index.mjs.map 117.76 KB
15
+ ESM ⚡️ Build success in 17ms
16
+ CJS dist/index.js 58.40 KB
17
+ CJS dist/index.js.map 118.05 KB
18
+ CJS ⚡️ Build success in 17ms
19
+ DTS Build start
20
+ DTS ⚡️ Build success in 6164ms
21
+ DTS dist/index.d.ts 7.96 KB
22
+ DTS dist/index.d.mts 7.96 KB
@@ -0,0 +1,4 @@
1
+
2
+ > @copilotkit/runtime@0.0.0 check-types /Users/mme/Code/CopilotKit2/packages/runtime
3
+ > tsc --noEmit
4
+
@@ -0,0 +1,56 @@
1
+
2
+ > @copilotkit/runtime@0.0.0 lint /Users/mme/Code/CopilotKit2/packages/runtime
3
+ > eslint . --max-warnings 0
4
+
5
+
6
+ /Users/mme/Code/CopilotKit2/packages/runtime/src/__tests__/in-process-agent-runner-messages.test.ts
7
+ 35:17 warning 'input' is defined but never used @typescript-eslint/no-unused-vars
8
+ 46:5 warning Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 3 characters or longer @typescript-eslint/ban-ts-comment
9
+
10
+ /Users/mme/Code/CopilotKit2/packages/runtime/src/runner/__tests__/event-compaction.test.ts
11
+ 21:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
12
+ 41:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
13
+ 45:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
14
+ 47:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
15
+ 66:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
16
+ 68:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
17
+ 72:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
18
+ 74:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
19
+ 90:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
20
+ 117:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
21
+ 137:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
22
+ 157:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
23
+ 161:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
24
+ 163:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
25
+ 182:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
26
+ 184:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
27
+ 188:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
28
+ 190:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
29
+ 206:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
30
+ 221:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
31
+ 244:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
32
+ 249:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
33
+
34
+ /Users/mme/Code/CopilotKit2/packages/runtime/src/runner/event-compaction.ts
35
+ 129:19 warning 'messageId' is assigned a value but never used @typescript-eslint/no-unused-vars
36
+ 140:21 warning 'toolCallId' is assigned a value but never used @typescript-eslint/no-unused-vars
37
+
38
+ /Users/mme/Code/CopilotKit2/packages/runtime/src/runner/in-memory.ts
39
+ 8:10 warning 'EMPTY' is defined but never used @typescript-eslint/no-unused-vars
40
+ 99:31 warning 'args' is defined but never used @typescript-eslint/no-unused-vars
41
+ 121:16 warning 'error' is defined but never used @typescript-eslint/no-unused-vars
42
+
43
+ /Users/mme/Code/CopilotKit2/packages/runtime/src/runner/sqlite.ts
44
+ 8:10 warning 'EMPTY' is defined but never used @typescript-eslint/no-unused-vars
45
+ 60:15 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
46
+ 68:41 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
47
+ 71:24 warning A `require()` style import is forbidden @typescript-eslint/no-require-imports
48
+ 73:14 warning 'e' is defined but never used @typescript-eslint/no-unused-vars
49
+ 164:50 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
50
+ 232:31 warning 'args' is defined but never used @typescript-eslint/no-unused-vars
51
+ 254:16 warning 'error' is defined but never used @typescript-eslint/no-unused-vars
52
+
53
+ ✖ 37 problems (0 errors, 37 warnings)
54
+
55
+ ESLint found too many warnings (maximum: 0).
56
+  ELIFECYCLE  Command failed with exit code 1.
@@ -0,0 +1,149 @@
1
+
2
+ 
3
+ > @copilotkit/runtime@0.0.0 test:coverage /Users/mme/Code/CopilotKit2/packages/runtime
4
+ > jest --coverage
5
+
6
+ Determining test suites to run...
7
+
8
+
9
+  RUNS  src/__tests__/endpoint.test.ts
10
+
11
+  RUNS  src/__tests__/endpoint.test.ts
12
+
13
+  RUNS  src/__tests__/endpoint.test.ts
14
+
15
+  RUNS  src/__tests__/endpoint.test.ts
16
+
17
+  RUNS  src/__tests__/endpoint.test.ts
18
+
19
+  RUNS  src/__tests__/endpoint.test.ts
20
+
21
+  RUNS  src/__tests__/endpoint.test.ts
22
+
23
+  RUNS  src/__tests__/endpoint.test.ts
24
+
25
+  RUNS  src/__tests__/endpoint.test.ts
26
+
27
+  RUNS  src/__tests__/endpoint.test.ts
28
+
29
+  RUNS  src/__tests__/endpoint.test.ts
30
+
31
+  RUNS  src/__tests__/endpoint.test.ts
32
+
33
+  RUNS  src/__tests__/endpoint.test.ts
34
+
35
+  RUNS  src/__tests__/endpoint.test.ts
36
+
37
+  RUNS  src/__tests__/endpoint.test.ts
38
+
39
+  RUNS  src/__tests__/endpoint.test.ts
40
+
41
+  RUNS  src/__tests__/endpoint.test.ts
42
+
43
+  RUNS  src/__tests__/endpoint.test.ts
44
+
45
+  RUNS  src/__tests__/endpoint.test.ts
46
+
47
+  RUNS  src/__tests__/endpoint.test.ts
48
+
49
+  RUNS  src/__tests__/endpoint.test.ts
50
+
51
+
52
+  RUNS  src/__tests__/endpoint.test.ts
53
+
54
+
55
+  RUNS  src/__tests__/endpoint.test.ts
56
+
57
+
58
+  RUNS  src/__tests__/endpoint.test.ts
59
+
60
+
61
+  RUNS  src/__tests__/endpoint.test.ts
62
+
63
+
64
+  RUNS  src/__tests__/endpoint.test.ts
65
+
66
+
67
+  RUNS  src/__tests__/endpoint.test.ts
68
+
69
+
70
+  RUNS  src/__tests__/endpoint.test.ts
71
+
72
+
73
+  RUNS  src/__tests__/endpoint.test.ts
74
+
75
+
76
+  RUNS  src/__tests__/endpoint.test.ts
77
+
78
+
79
+  RUNS  src/__tests__/endpoint.test.ts
80
+
81
+
82
+  RUNS  src/__tests__/endpoint.test.ts
83
+
84
+
85
+  RUNS  src/__tests__/endpoint.test.ts
86
+
87
+
88
+  RUNS  src/__tests__/endpoint.test.ts
89
+
90
+
91
+  RUNS  src/__tests__/endpoint.test.ts
92
+
93
+
94
+  RUNS  src/__tests__/endpoint.test.ts
95
+
96
+
97
+  RUNS  src/__tests__/endpoint.test.ts
98
+
99
+
100
+  RUNS  src/__tests__/endpoint.test.ts
101
+
102
+
103
+  RUNS  src/__tests__/endpoint.test.ts
104
+
105
+
106
+  RUNS  src/__tests__/endpoint.test.ts
107
+
108
+
109
+  RUNS  src/__tests__/endpoint.test.ts
110
+
111
+
112
+  RUNS  src/__tests__/endpoint.test.ts
113
+
114
+
115
+  RUNS  src/__tests__/endpoint.test.ts
116
+
117
+
118
+  RUNS  src/__tests__/endpoint.test.ts
119
+
120
+
121
+  RUNS  src/__tests__/endpoint.test.ts
122
+
123
+
124
+  RUNS  src/__tests__/endpoint.test.ts
125
+
126
+
127
+  RUNS  src/__tests__/endpoint.test.ts
128
+
129
+
130
+  RUNS  src/__tests__/endpoint.test.ts
131
+
132
+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
133
+ ----------------|---------|----------|---------|---------|-------------------
134
+ All files  |  43.47 |  52.17 |  15.38 |  43.47 |  
135
+  src  |  46.42 |  57.14 |  22.22 |  46.42 |  
136
+  endpoint.ts  |  38.63 |  36.36 |  14.28 |  38.63 | 10-40,85-131 
137
+  handler.ts  |  100 |  100 |  100 |  100 |  
138
+  logger.ts  |  100 |  75 |  100 |  100 | 12-16 
139
+  runtime.ts  |  50 |  100 |  0 |  50 | 44-46 
140
+  src/handlers  |  30.76 |  0 |  0 |  30.76 |  
141
+  get-agents.ts |  12.5 |  0 |  0 |  12.5 | 10-34 
142
+  get-info.ts  |  66.66 |  100 |  0 |  66.66 | 10 
143
+  handle-run.ts |  50 |  100 |  0 |  50 | 14 
144
+ ----------------|---------|----------|---------|---------|-------------------
145
+ Test Suites: 1 passed, 1 total
146
+ Tests: 20 passed, 20 total
147
+ Snapshots: 0 total
148
+ Time: 0.556 s, estimated 1 s
149
+ Ran all test suites.
@@ -0,0 +1,107 @@
1
+
2
+ > @copilotkitnext/runtime@0.0.0 test /Users/mme/Code/CopilotKit2/packages/runtime
3
+ > vitest run
4
+
5
+
6
+ RUN v3.2.4 /Users/mme/Code/CopilotKit2/packages/runtime
7
+
8
+ ✓ src/__tests__/handle-transcribe.test.ts (12 tests) 36ms
9
+ stderr | src/__tests__/handle-run.test.ts > handleRunAgent > should return 500 when runtime.agents throws an error
10
+ Error running agent: Error: Database connection failed
11
+ at /Users/mme/Code/CopilotKit2/packages/runtime/src/__tests__/handle-run.test.ts:46:30
12
+ at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:155:11
13
+ at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:752:26
14
+ at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1897:20
15
+ at new Promise (<anonymous>)
16
+ at runWithTimeout (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1863:10)
17
+ at runTest (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1574:12)
18
+  at processTicksAndRejections (node:internal/process/task_queues:95:5)
19
+ at runSuite (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1729:8)
20
+ at runSuite (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1729:8)
21
+ Error stack: Error: Database connection failed
22
+ at /Users/mme/Code/CopilotKit2/packages/runtime/src/__tests__/handle-run.test.ts:46:30
23
+ at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:155:11
24
+ at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:752:26
25
+ at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1897:20
26
+ at new Promise (<anonymous>)
27
+ at runWithTimeout (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1863:10)
28
+ at runTest (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1574:12)
29
+ at processTicksAndRejections (node:internal/process/task_queues:95:5)
30
+ at runSuite (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1729:8)
31
+ at runSuite (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1729:8)
32
+ Error details: {
33
+ name: 'Error',
34
+ message: 'Database connection failed',
35
+ cause: undefined
36
+ }
37
+
38
+ ✓ src/runner/__tests__/in-memory-runner.test.ts (7 tests) 8ms
39
+ ✓ src/__tests__/in-process-agent-runner-messages.test.ts (7 tests) 8ms
40
+ ✓ src/__tests__/handle-run.test.ts (2 tests) 16ms
41
+ ✓ src/__tests__/routing.test.ts (21 tests) 39ms
42
+ ✓ src/runner/__tests__/sqlite-runner.test.ts (19 tests) 201ms
43
+ ✓ src/__tests__/in-process-agent-runner.test.ts (18 tests) 749ms
44
+ ✓ src/runner/__tests__/event-compaction.test.ts (12 tests) 28ms
45
+ ✓ src/__tests__/get-runtime-info.test.ts (4 tests) 8ms
46
+ stderr | src/__tests__/middleware.test.ts > CopilotEndpoint middleware > handles webhook middleware timeout
47
+ {
48
+ err: Response {
49
+ status: 502,
50
+ statusText: '',
51
+ headers: Headers {},
52
+ body: null,
53
+ bodyUsed: false,
54
+ ok: false,
55
+ redirected: false,
56
+ type: 'default',
57
+ url: ''
58
+ },
59
+ url: 'https://example.com/info',
60
+ path: '/info'
61
+ } Error running before request middleware
62
+
63
+ stderr | src/__tests__/middleware.test.ts > CopilotEndpoint middleware > handles webhook middleware error responses
64
+ {
65
+ err: Response {
66
+ status: 400,
67
+ statusText: '',
68
+ headers: Headers { 'content-type': 'text/plain;charset=UTF-8' },
69
+ body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
70
+ bodyUsed: false,
71
+ ok: false,
72
+ redirected: false,
73
+ type: 'default',
74
+ url: ''
75
+ },
76
+ url: 'https://example.com/info',
77
+ path: '/info'
78
+ } Error running before request middleware
79
+
80
+ stderr | src/__tests__/middleware.test.ts > CopilotEndpoint middleware > handles webhook middleware server error
81
+ {
82
+ err: Response {
83
+ status: 502,
84
+ statusText: '',
85
+ headers: Headers {},
86
+ body: null,
87
+ bodyUsed: false,
88
+ ok: false,
89
+ redirected: false,
90
+ type: 'default',
91
+ url: ''
92
+ },
93
+ url: 'https://example.com/info',
94
+ path: '/info'
95
+ } Error running before request middleware
96
+
97
+ ✓ src/__tests__/middleware.test.ts (11 tests) 2378ms
98
+ ✓ CopilotEndpoint middleware > handles webhook middleware timeout 2003ms
99
+ ✓ src/runner/__tests__/enterprise-runner.test.ts (20 tests) 3206ms
100
+ ✓ EnterpriseAgentRunner > should prevent concurrent runs on same thread 630ms
101
+ ✓ EnterpriseAgentRunner > should track running state correctly 303ms
102
+
103
+ Test Files 11 passed (11)
104
+ Tests 133 passed (133)
105
+ Start at 10:38:14
106
+ Duration 4.92s (transform 1.12s, setup 0ms, collect 6.01s, tests 6.68s, environment 1ms, prepare 2.04s)
107
+
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Note: This license does not apply to the whole project. Individual packages may contain their own licenses.
2
+
3
+ MIT License
4
+
5
+ Copyright 2025 Tawkit Inc.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,78 @@
1
+ # Agent Runners
2
+
3
+ CopilotKit Runtime provides two agent runners for different use cases:
4
+
5
+ ## InMemoryAgentRunner (Default)
6
+
7
+ The default runner that stores all data in memory. Perfect for development and applications that don't need persistence.
8
+
9
+ ```typescript
10
+ import { CopilotRuntime, InMemoryAgentRunner } from "@copilotkitnext/runtime";
11
+
12
+ // Default - uses InMemoryAgentRunner automatically
13
+ const runtime = new CopilotRuntime({
14
+ agents: myAgents,
15
+ });
16
+
17
+ // Or explicitly
18
+ const runtime = new CopilotRuntime({
19
+ agents: myAgents,
20
+ runner: new InMemoryAgentRunner(),
21
+ });
22
+ ```
23
+
24
+ **Features:**
25
+
26
+ - No external dependencies
27
+ - Fast performance
28
+ - Data is lost when process restarts
29
+ - Perfect for development and stateless applications
30
+
31
+ ## SqliteAgentRunner
32
+
33
+ Provides persistent storage using SQLite. Ideal for applications that need to preserve conversation history across restarts.
34
+
35
+ ```typescript
36
+ import { CopilotRuntime, SqliteAgentRunner } from "@copilotkitnext/runtime";
37
+
38
+ const runtime = new CopilotRuntime({
39
+ agents: myAgents,
40
+ runner: new SqliteAgentRunner("./data/copilot.db"),
41
+ });
42
+
43
+ // Or use in-memory SQLite (data persists during runtime only)
44
+ const runtime = new CopilotRuntime({
45
+ agents: myAgents,
46
+ runner: new SqliteAgentRunner(":memory:"),
47
+ });
48
+ ```
49
+
50
+ **Features:**
51
+
52
+ - Persistent storage across restarts
53
+ - Maintains conversation history
54
+ - Parent-child run relationships
55
+ - Event compaction for historic runs
56
+
57
+ **Requirements:**
58
+
59
+ - Requires `better-sqlite3` to be installed:
60
+ ```bash
61
+ npm install better-sqlite3
62
+ ```
63
+
64
+ ## Choosing the Right Runner
65
+
66
+ - **Use InMemoryAgentRunner when:**
67
+ - Building prototypes or demos
68
+ - Running in serverless environments
69
+ - You don't need conversation history
70
+ - You want zero external dependencies
71
+
72
+ - **Use SqliteAgentRunner when:**
73
+ - You need persistent conversation history
74
+ - Building production applications
75
+ - You want to analyze historic conversations
76
+ - Running on a traditional server
77
+
78
+ Both runners implement the same `AgentRunner` interface, so you can switch between them without changing your application code.