@inkeep/agents-cli 0.6.4 → 0.6.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-cli",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Inkeep CLI tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,8 +45,8 @@
45
45
  "recast": "^0.23.0",
46
46
  "ts-morph": "^26.0.0",
47
47
  "tsx": "^4.20.5",
48
- "@inkeep/agents-core": "^0.6.4",
49
- "@inkeep/agents-manage-ui": "^0.6.4"
48
+ "@inkeep/agents-core": "^0.6.5",
49
+ "@inkeep/agents-manage-ui": "^0.6.5"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/degit": "^2.8.6",
@@ -1,12 +0,0 @@
1
- declare const createAgents: (args?: {
2
- tenantId?: string;
3
- projectId?: string;
4
- dirName?: string;
5
- openAiKey?: string;
6
- anthropicKey?: string;
7
- manageApiPort?: string;
8
- runApiPort?: string;
9
- }) => Promise<void>;
10
- declare function createCommand(dirName?: string, options?: any): Promise<void>;
11
-
12
- export { createAgents, createCommand };
@@ -1,869 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/commands/create.ts
4
- import color from "picocolors";
5
- import * as p from "@clack/prompts";
6
- import fs from "fs-extra";
7
- import { exec } from "child_process";
8
- import { promisify } from "util";
9
- import path from "path";
10
-
11
- // src/utils/model-config.ts
12
- import inquirer from "inquirer";
13
- var defaultDualModelConfigurations = {
14
- base: {
15
- model: "anthropic/claude-sonnet-4-20250514"
16
- },
17
- structuredOutput: {
18
- model: "openai/gpt-4.1-mini-2025-04-14"
19
- },
20
- summarizer: {
21
- model: "openai/gpt-4.1-nano-2025-04-14"
22
- }
23
- };
24
- var defaultOpenaiModelConfigurations = {
25
- base: {
26
- model: "openai/gpt-5-2025-08-07"
27
- },
28
- structuredOutput: {
29
- model: "openai/gpt-4.1-mini-2025-04-14"
30
- },
31
- summarizer: {
32
- model: "openai/gpt-4.1-nano-2025-04-14"
33
- }
34
- };
35
- var defaultAnthropicModelConfigurations = {
36
- base: {
37
- model: "anthropic/claude-sonnet-4-20250514"
38
- },
39
- structuredOutput: {
40
- model: "anthropic/claude-sonnet-4-20250514"
41
- },
42
- summarizer: {
43
- model: "anthropic/claude-sonnet-4-20250514"
44
- }
45
- };
46
-
47
- // src/commands/create.ts
48
- var execAsync = promisify(exec);
49
- var createAgents = async (args = {}) => {
50
- let { tenantId, projectId, dirName, openAiKey, anthropicKey, manageApiPort, runApiPort } = args;
51
- p.intro(color.inverse(" Create Agents Directory "));
52
- if (!dirName) {
53
- const dirResponse = await p.text({
54
- message: "What do you want to name your agents directory?",
55
- placeholder: "agents",
56
- defaultValue: "agents",
57
- validate: (value) => {
58
- if (!value || value.trim() === "") {
59
- return "Directory name is required";
60
- }
61
- return void 0;
62
- }
63
- });
64
- if (p.isCancel(dirResponse)) {
65
- p.cancel("Operation cancelled");
66
- process.exit(0);
67
- }
68
- dirName = dirResponse;
69
- }
70
- if (!tenantId) {
71
- const tenantIdResponse = await p.text({
72
- message: "Enter your tenant ID :",
73
- placeholder: "(default)",
74
- defaultValue: "default"
75
- });
76
- if (p.isCancel(tenantIdResponse)) {
77
- p.cancel("Operation cancelled");
78
- process.exit(0);
79
- }
80
- tenantId = tenantIdResponse;
81
- }
82
- if (!projectId) {
83
- const projectIdResponse = await p.text({
84
- message: "Enter your project ID:",
85
- placeholder: "(default)",
86
- defaultValue: "default"
87
- });
88
- if (p.isCancel(projectIdResponse)) {
89
- p.cancel("Operation cancelled");
90
- process.exit(0);
91
- }
92
- projectId = projectIdResponse;
93
- }
94
- if (!anthropicKey && !openAiKey) {
95
- const providerChoice = await p.select({
96
- message: "Which AI provider(s) would you like to use?",
97
- options: [
98
- { value: "both", label: "Both Anthropic and OpenAI (recommended)" },
99
- { value: "anthropic", label: "Anthropic only" },
100
- { value: "openai", label: "OpenAI only" }
101
- ]
102
- });
103
- if (p.isCancel(providerChoice)) {
104
- p.cancel("Operation cancelled");
105
- process.exit(0);
106
- }
107
- if (providerChoice === "anthropic" || providerChoice === "both") {
108
- const anthropicKeyResponse = await p.text({
109
- message: "Enter your Anthropic API key:",
110
- placeholder: "sk-ant-...",
111
- validate: (value) => {
112
- if (!value || value.trim() === "") {
113
- return "Anthropic API key is required";
114
- }
115
- return void 0;
116
- }
117
- });
118
- if (p.isCancel(anthropicKeyResponse)) {
119
- p.cancel("Operation cancelled");
120
- process.exit(0);
121
- }
122
- anthropicKey = anthropicKeyResponse;
123
- }
124
- if (providerChoice === "openai" || providerChoice === "both") {
125
- const openAiKeyResponse = await p.text({
126
- message: "Enter your OpenAI API key:",
127
- placeholder: "sk-...",
128
- validate: (value) => {
129
- if (!value || value.trim() === "") {
130
- return "OpenAI API key is required";
131
- }
132
- return void 0;
133
- }
134
- });
135
- if (p.isCancel(openAiKeyResponse)) {
136
- p.cancel("Operation cancelled");
137
- process.exit(0);
138
- }
139
- openAiKey = openAiKeyResponse;
140
- }
141
- } else {
142
- if (!anthropicKey) {
143
- const anthropicKeyResponse = await p.text({
144
- message: "Enter your Anthropic API key (optional):",
145
- placeholder: "sk-ant-...",
146
- defaultValue: ""
147
- });
148
- if (p.isCancel(anthropicKeyResponse)) {
149
- p.cancel("Operation cancelled");
150
- process.exit(0);
151
- }
152
- anthropicKey = anthropicKeyResponse || void 0;
153
- }
154
- if (!openAiKey) {
155
- const openAiKeyResponse = await p.text({
156
- message: "Enter your OpenAI API key (optional):",
157
- placeholder: "sk-...",
158
- defaultValue: ""
159
- });
160
- if (p.isCancel(openAiKeyResponse)) {
161
- p.cancel("Operation cancelled");
162
- process.exit(0);
163
- }
164
- openAiKey = openAiKeyResponse || void 0;
165
- }
166
- }
167
- let defaultModelSettings = {};
168
- if (anthropicKey && openAiKey) {
169
- defaultModelSettings = defaultDualModelConfigurations;
170
- } else if (anthropicKey) {
171
- defaultModelSettings = defaultAnthropicModelConfigurations;
172
- } else if (openAiKey) {
173
- defaultModelSettings = defaultOpenaiModelConfigurations;
174
- }
175
- const s = p.spinner();
176
- s.start("Creating directory structure...");
177
- try {
178
- const directoryPath = path.resolve(process.cwd(), dirName);
179
- if (await fs.pathExists(directoryPath)) {
180
- s.stop();
181
- const overwrite = await p.confirm({
182
- message: `Directory ${dirName} already exists. Do you want to overwrite it?`
183
- });
184
- if (p.isCancel(overwrite) || !overwrite) {
185
- p.cancel("Operation cancelled");
186
- process.exit(0);
187
- }
188
- s.start("Cleaning existing directory...");
189
- await fs.emptyDir(directoryPath);
190
- }
191
- await fs.ensureDir(directoryPath);
192
- process.chdir(directoryPath);
193
- const config = {
194
- dirName,
195
- tenantId,
196
- projectId,
197
- openAiKey,
198
- anthropicKey,
199
- manageApiPort: manageApiPort || "3002",
200
- runApiPort: runApiPort || "3003",
201
- modelSettings: defaultModelSettings
202
- };
203
- s.message("Setting up workspace structure...");
204
- await createWorkspaceStructure(projectId);
205
- s.message("Creating package configurations...");
206
- await setupPackageConfigurations(dirName);
207
- s.message("Setting up environment files...");
208
- await createEnvironmentFiles(config);
209
- s.message("Creating service files...");
210
- await createServiceFiles(config);
211
- s.message("Creating documentation...");
212
- await createDocumentation(config);
213
- s.message("Setting up Turbo...");
214
- await createTurboConfig();
215
- s.message("Installing dependencies (this may take a while)...");
216
- await installDependencies();
217
- s.message("Setting up database...");
218
- await setupDatabase();
219
- s.stop();
220
- p.note(
221
- `${color.green("\u2713")} Project created at: ${color.cyan(directoryPath)}
222
-
223
- ${color.yellow("Next steps:")}
224
- cd ${dirName}
225
- pnpm run dev (for APIs only)
226
- inkeep dev (for APIs + Manage UI)
227
-
228
- ${color.yellow("Available services:")}
229
- \u2022 Manage API: http://localhost:${manageApiPort || "3002"}
230
- \u2022 Run API: http://localhost:${runApiPort || "3003"}
231
- \u2022 Manage UI: Available with 'inkeep dev'
232
-
233
- ${color.yellow("Configuration:")}
234
- \u2022 Edit .env for environment variables
235
- \u2022 Edit src/${projectId}/weather.graph.ts for agent definitions
236
- \u2022 Use 'inkeep push' to deploy agents to the platform
237
- \u2022 Use 'inkeep chat' to test your agents locally
238
- `,
239
- "Ready to go!"
240
- );
241
- } catch (error) {
242
- s.stop();
243
- p.cancel(
244
- `Error creating directory: ${error instanceof Error ? error.message : "Unknown error"}`
245
- );
246
- process.exit(1);
247
- }
248
- };
249
- async function createWorkspaceStructure(projectId) {
250
- await fs.ensureDir(`src/${projectId}`);
251
- await fs.ensureDir("apps/manage-api/src");
252
- await fs.ensureDir("apps/run-api/src");
253
- await fs.ensureDir("apps/shared");
254
- }
255
- async function setupPackageConfigurations(dirName) {
256
- const rootPackageJson = {
257
- name: dirName,
258
- version: "0.1.0",
259
- description: "An Inkeep Agent Framework directory",
260
- private: true,
261
- type: "module",
262
- scripts: {
263
- dev: "turbo dev",
264
- "db:push": "drizzle-kit push"
265
- },
266
- dependencies: {},
267
- devDependencies: {
268
- "@biomejs/biome": "^1.8.0",
269
- "@inkeep/agents-cli": "^0.1.1",
270
- "drizzle-kit": "^0.31.4",
271
- tsx: "^4.19.0",
272
- turbo: "^2.5.5"
273
- },
274
- engines: {
275
- node: ">=22.x"
276
- },
277
- packageManager: "pnpm@10.10.0"
278
- };
279
- await fs.writeJson("package.json", rootPackageJson, { spaces: 2 });
280
- const pnpmWorkspace = `packages:
281
- - "apps/*"
282
- `;
283
- await fs.writeFile("pnpm-workspace.yaml", pnpmWorkspace);
284
- rootPackageJson.dependencies = {
285
- "@inkeep/agents-core": "^0.1.0",
286
- "@inkeep/agents-sdk": "^0.1.0",
287
- zod: "^4.1.5"
288
- };
289
- await fs.writeJson("package.json", rootPackageJson, { spaces: 2 });
290
- const manageApiPackageJson = {
291
- name: `@${dirName}/manage-api`,
292
- version: "0.1.0",
293
- description: "Manage API for agents",
294
- type: "module",
295
- scripts: {
296
- build: "tsc",
297
- dev: "tsx watch src/index.ts",
298
- start: "node dist/index.js"
299
- },
300
- dependencies: {
301
- "@inkeep/agents-manage-api": "^0.1.1",
302
- "@inkeep/agents-core": "^0.1.0",
303
- "@hono/node-server": "^1.14.3"
304
- },
305
- devDependencies: {
306
- "@types/node": "^20.12.0",
307
- tsx: "^4.19.0",
308
- typescript: "^5.4.0"
309
- },
310
- engines: {
311
- node: ">=22.x"
312
- }
313
- };
314
- await fs.writeJson("apps/manage-api/package.json", manageApiPackageJson, { spaces: 2 });
315
- const runApiPackageJson = {
316
- name: `@${dirName}/run-api`,
317
- version: "0.1.0",
318
- description: "Run API for agents",
319
- type: "module",
320
- scripts: {
321
- dev: "tsx watch src/index.ts",
322
- start: "node dist/index.js"
323
- },
324
- dependencies: {
325
- "@inkeep/agents-run-api": "^0.1.1",
326
- "@inkeep/agents-core": "^0.1.0",
327
- "@hono/node-server": "^1.14.3"
328
- },
329
- devDependencies: {
330
- "@types/node": "^20.12.0",
331
- tsx: "^4.19.0",
332
- typescript: "^5.4.0"
333
- },
334
- engines: {
335
- node: ">=22.x"
336
- }
337
- };
338
- await fs.writeJson("apps/run-api/package.json", runApiPackageJson, { spaces: 2 });
339
- const apiTsConfig = {
340
- compilerOptions: {
341
- target: "ES2022",
342
- module: "ESNext",
343
- moduleResolution: "bundler",
344
- strict: true,
345
- esModuleInterop: true,
346
- skipLibCheck: true,
347
- forceConsistentCasingInFileNames: true,
348
- declaration: true,
349
- outDir: "./dist",
350
- rootDir: "..",
351
- allowImportingTsExtensions: false,
352
- resolveJsonModule: true,
353
- isolatedModules: true,
354
- noEmit: false
355
- },
356
- include: ["src/**/*", "../shared/**/*"],
357
- exclude: ["node_modules", "dist", "**/*.test.ts"]
358
- };
359
- await fs.writeJson("apps/manage-api/tsconfig.json", apiTsConfig, { spaces: 2 });
360
- await fs.writeJson("apps/run-api/tsconfig.json", apiTsConfig, { spaces: 2 });
361
- }
362
- async function createEnvironmentFiles(config) {
363
- const envContent = `# Environment
364
- ENVIRONMENT=development
365
-
366
- # Database
367
- DB_FILE_NAME=file:./local.db
368
-
369
- # AI Provider Keys
370
- ANTHROPIC_API_KEY=${config.anthropicKey || "your-anthropic-key-here"}
371
- OPENAI_API_KEY=${config.openAiKey || "your-openai-key-here"}
372
-
373
- # Logging
374
- LOG_LEVEL=debug
375
-
376
- # Service Ports
377
- MANAGE_API_PORT=${config.manageApiPort}
378
- RUN_API_PORT=${config.runApiPort}
379
-
380
- # UI Configuration (for dashboard)
381
- NEXT_PUBLIC_INKEEP_AGENTS_MANAGE_API_URL=http://localhost:${config.manageApiPort}
382
- NEXT_PUBLIC_INKEEP_AGENTS_RUN_API_URL=http://localhost:${config.runApiPort}
383
- `;
384
- await fs.writeFile(".env", envContent);
385
- const envExample = envContent.replace(/=.+$/gm, "=");
386
- await fs.writeFile(".env.example", envExample);
387
- const runApiEnvContent = `# Environment
388
- ENVIRONMENT=development
389
-
390
- # Database (relative path from API directory)
391
- DB_FILE_NAME=file:../../local.db
392
-
393
- # AI Provider Keys
394
- ANTHROPIC_API_KEY=${config.anthropicKey || "your-anthropic-key-here"}
395
- OPENAI_API_KEY=${config.openAiKey || "your-openai-key-here"}
396
-
397
- AGENTS_RUN_API_URL=http://localhost:${config.runApiPort}
398
- `;
399
- const manageApiEnvContent = `# Environment
400
- ENVIRONMENT=development
401
-
402
- # Database (relative path from API directory)
403
- DB_FILE_NAME=file:../../local.db
404
-
405
- AGENTS_MANAGE_API_URL=http://localhost:${config.manageApiPort}
406
- `;
407
- await fs.writeFile("apps/manage-api/.env", manageApiEnvContent);
408
- await fs.writeFile("apps/run-api/.env", runApiEnvContent);
409
- const gitignore = `# Dependencies
410
- node_modules/
411
- .pnpm-store/
412
-
413
- # Environment variables
414
- .env
415
- .env.local
416
- .env.development.local
417
- .env.test.local
418
- .env.production.local
419
-
420
- # Build outputs
421
- dist/
422
- build/
423
- .next/
424
- .turbo/
425
-
426
- # Logs
427
- *.log
428
- logs/
429
-
430
- # Database
431
- *.db
432
- *.sqlite
433
- *.sqlite3
434
-
435
- # IDE
436
- .vscode/
437
- .idea/
438
- *.swp
439
- *.swo
440
-
441
- # OS
442
- .DS_Store
443
- Thumbs.db
444
-
445
- # Coverage
446
- coverage/
447
- .nyc_output/
448
-
449
- # Temporary files
450
- *.tmp
451
- *.temp
452
- .cache/
453
-
454
- # Runtime data
455
- pids/
456
- *.pid
457
- *.seed
458
- *.pid.lock
459
- `;
460
- await fs.writeFile(".gitignore", gitignore);
461
- const biomeConfig = {
462
- linter: {
463
- enabled: true,
464
- rules: {
465
- recommended: true
466
- }
467
- },
468
- formatter: {
469
- enabled: true,
470
- indentStyle: "space",
471
- indentWidth: 2
472
- },
473
- organizeImports: {
474
- enabled: true
475
- },
476
- javascript: {
477
- formatter: {
478
- semicolons: "always",
479
- quoteStyle: "single"
480
- }
481
- }
482
- };
483
- await fs.writeJson("biome.json", biomeConfig, { spaces: 2 });
484
- }
485
- async function createServiceFiles(config) {
486
- const agentsGraph = `import { agent, agentGraph, mcpTool } from '@inkeep/agents-sdk';
487
-
488
- // MCP Tools
489
- const forecastWeatherTool = mcpTool({
490
- id: 'fUI2riwrBVJ6MepT8rjx0',
491
- name: 'Forecast weather',
492
- serverUrl: 'https://weather-forecast-mcp.vercel.app/mcp',
493
- });
494
-
495
- const geocodeAddressTool = mcpTool({
496
- id: 'fdxgfv9HL7SXlfynPx8hf',
497
- name: 'Geocode address',
498
- serverUrl: 'https://geocoder-mcp.vercel.app/mcp',
499
- });
500
-
501
- // Agents
502
- const weatherAssistant = agent({
503
- id: 'weather-assistant',
504
- name: 'Weather assistant',
505
- description: 'Responsible for routing between the geocoder agent and weather forecast agent',
506
- prompt:
507
- 'You are a helpful assistant. When the user asks about the weather in a given location, first ask the geocoder agent for the coordinates, and then pass those coordinates to the weather forecast agent to get the weather forecast',
508
- canDelegateTo: () => [weatherForecaster, geocoderAgent],
509
- });
510
-
511
- const weatherForecaster = agent({
512
- id: 'weather-forecaster',
513
- name: 'Weather forecaster',
514
- description:
515
- 'This agent is responsible for taking in coordinates and returning the forecast for the weather at that location',
516
- prompt:
517
- 'You are a helpful assistant responsible for taking in coordinates and returning the forecast for that location using your forecasting tool',
518
- canUse: () => [forecastWeatherTool],
519
- });
520
-
521
- const geocoderAgent = agent({
522
- id: 'geocoder-agent',
523
- name: 'Geocoder agent',
524
- description: 'Responsible for converting location or address into coordinates',
525
- prompt:
526
- 'You are a helpful assistant responsible for converting location or address into coordinates using your geocode tool',
527
- canUse: () => [geocodeAddressTool],
528
- });
529
-
530
- // Agent Graph
531
- export const weatherGraph = agentGraph({
532
- id: 'weather-graph',
533
- name: 'Weather graph',
534
- defaultAgent: weatherAssistant,
535
- agents: () => [weatherAssistant, weatherForecaster, geocoderAgent],
536
- });`;
537
- await fs.writeFile(`src/${config.projectId}/weather.graph.ts`, agentsGraph);
538
- const inkeepConfig = `import { defineConfig } from '@inkeep/agents-cli/config';
539
-
540
- const config = defineConfig({
541
- tenantId: "${config.tenantId}",
542
- projectId: "${config.projectId}",
543
- agentsManageApiUrl: \`http://localhost:\${process.env.MANAGE_API_PORT || '3002'}\`,
544
- agentsRunApiUrl: \`http://localhost:\${process.env.RUN_API_PORT || '3003'}\`,
545
- modelSettings: ${JSON.stringify(config.modelSettings, null, 2)},
546
- });
547
-
548
- export default config;`;
549
- await fs.writeFile(`src/${config.projectId}/inkeep.config.ts`, inkeepConfig);
550
- const projectEnvContent = `# Environment
551
- ENVIRONMENT=development
552
-
553
- # Database (relative path from project directory)
554
- DB_FILE_NAME=file:../../local.db
555
-
556
- # UI Configuration (for dashboard)
557
- NEXT_PUBLIC_INKEEP_AGENTS_MANAGE_API_URL=http://localhost:${config.manageApiPort}
558
- NEXT_PUBLIC_INKEEP_AGENTS_RUN_API_URL=http://localhost:${config.runApiPort}
559
-
560
- `;
561
- await fs.writeFile(`src/${config.projectId}/.env`, projectEnvContent);
562
- const credentialStoresFile = `import {
563
- InMemoryCredentialStore,
564
- createNangoCredentialStore,
565
- createKeyChainStore,
566
- } from '@inkeep/agents-core';
567
-
568
- // Shared credential stores configuration for all services
569
- export const credentialStores = [
570
- new InMemoryCredentialStore('memory-default'),
571
- ...(process.env.NANGO_SECRET_KEY
572
- ? [
573
- createNangoCredentialStore('nango-default', {
574
- apiUrl: process.env.NANGO_HOST || 'https://api.nango.dev',
575
- secretKey: process.env.NANGO_SECRET_KEY,
576
- }),
577
- ]
578
- : []),
579
- createKeyChainStore('keychain-default'),
580
- ];
581
- `;
582
- await fs.writeFile("apps/shared/credential-stores.ts", credentialStoresFile);
583
- const manageApiIndex = `import { serve } from '@hono/node-server';
584
- import { createManagementApp } from '@inkeep/agents-manage-api';
585
- import { getLogger } from '@inkeep/agents-core';
586
- import { credentialStores } from '../../shared/credential-stores.js';
587
-
588
- const logger = getLogger('management-api');
589
-
590
- // Create the Hono app
591
- const app = createManagementApp({
592
- serverConfig: {
593
- port: Number(process.env.MANAGE_API_PORT) || 3002,
594
- serverOptions: {
595
- requestTimeout: 60000,
596
- keepAliveTimeout: 60000,
597
- keepAlive: true,
598
- },
599
- },
600
- credentialStores,
601
- });
602
-
603
- const port = Number(process.env.MANAGE_API_PORT) || 3002;
604
-
605
- // Start the server using @hono/node-server
606
- serve(
607
- {
608
- fetch: app.fetch,
609
- port,
610
- },
611
- (info) => {
612
- logger.info({}, \`\u{1F4DD} Management API running on http://localhost:\${info.port}\`);
613
- logger.info({}, \`\u{1F4DD} OpenAPI documentation available at http://localhost:\${info.port}/openapi.json\`);
614
- }
615
- );`;
616
- await fs.writeFile("apps/manage-api/src/index.ts", manageApiIndex);
617
- const runApiIndex = `import { serve } from '@hono/node-server';
618
- import { createExecutionApp } from '@inkeep/agents-run-api';
619
- import { credentialStores } from '../../shared/credential-stores.js';
620
- import { getLogger } from '@inkeep/agents-core';
621
-
622
- const logger = getLogger('execution-api');
623
-
624
-
625
- // Create the Hono app
626
- const app = createExecutionApp({
627
- serverConfig: {
628
- port: Number(process.env.RUN_API_PORT) || 3003,
629
- serverOptions: {
630
- requestTimeout: 120000,
631
- keepAliveTimeout: 60000,
632
- keepAlive: true,
633
- },
634
- },
635
- credentialStores,
636
- });
637
-
638
- const port = Number(process.env.RUN_API_PORT) || 3003;
639
-
640
- // Start the server using @hono/node-server
641
- serve(
642
- {
643
- fetch: app.fetch,
644
- port,
645
- },
646
- (info) => {
647
- logger.info({}, \`\u{1F4DD} Run API running on http://localhost:\${info.port}\`);
648
- logger.info({}, \`\u{1F4DD} OpenAPI documentation available at http://localhost:\${info.port}/openapi.json\`);
649
- }
650
- );`;
651
- await fs.writeFile("apps/run-api/src/index.ts", runApiIndex);
652
- const drizzleConfig = `import { defineConfig } from 'drizzle-kit';
653
-
654
- export default defineConfig({
655
- schema: 'node_modules/@inkeep/agents-core/dist/db/schema.js',
656
- dialect: 'sqlite',
657
- dbCredentials: {
658
- url: process.env.DB_FILE_NAME || 'file:./local.db'
659
- },
660
- });`;
661
- await fs.writeFile("drizzle.config.ts", drizzleConfig);
662
- }
663
- async function createTurboConfig() {
664
- const turboConfig = {
665
- $schema: "https://turbo.build/schema.json",
666
- ui: "tui",
667
- globalDependencies: ["**/.env", "**/.env.local", "**/.env.*"],
668
- globalEnv: [
669
- "NODE_ENV",
670
- "CI",
671
- "ANTHROPIC_API_KEY",
672
- "OPENAI_API_KEY",
673
- "ENVIRONMENT",
674
- "DB_FILE_NAME",
675
- "MANAGE_API_PORT",
676
- "RUN_API_PORT",
677
- "LOG_LEVEL",
678
- "NANGO_SECRET_KEY"
679
- ],
680
- tasks: {
681
- build: {
682
- dependsOn: ["^build"],
683
- inputs: ["$TURBO_DEFAULT$", ".env*"],
684
- outputs: ["dist/**", "build/**", ".next/**", "!.next/cache/**"]
685
- },
686
- dev: {
687
- cache: false,
688
- persistent: true
689
- },
690
- start: {
691
- dependsOn: ["build"],
692
- cache: false
693
- },
694
- "db:push": {
695
- cache: false,
696
- inputs: ["drizzle.config.ts", "src/data/db/schema.ts"]
697
- }
698
- }
699
- };
700
- await fs.writeJson("turbo.json", turboConfig, { spaces: 2 });
701
- }
702
- async function createDocumentation(config) {
703
- const readme = `# ${config.dirName}
704
-
705
- An Inkeep Agent Framework project with multi-service architecture.
706
-
707
- ## Architecture
708
-
709
- This project follows a workspace structure with the following services:
710
-
711
- - **Agents Manage API** (Port 3002): Agent configuration and managemen
712
- - Handles entity management and configuration endpoints.
713
- - **Agents Run API** (Port 3003): Agent execution and chat processing
714
- - Handles agent communication. You can interact with your agents either over MCP from an MCP client or through our React UI components library
715
- - **Agents Manage UI** (Port 3000): Web interface available via \`inkeep dev\`
716
- - The agent framework visual builder. From the builder you can create, manage and visualize all your graphs.
717
-
718
- ## Quick Start
719
- 1. **Install the Inkeep CLI:**
720
- \`\`\`bash
721
- pnpm install -g @inkeep/agents-cli
722
- \`\`\`
723
-
724
- 1. **Start services:**
725
- \`\`\`bash
726
- # Start Agents Manage API and Agents Run API
727
- pnpm dev
728
-
729
- # Start the Dashboard
730
- inkeep dev
731
- \`\`\`
732
-
733
- 3. **Deploy your first agent graph:**
734
- \`\`\`bash
735
- # Navigate to your project's graph directory
736
- cd src/${config.projectId}/
737
-
738
- # Push the weather graph to create it
739
- inkeep push weather.graph.ts
740
- \`\`\`
741
- - Follow the prompts to create the project and graph
742
- - Click on the "View graph in UI:" link to see the graph in the management dashboard
743
-
744
- ## Project Structure
745
-
746
- \`\`\`
747
- ${config.dirName}/
748
- \u251C\u2500\u2500 src/
749
- \u2502 \u251C\u2500\u2500 /${config.projectId} # Agent configurations
750
- \u251C\u2500\u2500 apps/
751
- \u2502 \u251C\u2500\u2500 manage-api/ # Agents Manage API service
752
- \u2502 \u251C\u2500\u2500 run-api/ # Agents Run API service
753
- \u2502 \u2514\u2500\u2500 shared/ # Shared code between API services
754
- \u2502 \u2514\u2500\u2500 credential-stores.ts # Shared credential store configuration
755
- \u251C\u2500\u2500 turbo.json # Turbo configuration
756
- \u251C\u2500\u2500 pnpm-workspace.yaml # pnpm workspace configuration
757
- \u2514\u2500\u2500 package.json # Root package configuration
758
- \`\`\`
759
-
760
- ## Configuration
761
-
762
- ### Environment Variables
763
-
764
- Environment variables are defined in the following places:
765
-
766
- - \`apps/manage-api/.env\`: Agents Manage API environment variables
767
- - \`apps/run-api/.env\`: Agents Run API environment variables
768
- - \`src/${config.projectId}/.env\`: Inkeep CLI environment variables
769
- - \`.env\`: Root environment variables
770
-
771
- To change the API keys used by your agents modify \`apps/run-api/.env\`. You are required to define at least one LLM provider key.
772
-
773
- \`\`\`bash
774
- # AI Provider Keys
775
- ANTHROPIC_API_KEY=your-anthropic-key-here
776
- OPENAI_API_KEY=your-openai-key-here
777
- \`\`\`
778
-
779
- To change the ports used by your services modify \`apps/manage-api/.env\` and \`apps/run-api/.env\` respectively:
780
-
781
- \`\`\`bash
782
- # Service port for apps/run-api
783
- RUN_API_PORT=3003
784
-
785
- # Service port for apps/manage-api
786
- MANAGE_API_PORT=3002
787
- \`\`\`
788
-
789
- After changing the API Service ports make sure that you modify the dashboard API urls from whichever directory you are running \`inkeep dev\`:
790
-
791
- \`\`\`bash
792
- # UI Configuration (for dashboard)
793
- NEXT_PUBLIC_INKEEP_AGENTS_MANAGE_API_URL=http://localhost:${config.manageApiPort}
794
- NEXT_PUBLIC_INKEEP_AGENTS_RUN_API_URL=http://localhost:${config.runApiPort}
795
- \`\`\`
796
-
797
- ### Agent Configuration
798
-
799
- Your graphs are defined in \`src/${config.projectId}/weather.graph.ts\`. The default setup includes:
800
-
801
- - **Weather Graph**: A graph that can forecast the weather in a given location.
802
-
803
- Your inkeep configuration is defined in \`src/${config.projectId}/inkeep.config.ts\`. The inkeep configuration is used to configure defaults for the inkeep CLI. The configuration includes:
804
-
805
- - \`tenantId\`: The tenant ID
806
- - \`projectId\`: The project ID
807
- - \`agentsManageApiUrl\`: The Manage API URL
808
- - \`agentsRunApiUrl\`: The Run API URL
809
-
810
-
811
- ## Development
812
-
813
- ### Updating Your Agents
814
-
815
- 1. Edit \`src/${config.projectId}/weather.graph.ts\`
816
- 2. Push the graph to the platform to update: \`inkeep pus weather.graph.ts\`
817
-
818
- ### API Documentation
819
-
820
- Once services are running, view the OpenAPI documentation:
821
-
822
- - Manage API: http://localhost:${config.manageApiPort}/docs
823
- - Run API: http://localhost:${config.runApiPort}/docs
824
-
825
- ## Learn More
826
-
827
- - [Inkeep Documentation](https://docs.inkeep.com)
828
-
829
- ## Troubleshooting
830
-
831
- ## Inkeep CLI commands
832
-
833
- - Ensure you are runnning commands from \`cd src/${config.projectId}\`.
834
- - Validate the \`inkeep.config.ts\` file has the correct api urls.
835
- - Validate that the \`.env\` file in \`src/${config.projectId}\` has the correct \`DB_FILE_NAME\`.
836
-
837
- ### Services won't start
838
-
839
- 1. Ensure all dependencies are installed: \`pnpm install\`
840
- 2. Check that ports 3000-3003 are available
841
-
842
- ### Agents won't respond
843
-
844
- 1. Ensure that the Agents Run API is running and includes a valid Anthropic or OpenAI API key in its .env file
845
- `;
846
- await fs.writeFile("README.md", readme);
847
- }
848
- async function installDependencies() {
849
- await execAsync("pnpm install");
850
- }
851
- async function setupDatabase() {
852
- try {
853
- await execAsync("pnpm db:push");
854
- } catch (error) {
855
- throw new Error(
856
- `Failed to setup database: ${error instanceof Error ? error.message : "Unknown error"}`
857
- );
858
- }
859
- }
860
- async function createCommand(dirName, options) {
861
- await createAgents({
862
- dirName,
863
- ...options
864
- });
865
- }
866
- export {
867
- createAgents,
868
- createCommand
869
- };