@inkeep/agents-sdk 0.0.0-dev-20250910233133 → 0.0.0-dev-20250910233151

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 (61) hide show
  1. package/dist/chunk-SMQ7HFDN.js +146 -0
  2. package/dist/index.cjs +2948 -0
  3. package/dist/index.d.cts +862 -0
  4. package/dist/index.d.ts +862 -11
  5. package/dist/index.js +2760 -10
  6. package/dist/tool-MDKZB6AJ.js +1 -0
  7. package/package.json +3 -3
  8. package/dist/__tests__/utils/testTenant.d.ts +0 -7
  9. package/dist/__tests__/utils/testTenant.d.ts.map +0 -1
  10. package/dist/__tests__/utils/testTenant.js +0 -10
  11. package/dist/__tests__/utils/testTenant.js.map +0 -1
  12. package/dist/agent.d.ts +0 -39
  13. package/dist/agent.d.ts.map +0 -1
  14. package/dist/agent.js +0 -513
  15. package/dist/agent.js.map +0 -1
  16. package/dist/artifact-component.d.ts +0 -27
  17. package/dist/artifact-component.d.ts.map +0 -1
  18. package/dist/artifact-component.js +0 -118
  19. package/dist/artifact-component.js.map +0 -1
  20. package/dist/builders.d.ts +0 -211
  21. package/dist/builders.d.ts.map +0 -1
  22. package/dist/builders.js +0 -244
  23. package/dist/builders.js.map +0 -1
  24. package/dist/data-component.d.ts +0 -25
  25. package/dist/data-component.d.ts.map +0 -1
  26. package/dist/data-component.js +0 -114
  27. package/dist/data-component.js.map +0 -1
  28. package/dist/environment-settings.d.ts +0 -28
  29. package/dist/environment-settings.d.ts.map +0 -1
  30. package/dist/environment-settings.js +0 -79
  31. package/dist/environment-settings.js.map +0 -1
  32. package/dist/externalAgent.d.ts +0 -58
  33. package/dist/externalAgent.d.ts.map +0 -1
  34. package/dist/externalAgent.js +0 -163
  35. package/dist/externalAgent.js.map +0 -1
  36. package/dist/graph.d.ts +0 -200
  37. package/dist/graph.d.ts.map +0 -1
  38. package/dist/graph.js +0 -1322
  39. package/dist/graph.js.map +0 -1
  40. package/dist/graphFullClient.d.ts +0 -22
  41. package/dist/graphFullClient.d.ts.map +0 -1
  42. package/dist/graphFullClient.js +0 -189
  43. package/dist/graphFullClient.js.map +0 -1
  44. package/dist/index.d.ts.map +0 -1
  45. package/dist/index.js.map +0 -1
  46. package/dist/module-hosted-tool-manager.d.ts +0 -37
  47. package/dist/module-hosted-tool-manager.d.ts.map +0 -1
  48. package/dist/module-hosted-tool-manager.js +0 -378
  49. package/dist/module-hosted-tool-manager.js.map +0 -1
  50. package/dist/runner.d.ts +0 -38
  51. package/dist/runner.d.ts.map +0 -1
  52. package/dist/runner.js +0 -164
  53. package/dist/runner.js.map +0 -1
  54. package/dist/tool.d.ts +0 -29
  55. package/dist/tool.d.ts.map +0 -1
  56. package/dist/tool.js +0 -122
  57. package/dist/tool.js.map +0 -1
  58. package/dist/types.d.ts +0 -286
  59. package/dist/types.d.ts.map +0 -1
  60. package/dist/types.js +0 -39
  61. package/dist/types.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,11 +1,862 @@
