@inkeep/agents-sdk 0.1.6 → 0.1.7

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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, MCPTransportType, CredentialReferenceSelect, AgentApiInsert, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert } from '@inkeep/agents-core';
1
+ import { MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, MCPTransportType, CredentialReferenceSelect, AgentApiInsert, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, ToolInsert, McpTransportConfig, ArtifactComponentInsert, DataComponentInsert, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
2
2
  import { z } from 'zod';
3
3
 
4
4
  interface ToolInterface {
@@ -97,7 +97,7 @@ type AgentMcpConfig = {
97
97
  declare function transfer(targetAgent: Agent, description?: string, condition?: TransferConditionFunction): TransferConfig;
98
98
 
99
99
  type ExternalAgentConfig = {
100
- type?: "external";
100
+ type?: 'external';
101
101
  tenantId?: string;
102
102
  id: string;
103
103
  name: string;
@@ -149,28 +149,28 @@ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
149
149
  declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
150
150
 
151
151
  interface UserMessage {
152
- role: "user";
152
+ role: 'user';
153
153
  content: string;
154
154
  }
155
155
  interface AssistantMessage {
156
- role: "assistant";
156
+ role: 'assistant';
157
157
  content: string;
158
158
  toolCalls?: ToolCall[];
159
159
  }
160
160
  interface ToolMessage {
161
- role: "tool";
161
+ role: 'tool';
162
162
  content: string;
163
163
  toolCallId: string;
164
164
  }
165
165
  interface SystemMessage {
166
- role: "system";
166
+ role: 'system';
167
167
  content: string;
168
168
  }
169
169
  type Message = UserMessage | AssistantMessage | ToolMessage | SystemMessage;
170
170
  type MessageInput = string | string[] | Message | Message[];
171
171
  interface ToolCall {
172
172
  id: string;
173
- type: "function";
173
+ type: 'function';
174
174
  function: {
175
175
  name: string;
176
176
  arguments: string;
@@ -183,8 +183,8 @@ interface ToolResult {
183
183
  }
184
184
  type AllAgentInterface = AgentInterface | ExternalAgentInterface;
185
185
  type AgentCanUseType = Tool | AgentMcpConfig;
186
- interface AgentConfig extends Omit<AgentApiInsert, "projectId"> {
187
- type?: "internal";
186
+ interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
187
+ type?: 'internal';
188
188
  canUse?: () => AgentCanUseType[];
189
189
  canTransferTo?: () => AgentInterface[];
190
190
  canDelegateTo?: () => AllAgentInterface[];
@@ -195,11 +195,9 @@ interface AgentConfig extends Omit<AgentApiInsert, "projectId"> {
195
195
  structuredOutput?: ModelSettings;
196
196
  summarizer?: ModelSettings;
197
197
  };
198
- stopWhen?: {
199
- stepCountIs?: number;
200
- };
198
+ stopWhen?: AgentStopWhen;
201
199
  memory?: {
202
- type: "conversation" | "episodic" | "short_term";
200
+ type: 'conversation' | 'episodic' | 'short_term';
203
201
  capacity?: number;
204
202
  };
205
203
  dataComponents?: () => DataComponentApiInsert[];
@@ -234,14 +232,14 @@ interface MCPToolConfig {
234
232
  toolName?: string;
235
233
  activeTools?: string[];
236
234
  headers?: Record<string, string>;
237
- mcpType?: "nango" | "generic";
235
+ mcpType?: 'nango' | 'generic';
238
236
  transport?: McpTransportConfig;
239
237
  imageUrl?: string;
240
238
  }
241
239
  interface FetchDefinitionConfig {
242
240
  id: string;
243
241
  name?: string;
244
- trigger: "initialization" | "invocation";
242
+ trigger: 'initialization' | 'invocation';
245
243
  url: string;
246
244
  method?: string;
247
245
  headers?: Record<string, string>;
@@ -260,7 +258,7 @@ interface RequestSchemaDefinition {
260
258
  }
261
259
  interface RequestSchemaConfig {
262
260
  schemas: RequestSchemaDefinition;
263
- optional?: ("body" | "headers" | "query" | "params")[];
261
+ optional?: ('body' | 'headers' | 'query' | 'params')[];
264
262
  }
265
263
  interface TransferConfig {
266
264
  agent: AgentInterface;
@@ -271,7 +269,7 @@ interface GenerateOptions {
271
269
  maxTurns?: number;
272
270
  maxSteps?: number;
273
271
  temperature?: number;
274
- toolChoice?: "auto" | "none" | string;
272
+ toolChoice?: 'auto' | 'none' | string;
275
273
  resourceId?: string;
276
274
  conversationId?: string;
277
275
  stream?: boolean;
@@ -282,7 +280,7 @@ interface AgentResponse {
282
280
  text: string;
283
281
  toolCalls?: ToolCall[];
284
282
  transfer?: TransferConfig;
285
- finishReason: "completed" | "tool_calls" | "transfer" | "max_turns" | "error";
283
+ finishReason: 'completed' | 'tool_calls' | 'transfer' | 'max_turns' | 'error';
286
284
  usage?: {
287
285
  inputTokens: number;
288
286
  outputTokens: number;
@@ -295,7 +293,7 @@ interface StreamResponse {
295
293
  eventStream?: AsyncGenerator<StreamEvent>;
296
294
  }
297
295
  interface StreamEvent {
298
- type: "text" | "tool_call" | "transfer" | "error" | "done";
296
+ type: 'text' | 'tool_call' | 'transfer' | 'error' | 'done';
299
297
  data: any;
300
298
  timestamp: Date;
301
299
  }
@@ -319,7 +317,7 @@ interface StatusComponent {
319
317
  type: string;
320
318
  description?: string;
321
319
  schema: {
322
- type: "object";
320
+ type: 'object';
323
321
  properties: Record<string, any>;
324
322
  required?: string[];
325
323
  };
@@ -341,9 +339,7 @@ interface GraphConfig {
341
339
  tenantId?: string;
342
340
  contextConfig?: any;
343
341
  credentials?: () => CredentialReferenceApiInsert[];
344
- stopWhen?: {
345
- transferCountIs?: number;
346
- };
342
+ stopWhen?: GraphStopWhen;
347
343
  graphPrompt?: string;
348
344
  models?: {
349
345
  base?: ModelSettings;
@@ -368,7 +364,7 @@ declare class TransferError extends AgentError {
368
364
  }
369
365
  interface AgentInterface {
370
366
  config: AgentConfig;
371
- type: "internal";
367
+ type: 'internal';
372
368
  init(): Promise<void>;
373
369
  getId(): string;
374
370
  getName(): string;
@@ -384,7 +380,7 @@ interface AgentInterface {
384
380
  }
385
381
  interface ExternalAgentInterface {
386
382
  config: ExternalAgentConfig;
387
- type: "external";
383
+ type: 'external';
388
384
  init(): Promise<void>;
389
385
  getId(): string;
390
386
  getName(): string;
@@ -411,7 +407,7 @@ interface BuilderToolConfig {
411
407
  name: string;
412
408
  description: string;
413
409
  config: {
414
- type: "mcp";
410
+ type: 'mcp';
415
411
  mcp: {
416
412
  server: {
417
413
  url: string;
@@ -422,7 +418,7 @@ interface BuilderToolConfig {
422
418
  }
423
419
  interface BuilderRelationConfig {
424
420
  targetAgent: string;
425
- relationType: "transfer" | "delegate";
421
+ relationType: 'transfer' | 'delegate';
426
422
  }
427
423
  interface BuilderAgentConfig {
428
424
  name: string;
@@ -469,13 +465,13 @@ declare class Agent implements AgentInterface {
469
465
  }
470
466
 
471
467
  interface ArtifactComponentInterface {
472
- config: Omit<ArtifactComponentInsert, "id">;
468
+ config: Omit<ArtifactComponentInsert, 'id'>;
473
469
  init(): Promise<void>;
474
- getId(): ArtifactComponentInsert["id"];
475
- getName(): ArtifactComponentInsert["name"];
476
- getDescription(): ArtifactComponentInsert["description"];
477
- getSummaryProps(): ArtifactComponentInsert["summaryProps"];
478
- getFullProps(): ArtifactComponentInsert["fullProps"];
470
+ getId(): ArtifactComponentInsert['id'];
471
+ getName(): ArtifactComponentInsert['name'];
472
+ getDescription(): ArtifactComponentInsert['description'];
473
+ getSummaryProps(): ArtifactComponentInsert['summaryProps'];
474
+ getFullProps(): ArtifactComponentInsert['fullProps'];
479
475
  }
480
476
  declare class ArtifactComponent implements ArtifactComponentInterface {
481
477
  config: ArtifactComponentInsert;
@@ -484,23 +480,23 @@ declare class ArtifactComponent implements ArtifactComponentInterface {
484
480
  private projectId;
485
481
  private initialized;
486
482
  private id;
487
- constructor(config: Omit<ArtifactComponentInsert, "id">);
483
+ constructor(config: Omit<ArtifactComponentInsert, 'id'>);
488
484
  getId(): string;
489
485
  getName(): string;
490
486
  getDescription(): string;
491
- getSummaryProps(): ArtifactComponentInsert["summaryProps"];
492
- getFullProps(): ArtifactComponentInsert["fullProps"];
487
+ getSummaryProps(): ArtifactComponentInsert['summaryProps'];
488
+ getFullProps(): ArtifactComponentInsert['fullProps'];
493
489
  init(): Promise<void>;
494
490
  private upsertArtifactComponent;
495
491
  }
496
492
 
497
493
  interface DataComponentInterface {
498
- config: Omit<DataComponentInsert, "id">;
494
+ config: Omit<DataComponentInsert, 'id'>;
499
495
  init(): Promise<void>;
500
- getId(): DataComponentInsert["id"];
501
- getName(): DataComponentInsert["name"];
502
- getDescription(): DataComponentInsert["description"];
503
- getProps(): DataComponentInsert["props"];
496
+ getId(): DataComponentInsert['id'];
497
+ getName(): DataComponentInsert['name'];
498
+ getDescription(): DataComponentInsert['description'];
499
+ getProps(): DataComponentInsert['props'];
504
500
  }
505
501
  declare class DataComponent implements DataComponentInterface {
506
502
  config: DataComponentInsert;
@@ -509,11 +505,11 @@ declare class DataComponent implements DataComponentInterface {
509
505
  private projectId;
510
506
  private initialized;
511
507
  private id;
512
- constructor(config: Omit<DataComponentInsert, "id">);
508
+ constructor(config: Omit<DataComponentInsert, 'id'>);
513
509
  getId(): string;
514
510
  getName(): string;
515
511
  getDescription(): string;
516
- getProps(): DataComponentInsert["props"];
512
+ getProps(): DataComponentInsert['props'];
517
513
  init(): Promise<void>;
518
514
  private upsertDataComponent;
519
515
  }
@@ -625,9 +621,7 @@ declare class AgentGraph implements GraphInterface {
625
621
  /**
626
622
  * Get the graph's stopWhen configuration
627
623
  */
628
- getStopWhen(): {
629
- transferCountIs?: number;
630
- };
624
+ getStopWhen(): GraphStopWhen;
631
625
  /**
632
626
  * Get the graph's status updates configuration
633
627
  */
@@ -709,10 +703,206 @@ declare class AgentGraph implements GraphInterface {
709
703
  private createExternalAgents;
710
704
  }
711
705
 
706
+ /**
707
+ * Project configuration interface for the SDK
708
+ */
709
+ interface ProjectConfig {
710
+ id: string;
711
+ name: string;
712
+ description?: string;
713
+ tenantId?: string;
714
+ models?: {
715
+ base?: ModelSettings;
716
+ structuredOutput?: ModelSettings;
717
+ summarizer?: ModelSettings;
718
+ };
719
+ stopWhen?: StopWhen;
720
+ graphs?: () => AgentGraph[];
721
+ }
722
+ /**
723
+ * Project interface for operations
724
+ */
725
+ interface ProjectInterface {
726
+ init(): Promise<void>;
727
+ setConfig(tenantId: string, apiUrl: string): void;
728
+ getId(): string;
729
+ getName(): string;
730
+ getDescription(): string | undefined;
731
+ getTenantId(): string;
732
+ getModels(): ProjectConfig['models'];
733
+ getStopWhen(): ProjectConfig['stopWhen'];
734
+ getGraphs(): AgentGraph[];
735
+ addGraph(graph: AgentGraph): void;
736
+ removeGraph(id: string): boolean;
737
+ getStats(): {
738
+ projectId: string;
739
+ tenantId: string;
740
+ graphCount: number;
741
+ initialized: boolean;
742
+ };
743
+ validate(): {
744
+ valid: boolean;
745
+ errors: string[];
746
+ };
747
+ }
748
+ /**
749
+ * Project class for managing agent projects
750
+ *
751
+ * Projects are the top-level organizational unit that contains graphs, agents, and shared configurations.
752
+ * They provide model inheritance and execution limits that cascade down to graphs and agents.
753
+ *
754
+ * @example
755
+ * ```typescript
756
+ * const myProject = new Project({
757
+ * id: 'customer-support-project',
758
+ * name: 'Customer Support System',
759
+ * description: 'Multi-agent customer support system',
760
+ * models: {
761
+ * base: { model: 'gpt-4o-mini' },
762
+ * structuredOutput: { model: 'gpt-4o' }
763
+ * },
764
+ * stopWhen: {
765
+ * transferCountIs: 10,
766
+ * stepCountIs: 50
767
+ * }
768
+ * });
769
+ *
770
+ * await myProject.init();
771
+ * ```
772
+ */
773
+ declare class Project implements ProjectInterface {
774
+ private projectId;
775
+ private projectName;
776
+ private projectDescription?;
777
+ private tenantId;
778
+ private baseURL;
779
+ private initialized;
780
+ private models?;
781
+ private stopWhen?;
782
+ private graphs;
783
+ private graphMap;
784
+ constructor(config: ProjectConfig);
785
+ /**
786
+ * Set or update the configuration (tenantId and apiUrl)
787
+ * This is used by the CLI to inject configuration from inkeep.config.ts
788
+ */
789
+ setConfig(tenantId: string, apiUrl: string): void;
790
+ /**
791
+ * Initialize the project and create/update it in the backend using full project approach
792
+ */
793
+ init(): Promise<void>;
794
+ /**
795
+ * Get the project ID
796
+ */
797
+ getId(): string;
798
+ /**
799
+ * Get the project name
800
+ */
801
+ getName(): string;
802
+ /**
803
+ * Get the project description
804
+ */
805
+ getDescription(): string | undefined;
806
+ /**
807
+ * Get the tenant ID
808
+ */
809
+ getTenantId(): string;
810
+ /**
811
+ * Get the project's model configuration
812
+ */
813
+ getModels(): ProjectConfig['models'];
814
+ /**
815
+ * Set the project's model configuration
816
+ */
817
+ setModels(models: ProjectConfig['models']): void;
818
+ /**
819
+ * Get the project's stopWhen configuration
820
+ */
821
+ getStopWhen(): ProjectConfig['stopWhen'];
822
+ /**
823
+ * Set the project's stopWhen configuration
824
+ */
825
+ setStopWhen(stopWhen: ProjectConfig['stopWhen']): void;
826
+ /**
827
+ * Get all graphs in the project
828
+ */
829
+ getGraphs(): AgentGraph[];
830
+ /**
831
+ * Get a graph by ID
832
+ */
833
+ getGraph(id: string): AgentGraph | undefined;
834
+ /**
835
+ * Add a graph to the project
836
+ */
837
+ addGraph(graph: AgentGraph): void;
838
+ /**
839
+ * Remove a graph from the project
840
+ */
841
+ removeGraph(id: string): boolean;
842
+ /**
843
+ * Get project statistics
844
+ */
845
+ getStats(): {
846
+ projectId: string;
847
+ tenantId: string;
848
+ graphCount: number;
849
+ initialized: boolean;
850
+ };
851
+ /**
852
+ * Validate the project configuration
853
+ */
854
+ validate(): {
855
+ valid: boolean;
856
+ errors: string[];
857
+ };
858
+ /**
859
+ * Convert the Project to FullProjectDefinition format
860
+ */
861
+ private toFullProjectDefinition;
862
+ /**
863
+ * Convert project configuration to API format
864
+ */
865
+ private toApiFormat;
866
+ }
867
+
712
868
  /**
713
869
  * Helper function to create graphs - OpenAI style
714
870
  */
715
871
  declare function agentGraph(config: GraphConfig): AgentGraph;
872
+ /**
873
+ * Helper function to create projects - OpenAI style
874
+ *
875
+ * Projects are the top-level organizational unit that contains graphs, agents, and shared configurations.
876
+ * They provide model inheritance and execution limits that cascade down to graphs and agents.
877
+ *
878
+ * @param config - Project configuration
879
+ * @returns A new Project instance
880
+ *
881
+ * @example
882
+ * ```typescript
883
+ * const customerSupport = project({
884
+ * id: 'customer-support-project',
885
+ * name: 'Customer Support System',
886
+ * description: 'Multi-agent customer support system',
887
+ * models: {
888
+ * base: { model: 'gpt-4o-mini' },
889
+ * structuredOutput: { model: 'gpt-4o' }
890
+ * },
891
+ * stopWhen: {
892
+ * transferCountIs: 10,
893
+ * stepCountIs: 50
894
+ * },
895
+ * graphs: () => [
896
+ * agentGraph({
897
+ * id: 'support-graph',
898
+ * name: 'Support Graph',
899
+ * // ... graph config
900
+ * })
901
+ * ]
902
+ * });
903
+ * ```
904
+ */
905
+ declare function project(config: ProjectConfig): Project;
716
906
  /**
717
907
  * Creates a new agent with stable ID enforcement.
718
908
  *
@@ -879,6 +1069,28 @@ declare function createEnvironmentSettings<T extends Record<string, EnvironmentS
879
1069
  */
880
1070
  declare function registerEnvironmentSettings<T extends EnvironmentSettingsConfig>(config: T): T;
881
1071
 
1072
+ /**
1073
+ * Client-side functions for interacting with the Full Project API
1074
+ * These functions make HTTP requests to the server instead of direct database calls
1075
+ */
1076
+
1077
+ /**
1078
+ * Create a full project via HTTP API
1079
+ */
1080
+ declare function createFullProjectViaAPI(tenantId: string, apiUrl: string, projectData: FullProjectDefinition): Promise<FullProjectDefinition>;
1081
+ /**
1082
+ * Update a full project via HTTP API (upsert behavior)
1083
+ */
1084
+ declare function updateFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string, projectData: FullProjectDefinition): Promise<FullProjectDefinition>;
1085
+ /**
1086
+ * Get a full project via HTTP API
1087
+ */
1088
+ declare function getFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string): Promise<FullProjectDefinition | null>;
1089
+ /**
1090
+ * Delete a full project via HTTP API
1091
+ */
1092
+ declare function deleteFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string): Promise<void>;
1093
+
882
1094
  declare class Runner {
883
1095
  /**
884
1096
  * Run a graph until completion, handling transfers and tool calls
@@ -916,4 +1128,4 @@ declare const run: typeof Runner.run;
916
1128
  declare const stream: typeof Runner.stream;
917
1129
  declare const raceGraphs: typeof Runner.raceGraphs;
918
1130
 
919
- export { Agent, type AgentCanUseType, type AgentConfig, AgentError, 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, agentMcp, artifactComponent, createEnvironmentSettings, credential, dataComponent, externalAgent, externalAgents, mcpServer, mcpTool, raceGraphs, registerEnvironmentSettings, run, stream, transfer };
1131
+ export { Agent, type AgentCanUseType, type AgentConfig, AgentError, 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, Project, 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, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };