@inkeep/agents-sdk 0.0.0-dev-20251008200151 → 0.0.0-dev-20251009005405

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,5 +1,5 @@
1
- import { MCPToolConfig as MCPToolConfig$1, ArtifactComponentInsert, CredentialReferenceApiInsert, DataComponentInsert, CredentialReferenceSelect, AgentApiInsert, ModelSettings, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, FullGraphDefinition, ToolInsert, McpTransportConfig, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
2
- export { ModelSettings } from '@inkeep/agents-core';
1
+ import { MCPToolConfig as MCPToolConfig$1, ArtifactComponentInsert, CredentialReferenceApiInsert, DataComponentInsert, CredentialReferenceSelect, FunctionToolConfig, AgentApiInsert, ModelSettings, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, FullGraphDefinition, ToolInsert, McpTransportConfig, StopWhen, SandboxConfig, FullProjectDefinition } from '@inkeep/agents-core';
2
+ export { FunctionToolConfig, ModelSettings, SandboxConfig } from '@inkeep/agents-core';
3
3
  import { z } from 'zod';
4
4
 
5
5
  interface ToolInterface {
@@ -200,6 +200,39 @@ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
200
200
  */
201
201
  declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
202
202
 
203
+ interface FunctionToolInterface {
204
+ config: FunctionToolConfig;
205
+ getId(): string;
206
+ getName(): string;
207
+ getDescription(): string;
208
+ getInputSchema(): Record<string, unknown>;
209
+ getDependencies(): Record<string, string>;
210
+ getExecuteFunction(): (params: any) => Promise<any>;
211
+ }
212
+ declare class FunctionTool implements FunctionToolInterface {
213
+ config: FunctionToolConfig;
214
+ private id;
215
+ constructor(config: FunctionToolConfig);
216
+ getId(): string;
217
+ getName(): string;
218
+ getDescription(): string;
219
+ getInputSchema(): Record<string, unknown>;
220
+ getDependencies(): Record<string, string>;
221
+ getExecuteFunction(): (params: any) => Promise<any>;
222
+ serializeFunction(): {
223
+ id: string;
224
+ inputSchema: Record<string, unknown>;
225
+ executeCode: string;
226
+ dependencies: Record<string, string>;
227
+ };
228
+ serializeTool(): {
229
+ id: string;
230
+ name: string;
231
+ description: string;
232
+ functionId: string;
233
+ };
234
+ }
235
+
203
236
  interface ArtifactComponentWithZodProps {
204
237
  id: string;
205
238
  name: string;
@@ -216,10 +249,13 @@ interface DataComponentWithZodProps {
216
249
  /**
217
250
  * Tool instance that may have additional metadata attached during agent processing
218
251
  */
219
- type AgentTool = Tool & {
252
+ type AgentTool = (Tool & {
220
253
  selectedTools?: string[];
221
254
  headers?: Record<string, string>;
222
- };
255
+ }) | (FunctionTool & {
256
+ selectedTools?: string[];
257
+ headers?: Record<string, string>;
258
+ });
223
259
  interface UserMessage {
224
260
  role: 'user';
225
261
  content: string;
@@ -254,7 +290,7 @@ interface ToolResult {
254
290
  error?: string;
255
291
  }
256
292
  type AllAgentInterface = AgentInterface | ExternalAgentInterface;
257
- type AgentCanUseType = Tool | AgentMcpConfig;
293
+ type AgentCanUseType = Tool | AgentMcpConfig | FunctionTool;
258
294
  interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
259
295
  type?: 'internal';
260
296
  canUse?: () => AgentCanUseType[];
@@ -312,6 +348,7 @@ interface FetchDefinitionConfig {
312
348
  timeout?: number;
313
349
  credential?: CredentialReferenceApiInsert;
314
350
  }
351
+
315
352
  interface RequestSchemaDefinition {
316
353
  body?: z.ZodSchema<any>;
317
354
  headers?: z.ZodSchema<any>;
@@ -480,9 +517,10 @@ declare class Agent implements AgentInterface {
480
517
  private baseURL;
481
518
  private tenantId;
482
519
  private projectId;
520
+ private graphId;
483
521
  private initialized;
484
522
  constructor(config: AgentConfig);
485
- setContext(tenantId: string, projectId: string, baseURL?: string): void;
523
+ setContext(tenantId: string, projectId: string, graphId: string, baseURL?: string): void;
486
524
  getId(): string;
487
525
  getName(): string;
488
526
  getInstructions(): string;
@@ -507,6 +545,7 @@ declare class Agent implements AgentInterface {
507
545
  private saveArtifactComponents;
508
546
  private loadDataComponents;
509
547
  private loadArtifactComponents;
548
+ private createFunctionTool;
510
549
  private createTool;
511
550
  private createDataComponent;
512
551
  private createArtifactComponent;
@@ -717,10 +756,12 @@ interface ProjectConfig {
717
756
  summarizer?: ModelSettings;
718
757
  };
719
758
  stopWhen?: StopWhen;
759
+ sandboxConfig?: SandboxConfig;
720
760
  graphs?: () => AgentGraph[];
721
761
  tools?: () => Tool[];
722
762
  dataComponents?: () => DataComponent[];
723
763
  artifactComponents?: () => ArtifactComponent[];
764
+ credentialReferences?: () => CredentialReferenceApiInsert[];
724
765
  }
725
766
  /**
726
767
  * Project interface for operations
@@ -784,9 +825,13 @@ declare class Project implements ProjectInterface {
784
825
  private initialized;
785
826
  private models?;
786
827
  private stopWhen?;
828
+ private sandboxConfig?;
787
829
  private graphs;
788
830
  private graphMap;
789
831
  private credentialReferences?;
832
+ private projectTools;
833
+ private projectDataComponents;
834
+ private projectArtifactComponents;
790
835
  constructor(config: ProjectConfig);
791
836
  /**
792
837
  * Set or update the configuration (tenantId and apiUrl)
@@ -1071,6 +1116,46 @@ declare function artifactComponent(config: ArtifactComponentConfig): ArtifactCom
1071
1116
  */
1072
1117
  declare function dataComponent(config: DataComponentConfig): DataComponent;
1073
1118
  declare function agentMcp(config: AgentMcpConfig): AgentMcpConfig;
1119
+ /**
1120
+ * Creates a function tool that executes user-defined code in a sandboxed environment.
1121
+ *
1122
+ * Function tools allow users to define custom logic that runs securely in isolated
1123
+ * environments. Dependencies are installed automatically in the sandbox.
1124
+ *
1125
+ * @param config - Function tool configuration
1126
+ * @returns A FunctionTool instance
1127
+ *
1128
+ * @example
1129
+ * ```typescript
1130
+ * const calculatorTool = functionTool({
1131
+ * name: 'calculator',
1132
+ * description: 'Performs basic math operations',
1133
+ * inputSchema: {
1134
+ * type: 'object',
1135
+ * properties: {
1136
+ * operation: { type: 'string', enum: ['add', 'subtract', 'multiply', 'divide'] },
1137
+ * a: { type: 'number' },
1138
+ * b: { type: 'number' }
1139
+ * },
1140
+ * required: ['operation', 'a', 'b']
1141
+ * },
1142
+ * dependencies: {
1143
+ * 'lodash': '^4.17.21'
1144
+ * },
1145
+ * execute: async (params) => {
1146
+ * const { operation, a, b } = params;
1147
+ * switch (operation) {
1148
+ * case 'add': return { result: a + b };
1149
+ * case 'subtract': return { result: a - b };
1150
+ * case 'multiply': return { result: a * b };
1151
+ * case 'divide': return { result: a / b };
1152
+ * default: throw new Error(`Unknown operation: ${operation}`);
1153
+ * }
1154
+ * }
1155
+ * });
1156
+ * ```
1157
+ */
1158
+ declare function functionTool(config: FunctionToolConfig): FunctionTool;
1074
1159
 
1075
1160
  /**
1076
1161
  * Credential Reference System
@@ -1197,4 +1282,4 @@ declare const run: typeof Runner.run;
1197
1282
  declare const stream: typeof Runner.stream;
1198
1283
  declare const raceGraphs: typeof Runner.raceGraphs;
1199
1284
 
1200
- export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AgentTool, type AllAgentInterface, ArtifactComponent, type ArtifactComponentInterface, type ArtifactComponentWithZodProps, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, type CredentialReference, DataComponent, type DataComponentInterface, type DataComponentWithZodProps, ExternalAgent, type ExternalAgentInterface, type ExtractCredentialIds, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UnionCredentialIds, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
1285
+ export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AgentTool, type AllAgentInterface, ArtifactComponent, type ArtifactComponentInterface, type ArtifactComponentWithZodProps, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, type CredentialReference, DataComponent, type DataComponentInterface, type DataComponentWithZodProps, ExternalAgent, type ExternalAgentInterface, type ExtractCredentialIds, type FetchDefinitionConfig, FunctionTool, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UnionCredentialIds, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { MCPToolConfig as MCPToolConfig$1, ArtifactComponentInsert, CredentialReferenceApiInsert, DataComponentInsert, CredentialReferenceSelect, AgentApiInsert, ModelSettings, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, FullGraphDefinition, ToolInsert, McpTransportConfig, StopWhen, FullProjectDefinition } from '@inkeep/agents-core';
2
- export { ModelSettings } from '@inkeep/agents-core';
1
+ import { MCPToolConfig as MCPToolConfig$1, ArtifactComponentInsert, CredentialReferenceApiInsert, DataComponentInsert, CredentialReferenceSelect, FunctionToolConfig, AgentApiInsert, ModelSettings, AgentStopWhen, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, GraphStopWhen, StatusUpdateSettings, FullGraphDefinition, ToolInsert, McpTransportConfig, StopWhen, SandboxConfig, FullProjectDefinition } from '@inkeep/agents-core';
2
+ export { FunctionToolConfig, ModelSettings, SandboxConfig } from '@inkeep/agents-core';
3
3
  import { z } from 'zod';
4
4
 
5
5
  interface ToolInterface {
@@ -200,6 +200,39 @@ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
200
200
  */
201
201
  declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
202
202
 
203
+ interface FunctionToolInterface {
204
+ config: FunctionToolConfig;
205
+ getId(): string;
206
+ getName(): string;
207
+ getDescription(): string;
208
+ getInputSchema(): Record<string, unknown>;
209
+ getDependencies(): Record<string, string>;
210
+ getExecuteFunction(): (params: any) => Promise<any>;
211
+ }
212
+ declare class FunctionTool implements FunctionToolInterface {
213
+ config: FunctionToolConfig;
214
+ private id;
215
+ constructor(config: FunctionToolConfig);
216
+ getId(): string;
217
+ getName(): string;
218
+ getDescription(): string;
219
+ getInputSchema(): Record<string, unknown>;
220
+ getDependencies(): Record<string, string>;
221
+ getExecuteFunction(): (params: any) => Promise<any>;
222
+ serializeFunction(): {
223
+ id: string;
224
+ inputSchema: Record<string, unknown>;
225
+ executeCode: string;
226
+ dependencies: Record<string, string>;
227
+ };
228
+ serializeTool(): {
229
+ id: string;
230
+ name: string;
231
+ description: string;
232
+ functionId: string;
233
+ };
234
+ }
235
+
203
236
  interface ArtifactComponentWithZodProps {
204
237
  id: string;
205
238
  name: string;
@@ -216,10 +249,13 @@ interface DataComponentWithZodProps {
216
249
  /**
217
250
  * Tool instance that may have additional metadata attached during agent processing
218
251
  */
219
- type AgentTool = Tool & {
252
+ type AgentTool = (Tool & {
220
253
  selectedTools?: string[];
221
254
  headers?: Record<string, string>;
222
- };
255
+ }) | (FunctionTool & {
256
+ selectedTools?: string[];
257
+ headers?: Record<string, string>;
258
+ });
223
259
  interface UserMessage {
224
260
  role: 'user';
225
261
  content: string;
@@ -254,7 +290,7 @@ interface ToolResult {
254
290
  error?: string;
255
291
  }
256
292
  type AllAgentInterface = AgentInterface | ExternalAgentInterface;
257
- type AgentCanUseType = Tool | AgentMcpConfig;
293
+ type AgentCanUseType = Tool | AgentMcpConfig | FunctionTool;
258
294
  interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
259
295
  type?: 'internal';
260
296
  canUse?: () => AgentCanUseType[];
@@ -312,6 +348,7 @@ interface FetchDefinitionConfig {
312
348
  timeout?: number;
313
349
  credential?: CredentialReferenceApiInsert;
314
350
  }
351
+
315
352
  interface RequestSchemaDefinition {
316
353
  body?: z.ZodSchema<any>;
317
354
  headers?: z.ZodSchema<any>;
@@ -480,9 +517,10 @@ declare class Agent implements AgentInterface {
480
517
  private baseURL;
481
518
  private tenantId;
482
519
  private projectId;
520
+ private graphId;
483
521
  private initialized;
484
522
  constructor(config: AgentConfig);
485
- setContext(tenantId: string, projectId: string, baseURL?: string): void;
523
+ setContext(tenantId: string, projectId: string, graphId: string, baseURL?: string): void;
486
524
  getId(): string;
487
525
  getName(): string;
488
526
  getInstructions(): string;
@@ -507,6 +545,7 @@ declare class Agent implements AgentInterface {
507
545
  private saveArtifactComponents;
508
546
  private loadDataComponents;
509
547
  private loadArtifactComponents;
548
+ private createFunctionTool;
510
549
  private createTool;
511
550
  private createDataComponent;
512
551
  private createArtifactComponent;
@@ -717,10 +756,12 @@ interface ProjectConfig {
717
756
  summarizer?: ModelSettings;
718
757
  };
719
758
  stopWhen?: StopWhen;
759
+ sandboxConfig?: SandboxConfig;
720
760
  graphs?: () => AgentGraph[];
721
761
  tools?: () => Tool[];
722
762
  dataComponents?: () => DataComponent[];
723
763
  artifactComponents?: () => ArtifactComponent[];
764
+ credentialReferences?: () => CredentialReferenceApiInsert[];
724
765
  }
725
766
  /**
726
767
  * Project interface for operations
@@ -784,9 +825,13 @@ declare class Project implements ProjectInterface {
784
825
  private initialized;
785
826
  private models?;
786
827
  private stopWhen?;
828
+ private sandboxConfig?;
787
829
  private graphs;
788
830
  private graphMap;
789
831
  private credentialReferences?;
832
+ private projectTools;
833
+ private projectDataComponents;
834
+ private projectArtifactComponents;
790
835
  constructor(config: ProjectConfig);
791
836
  /**
792
837
  * Set or update the configuration (tenantId and apiUrl)
@@ -1071,6 +1116,46 @@ declare function artifactComponent(config: ArtifactComponentConfig): ArtifactCom
1071
1116
  */
1072
1117
  declare function dataComponent(config: DataComponentConfig): DataComponent;
1073
1118
  declare function agentMcp(config: AgentMcpConfig): AgentMcpConfig;
1119
+ /**
1120
+ * Creates a function tool that executes user-defined code in a sandboxed environment.
1121
+ *
1122
+ * Function tools allow users to define custom logic that runs securely in isolated
1123
+ * environments. Dependencies are installed automatically in the sandbox.
1124
+ *
1125
+ * @param config - Function tool configuration
1126
+ * @returns A FunctionTool instance
1127
+ *
1128
+ * @example
1129
+ * ```typescript
1130
+ * const calculatorTool = functionTool({
1131
+ * name: 'calculator',
1132
+ * description: 'Performs basic math operations',
1133
+ * inputSchema: {
1134
+ * type: 'object',
1135
+ * properties: {
1136
+ * operation: { type: 'string', enum: ['add', 'subtract', 'multiply', 'divide'] },
1137
+ * a: { type: 'number' },
1138
+ * b: { type: 'number' }
1139
+ * },
1140
+ * required: ['operation', 'a', 'b']
1141
+ * },
1142
+ * dependencies: {
1143
+ * 'lodash': '^4.17.21'
1144
+ * },
1145
+ * execute: async (params) => {
1146
+ * const { operation, a, b } = params;
1147
+ * switch (operation) {
1148
+ * case 'add': return { result: a + b };
1149
+ * case 'subtract': return { result: a - b };
1150
+ * case 'multiply': return { result: a * b };
1151
+ * case 'divide': return { result: a / b };
1152
+ * default: throw new Error(`Unknown operation: ${operation}`);
1153
+ * }
1154
+ * }
1155
+ * });
1156
+ * ```
1157
+ */
1158
+ declare function functionTool(config: FunctionToolConfig): FunctionTool;
1074
1159
 
1075
1160
  /**
1076
1161
  * Credential Reference System
@@ -1197,4 +1282,4 @@ declare const run: typeof Runner.run;
1197
1282
  declare const stream: typeof Runner.stream;
1198
1283
  declare const raceGraphs: typeof Runner.raceGraphs;
1199
1284
 
1200
- export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AgentTool, type AllAgentInterface, ArtifactComponent, type ArtifactComponentInterface, type ArtifactComponentWithZodProps, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, type CredentialReference, DataComponent, type DataComponentInterface, type DataComponentWithZodProps, ExternalAgent, type ExternalAgentInterface, type ExtractCredentialIds, type FetchDefinitionConfig, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UnionCredentialIds, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };
1285
+ export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AgentTool, type AllAgentInterface, ArtifactComponent, type ArtifactComponentInterface, type ArtifactComponentWithZodProps, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, type CredentialReference, DataComponent, type DataComponentInterface, type DataComponentWithZodProps, ExternalAgent, type ExternalAgentInterface, type ExtractCredentialIds, type FetchDefinitionConfig, FunctionTool, type GenerateOptions, type GraphConfig, type GraphInterface, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StreamEvent, type StreamResponse, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UnionCredentialIds, type UserMessage, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceGraphs, registerEnvironmentSettings, run, stream, transfer, updateFullProjectViaAPI };