1
- export { Agent } from "./agent";
2
- export { ArtifactComponent } from "./artifact-component";
3
- export { agent, artifactComponent, credential, dataComponent, mcpServer, mcpTool, tool, transfer, } from "./builders";
4
- export { DataComponent } from "./data-component";
5
- export { createEnvironmentSettings, getAllEnvironmentSettingKeys, registerEnvironmentSettings, } from "./environment-settings";
6
- export { ExternalAgent, externalAgent, externalAgents, } from "./externalAgent";
7
- export { AgentGraph, agentGraph, generateGraph } from "./graph";
8
- export { Runner, raceGraphs, run, stream } from "./runner";
9
- export { Tool } from "./tool";
10
- export type * from "./types";
11
- //# sourceMappingURL=index.d.ts.map
1
+ import { CredentialReferenceSelect, AgentApiInsert, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, CredentialReferenceApiInsert, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert, MCPToolConfig as MCPToolConfig$1 } from '@inkeep/agents-core';
2
+ import { z } from 'zod';
3
+
4
+ type ExternalAgentConfig = {
5
+ type?: "external";
6
+ tenantId?: string;
7
+ id: string;
8
+ name: string;
9
+ description: string;
10
+ baseUrl: string;
11
+ credentialReference?: CredentialReferenceSelect;
12
+ headers?: Record<string, string>;
13
+ };
14
+ declare class ExternalAgent implements ExternalAgentInterface {
15
+ config: ExternalAgentConfig;
16
+ readonly type: "external";
17
+ private initialized;
18
+ private tenantId;
19
+ private baseURL;
20
+ constructor(config: ExternalAgentConfig);
21
+ /**
22
+ * Initialize the external agent by upserting it in the database
23
+ */
24
+ init(): Promise<void>;
25
+ getId(): string;
26
+ private upsertExternalAgent;
27
+ /**
28
+ * Get the external agent configuration
29
+ */
30
+ getConfig(): ExternalAgentConfig;
31
+ /**
32
+ * Get the external agent name
33
+ */
34
+ getName(): string;
35
+ /**
36
+ * Get the external agent base URL
37
+ */
38
+ getBaseUrl(): string;
39
+ /**
40
+ * Get the tenant ID
41
+ */
42
+ getTenantId(): string;
43
+ getDescription(): string;
44
+ getCredentialReferenceId(): string | undefined;
45
+ getHeaders(): Record<string, string> | undefined;
46
+ }
47
+ /**
48
+ * Factory function to create external agents - follows the same pattern as agent()
49
+ */
50
+ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
51
+ /**
52
+ * Helper function to create multiple external agents
53
+ */
54
+ declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
55
+
56
+ interface UserMessage {
57
+ role: "user";
58
+ content: string;
59
+ }
60
+ interface AssistantMessage {
61
+ role: "assistant";
62
+ content: string;
63
+ toolCalls?: ToolCall[];
64
+ }
65
+ interface ToolMessage {
66
+ role: "tool";
67
+ content: string;
68
+ toolCallId: string;
69
+ }
70
+ interface SystemMessage {
71
+ role: "system";
72
+ content: string;
73
+ }
74
+ type Message = UserMessage | AssistantMessage | ToolMessage | SystemMessage;
75
+ type MessageInput = string | string[] | Message | Message[];
76
+ interface ToolCall {
77
+ id: string;
78
+ type: "function";
79
+ function: {
80
+ name: string;
81
+ arguments: string;
82
+ };
83
+ }
84
+ interface ToolResult {
85
+ id: string;
86
+ result: any;
87
+ error?: string;
88
+ }
89
+ type AllAgentInterface = AgentInterface | ExternalAgentInterface;
90
+ interface AgentConfig extends Omit<AgentApiInsert, "projectId"> {
91
+ type?: "internal";
92
+ tools?: () => any[];
93
+ canTransferTo?: () => AgentInterface[];
94
+ canDelegateTo?: () => AllAgentInterface[];
95
+ tenantId?: string;
96
+ projectId?: string;
97
+ models?: {
98
+ base?: ModelSettings;
99
+ structuredOutput?: ModelSettings;
100
+ summarizer?: ModelSettings;
101
+ };
102
+ stopWhen?: {
103
+ stepCountIs?: number;
104
+ };
105
+ memory?: {
106
+ type: "conversation" | "episodic" | "short_term";
107
+ capacity?: number;
108
+ };
109
+ dataComponents?: () => DataComponentApiInsert[];
110
+ artifactComponents?: () => ArtifactComponentApiInsert[];
111
+ conversationHistoryConfig?: AgentConversationHistoryConfig;
112
+ }
113
+ interface ModelSettings {
114
+ model?: string;
115
+ providerOptions?: Record<string, Record<string, unknown>>;
116
+ }
117
+ declare const ModelSettingsSchema: z.ZodObject<{
118
+ model: z.ZodOptional<z.ZodString>;
119
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
120
+ }, z.core.$strip>;
121
+ interface ToolConfig extends ToolInsert {
122
+ execute: (params: any) => Promise<any>;
123
+ parameters?: Record<string, any>;
124
+ schema?: z.ZodJSONSchema;
125
+ }
126
+ interface ServerConfig {
127
+ type: string;
128
+ version?: string;
129
+ }
130
+ interface MCPToolConfig {
131
+ id: string;
132
+ name: string;
133
+ tenantId?: string;
134
+ description?: string;
135
+ credential?: CredentialReferenceApiInsert;
136
+ server?: ServerConfig;
137
+ serverUrl: string;
138
+ toolName?: string;
139
+ activeTools?: string[];
140
+ headers?: Record<string, string>;
141
+ mcpType?: "nango" | "generic";
142
+ transport?: McpTransportConfig;
143
+ imageUrl?: string;
144
+ }
145
+ interface FetchDefinitionConfig {
146
+ id: string;
147
+ name?: string;
148
+ trigger: "initialization" | "invocation";
149
+ url: string;
150
+ method?: string;
151
+ headers?: Record<string, string>;
152
+ body?: Record<string, unknown>;
153
+ transform?: string;
154
+ responseSchema?: z.ZodSchema<any>;
155
+ defaultValue?: unknown;
156
+ timeout?: number;
157
+ credential?: CredentialReferenceApiInsert;
158
+ }
159
+ interface RequestSchemaDefinition {
160
+ body?: z.ZodSchema<any>;
161
+ headers?: z.ZodSchema<any>;
162
+ query?: z.ZodSchema<any>;
163
+ params?: z.ZodSchema<any>;
164
+ }
165
+ interface RequestSchemaConfig {
166
+ schemas: RequestSchemaDefinition;
167
+ optional?: ("body" | "headers" | "query" | "params")[];
168
+ }
169
+ interface TransferConfig {
170
+ agent: AgentInterface;
171
+ description?: string;
172
+ condition?: (context: any) => boolean;
173
+ }
174
+ interface GenerateOptions {
175
+ maxTurns?: number;
176
+ maxSteps?: number;
177
+ temperature?: number;
178
+ toolChoice?: "auto" | "none" | string;
179
+ resourceId?: string;
180
+ conversationId?: string;
181
+ stream?: boolean;
182
+ customBodyParams?: Record<string, unknown>;
183
+ }
184
+ interface AgentResponse {
185
+ id?: string;
186
+ text: string;
187
+ toolCalls?: ToolCall[];
188
+ transfer?: TransferConfig;
189
+ finishReason: "completed" | "tool_calls" | "transfer" | "max_turns" | "error";
190
+ usage?: {
191
+ inputTokens: number;
192
+ outputTokens: number;
193
+ totalTokens?: number;
194
+ };
195
+ metadata?: Record<string, any>;
196
+ }
197
+ interface StreamResponse {
198
+ textStream?: AsyncGenerator<string>;
199
+ eventStream?: AsyncGenerator<StreamEvent>;
200
+ }
201
+ interface StreamEvent {
202
+ type: "text" | "tool_call" | "transfer" | "error" | "done";
203
+ data: any;
204
+ timestamp: Date;
205
+ }
206
+ interface RunResult {
207
+ finalOutput: string;
208
+ agent: AgentInterface;
209
+ turnCount: number;
210
+ usage?: {
211
+ inputTokens: number;
212
+ outputTokens: number;
213
+ totalTokens?: number;
214
+ };
215
+ metadata?: {
216
+ toolCalls: ToolCall[];
217
+ transfers: TransferConfig[];
218
+ };
219
+ }
220
+ interface StatusComponent {
221
+ id: string;
222
+ name: string;
223
+ type: string;
224
+ description?: string;
225
+ schema: {
226
+ type: "object";
227
+ properties: Record<string, any>;
228
+ required?: string[];
229
+ };
230
+ }
231
+ interface StatusUpdateSettings {
232
+ enabled?: boolean;
233
+ numEvents?: number;
234
+ timeInSeconds?: number;
235
+ model?: string;
236
+ statusComponents?: StatusComponent[];
237
+ prompt?: string;
238
+ }
239
+ interface GraphConfig {
240
+ id: string;
241
+ name?: string;
242
+ description?: string;
243
+ defaultAgent?: AgentInterface;
244
+ agents?: () => AllAgentInterface[];
245
+ tenantId?: string;
246
+ contextConfig?: any;
247
+ credentials?: () => CredentialReferenceApiInsert[];
248
+ stopWhen?: {
249
+ transferCountIs?: number;
250
+ };
251
+ graphPrompt?: string;
252
+ models?: {
253
+ base?: ModelSettings;
254
+ structuredOutput?: ModelSettings;
255
+ summarizer?: ModelSettings;
256
+ };
257
+ statusUpdates?: StatusUpdateSettings;
258
+ }
259
+ declare class AgentError extends Error {
260
+ code?: string | undefined;
261
+ details?: any | undefined;
262
+ constructor(message: string, code?: string | undefined, details?: any | undefined);
263
+ }
264
+ declare class MaxTurnsExceededError extends AgentError {
265
+ constructor(maxTurns: number);
266
+ }
267
+ declare class ToolExecutionError extends AgentError {
268
+ constructor(toolName: string, originalError: Error);
269
+ }
270
+ declare class TransferError extends AgentError {
271
+ constructor(sourceAgent: string, targetAgent: string, reason: string);
272
+ }
273
+ interface AgentInterface {
274
+ config: AgentConfig;
275
+ type: "internal";
276
+ init(): Promise<void>;
277
+ getId(): string;
278
+ getName(): string;
279
+ getInstructions(): string;
280
+ getTools(): Record<string, any>;
281
+ getTransfers(): AgentInterface[];
282
+ getDelegates(): AllAgentInterface[];
283
+ getDataComponents(): DataComponentApiInsert[];
284
+ getArtifactComponents(): ArtifactComponentApiInsert[];
285
+ addTool(name: string, tool: any): void;
286
+ addTransfer(...agents: AgentInterface[]): void;
287
+ addDelegate(...agents: AgentInterface[]): void;
288
+ }
289
+ interface ExternalAgentInterface {
290
+ config: ExternalAgentConfig;
291
+ type: "external";
292
+ init(): Promise<void>;
293
+ getId(): string;
294
+ getName(): string;
295
+ getDescription(): string;
296
+ getBaseUrl(): string;
297
+ getCredentialReferenceId(): string | undefined;
298
+ getHeaders(): Record<string, string> | undefined;
299
+ }
300
+ interface GraphInterface {
301
+ init(): Promise<void>;
302
+ setConfig(tenantId: string, projectId: string, apiUrl: string): void;
303
+ getId(): string;
304
+ getName(): string;
305
+ getDescription(): string | undefined;
306
+ getTenantId(): string;
307
+ generate(input: MessageInput, options?: GenerateOptions): Promise<string>;
308
+ stream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
309
+ generateStream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
310
+ getDefaultAgent(): AgentInterface | undefined;
311
+ getAgent(name: string): AllAgentInterface | undefined;
312
+ getAgents(): AllAgentInterface[];
313
+ }
314
+ interface BuilderToolConfig {
315
+ name: string;
316
+ description: string;
317
+ config: {
318
+ type: "mcp";
319
+ mcp: {
320
+ server: {
321
+ url: string;
322
+ };
323
+ };
324
+ };
325
+ parameters?: Record<string, any>;
326
+ }
327
+ interface BuilderRelationConfig {
328
+ targetAgent: string;
329
+ relationType: "transfer" | "delegate";
330
+ }
331
+ interface BuilderAgentConfig {
332
+ name: string;
333
+ description: string;
334
+ instructions: string;
335
+ tools: BuilderToolConfig[];
336
+ relations?: BuilderRelationConfig[];
337
+ }
338
+
339
+ declare class Agent implements AgentInterface {
340
+ config: AgentConfig;
341
+ readonly type: "internal";
342
+ private baseURL;
343
+ private tenantId;
344
+ private projectId;
345
+ private initialized;
346
+ constructor(config: AgentConfig);
347
+ getId(): string;
348
+ getName(): string;
349
+ getInstructions(): string;
350
+ getTools(): Record<string, unknown>;
351
+ getModels(): typeof this$1.config.models;
352
+ setModels(models: typeof this$1.config.models): void;
353
+ getTransfers(): AgentInterface[];
354
+ getDelegates(): AllAgentInterface[];
355
+ getDataComponents(): DataComponentApiInsert[];
356
+ getArtifactComponents(): ArtifactComponentApiInsert[];
357
+ addTool(_name: string, tool: unknown): void;
358
+ addTransfer(...agents: AgentInterface[]): void;
359
+ addDelegate(...agents: AllAgentInterface[]): void;
360
+ init(): Promise<void>;
361
+ private upsertAgent;
362
+ private saveToolsAndRelations;
363
+ private saveDataComponents;
364
+ private saveArtifactComponents;
365
+ private loadDataComponents;
366
+ private loadArtifactComponents;
367
+ private createTool;
368
+ private createDataComponent;
369
+ private createArtifactComponent;
370
+ private createAgentDataComponentRelation;
371
+ private createAgentArtifactComponentRelation;
372
+ private createAgentToolRelation;
373
+ }
374
+
375
+ interface ArtifactComponentInterface {
376
+ config: Omit<ArtifactComponentInsert, "id">;
377
+ init(): Promise<void>;
378
+ getId(): ArtifactComponentInsert["id"];
379
+ getName(): ArtifactComponentInsert["name"];
380
+ getDescription(): ArtifactComponentInsert["description"];
381
+ getSummaryProps(): ArtifactComponentInsert["summaryProps"];
382
+ getFullProps(): ArtifactComponentInsert["fullProps"];
383
+ }
384
+ declare class ArtifactComponent implements ArtifactComponentInterface {
385
+ config: ArtifactComponentInsert;
386
+ private baseURL;
387
+ private tenantId;
388
+ private projectId;
389
+ private initialized;
390
+ private id;
391
+ constructor(config: Omit<ArtifactComponentInsert, "id">);
392
+ getId(): string;
393
+ getName(): string;
394
+ getDescription(): string;
395
+ getSummaryProps(): ArtifactComponentInsert["summaryProps"];
396
+ getFullProps(): ArtifactComponentInsert["fullProps"];
397
+ init(): Promise<void>;
398
+ private upsertArtifactComponent;
399
+ }
400
+
401
+ interface DataComponentInterface {
402
+ config: Omit<DataComponentInsert, "id">;
403
+ init(): Promise<void>;
404
+ getId(): DataComponentInsert["id"];
405
+ getName(): DataComponentInsert["name"];
406
+ getDescription(): DataComponentInsert["description"];
407
+ getProps(): DataComponentInsert["props"];
408
+ }
409
+ declare class DataComponent implements DataComponentInterface {
410
+ config: DataComponentInsert;
411
+ private baseURL;
412
+ private tenantId;
413
+ private projectId;
414
+ private initialized;
415
+ private id;
416
+ constructor(config: Omit<DataComponentInsert, "id">);
417
+ getId(): string;
418
+ getName(): string;
419
+ getDescription(): string;
420
+ getProps(): DataComponentInsert["props"];
421
+ init(): Promise<void>;
422
+ private upsertDataComponent;
423
+ }
424
+
425
+ interface ToolInterface {
426
+ config: MCPToolConfig$1;
427
+ init(): Promise<void>;
428
+ getId(): string;
429
+ getName(): string;
430
+ getDescription(): string;
431
+ getServerUrl(): string;
432
+ getActiveTools(): string[] | undefined;
433
+ getCredentialReferenceId(): string | null | undefined;
434
+ }
435
+ declare class Tool implements ToolInterface {
436
+ config: MCPToolConfig$1;
437
+ private baseURL;
438
+ private tenantId;
439
+ private initialized;
440
+ constructor(config: MCPToolConfig$1);
441
+ getId(): string;
442
+ getName(): string;
443
+ getDescription(): string;
444
+ getServerUrl(): string;
445
+ getActiveTools(): string[] | undefined;
446
+ getCredentialReferenceId(): string | null | undefined;
447
+ init(options?: {
448
+ skipDatabaseRegistration?: boolean;
449
+ }): Promise<void>;
450
+ private upsertTool;
451
+ }
452
+
453
+ /**
454
+ * Creates a new agent with stable ID enforcement.
455
+ *
456
+ * @param config - Agent configuration including required stable ID
457
+ * @returns A new Agent instance
458
+ * @throws Error if config.id is not provided (stable IDs are required)
459
+ *
460
+ * @example
461
+ * ```typescript
462
+ * const myAgent = agent({
463
+ * id: 'customer-support-agent',
464
+ * name: 'Customer Support',
465
+ * prompt: 'Help customers with their questions'
466
+ * });
467
+ * ```
468
+ */
469
+ declare function agent(config: AgentConfig): Agent;
470
+ declare function credential(config: CredentialReferenceApiInsert): {
471
+ type: string;
472
+ id: string;
473
+ credentialStoreId: string;
474
+ retrievalParams?: Record<string, unknown> | null | undefined;
475
+ };
476
+ /**
477
+ * Creates a tool with automatic ID generation (unlike agents which require explicit IDs).
478
+ *
479
+ * Tools automatically generate IDs from their name, whereas agents require stable IDs
480
+ * to be explicitly provided for consistency across deployments.
481
+ *
482
+ * @param config - Tool configuration with auto-generated ID
483
+ * @returns A Tool instance with auto-generated ID based on name
484
+ *
485
+ * @example
486
+ * ```typescript
487
+ * const searchTool = tool({
488
+ * name: 'Search Database',
489
+ * description: 'Search the product database',
490
+ * execute: async (params) => { ... }
491
+ * });
492
+ * // ID will be auto-generated as 'search-database'
493
+ * ```
494
+ */
495
+ declare function tool(config: {
496
+ name: string;
497
+ description: string;
498
+ execute: (params: any) => Promise<any>;
499
+ parameters?: Record<string, any>;
500
+ schema?: z.ZodJSONSchema;
501
+ }): {
502
+ id: string;
503
+ name: string;
504
+ description: string;
505
+ execute: (params: any) => Promise<any>;
506
+ parameters: Record<string, any> | undefined;
507
+ schema: unknown;
508
+ type: "function";
509
+ };
510
+ /**
511
+ * Creates an MCP (Model Context Protocol) server for tool functionality.
512
+ *
513
+ * This unified builder replaces tool(), mcpTool(), ipcTool(), and hostedTool().
514
+ * All tools are MCP servers - either local (with execute function) or remote (with URL).
515
+ *
516
+ * @param config - MCP server configuration
517
+ * @returns An MCP server instance that can be used as a tool in agents
518
+ *
519
+ * @example
520
+ * ```typescript
521
+ * // Local MCP server with execute function (auto-wrapped via IPC)
522
+ * const searchServer = mcpServer({
523
+ * name: 'search',
524
+ * description: 'Search the database',
525
+ * execute: async (params) => {
526
+ * // Implementation
527
+ * return results;
528
+ * }
529
+ * });
530
+ *
531
+ * // Remote MCP server
532
+ * const apiServer = mcpServer({
533
+ * name: 'external_api',
534
+ * description: 'External API service',
535
+ * serverUrl: 'https://api.example.com/mcp'
536
+ * });
537
+ * ```
538
+ */
539
+ declare function mcpServer(config: {
540
+ name: string;
541
+ description: string;
542
+ deployment?: "local" | "remote";
543
+ execute?: (params: any) => Promise<any>;
544
+ port?: number;
545
+ serverUrl?: string;
546
+ id?: string;
547
+ parameters?: Record<string, z.ZodJSONSchema>;
548
+ credential?: CredentialReferenceApiInsert;
549
+ tenantId?: string;
550
+ transport?: "ipc" | "http" | "sse";
551
+ activeTools?: string[];
552
+ headers?: Record<string, string>;
553
+ }): Tool;
554
+ declare function mcpTool(config: MCPToolConfig$1): Tool;
555
+ declare function transfer(targetAgent: Agent, description?: string, condition?: (context: unknown) => boolean): TransferConfig;
556
+ /**
557
+ * Creates an artifact component with automatic ID generation.
558
+ *
559
+ * @param config - Artifact component configuration
560
+ * @returns An ArtifactComponent instance with auto-generated ID
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * const productCard = artifactComponent({
565
+ * name: 'Product Card',
566
+ * description: 'Display product information',
567
+ * summaryProps: { title: 'Product', price: '$0' },
568
+ * fullProps: { title: 'Product', price: '$0', description: '...' }
569
+ * });
570
+ * ```
571
+ */
572
+ declare function artifactComponent(config: {
573
+ name: string;
574
+ description: string;
575
+ summaryProps: Record<string, any>;
576
+ fullProps: Record<string, any>;
577
+ tenantId?: string;
578
+ projectId?: string;
579
+ }): ArtifactComponent;
580
+ /**
581
+ * Creates a data component with automatic ID generation.
582
+ *
583
+ * @param config - Data component configuration
584
+ * @returns A DataComponent instance with auto-generated ID
585
+ *
586
+ * @example
587
+ * ```typescript
588
+ * const userProfile = dataComponent({
589
+ * name: 'User Profile',
590
+ * description: 'User profile data',
591
+ * props: { userId: '123', name: 'John Doe' }
592
+ * });
593
+ * ```
594
+ */
595
+ declare function dataComponent(config: {
596
+ name: string;
597
+ description: string;
598
+ props: Record<string, any>;
599
+ tenantId?: string;
600
+ projectId?: string;
601
+ }): DataComponent;
602
+
603
+ interface EnvironmentSettingsConfig {
604
+ credentials?: {
605
+ [settingId: string]: CredentialReferenceApiInsert;
606
+ };
607
+ }
608
+ /**
609
+ * Get all registered setting keys across all environments
610
+ */
611
+ declare function getAllEnvironmentSettingKeys(): string[];
612
+ /**
613
+ * Create a setting helper with TypeScript autocomplete
614
+ * Automatically infers environment names from object keys
615
+ */
616
+ declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
617
+ getEnvironmentSetting: <K extends string>(key: K) => Promise<CredentialReferenceApiInsert>;
618
+ getEnvironmentSettingKeys: () => string[];
619
+ hasEnvironmentSetting: (key: string) => key is string;
620
+ };
621
+ /**
622
+ * Create type-safe environment configurations with setting registration
623
+ */
624
+ declare function registerEnvironmentSettings<T extends EnvironmentSettingsConfig>(config: T): T;
625
+
626
+ declare class AgentGraph implements GraphInterface {
627
+ private agents;
628
+ private agentMap;
629
+ private defaultAgent?;
630
+ private baseURL;
631
+ private tenantId;
632
+ private projectId;
633
+ private graphId;
634
+ private graphName;
635
+ private graphDescription?;
636
+ private initialized;
637
+ private contextConfig?;
638
+ private credentials?;
639
+ private models?;
640
+ private statusUpdateSettings?;
641
+ private graphPrompt?;
642
+ private stopWhen?;
643
+ private dbClient;
644
+ constructor(config: GraphConfig);
645
+ /**
646
+ * Set or update the configuration (tenantId, projectId and apiUrl)
647
+ * This is used by the CLI to inject configuration from inkeep.config.ts
648
+ */
649
+ setConfig(tenantId: string, projectId: string, apiUrl: string): void;
650
+ /**
651
+ * Convert the AgentGraph to FullGraphDefinition format for the new graph endpoint
652
+ */
653
+ private toFullGraphDefinition;
654
+ /**
655
+ * Initialize all tools in all agents (especially IPCTools that need MCP server URLs)
656
+ */
657
+ private initializeAllTools;
658
+ /**
659
+ * Initialize the graph and all agents in the backend using the new graph endpoint
660
+ */
661
+ init(): Promise<void>;
662
+ /**
663
+ * Legacy initialization method - kept for backward compatibility
664
+ * Initialize the graph and all agents in the backend using individual endpoints
665
+ */
666
+ initLegacy(): Promise<void>;
667
+ /**
668
+ * Generate a response using the default agent
669
+ */
670
+ generate(input: MessageInput, options?: GenerateOptions): Promise<string>;
671
+ /**
672
+ * Stream a response using the default agent
673
+ */
674
+ stream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
675
+ /**
676
+ * Alias for stream() method for consistency with naming patterns
677
+ */
678
+ generateStream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
679
+ /**
680
+ * Run with a specific agent from the graph
681
+ */
682
+ runWith(agentId: string, input: MessageInput, options?: GenerateOptions): Promise<RunResult>;
683
+ /**
684
+ * Get an agent by name (unified method for all agent types)
685
+ */
686
+ getAgent(name: string): AllAgentInterface | undefined;
687
+ /**
688
+ * Add an agent to the graph
689
+ */
690
+ addAgent(agent: AgentInterface): void;
691
+ /**
692
+ * Remove an agent from the graph
693
+ */
694
+ removeAgent(id: string): boolean;
695
+ /**
696
+ * Get all agents in the graph
697
+ */
698
+ getAgents(): AllAgentInterface[];
699
+ /**
700
+ * Get all agent ids (unified method for all agent types)
701
+ */
702
+ getAgentIds(): string[];
703
+ /**
704
+ * Set the default agent
705
+ */
706
+ setDefaultAgent(agent: AgentInterface): void;
707
+ /**
708
+ * Get the default agent
709
+ */
710
+ getDefaultAgent(): AgentInterface | undefined;
711
+ /**
712
+ * Get the graph ID
713
+ */
714
+ getId(): string;
715
+ getName(): string;
716
+ getDescription(): string | undefined;
717
+ getTenantId(): string;
718
+ /**
719
+ * Get the graph's model settingsuration
720
+ */
721
+ getModels(): typeof this.models;
722
+ /**
723
+ * Set the graph's model settingsuration
724
+ */
725
+ setModels(models: typeof this.models): void;
726
+ /**
727
+ * Get the graph's prompt configuration
728
+ */
729
+ getGraphPrompt(): string | undefined;
730
+ /**
731
+ * Get the graph's stopWhen configuration
732
+ */
733
+ getStopWhen(): {
734
+ transferCountIs?: number;
735
+ };
736
+ /**
737
+ * Get the graph's status updates configuration
738
+ */
739
+ getStatusUpdateSettings(): StatusUpdateSettings | undefined;
740
+ /**
741
+ * Get the summarizer model from the graph's model settings
742
+ */
743
+ getSummarizerModel(): ModelSettings | undefined;
744
+ /**
745
+ * Get graph statistics
746
+ */
747
+ getStats(): {
748
+ agentCount: number;
749
+ defaultAgent: string | null;
750
+ initialized: boolean;
751
+ graphId: string;
752
+ tenantId: string;
753
+ };
754
+ /**
755
+ * Validate the graph configuration
756
+ */
757
+ validate(): {
758
+ valid: boolean;
759
+ errors: string[];
760
+ };
761
+ private _init;
762
+ /**
763
+ * Type guard to check if an agent is an internal AgentInterface
764
+ */
765
+ isInternalAgent(agent: AllAgentInterface): agent is AgentInterface;
766
+ /**
767
+ * Get project-level model settingsuration defaults
768
+ */
769
+ private getProjectModelDefaults;
770
+ /**
771
+ * Get project-level stopWhen configuration defaults
772
+ */
773
+ private getProjectStopWhenDefaults;
774
+ /**
775
+ * Apply model inheritance hierarchy: Project -> Graph -> Agent
776
+ */
777
+ private applyModelInheritance;
778
+ /**
779
+ * Apply stopWhen inheritance hierarchy: Project -> Graph -> Agent
780
+ */
781
+ private applyStopWhenInheritance;
782
+ /**
783
+ * Propagate graph-level model settings to agents (supporting partial inheritance)
784
+ */
785
+ private propagateModelSettingsToAgent;
786
+ /**
787
+ * Immediately propagate graph-level models to all agents during construction
788
+ */
789
+ private propagateImmediateModelSettings;
790
+ /**
791
+ * Type guard to check if an agent is an external AgentInterface
792
+ */
793
+ isExternalAgent(agent: AllAgentInterface): agent is ExternalAgentInterface;
794
+ /**
795
+ * Execute agent using the backend system instead of local runner
796
+ */
797
+ private executeWithBackend;
798
+ /**
799
+ * Parse streaming response in SSE format
800
+ */
801
+ private parseStreamingResponse;
802
+ /**
803
+ * Normalize input messages to the expected format
804
+ */
805
+ private normalizeMessages;
806
+ private saveToDatabase;
807
+ private saveRelations;
808
+ private createAgentRelations;
809
+ private createInternalAgentRelation;
810
+ private createExternalAgentRelation;
811
+ /**
812
+ * Create external agents in the database
813
+ */
814
+ private createExternalAgents;
815
+ }
816
+ /**
817
+ * Helper function to create graphs - OpenAI style
818
+ */
819
+ declare function agentGraph(config: GraphConfig): AgentGraph;
820
+ /**
821
+ * Factory function to create graph from configuration file
822
+ */
823
+ declare function generateGraph(configPath: string): Promise<AgentGraph>;
824
+
825
+ declare class Runner {
826
+ /**
827
+ * Run a graph until completion, handling transfers and tool calls
828
+ * Similar to OpenAI's Runner.run() pattern
829
+ * NOTE: This now requires a graph instead of an agent
830
+ */
831
+ static run(graph: GraphInterface, messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
832
+ /**
833
+ * Stream a graph's response
834
+ */
835
+ static stream(graph: GraphInterface, messages: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
836
+ /**
837
+ * Execute multiple graphs in parallel and return the first successful result
838
+ */
839
+ static raceGraphs(graphs: GraphInterface[], messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
840
+ private static normalizeToMessageHistory;
841
+ /**
842
+ * Validate graph configuration before running
843
+ */
844
+ static validateGraph(graph: GraphInterface): {
845
+ valid: boolean;
846
+ errors: string[];
847
+ };
848
+ /**
849
+ * Get execution statistics for a graph
850
+ */
851
+ static getExecutionStats(graph: GraphInterface, messages: MessageInput, options?: GenerateOptions): Promise<{
852
+ estimatedTurns: number;
853
+ estimatedTokens: number;
854
+ agentCount: number;
855
+ defaultAgent: string | undefined;
856
+ }>;
857
+ }
858
+ declare const run: typeof Runner.run;
859
+ declare const stream: typeof Runner.stream;
860
+ declare const raceGraphs: typeof Runner.raceGraphs;
861
+
862
+ export { Agent, type AgentConfig, AgentError, AgentGraph, type AgentInterface, type AgentResponse, type AllAgentInterface, ArtifactComponent, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, DataComponent, ExternalAgent, type ExternalAgentInterface, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, type ModelSettings, ModelSettingsSchema, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StatusComponent, type StatusUpdateSettings, type StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UserMessage, agent, agentGraph, artifactComponent, createEnvironmentSettings, credential, dataComponent, externalAgent, externalAgents, generateGraph, getAllEnvironmentSettingKeys, mcpServer, mcpTool, raceGraphs, registerEnvironmentSettings, run, stream, tool, transfer };