@inkeep/agents-sdk 0.14.16 → 0.16.0
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.cjs +213531 -183
- package/dist/index.d.cts +118 -24
- package/dist/index.d.ts +118 -24
- package/dist/index.js +213505 -184
- package/package.json +7 -2
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 {
|
|
@@ -38,8 +38,7 @@ interface ArtifactComponentInterface {
|
|
|
38
38
|
getId(): ArtifactComponentInsert['id'];
|
|
39
39
|
getName(): ArtifactComponentInsert['name'];
|
|
40
40
|
getDescription(): ArtifactComponentInsert['description'];
|
|
41
|
-
|
|
42
|
-
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
41
|
+
getProps(): ArtifactComponentInsert['props'];
|
|
43
42
|
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
44
43
|
}
|
|
45
44
|
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
@@ -54,8 +53,7 @@ declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
|
54
53
|
getId(): string;
|
|
55
54
|
getName(): string;
|
|
56
55
|
getDescription(): string;
|
|
57
|
-
|
|
58
|
-
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
56
|
+
getProps(): ArtifactComponentInsert['props'];
|
|
59
57
|
init(): Promise<void>;
|
|
60
58
|
private upsertArtifactComponent;
|
|
61
59
|
}
|
|
@@ -88,8 +86,7 @@ interface ComponentConfig {
|
|
|
88
86
|
description: string;
|
|
89
87
|
}
|
|
90
88
|
interface ArtifactComponentConfig extends ComponentConfig {
|
|
91
|
-
|
|
92
|
-
fullProps: Record<string, unknown>;
|
|
89
|
+
props: Record<string, unknown>;
|
|
93
90
|
}
|
|
94
91
|
interface DataComponentConfig extends ComponentConfig {
|
|
95
92
|
props: Record<string, unknown>;
|
|
@@ -203,13 +200,62 @@ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
|
|
|
203
200
|
*/
|
|
204
201
|
declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
|
|
205
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
|
+
|
|
236
|
+
interface ArtifactComponentWithZodProps {
|
|
237
|
+
id: string;
|
|
238
|
+
name: string;
|
|
239
|
+
description: string;
|
|
240
|
+
props?: z.ZodObject<any>;
|
|
241
|
+
}
|
|
242
|
+
interface DataComponentWithZodProps {
|
|
243
|
+
id: string;
|
|
244
|
+
name: string;
|
|
245
|
+
description: string;
|
|
246
|
+
props?: z.ZodObject<any>;
|
|
247
|
+
}
|
|
248
|
+
|
|
206
249
|
/**
|
|
207
250
|
* Tool instance that may have additional metadata attached during agent processing
|
|
208
251
|
*/
|
|
209
|
-
type AgentTool = Tool & {
|
|
252
|
+
type AgentTool = (Tool & {
|
|
210
253
|
selectedTools?: string[];
|
|
211
254
|
headers?: Record<string, string>;
|
|
212
|
-
}
|
|
255
|
+
}) | (FunctionTool & {
|
|
256
|
+
selectedTools?: string[];
|
|
257
|
+
headers?: Record<string, string>;
|
|
258
|
+
});
|
|
213
259
|
interface UserMessage {
|
|
214
260
|
role: 'user';
|
|
215
261
|
content: string;
|
|
@@ -244,7 +290,7 @@ interface ToolResult {
|
|
|
244
290
|
error?: string;
|
|
245
291
|
}
|
|
246
292
|
type AllAgentInterface = AgentInterface | ExternalAgentInterface;
|
|
247
|
-
type AgentCanUseType = Tool | AgentMcpConfig;
|
|
293
|
+
type AgentCanUseType = Tool | AgentMcpConfig | FunctionTool;
|
|
248
294
|
interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
|
|
249
295
|
type?: 'internal';
|
|
250
296
|
canUse?: () => AgentCanUseType[];
|
|
@@ -260,8 +306,8 @@ interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
|
|
|
260
306
|
type: 'conversation' | 'episodic' | 'short_term';
|
|
261
307
|
capacity?: number;
|
|
262
308
|
};
|
|
263
|
-
dataComponents?: () => (DataComponentApiInsert | DataComponentInterface)[];
|
|
264
|
-
artifactComponents?: () => (ArtifactComponentApiInsert | ArtifactComponentInterface)[];
|
|
309
|
+
dataComponents?: () => (DataComponentApiInsert | DataComponentInterface | DataComponentWithZodProps)[];
|
|
310
|
+
artifactComponents?: () => (ArtifactComponentApiInsert | ArtifactComponentInterface | ArtifactComponentWithZodProps)[];
|
|
265
311
|
conversationHistoryConfig?: AgentConversationHistoryConfig;
|
|
266
312
|
}
|
|
267
313
|
interface ToolConfig extends ToolInsert {
|
|
@@ -302,6 +348,7 @@ interface FetchDefinitionConfig {
|
|
|
302
348
|
timeout?: number;
|
|
303
349
|
credential?: CredentialReferenceApiInsert;
|
|
304
350
|
}
|
|
351
|
+
|
|
305
352
|
interface RequestSchemaDefinition {
|
|
306
353
|
body?: z.ZodSchema<any>;
|
|
307
354
|
headers?: z.ZodSchema<any>;
|
|
@@ -470,9 +517,10 @@ declare class Agent implements AgentInterface {
|
|
|
470
517
|
private baseURL;
|
|
471
518
|
private tenantId;
|
|
472
519
|
private projectId;
|
|
520
|
+
private graphId;
|
|
473
521
|
private initialized;
|
|
474
522
|
constructor(config: AgentConfig);
|
|
475
|
-
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
523
|
+
setContext(tenantId: string, projectId: string, graphId: string, baseURL?: string): void;
|
|
476
524
|
getId(): string;
|
|
477
525
|
getName(): string;
|
|
478
526
|
getInstructions(): string;
|
|
@@ -497,6 +545,7 @@ declare class Agent implements AgentInterface {
|
|
|
497
545
|
private saveArtifactComponents;
|
|
498
546
|
private loadDataComponents;
|
|
499
547
|
private loadArtifactComponents;
|
|
548
|
+
private createFunctionTool;
|
|
500
549
|
private createTool;
|
|
501
550
|
private createDataComponent;
|
|
502
551
|
private createArtifactComponent;
|
|
@@ -707,10 +756,12 @@ interface ProjectConfig {
|
|
|
707
756
|
summarizer?: ModelSettings;
|
|
708
757
|
};
|
|
709
758
|
stopWhen?: StopWhen;
|
|
759
|
+
sandboxConfig?: SandboxConfig;
|
|
710
760
|
graphs?: () => AgentGraph[];
|
|
711
761
|
tools?: () => Tool[];
|
|
712
762
|
dataComponents?: () => DataComponent[];
|
|
713
763
|
artifactComponents?: () => ArtifactComponent[];
|
|
764
|
+
credentialReferences?: () => CredentialReferenceApiInsert[];
|
|
714
765
|
}
|
|
715
766
|
/**
|
|
716
767
|
* Project interface for operations
|
|
@@ -774,9 +825,13 @@ declare class Project implements ProjectInterface {
|
|
|
774
825
|
private initialized;
|
|
775
826
|
private models?;
|
|
776
827
|
private stopWhen?;
|
|
828
|
+
private sandboxConfig?;
|
|
777
829
|
private graphs;
|
|
778
830
|
private graphMap;
|
|
779
831
|
private credentialReferences?;
|
|
832
|
+
private projectTools;
|
|
833
|
+
private projectDataComponents;
|
|
834
|
+
private projectArtifactComponents;
|
|
780
835
|
constructor(config: ProjectConfig);
|
|
781
836
|
/**
|
|
782
837
|
* Set or update the configuration (tenantId and apiUrl)
|
|
@@ -1024,15 +1079,14 @@ declare function mcpTool(config: MCPToolConfig$1): Tool;
|
|
|
1024
1079
|
* const productCard = artifactComponent({
|
|
1025
1080
|
* name: 'Product Card',
|
|
1026
1081
|
* description: 'Display product information',
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
* image: 'product.jpg'
|
|
1082
|
+
* props: {
|
|
1083
|
+
* type: 'object',
|
|
1084
|
+
* properties: {
|
|
1085
|
+
* title: { type: 'string', inPreview: true },
|
|
1086
|
+
* price: { type: 'string', inPreview: true },
|
|
1087
|
+
* description: { type: 'string' },
|
|
1088
|
+
* image: { type: 'string' }
|
|
1089
|
+
* }
|
|
1036
1090
|
* }
|
|
1037
1091
|
* });
|
|
1038
1092
|
* ```
|
|
@@ -1062,6 +1116,46 @@ declare function artifactComponent(config: ArtifactComponentConfig): ArtifactCom
|
|
|
1062
1116
|
*/
|
|
1063
1117
|
declare function dataComponent(config: DataComponentConfig): DataComponent;
|
|
1064
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;
|
|
1065
1159
|
|
|
1066
1160
|
/**
|
|
1067
1161
|
* Credential Reference System
|
|
@@ -1188,4 +1282,4 @@ declare const run: typeof Runner.run;
|
|
|
1188
1282
|
declare const stream: typeof Runner.stream;
|
|
1189
1283
|
declare const raceGraphs: typeof Runner.raceGraphs;
|
|
1190
1284
|
|
|
1191
|
-
export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AgentTool, type AllAgentInterface, ArtifactComponent, type ArtifactComponentInterface, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, type CredentialReference, DataComponent, type DataComponentInterface, 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 {
|
|
@@ -38,8 +38,7 @@ interface ArtifactComponentInterface {
|
|
|
38
38
|
getId(): ArtifactComponentInsert['id'];
|
|
39
39
|
getName(): ArtifactComponentInsert['name'];
|
|
40
40
|
getDescription(): ArtifactComponentInsert['description'];
|
|
41
|
-
|
|
42
|
-
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
41
|
+
getProps(): ArtifactComponentInsert['props'];
|
|
43
42
|
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
44
43
|
}
|
|
45
44
|
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
@@ -54,8 +53,7 @@ declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
|
54
53
|
getId(): string;
|
|
55
54
|
getName(): string;
|
|
56
55
|
getDescription(): string;
|
|
57
|
-
|
|
58
|
-
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
56
|
+
getProps(): ArtifactComponentInsert['props'];
|
|
59
57
|
init(): Promise<void>;
|
|
60
58
|
private upsertArtifactComponent;
|
|
61
59
|
}
|
|
@@ -88,8 +86,7 @@ interface ComponentConfig {
|
|
|
88
86
|
description: string;
|
|
89
87
|
}
|
|
90
88
|
interface ArtifactComponentConfig extends ComponentConfig {
|
|
91
|
-
|
|
92
|
-
fullProps: Record<string, unknown>;
|
|
89
|
+
props: Record<string, unknown>;
|
|
93
90
|
}
|
|
94
91
|
interface DataComponentConfig extends ComponentConfig {
|
|
95
92
|
props: Record<string, unknown>;
|
|
@@ -203,13 +200,62 @@ declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
|
|
|
203
200
|
*/
|
|
204
201
|
declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
|
|
205
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
|
+
|
|
236
|
+
interface ArtifactComponentWithZodProps {
|
|
237
|
+
id: string;
|
|
238
|
+
name: string;
|
|
239
|
+
description: string;
|
|
240
|
+
props?: z.ZodObject<any>;
|
|
241
|
+
}
|
|
242
|
+
interface DataComponentWithZodProps {
|
|
243
|
+
id: string;
|
|
244
|
+
name: string;
|
|
245
|
+
description: string;
|
|
246
|
+
props?: z.ZodObject<any>;
|
|
247
|
+
}
|
|
248
|
+
|
|
206
249
|
/**
|
|
207
250
|
* Tool instance that may have additional metadata attached during agent processing
|
|
208
251
|
*/
|
|
209
|
-
type AgentTool = Tool & {
|
|
252
|
+
type AgentTool = (Tool & {
|
|
210
253
|
selectedTools?: string[];
|
|
211
254
|
headers?: Record<string, string>;
|
|
212
|
-
}
|
|
255
|
+
}) | (FunctionTool & {
|
|
256
|
+
selectedTools?: string[];
|
|
257
|
+
headers?: Record<string, string>;
|
|
258
|
+
});
|
|
213
259
|
interface UserMessage {
|
|
214
260
|
role: 'user';
|
|
215
261
|
content: string;
|
|
@@ -244,7 +290,7 @@ interface ToolResult {
|
|
|
244
290
|
error?: string;
|
|
245
291
|
}
|
|
246
292
|
type AllAgentInterface = AgentInterface | ExternalAgentInterface;
|
|
247
|
-
type AgentCanUseType = Tool | AgentMcpConfig;
|
|
293
|
+
type AgentCanUseType = Tool | AgentMcpConfig | FunctionTool;
|
|
248
294
|
interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
|
|
249
295
|
type?: 'internal';
|
|
250
296
|
canUse?: () => AgentCanUseType[];
|
|
@@ -260,8 +306,8 @@ interface AgentConfig extends Omit<AgentApiInsert, 'projectId'> {
|
|
|
260
306
|
type: 'conversation' | 'episodic' | 'short_term';
|
|
261
307
|
capacity?: number;
|
|
262
308
|
};
|
|
263
|
-
dataComponents?: () => (DataComponentApiInsert | DataComponentInterface)[];
|
|
264
|
-
artifactComponents?: () => (ArtifactComponentApiInsert | ArtifactComponentInterface)[];
|
|
309
|
+
dataComponents?: () => (DataComponentApiInsert | DataComponentInterface | DataComponentWithZodProps)[];
|
|
310
|
+
artifactComponents?: () => (ArtifactComponentApiInsert | ArtifactComponentInterface | ArtifactComponentWithZodProps)[];
|
|
265
311
|
conversationHistoryConfig?: AgentConversationHistoryConfig;
|
|
266
312
|
}
|
|
267
313
|
interface ToolConfig extends ToolInsert {
|
|
@@ -302,6 +348,7 @@ interface FetchDefinitionConfig {
|
|
|
302
348
|
timeout?: number;
|
|
303
349
|
credential?: CredentialReferenceApiInsert;
|
|
304
350
|
}
|
|
351
|
+
|
|
305
352
|
interface RequestSchemaDefinition {
|
|
306
353
|
body?: z.ZodSchema<any>;
|
|
307
354
|
headers?: z.ZodSchema<any>;
|
|
@@ -470,9 +517,10 @@ declare class Agent implements AgentInterface {
|
|
|
470
517
|
private baseURL;
|
|
471
518
|
private tenantId;
|
|
472
519
|
private projectId;
|
|
520
|
+
private graphId;
|
|
473
521
|
private initialized;
|
|
474
522
|
constructor(config: AgentConfig);
|
|
475
|
-
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
523
|
+
setContext(tenantId: string, projectId: string, graphId: string, baseURL?: string): void;
|
|
476
524
|
getId(): string;
|
|
477
525
|
getName(): string;
|
|
478
526
|
getInstructions(): string;
|
|
@@ -497,6 +545,7 @@ declare class Agent implements AgentInterface {
|
|
|
497
545
|
private saveArtifactComponents;
|
|
498
546
|
private loadDataComponents;
|
|
499
547
|
private loadArtifactComponents;
|
|
548
|
+
private createFunctionTool;
|
|
500
549
|
private createTool;
|
|
501
550
|
private createDataComponent;
|
|
502
551
|
private createArtifactComponent;
|
|
@@ -707,10 +756,12 @@ interface ProjectConfig {
|
|
|
707
756
|
summarizer?: ModelSettings;
|
|
708
757
|
};
|
|
709
758
|
stopWhen?: StopWhen;
|
|
759
|
+
sandboxConfig?: SandboxConfig;
|
|
710
760
|
graphs?: () => AgentGraph[];
|
|
711
761
|
tools?: () => Tool[];
|
|
712
762
|
dataComponents?: () => DataComponent[];
|
|
713
763
|
artifactComponents?: () => ArtifactComponent[];
|
|
764
|
+
credentialReferences?: () => CredentialReferenceApiInsert[];
|
|
714
765
|
}
|
|
715
766
|
/**
|
|
716
767
|
* Project interface for operations
|
|
@@ -774,9 +825,13 @@ declare class Project implements ProjectInterface {
|
|
|
774
825
|
private initialized;
|
|
775
826
|
private models?;
|
|
776
827
|
private stopWhen?;
|
|
828
|
+
private sandboxConfig?;
|
|
777
829
|
private graphs;
|
|
778
830
|
private graphMap;
|
|
779
831
|
private credentialReferences?;
|
|
832
|
+
private projectTools;
|
|
833
|
+
private projectDataComponents;
|
|
834
|
+
private projectArtifactComponents;
|
|
780
835
|
constructor(config: ProjectConfig);
|
|
781
836
|
/**
|
|
782
837
|
* Set or update the configuration (tenantId and apiUrl)
|
|
@@ -1024,15 +1079,14 @@ declare function mcpTool(config: MCPToolConfig$1): Tool;
|
|
|
1024
1079
|
* const productCard = artifactComponent({
|
|
1025
1080
|
* name: 'Product Card',
|
|
1026
1081
|
* description: 'Display product information',
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
* image: 'product.jpg'
|
|
1082
|
+
* props: {
|
|
1083
|
+
* type: 'object',
|
|
1084
|
+
* properties: {
|
|
1085
|
+
* title: { type: 'string', inPreview: true },
|
|
1086
|
+
* price: { type: 'string', inPreview: true },
|
|
1087
|
+
* description: { type: 'string' },
|
|
1088
|
+
* image: { type: 'string' }
|
|
1089
|
+
* }
|
|
1036
1090
|
* }
|
|
1037
1091
|
* });
|
|
1038
1092
|
* ```
|
|
@@ -1062,6 +1116,46 @@ declare function artifactComponent(config: ArtifactComponentConfig): ArtifactCom
|
|
|
1062
1116
|
*/
|
|
1063
1117
|
declare function dataComponent(config: DataComponentConfig): DataComponent;
|
|
1064
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;
|
|
1065
1159
|
|
|
1066
1160
|
/**
|
|
1067
1161
|
* Credential Reference System
|
|
@@ -1188,4 +1282,4 @@ declare const run: typeof Runner.run;
|
|
|
1188
1282
|
declare const stream: typeof Runner.stream;
|
|
1189
1283
|
declare const raceGraphs: typeof Runner.raceGraphs;
|
|
1190
1284
|
|
|
1191
|
-
export { Agent, type AgentCanUseType, type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AgentTool, type AllAgentInterface, ArtifactComponent, type ArtifactComponentInterface, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, type CredentialReference, DataComponent, type DataComponentInterface, 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 };
|