@inkeep/agents-sdk 0.0.0-chat-to-edit-20251119071712
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/LICENSE.md +56 -0
- package/README.md +53 -0
- package/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/index.cjs +5070 -0
- package/dist/index.d.cts +1457 -0
- package/dist/index.d.ts +1457 -0
- package/dist/index.js +4970 -0
- package/package.json +72 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1457 @@
|
|
|
1
|
+
import { ArtifactComponentInsert, MCPToolConfig as MCPToolConfig$1, DataComponentApiInsert, ArtifactComponentApiInsert, McpToolSelection, ToolPolicy, CredentialReferenceApiInsert, DataComponentInsert, FunctionToolConfig, SubAgentApiInsert, FullAgentDefinition, AgentConversationHistoryConfig, AgentStopWhen, ModelSettings, StatusUpdateSettings, ToolInsert, McpTransportConfig, StopWhen, FullProjectDefinition, StatusComponent as StatusComponent$1 } from '@inkeep/agents-core';
|
|
2
|
+
export { ANTHROPIC_MODELS, FunctionToolConfig, GOOGLE_MODELS, ModelSettings, OPENAI_MODELS } from '@inkeep/agents-core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
type ArtifactComponentConfigWithZod = Omit<ArtifactComponentInsert, 'tenantId' | 'projectId' | 'props'> & {
|
|
6
|
+
props?: Record<string, unknown> | z.ZodObject<any> | null;
|
|
7
|
+
};
|
|
8
|
+
interface ArtifactComponentInterface {
|
|
9
|
+
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
10
|
+
init(): Promise<void>;
|
|
11
|
+
getId(): ArtifactComponentInsert['id'];
|
|
12
|
+
getName(): ArtifactComponentInsert['name'];
|
|
13
|
+
getDescription(): ArtifactComponentInsert['description'];
|
|
14
|
+
getProps(): ArtifactComponentInsert['props'];
|
|
15
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
16
|
+
}
|
|
17
|
+
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
18
|
+
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
19
|
+
private baseURL;
|
|
20
|
+
private tenantId;
|
|
21
|
+
private projectId;
|
|
22
|
+
private initialized;
|
|
23
|
+
private id;
|
|
24
|
+
constructor(config: ArtifactComponentConfigWithZod);
|
|
25
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
26
|
+
getId(): string;
|
|
27
|
+
getName(): string;
|
|
28
|
+
getDescription(): string;
|
|
29
|
+
getProps(): ArtifactComponentInsert['props'];
|
|
30
|
+
init(): Promise<void>;
|
|
31
|
+
private upsertArtifactComponent;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface ToolInterface {
|
|
35
|
+
config: MCPToolConfig$1;
|
|
36
|
+
init(): Promise<void>;
|
|
37
|
+
getId(): string;
|
|
38
|
+
getName(): string;
|
|
39
|
+
getDescription(): string;
|
|
40
|
+
getServerUrl(): string;
|
|
41
|
+
getActiveTools(): string[] | undefined;
|
|
42
|
+
getCredentialReferenceId(): string | null | undefined;
|
|
43
|
+
with(config: AgentMcpConfigInput): AgentMcpConfig;
|
|
44
|
+
}
|
|
45
|
+
declare class Tool implements ToolInterface {
|
|
46
|
+
config: MCPToolConfig$1;
|
|
47
|
+
private baseURL;
|
|
48
|
+
private tenantId;
|
|
49
|
+
private initialized;
|
|
50
|
+
private projectId;
|
|
51
|
+
constructor(config: Omit<MCPToolConfig$1, 'tenantId' | 'projectId'>);
|
|
52
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
53
|
+
getId(): string;
|
|
54
|
+
getName(): string;
|
|
55
|
+
getDescription(): string;
|
|
56
|
+
getServerUrl(): string;
|
|
57
|
+
getActiveTools(): string[] | undefined;
|
|
58
|
+
getCredentialReferenceId(): string | null | undefined;
|
|
59
|
+
init(options?: {
|
|
60
|
+
skipDatabaseRegistration?: boolean;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
private upsertTool;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new AgentMcpConfig with the given configuration.
|
|
65
|
+
*
|
|
66
|
+
* @param config - The configuration for the AgentMcpConfig
|
|
67
|
+
* @returns A new AgentMcpConfig
|
|
68
|
+
*
|
|
69
|
+
* example:
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const tool = new Tool({
|
|
72
|
+
* id: 'tool-id',
|
|
73
|
+
* name: 'Tool Name',
|
|
74
|
+
* serverUrl: 'https://example.com/mcp',
|
|
75
|
+
* });
|
|
76
|
+
* const agentMcpConfig = tool.with({ selectedTools: ['tool-1', 'tool-2'], headers: { 'Authorization': 'Bearer token' } });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
with(config: AgentMcpConfigInput): AgentMcpConfig;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare class SubAgent implements SubAgentInterface {
|
|
83
|
+
config: SubAgentConfig;
|
|
84
|
+
readonly type: "internal";
|
|
85
|
+
private baseURL;
|
|
86
|
+
private tenantId;
|
|
87
|
+
private projectId;
|
|
88
|
+
private initialized;
|
|
89
|
+
constructor(config: SubAgentConfig);
|
|
90
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
91
|
+
getId(): string;
|
|
92
|
+
getName(): string;
|
|
93
|
+
getInstructions(): string;
|
|
94
|
+
/**
|
|
95
|
+
* Get the agent's description (the human-readable description field)
|
|
96
|
+
*/
|
|
97
|
+
getDescription(): string;
|
|
98
|
+
getTools(): Record<string, AgentTool>;
|
|
99
|
+
getModels(): typeof this$1.config.models;
|
|
100
|
+
setModels(models: typeof this$1.config.models): void;
|
|
101
|
+
getTransfers(): SubAgentInterface[];
|
|
102
|
+
getSubAgentDelegates(): SubAgentInterface[];
|
|
103
|
+
getExternalAgentDelegates(): subAgentExternalAgentInterface[];
|
|
104
|
+
getTeamAgentDelegates(): subAgentTeamAgentInterface[];
|
|
105
|
+
getDelegates(): AllDelegateOutputInterface[];
|
|
106
|
+
getDataComponents(): DataComponentApiInsert[];
|
|
107
|
+
getArtifactComponents(): ArtifactComponentApiInsert[];
|
|
108
|
+
addTool(_name: string, tool: Tool): void;
|
|
109
|
+
addTransfer(...agents: SubAgentInterface[]): void;
|
|
110
|
+
addDelegate(...agents: AllDelegateInputInterface[]): void;
|
|
111
|
+
init(): Promise<void>;
|
|
112
|
+
private upsertAgent;
|
|
113
|
+
private saveToolsAndRelations;
|
|
114
|
+
private saveDataComponents;
|
|
115
|
+
private saveArtifactComponents;
|
|
116
|
+
private loadDataComponents;
|
|
117
|
+
private loadArtifactComponents;
|
|
118
|
+
private createFunctionTool;
|
|
119
|
+
private createTool;
|
|
120
|
+
private createDataComponent;
|
|
121
|
+
private createArtifactComponent;
|
|
122
|
+
private createAgentDataComponentRelation;
|
|
123
|
+
private createAgentArtifactComponentRelation;
|
|
124
|
+
private createAgentToolRelation;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Function signature for transfer conditions
|
|
129
|
+
*/
|
|
130
|
+
type TransferConditionFunction = (context: unknown) => boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Configuration for MCP server builders
|
|
133
|
+
*/
|
|
134
|
+
interface MCPServerConfig {
|
|
135
|
+
name: string;
|
|
136
|
+
description: string;
|
|
137
|
+
serverUrl: string;
|
|
138
|
+
id?: string;
|
|
139
|
+
parameters?: Record<string, z.ZodJSONSchema>;
|
|
140
|
+
credential?: CredentialReferenceApiInsert;
|
|
141
|
+
transport?: 'streamable_http' | 'sse';
|
|
142
|
+
activeTools?: string[];
|
|
143
|
+
headers?: Record<string, string>;
|
|
144
|
+
imageUrl?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Configuration for component builders
|
|
148
|
+
*/
|
|
149
|
+
interface ComponentConfig {
|
|
150
|
+
id?: string;
|
|
151
|
+
name: string;
|
|
152
|
+
description: string;
|
|
153
|
+
}
|
|
154
|
+
interface ArtifactComponentConfig extends ComponentConfig {
|
|
155
|
+
props: Record<string, unknown> | z.ZodObject<any>;
|
|
156
|
+
}
|
|
157
|
+
interface DataComponentConfig extends ComponentConfig {
|
|
158
|
+
props: Record<string, unknown> | z.ZodObject<any>;
|
|
159
|
+
render?: {
|
|
160
|
+
component: string;
|
|
161
|
+
mockData: Record<string, unknown>;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
interface StatusComponentConfig {
|
|
165
|
+
type: string;
|
|
166
|
+
description?: string;
|
|
167
|
+
detailsSchema?: Record<string, unknown> | z.ZodObject<any>;
|
|
168
|
+
}
|
|
169
|
+
type AgentMcpConfig = {
|
|
170
|
+
server: Tool;
|
|
171
|
+
selectedTools?: string[];
|
|
172
|
+
headers?: Record<string, string>;
|
|
173
|
+
toolPolicies?: Record<string, ToolPolicy>;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Input configuration for MCP tool customization
|
|
177
|
+
* Supports flexible tool selection with per-tool policies
|
|
178
|
+
*/
|
|
179
|
+
type AgentMcpConfigInput = {
|
|
180
|
+
/** Tools to enable from the MCP server - can be strings or objects with policies */
|
|
181
|
+
selectedTools?: McpToolSelection[];
|
|
182
|
+
/** Custom headers for MCP server requests */
|
|
183
|
+
headers?: Record<string, string>;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Creates a transfer configuration for agent transfers.
|
|
187
|
+
*
|
|
188
|
+
* Transfers allow one agent to hand off control to another agent
|
|
189
|
+
* based on optional conditions.
|
|
190
|
+
*
|
|
191
|
+
* @param targetAgent - The agent to transfer to
|
|
192
|
+
* @param description - Optional description of when/why to transfer
|
|
193
|
+
* @param condition - Optional function to determine if transfer should occur
|
|
194
|
+
* @returns A validated transfer configuration
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* // Simple transfer
|
|
199
|
+
* const transfer = transfer(supportAgent, 'Transfer to support');
|
|
200
|
+
*
|
|
201
|
+
* // Conditional transfer
|
|
202
|
+
* const conditionalHandoff = transfer(
|
|
203
|
+
* specialistAgent,
|
|
204
|
+
* 'Transfer to specialist for complex issues',
|
|
205
|
+
* (context) => context.complexity > 0.8
|
|
206
|
+
* );
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
declare function transfer(targetAgent: SubAgent, description?: string, condition?: TransferConditionFunction): TransferConfig;
|
|
210
|
+
|
|
211
|
+
type DataComponentConfigWithZod = Omit<DataComponentInsert, 'tenantId' | 'projectId' | 'props' | 'render'> & {
|
|
212
|
+
props?: Record<string, unknown> | z.ZodObject<any> | null;
|
|
213
|
+
render?: {
|
|
214
|
+
component: string;
|
|
215
|
+
mockData: Record<string, unknown>;
|
|
216
|
+
} | null;
|
|
217
|
+
};
|
|
218
|
+
interface DataComponentInterface {
|
|
219
|
+
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
220
|
+
init(): Promise<void>;
|
|
221
|
+
getId(): DataComponentInsert['id'];
|
|
222
|
+
getName(): DataComponentInsert['name'];
|
|
223
|
+
getDescription(): DataComponentInsert['description'];
|
|
224
|
+
getProps(): DataComponentInsert['props'];
|
|
225
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
226
|
+
}
|
|
227
|
+
declare class DataComponent implements DataComponentInterface {
|
|
228
|
+
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
229
|
+
private baseURL;
|
|
230
|
+
private tenantId;
|
|
231
|
+
private projectId;
|
|
232
|
+
private initialized;
|
|
233
|
+
private id;
|
|
234
|
+
constructor(config: DataComponentConfigWithZod);
|
|
235
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
236
|
+
getId(): string;
|
|
237
|
+
getName(): string;
|
|
238
|
+
getDescription(): string;
|
|
239
|
+
getProps(): DataComponentInsert['props'];
|
|
240
|
+
getRender(): DataComponentInsert['render'];
|
|
241
|
+
init(): Promise<void>;
|
|
242
|
+
private upsertDataComponent;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
type ExternalAgentConfig = {
|
|
246
|
+
type?: 'external';
|
|
247
|
+
id: string;
|
|
248
|
+
name: string;
|
|
249
|
+
description: string;
|
|
250
|
+
baseUrl: string;
|
|
251
|
+
credentialReference?: CredentialReferenceApiInsert;
|
|
252
|
+
};
|
|
253
|
+
declare class ExternalAgent implements ExternalAgentInterface {
|
|
254
|
+
config: ExternalAgentConfig;
|
|
255
|
+
readonly type: "external";
|
|
256
|
+
private initialized;
|
|
257
|
+
private tenantId;
|
|
258
|
+
private projectId;
|
|
259
|
+
private baseURL;
|
|
260
|
+
constructor(config: ExternalAgentConfig);
|
|
261
|
+
/**
|
|
262
|
+
* Initialize the external agent by upserting it in the database
|
|
263
|
+
*/
|
|
264
|
+
init(): Promise<void>;
|
|
265
|
+
setContext(tenantId: string, projectId: string): void;
|
|
266
|
+
getId(): string;
|
|
267
|
+
with(options: {
|
|
268
|
+
headers?: Record<string, string>;
|
|
269
|
+
}): subAgentExternalAgentInterface;
|
|
270
|
+
private upsertExternalAgent;
|
|
271
|
+
/**
|
|
272
|
+
* Get the external agent configuration
|
|
273
|
+
*/
|
|
274
|
+
getConfig(): ExternalAgentConfig;
|
|
275
|
+
/**
|
|
276
|
+
* Get the external agent name
|
|
277
|
+
*/
|
|
278
|
+
getName(): string;
|
|
279
|
+
/**
|
|
280
|
+
* Get the external agent base URL
|
|
281
|
+
*/
|
|
282
|
+
getBaseUrl(): string;
|
|
283
|
+
/**
|
|
284
|
+
* Get the tenant ID
|
|
285
|
+
*/
|
|
286
|
+
getTenantId(): string;
|
|
287
|
+
getDescription(): string;
|
|
288
|
+
getCredentialReferenceId(): string | undefined;
|
|
289
|
+
getCredentialReference(): CredentialReferenceApiInsert | undefined;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Factory function to create external agents - follows the same pattern as agent()
|
|
293
|
+
*/
|
|
294
|
+
declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
|
|
295
|
+
/**
|
|
296
|
+
* Helper function to create multiple external agents
|
|
297
|
+
*/
|
|
298
|
+
declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
|
|
299
|
+
|
|
300
|
+
interface FunctionToolInterface {
|
|
301
|
+
config: FunctionToolConfig;
|
|
302
|
+
getId(): string;
|
|
303
|
+
getName(): string;
|
|
304
|
+
getDescription(): string;
|
|
305
|
+
getInputSchema(): Record<string, unknown>;
|
|
306
|
+
getDependencies(): Record<string, string>;
|
|
307
|
+
getExecuteFunction(): (params: any) => Promise<any>;
|
|
308
|
+
}
|
|
309
|
+
declare class FunctionTool implements FunctionToolInterface {
|
|
310
|
+
config: FunctionToolConfig;
|
|
311
|
+
private id;
|
|
312
|
+
constructor(config: FunctionToolConfig);
|
|
313
|
+
getId(): string;
|
|
314
|
+
getName(): string;
|
|
315
|
+
getDescription(): string;
|
|
316
|
+
getInputSchema(): Record<string, unknown>;
|
|
317
|
+
getDependencies(): Record<string, string>;
|
|
318
|
+
getExecuteFunction(): (params: any) => Promise<any>;
|
|
319
|
+
serializeFunction(): {
|
|
320
|
+
id: string;
|
|
321
|
+
inputSchema: Record<string, unknown>;
|
|
322
|
+
executeCode: string;
|
|
323
|
+
dependencies: Record<string, string>;
|
|
324
|
+
};
|
|
325
|
+
serializeTool(): {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
description: string;
|
|
329
|
+
functionId: string;
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
interface ArtifactComponentWithZodProps {
|
|
334
|
+
id: string;
|
|
335
|
+
name: string;
|
|
336
|
+
description: string;
|
|
337
|
+
props?: z.ZodObject<any>;
|
|
338
|
+
}
|
|
339
|
+
interface DataComponentWithZodProps {
|
|
340
|
+
id: string;
|
|
341
|
+
name: string;
|
|
342
|
+
description: string;
|
|
343
|
+
props?: z.ZodObject<any>;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Tool instance that may have additional metadata attached during agent processing
|
|
348
|
+
*/
|
|
349
|
+
type AgentTool = (Tool & {
|
|
350
|
+
selectedTools?: string[];
|
|
351
|
+
headers?: Record<string, string>;
|
|
352
|
+
toolPolicies?: Record<string, ToolPolicy>;
|
|
353
|
+
}) | (FunctionTool & {
|
|
354
|
+
selectedTools?: string[];
|
|
355
|
+
headers?: Record<string, string>;
|
|
356
|
+
toolPolicies?: Record<string, ToolPolicy>;
|
|
357
|
+
});
|
|
358
|
+
interface UserMessage {
|
|
359
|
+
role: 'user';
|
|
360
|
+
content: string;
|
|
361
|
+
}
|
|
362
|
+
interface AssistantMessage {
|
|
363
|
+
role: 'assistant';
|
|
364
|
+
content: string;
|
|
365
|
+
toolCalls?: ToolCall[];
|
|
366
|
+
}
|
|
367
|
+
interface ToolMessage {
|
|
368
|
+
role: 'tool';
|
|
369
|
+
content: string;
|
|
370
|
+
toolCallId: string;
|
|
371
|
+
}
|
|
372
|
+
interface SystemMessage {
|
|
373
|
+
role: 'system';
|
|
374
|
+
content: string;
|
|
375
|
+
}
|
|
376
|
+
type Message = UserMessage | AssistantMessage | ToolMessage | SystemMessage;
|
|
377
|
+
type MessageInput = string | string[] | Message | Message[];
|
|
378
|
+
interface ToolCall {
|
|
379
|
+
id: string;
|
|
380
|
+
type: 'function';
|
|
381
|
+
function: {
|
|
382
|
+
name: string;
|
|
383
|
+
arguments: string;
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
interface ToolResult {
|
|
387
|
+
id: string;
|
|
388
|
+
result: any;
|
|
389
|
+
error?: string;
|
|
390
|
+
}
|
|
391
|
+
type AllDelegateInputInterface = SubAgentInterface | subAgentExternalAgentInterface | ExternalAgentInterface | AgentInterface | subAgentTeamAgentInterface;
|
|
392
|
+
type AllDelegateOutputInterface = SubAgentInterface | subAgentExternalAgentInterface | subAgentTeamAgentInterface;
|
|
393
|
+
type SubAgentCanUseType = Tool | AgentMcpConfig | FunctionTool;
|
|
394
|
+
interface SubAgentConfig extends Omit<SubAgentApiInsert, 'projectId'> {
|
|
395
|
+
type?: 'internal';
|
|
396
|
+
canUse?: () => SubAgentCanUseType[];
|
|
397
|
+
canTransferTo?: () => SubAgentInterface[];
|
|
398
|
+
canDelegateTo?: () => AllDelegateInputInterface[];
|
|
399
|
+
dataComponents?: () => (DataComponentApiInsert | DataComponentInterface | DataComponentWithZodProps)[];
|
|
400
|
+
artifactComponents?: () => (ArtifactComponentApiInsert | ArtifactComponentInterface | ArtifactComponentWithZodProps)[];
|
|
401
|
+
conversationHistoryConfig?: AgentConversationHistoryConfig;
|
|
402
|
+
}
|
|
403
|
+
interface ToolConfig extends ToolInsert {
|
|
404
|
+
execute: (params: any) => Promise<any>;
|
|
405
|
+
parameters?: Record<string, any>;
|
|
406
|
+
schema?: z.ZodJSONSchema;
|
|
407
|
+
}
|
|
408
|
+
interface ServerConfig {
|
|
409
|
+
type: string;
|
|
410
|
+
version?: string;
|
|
411
|
+
}
|
|
412
|
+
interface MCPToolConfig {
|
|
413
|
+
id: string;
|
|
414
|
+
name: string;
|
|
415
|
+
tenantId?: string;
|
|
416
|
+
description?: string;
|
|
417
|
+
credential?: CredentialReferenceApiInsert;
|
|
418
|
+
server?: ServerConfig;
|
|
419
|
+
serverUrl: string;
|
|
420
|
+
toolName?: string;
|
|
421
|
+
activeTools?: string[];
|
|
422
|
+
headers?: Record<string, string>;
|
|
423
|
+
mcpType?: 'nango' | 'generic';
|
|
424
|
+
transport?: McpTransportConfig;
|
|
425
|
+
imageUrl?: string;
|
|
426
|
+
}
|
|
427
|
+
interface FetchDefinitionConfig {
|
|
428
|
+
id: string;
|
|
429
|
+
name?: string;
|
|
430
|
+
trigger: 'initialization' | 'invocation';
|
|
431
|
+
url: string;
|
|
432
|
+
method?: string;
|
|
433
|
+
headers?: Record<string, string>;
|
|
434
|
+
body?: Record<string, unknown>;
|
|
435
|
+
transform?: string;
|
|
436
|
+
responseSchema?: z.ZodSchema<any>;
|
|
437
|
+
defaultValue?: unknown;
|
|
438
|
+
timeout?: number;
|
|
439
|
+
credential?: CredentialReferenceApiInsert;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
interface RequestSchemaDefinition {
|
|
443
|
+
body?: z.ZodSchema<any>;
|
|
444
|
+
headers?: z.ZodSchema<any>;
|
|
445
|
+
query?: z.ZodSchema<any>;
|
|
446
|
+
params?: z.ZodSchema<any>;
|
|
447
|
+
}
|
|
448
|
+
interface RequestSchemaConfig {
|
|
449
|
+
schemas: RequestSchemaDefinition;
|
|
450
|
+
optional?: ('body' | 'headers' | 'query' | 'params')[];
|
|
451
|
+
}
|
|
452
|
+
interface TransferConfig {
|
|
453
|
+
agent: SubAgentInterface;
|
|
454
|
+
description?: string;
|
|
455
|
+
condition?: (context: any) => boolean;
|
|
456
|
+
}
|
|
457
|
+
interface GenerateOptions {
|
|
458
|
+
maxTurns?: number;
|
|
459
|
+
maxSteps?: number;
|
|
460
|
+
temperature?: number;
|
|
461
|
+
toolChoice?: 'auto' | 'none' | string;
|
|
462
|
+
resourceId?: string;
|
|
463
|
+
conversationId?: string;
|
|
464
|
+
stream?: boolean;
|
|
465
|
+
customBodyParams?: Record<string, unknown>;
|
|
466
|
+
}
|
|
467
|
+
interface AgentResponse {
|
|
468
|
+
id?: string;
|
|
469
|
+
text: string;
|
|
470
|
+
toolCalls?: ToolCall[];
|
|
471
|
+
transfer?: TransferConfig;
|
|
472
|
+
finishReason: 'completed' | 'tool_calls' | 'transfer' | 'max_turns' | 'error';
|
|
473
|
+
usage?: {
|
|
474
|
+
inputTokens: number;
|
|
475
|
+
outputTokens: number;
|
|
476
|
+
totalTokens?: number;
|
|
477
|
+
};
|
|
478
|
+
metadata?: Record<string, any>;
|
|
479
|
+
}
|
|
480
|
+
interface StreamResponse {
|
|
481
|
+
textStream?: AsyncGenerator<string>;
|
|
482
|
+
eventStream?: AsyncGenerator<StreamEvent>;
|
|
483
|
+
}
|
|
484
|
+
interface StreamEvent {
|
|
485
|
+
type: 'text' | 'tool_call' | 'transfer' | 'error' | 'done';
|
|
486
|
+
data: any;
|
|
487
|
+
timestamp: Date;
|
|
488
|
+
}
|
|
489
|
+
interface RunResult {
|
|
490
|
+
finalOutput: string;
|
|
491
|
+
agent: SubAgentInterface;
|
|
492
|
+
turnCount: number;
|
|
493
|
+
usage?: {
|
|
494
|
+
inputTokens: number;
|
|
495
|
+
outputTokens: number;
|
|
496
|
+
totalTokens?: number;
|
|
497
|
+
};
|
|
498
|
+
metadata?: {
|
|
499
|
+
toolCalls: ToolCall[];
|
|
500
|
+
transfers: TransferConfig[];
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
interface AgentConfig {
|
|
504
|
+
id: string;
|
|
505
|
+
name?: string;
|
|
506
|
+
description?: string;
|
|
507
|
+
defaultSubAgent: SubAgentInterface;
|
|
508
|
+
subAgents?: () => SubAgentInterface[];
|
|
509
|
+
contextConfig?: any;
|
|
510
|
+
credentials?: () => CredentialReferenceApiInsert[];
|
|
511
|
+
stopWhen?: AgentStopWhen;
|
|
512
|
+
prompt?: string;
|
|
513
|
+
models?: {
|
|
514
|
+
base?: ModelSettings;
|
|
515
|
+
structuredOutput?: ModelSettings;
|
|
516
|
+
summarizer?: ModelSettings;
|
|
517
|
+
};
|
|
518
|
+
statusUpdates?: StatusUpdateSettings;
|
|
519
|
+
}
|
|
520
|
+
declare class AgentError extends Error {
|
|
521
|
+
code?: string | undefined;
|
|
522
|
+
details?: any | undefined;
|
|
523
|
+
constructor(message: string, code?: string | undefined, details?: any | undefined);
|
|
524
|
+
}
|
|
525
|
+
declare class MaxTurnsExceededError extends AgentError {
|
|
526
|
+
constructor(maxTurns: number);
|
|
527
|
+
}
|
|
528
|
+
declare class ToolExecutionError extends AgentError {
|
|
529
|
+
constructor(toolName: string, originalError: Error);
|
|
530
|
+
}
|
|
531
|
+
declare class TransferError extends AgentError {
|
|
532
|
+
constructor(sourceAgent: string, targetAgent: string, reason: string);
|
|
533
|
+
}
|
|
534
|
+
interface SubAgentInterface {
|
|
535
|
+
config: SubAgentConfig;
|
|
536
|
+
type: 'internal';
|
|
537
|
+
init(): Promise<void>;
|
|
538
|
+
getId(): string;
|
|
539
|
+
getName(): string;
|
|
540
|
+
getDescription(): string;
|
|
541
|
+
getInstructions(): string;
|
|
542
|
+
getTools(): Record<string, AgentTool>;
|
|
543
|
+
getTransfers(): SubAgentInterface[];
|
|
544
|
+
getDelegates(): AllDelegateOutputInterface[];
|
|
545
|
+
getSubAgentDelegates(): SubAgentInterface[];
|
|
546
|
+
getExternalAgentDelegates(): subAgentExternalAgentInterface[];
|
|
547
|
+
getDataComponents(): DataComponentApiInsert[];
|
|
548
|
+
getArtifactComponents(): ArtifactComponentApiInsert[];
|
|
549
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
550
|
+
addTool(name: string, tool: any): void;
|
|
551
|
+
addTransfer(...agents: SubAgentInterface[]): void;
|
|
552
|
+
addDelegate(...agents: AllDelegateInputInterface[]): void;
|
|
553
|
+
}
|
|
554
|
+
interface ExternalAgentInterface {
|
|
555
|
+
config: ExternalAgentConfig;
|
|
556
|
+
type: 'external';
|
|
557
|
+
init(): Promise<void>;
|
|
558
|
+
getId(): string;
|
|
559
|
+
getName(): string;
|
|
560
|
+
getDescription(): string;
|
|
561
|
+
getBaseUrl(): string;
|
|
562
|
+
setContext?(tenantId: string, projectId: string): void;
|
|
563
|
+
with(options: {
|
|
564
|
+
headers?: Record<string, string>;
|
|
565
|
+
}): subAgentExternalAgentInterface;
|
|
566
|
+
getCredentialReferenceId(): string | undefined;
|
|
567
|
+
getCredentialReference(): CredentialReferenceApiInsert | undefined;
|
|
568
|
+
}
|
|
569
|
+
type subAgentExternalAgentInterface = {
|
|
570
|
+
externalAgent: ExternalAgentInterface;
|
|
571
|
+
headers?: Record<string, string>;
|
|
572
|
+
};
|
|
573
|
+
type subAgentTeamAgentInterface = {
|
|
574
|
+
agent: AgentInterface;
|
|
575
|
+
headers?: Record<string, string>;
|
|
576
|
+
};
|
|
577
|
+
interface AgentInterface {
|
|
578
|
+
init(): Promise<void>;
|
|
579
|
+
setConfig(tenantId: string, projectId: string, apiUrl: string): void;
|
|
580
|
+
getId(): string;
|
|
581
|
+
getName(): string;
|
|
582
|
+
getDescription(): string | undefined;
|
|
583
|
+
getTenantId(): string;
|
|
584
|
+
generate(input: MessageInput, options?: GenerateOptions): Promise<string>;
|
|
585
|
+
stream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
586
|
+
generateStream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
587
|
+
getDefaultSubAgent(): SubAgentInterface | undefined;
|
|
588
|
+
getSubAgent(name: string): SubAgentInterface | undefined;
|
|
589
|
+
getSubAgents(): SubAgentInterface[];
|
|
590
|
+
toFullAgentDefinition(): Promise<FullAgentDefinition>;
|
|
591
|
+
with(options: {
|
|
592
|
+
headers?: Record<string, string>;
|
|
593
|
+
}): subAgentTeamAgentInterface;
|
|
594
|
+
}
|
|
595
|
+
interface BuilderToolConfig {
|
|
596
|
+
name: string;
|
|
597
|
+
description: string;
|
|
598
|
+
config: {
|
|
599
|
+
type: 'mcp';
|
|
600
|
+
mcp: {
|
|
601
|
+
server: {
|
|
602
|
+
url: string;
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
};
|
|
606
|
+
parameters?: Record<string, any>;
|
|
607
|
+
}
|
|
608
|
+
interface BuilderRelationConfig {
|
|
609
|
+
targetAgent: string;
|
|
610
|
+
relationType: 'transfer' | 'delegate';
|
|
611
|
+
}
|
|
612
|
+
interface BuilderAgentConfig {
|
|
613
|
+
name: string;
|
|
614
|
+
description: string;
|
|
615
|
+
instructions: string;
|
|
616
|
+
tools: BuilderToolConfig[];
|
|
617
|
+
relations?: BuilderRelationConfig[];
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
declare class Agent implements AgentInterface {
|
|
621
|
+
private subAgents;
|
|
622
|
+
private agentMap;
|
|
623
|
+
private defaultSubAgent?;
|
|
624
|
+
private baseURL;
|
|
625
|
+
private tenantId;
|
|
626
|
+
private projectId;
|
|
627
|
+
private agentId;
|
|
628
|
+
private agentName;
|
|
629
|
+
private agentDescription?;
|
|
630
|
+
private initialized;
|
|
631
|
+
private contextConfig?;
|
|
632
|
+
private credentials?;
|
|
633
|
+
private models?;
|
|
634
|
+
private statusUpdateSettings?;
|
|
635
|
+
private prompt?;
|
|
636
|
+
private stopWhen?;
|
|
637
|
+
constructor(config: AgentConfig);
|
|
638
|
+
/**
|
|
639
|
+
* Set or update the configuration (tenantId, projectId and apiUrl)
|
|
640
|
+
* This is used by the CLI to inject configuration from inkeep.config.ts
|
|
641
|
+
*/
|
|
642
|
+
setConfig(tenantId: string, projectId: string, apiUrl: string): void;
|
|
643
|
+
/**
|
|
644
|
+
* Convert the Agent to FullAgentDefinition format for the new agent endpoint
|
|
645
|
+
*/
|
|
646
|
+
toFullAgentDefinition(): Promise<FullAgentDefinition>;
|
|
647
|
+
/**
|
|
648
|
+
* Initialize all tools in all agents (especially IPCTools that need MCP server URLs)
|
|
649
|
+
*/
|
|
650
|
+
private initializeAllTools;
|
|
651
|
+
/**
|
|
652
|
+
* Initialize the agent and all agents in the backend using the new agent endpoint
|
|
653
|
+
*/
|
|
654
|
+
init(): Promise<void>;
|
|
655
|
+
/**
|
|
656
|
+
* Generate a response using the default agent
|
|
657
|
+
*/
|
|
658
|
+
generate(input: MessageInput, options?: GenerateOptions): Promise<string>;
|
|
659
|
+
/**
|
|
660
|
+
* Stream a response using the default agent
|
|
661
|
+
*/
|
|
662
|
+
stream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
663
|
+
/**
|
|
664
|
+
* Alias for stream() method for consistency with naming patterns
|
|
665
|
+
*/
|
|
666
|
+
generateStream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
667
|
+
/**
|
|
668
|
+
* Run with a specific agent from the agent
|
|
669
|
+
*/
|
|
670
|
+
runWith(subAgentId: string, input: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
671
|
+
/**
|
|
672
|
+
* Get an agent by name (unified method for all agent types)
|
|
673
|
+
*/
|
|
674
|
+
getSubAgent(name: string): SubAgentInterface | undefined;
|
|
675
|
+
/**
|
|
676
|
+
* Add an agent to the agent
|
|
677
|
+
*/
|
|
678
|
+
addSubAgent(agent: SubAgentInterface): void;
|
|
679
|
+
/**
|
|
680
|
+
* Remove an agent from the agent
|
|
681
|
+
*/
|
|
682
|
+
removeSubAgent(id: string): boolean;
|
|
683
|
+
/**
|
|
684
|
+
* Get all agents in the agent
|
|
685
|
+
*/
|
|
686
|
+
getSubAgents(): SubAgentInterface[];
|
|
687
|
+
/**
|
|
688
|
+
* Get all agent ids (unified method for all agent types)
|
|
689
|
+
*/
|
|
690
|
+
getSubAgentIds(): string[];
|
|
691
|
+
/**
|
|
692
|
+
* Set the default agent
|
|
693
|
+
*/
|
|
694
|
+
setDefaultSubAgent(agent: SubAgentInterface): void;
|
|
695
|
+
/**
|
|
696
|
+
* Get the default agent
|
|
697
|
+
*/
|
|
698
|
+
getDefaultSubAgent(): SubAgentInterface | undefined;
|
|
699
|
+
/**
|
|
700
|
+
* Get the agent ID
|
|
701
|
+
*/
|
|
702
|
+
getId(): string;
|
|
703
|
+
getName(): string;
|
|
704
|
+
getDescription(): string | undefined;
|
|
705
|
+
getTenantId(): string;
|
|
706
|
+
/**
|
|
707
|
+
* Get the agent's model settingsuration
|
|
708
|
+
*/
|
|
709
|
+
getModels(): typeof this.models;
|
|
710
|
+
/**
|
|
711
|
+
* Set the agent's model settingsuration
|
|
712
|
+
*/
|
|
713
|
+
setModels(models: typeof this.models): void;
|
|
714
|
+
/**
|
|
715
|
+
* Get the agent's prompt configuration
|
|
716
|
+
*/
|
|
717
|
+
getPrompt(): string | undefined;
|
|
718
|
+
/**
|
|
719
|
+
* Get the agent's stopWhen configuration
|
|
720
|
+
*/
|
|
721
|
+
getStopWhen(): AgentStopWhen;
|
|
722
|
+
/**
|
|
723
|
+
* Get the agent's status updates configuration
|
|
724
|
+
*/
|
|
725
|
+
getStatusUpdateSettings(): StatusUpdateSettings | undefined;
|
|
726
|
+
/**
|
|
727
|
+
* Get the summarizer model from the agent's model settings
|
|
728
|
+
*/
|
|
729
|
+
getSummarizerModel(): ModelSettings | undefined;
|
|
730
|
+
/**
|
|
731
|
+
* Get agent statistics
|
|
732
|
+
*/
|
|
733
|
+
getStats(): {
|
|
734
|
+
agentCount: number;
|
|
735
|
+
defaultSubAgent: string | null;
|
|
736
|
+
initialized: boolean;
|
|
737
|
+
agentId: string;
|
|
738
|
+
tenantId: string;
|
|
739
|
+
};
|
|
740
|
+
with(options: {
|
|
741
|
+
headers?: Record<string, string>;
|
|
742
|
+
}): subAgentTeamAgentInterface;
|
|
743
|
+
/**
|
|
744
|
+
* Validate the agent configuration
|
|
745
|
+
*/
|
|
746
|
+
validate(): {
|
|
747
|
+
valid: boolean;
|
|
748
|
+
errors: string[];
|
|
749
|
+
};
|
|
750
|
+
private _init;
|
|
751
|
+
/**
|
|
752
|
+
* Type guard to check if an agent is an internal AgentInterface
|
|
753
|
+
*/
|
|
754
|
+
isInternalAgent(agent: AllDelegateInputInterface): agent is SubAgentInterface;
|
|
755
|
+
/**
|
|
756
|
+
* Get project-level model settingsuration defaults
|
|
757
|
+
*/
|
|
758
|
+
private getProjectModelDefaults;
|
|
759
|
+
/**
|
|
760
|
+
* Get project-level stopWhen configuration defaults
|
|
761
|
+
*/
|
|
762
|
+
private getProjectStopWhenDefaults;
|
|
763
|
+
/**
|
|
764
|
+
* Apply model inheritance hierarchy: Project -> Agent -> Agent
|
|
765
|
+
*/
|
|
766
|
+
private applyModelInheritance;
|
|
767
|
+
/**
|
|
768
|
+
* Apply stopWhen inheritance hierarchy: Project -> Agent -> Agent
|
|
769
|
+
*/
|
|
770
|
+
private applyStopWhenInheritance;
|
|
771
|
+
/**
|
|
772
|
+
* Propagate agent-level model settings to agents (supporting partial inheritance)
|
|
773
|
+
*/
|
|
774
|
+
private propagateModelSettingsToAgent;
|
|
775
|
+
/**
|
|
776
|
+
* Immediately propagate agent-level models to all agents during construction
|
|
777
|
+
*/
|
|
778
|
+
private propagateImmediateModelSettings;
|
|
779
|
+
/**
|
|
780
|
+
* Execute agent using the backend system instead of local runner
|
|
781
|
+
*/
|
|
782
|
+
private executeWithBackend;
|
|
783
|
+
/**
|
|
784
|
+
* Parse streaming response in SSE format
|
|
785
|
+
*/
|
|
786
|
+
private parseStreamingResponse;
|
|
787
|
+
/**
|
|
788
|
+
* Normalize input messages to the expected format
|
|
789
|
+
*/
|
|
790
|
+
private normalizeMessages;
|
|
791
|
+
private saveToDatabase;
|
|
792
|
+
private saveRelations;
|
|
793
|
+
private createSubAgentRelations;
|
|
794
|
+
private createSubAgentRelation;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Project configuration interface for the SDK
|
|
799
|
+
*/
|
|
800
|
+
interface ProjectConfig {
|
|
801
|
+
id: string;
|
|
802
|
+
name: string;
|
|
803
|
+
description?: string;
|
|
804
|
+
models?: {
|
|
805
|
+
base?: ModelSettings;
|
|
806
|
+
structuredOutput?: ModelSettings;
|
|
807
|
+
summarizer?: ModelSettings;
|
|
808
|
+
};
|
|
809
|
+
stopWhen?: StopWhen;
|
|
810
|
+
agents?: () => Agent[];
|
|
811
|
+
tools?: () => Tool[];
|
|
812
|
+
externalAgents?: () => ExternalAgent[];
|
|
813
|
+
dataComponents?: () => DataComponent[];
|
|
814
|
+
artifactComponents?: () => ArtifactComponent[];
|
|
815
|
+
credentialReferences?: () => CredentialReferenceApiInsert[];
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Project interface for operations
|
|
819
|
+
*/
|
|
820
|
+
interface ProjectInterface {
|
|
821
|
+
init(): Promise<void>;
|
|
822
|
+
setConfig(tenantId: string, apiUrl: string): void;
|
|
823
|
+
getId(): string;
|
|
824
|
+
getName(): string;
|
|
825
|
+
getDescription(): string | undefined;
|
|
826
|
+
getTenantId(): string;
|
|
827
|
+
getModels(): ProjectConfig['models'];
|
|
828
|
+
getStopWhen(): ProjectConfig['stopWhen'];
|
|
829
|
+
getAgents(): Agent[];
|
|
830
|
+
addAgent(agent: Agent): void;
|
|
831
|
+
removeAgent(id: string): boolean;
|
|
832
|
+
getStats(): {
|
|
833
|
+
projectId: string;
|
|
834
|
+
tenantId: string;
|
|
835
|
+
agentCount: number;
|
|
836
|
+
initialized: boolean;
|
|
837
|
+
};
|
|
838
|
+
validate(): {
|
|
839
|
+
valid: boolean;
|
|
840
|
+
errors: string[];
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Project class for managing agent projects
|
|
845
|
+
*
|
|
846
|
+
* Projects are the top-level organizational unit that contains Agents, Sub Agents, and shared configurations.
|
|
847
|
+
* They provide model inheritance and execution limits that cascade down to Agents and Sub Agents.
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```typescript
|
|
851
|
+
* const myProject = new Project({
|
|
852
|
+
* id: 'customer-support-project',
|
|
853
|
+
* name: 'Customer Support System',
|
|
854
|
+
* description: 'Multi-agent customer support system',
|
|
855
|
+
* models: {
|
|
856
|
+
* base: { model: 'gpt-4.1-mini' },
|
|
857
|
+
* structuredOutput: { model: 'gpt-4.1' }
|
|
858
|
+
* },
|
|
859
|
+
* stopWhen: {
|
|
860
|
+
* transferCountIs: 10,
|
|
861
|
+
* stepCountIs: 50
|
|
862
|
+
* }
|
|
863
|
+
* });
|
|
864
|
+
*
|
|
865
|
+
* await myProject.init();
|
|
866
|
+
* ```
|
|
867
|
+
*/
|
|
868
|
+
declare class Project implements ProjectInterface {
|
|
869
|
+
readonly __type: "project";
|
|
870
|
+
private projectId;
|
|
871
|
+
private projectName;
|
|
872
|
+
private projectDescription?;
|
|
873
|
+
private tenantId;
|
|
874
|
+
private baseURL;
|
|
875
|
+
private apiKey?;
|
|
876
|
+
private initialized;
|
|
877
|
+
private models?;
|
|
878
|
+
private stopWhen?;
|
|
879
|
+
private agents;
|
|
880
|
+
private agentMap;
|
|
881
|
+
private credentialReferences?;
|
|
882
|
+
private projectTools;
|
|
883
|
+
private projectDataComponents;
|
|
884
|
+
private projectArtifactComponents;
|
|
885
|
+
private projectExternalAgents;
|
|
886
|
+
private externalAgentMap;
|
|
887
|
+
constructor(config: ProjectConfig);
|
|
888
|
+
/**
|
|
889
|
+
* Set or update the configuration (tenantId and apiUrl)
|
|
890
|
+
* This is used by the CLI to inject configuration from inkeep.config.ts
|
|
891
|
+
*/
|
|
892
|
+
setConfig(tenantId: string, apiUrl: string, models?: ProjectConfig['models'], apiKey?: string): void;
|
|
893
|
+
/**
|
|
894
|
+
* Set credential references for the project
|
|
895
|
+
* This is used by the CLI to inject environment-specific credentials
|
|
896
|
+
*/
|
|
897
|
+
setCredentials(credentials: Record<string, CredentialReferenceApiInsert>): void;
|
|
898
|
+
/**
|
|
899
|
+
* Initialize the project and create/update it in the backend using full project approach
|
|
900
|
+
*/
|
|
901
|
+
init(): Promise<void>;
|
|
902
|
+
/**
|
|
903
|
+
* Get the project ID
|
|
904
|
+
*/
|
|
905
|
+
getId(): string;
|
|
906
|
+
/**
|
|
907
|
+
* Get the project name
|
|
908
|
+
*/
|
|
909
|
+
getName(): string;
|
|
910
|
+
/**
|
|
911
|
+
* Get the project description
|
|
912
|
+
*/
|
|
913
|
+
getDescription(): string | undefined;
|
|
914
|
+
/**
|
|
915
|
+
* Get the tenant ID
|
|
916
|
+
*/
|
|
917
|
+
getTenantId(): string;
|
|
918
|
+
/**
|
|
919
|
+
* Get the project's model configuration
|
|
920
|
+
*/
|
|
921
|
+
getModels(): ProjectConfig['models'];
|
|
922
|
+
/**
|
|
923
|
+
* Set the project's model configuration
|
|
924
|
+
*/
|
|
925
|
+
setModels(models: ProjectConfig['models']): void;
|
|
926
|
+
/**
|
|
927
|
+
* Get the project's stopWhen configuration
|
|
928
|
+
*/
|
|
929
|
+
getStopWhen(): ProjectConfig['stopWhen'];
|
|
930
|
+
/**
|
|
931
|
+
* Set the project's stopWhen configuration
|
|
932
|
+
*/
|
|
933
|
+
setStopWhen(stopWhen: ProjectConfig['stopWhen']): void;
|
|
934
|
+
/**
|
|
935
|
+
* Get credential tracking information
|
|
936
|
+
*/
|
|
937
|
+
getCredentialTracking(): Promise<{
|
|
938
|
+
credentials: Record<string, any>;
|
|
939
|
+
usage: Record<string, Array<{
|
|
940
|
+
type: string;
|
|
941
|
+
id: string;
|
|
942
|
+
agentId?: string;
|
|
943
|
+
}>>;
|
|
944
|
+
}>;
|
|
945
|
+
getFullDefinition(): Promise<FullProjectDefinition>;
|
|
946
|
+
/**
|
|
947
|
+
* Get all agent in the project
|
|
948
|
+
*/
|
|
949
|
+
getAgents(): Agent[];
|
|
950
|
+
/**
|
|
951
|
+
* Get all external agents in the project
|
|
952
|
+
*/
|
|
953
|
+
getExternalAgents(): ExternalAgent[];
|
|
954
|
+
/**
|
|
955
|
+
* Get an external agent by ID
|
|
956
|
+
*/
|
|
957
|
+
getExternalAgent(id: string): ExternalAgent | undefined;
|
|
958
|
+
/**
|
|
959
|
+
* Add an external agent to the project
|
|
960
|
+
*/
|
|
961
|
+
addExternalAgent(externalAgent: ExternalAgent): void;
|
|
962
|
+
/**
|
|
963
|
+
* Remove an external agent from the project
|
|
964
|
+
*/
|
|
965
|
+
removeExternalAgent(id: string): boolean;
|
|
966
|
+
/**
|
|
967
|
+
* Get an agent by ID
|
|
968
|
+
*/
|
|
969
|
+
getAgent(id: string): Agent | undefined;
|
|
970
|
+
/**
|
|
971
|
+
* Add an agent to the project
|
|
972
|
+
*/
|
|
973
|
+
addAgent(agent: Agent): void;
|
|
974
|
+
/**
|
|
975
|
+
* Remove an agent from the project
|
|
976
|
+
*/
|
|
977
|
+
removeAgent(id: string): boolean;
|
|
978
|
+
/**
|
|
979
|
+
* Get project statistics
|
|
980
|
+
*/
|
|
981
|
+
getStats(): {
|
|
982
|
+
projectId: string;
|
|
983
|
+
tenantId: string;
|
|
984
|
+
agentCount: number;
|
|
985
|
+
initialized: boolean;
|
|
986
|
+
};
|
|
987
|
+
/**
|
|
988
|
+
* Validate the project configuration
|
|
989
|
+
*/
|
|
990
|
+
validate(): {
|
|
991
|
+
valid: boolean;
|
|
992
|
+
errors: string[];
|
|
993
|
+
};
|
|
994
|
+
/**
|
|
995
|
+
* Convert the Project to FullProjectDefinition format
|
|
996
|
+
*/
|
|
997
|
+
private toFullProjectDefinition;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
type StatusComponentConfigWithZod = Omit<StatusComponent$1, 'detailsSchema'> & {
|
|
1001
|
+
detailsSchema?: Record<string, unknown> | z.ZodObject<any>;
|
|
1002
|
+
};
|
|
1003
|
+
interface StatusComponentInterface {
|
|
1004
|
+
config: StatusComponent$1;
|
|
1005
|
+
getType(): string;
|
|
1006
|
+
getDescription(): string | undefined;
|
|
1007
|
+
getDetailsSchema(): StatusComponent$1['detailsSchema'];
|
|
1008
|
+
}
|
|
1009
|
+
declare class StatusComponent implements StatusComponentInterface {
|
|
1010
|
+
config: StatusComponent$1;
|
|
1011
|
+
constructor(config: StatusComponentConfigWithZod);
|
|
1012
|
+
getType(): string;
|
|
1013
|
+
getDescription(): string | undefined;
|
|
1014
|
+
getDetailsSchema(): StatusComponent$1['detailsSchema'];
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Helper function to create agent - OpenAI style
|
|
1019
|
+
*/
|
|
1020
|
+
declare function agent(config: AgentConfig): Agent;
|
|
1021
|
+
/**
|
|
1022
|
+
* Helper function to create projects - OpenAI style
|
|
1023
|
+
*
|
|
1024
|
+
* Projects are the top-level organizational unit that contains Agents, Sub Agents, and shared configurations.
|
|
1025
|
+
* They provide model inheritance and execution limits that cascade down to Agents and Sub Agents.
|
|
1026
|
+
*
|
|
1027
|
+
* @param config - Project configuration
|
|
1028
|
+
* @returns A new Project instance
|
|
1029
|
+
*
|
|
1030
|
+
* @example
|
|
1031
|
+
* ```typescript
|
|
1032
|
+
* const customerSupport = project({
|
|
1033
|
+
* id: 'customer-support-project',
|
|
1034
|
+
* name: 'Customer Support System',
|
|
1035
|
+
* description: 'Multi-agent customer support system',
|
|
1036
|
+
* models: {
|
|
1037
|
+
* base: { model: 'gpt-4.1-mini' },
|
|
1038
|
+
* structuredOutput: { model: 'gpt-4.1' }
|
|
1039
|
+
* },
|
|
1040
|
+
* stopWhen: {
|
|
1041
|
+
* transferCountIs: 10,
|
|
1042
|
+
* stepCountIs: 50
|
|
1043
|
+
* },
|
|
1044
|
+
* agent: () => [
|
|
1045
|
+
* agent({
|
|
1046
|
+
* id: 'support-agent',
|
|
1047
|
+
* name: 'Support Agent',
|
|
1048
|
+
* // ... agent config
|
|
1049
|
+
* })
|
|
1050
|
+
* ]
|
|
1051
|
+
* });
|
|
1052
|
+
* ```
|
|
1053
|
+
*/
|
|
1054
|
+
declare function project(config: ProjectConfig): Project;
|
|
1055
|
+
/**
|
|
1056
|
+
* Creates a new agent with stable ID enforcement.
|
|
1057
|
+
*
|
|
1058
|
+
* Agents require explicit stable IDs to ensure consistency across deployments.
|
|
1059
|
+
* This is different from tools which auto-generate IDs from their names.
|
|
1060
|
+
*
|
|
1061
|
+
* @param config - Agent configuration including required stable ID
|
|
1062
|
+
* @returns A new SubAgent instance
|
|
1063
|
+
* @throws {Error} If config.id is not provided
|
|
1064
|
+
*
|
|
1065
|
+
* @example
|
|
1066
|
+
* ```typescript
|
|
1067
|
+
* const myAgent = agent({
|
|
1068
|
+
* id: 'customer-support-agent',
|
|
1069
|
+
* name: 'Customer Support',
|
|
1070
|
+
* prompt: 'Help customers with their questions'
|
|
1071
|
+
* });
|
|
1072
|
+
* ```
|
|
1073
|
+
*/
|
|
1074
|
+
declare function subAgent(config: SubAgentConfig): SubAgent;
|
|
1075
|
+
/**
|
|
1076
|
+
* Creates a credential reference for authentication.
|
|
1077
|
+
*
|
|
1078
|
+
* Credentials are used to authenticate with external services.
|
|
1079
|
+
* They should be stored securely and referenced by ID.
|
|
1080
|
+
*
|
|
1081
|
+
* @param config - Credential configuration
|
|
1082
|
+
* @returns A validated credential reference
|
|
1083
|
+
*
|
|
1084
|
+
* @example
|
|
1085
|
+
* ```typescript
|
|
1086
|
+
* const apiCredential = credential({
|
|
1087
|
+
* id: 'github-token',
|
|
1088
|
+
* name: 'GitHub Token',
|
|
1089
|
+
* type: 'bearer',
|
|
1090
|
+
* value: process.env.GITHUB_TOKEN
|
|
1091
|
+
* });
|
|
1092
|
+
* ```
|
|
1093
|
+
*/
|
|
1094
|
+
declare function credential(config: CredentialReferenceApiInsert): {
|
|
1095
|
+
id: string;
|
|
1096
|
+
name: string;
|
|
1097
|
+
credentialStoreId: string;
|
|
1098
|
+
type: "nango" | "memory" | "keychain";
|
|
1099
|
+
createdAt?: string | undefined;
|
|
1100
|
+
updatedAt?: string | undefined;
|
|
1101
|
+
retrievalParams?: Record<string, unknown> | null | undefined;
|
|
1102
|
+
};
|
|
1103
|
+
/**
|
|
1104
|
+
* Creates an MCP (Model Context Protocol) server for tool functionality.
|
|
1105
|
+
*
|
|
1106
|
+
* MCP servers provide tool functionality through a standardized protocol.
|
|
1107
|
+
* They can be remote services accessed via HTTP/WebSocket.
|
|
1108
|
+
*
|
|
1109
|
+
* @param config - MCP server configuration
|
|
1110
|
+
* @returns A Tool instance configured as an MCP server
|
|
1111
|
+
* @throws {Error} If serverUrl is not provided
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* ```typescript
|
|
1115
|
+
* // Remote MCP server
|
|
1116
|
+
* const apiServer = mcpServer({
|
|
1117
|
+
* name: 'external_api',
|
|
1118
|
+
* description: 'External API service',
|
|
1119
|
+
* serverUrl: 'https://api.example.com/mcp'
|
|
1120
|
+
* });
|
|
1121
|
+
*
|
|
1122
|
+
* // With authentication
|
|
1123
|
+
* const secureServer = mcpServer({
|
|
1124
|
+
* name: 'secure_api',
|
|
1125
|
+
* description: 'Secure API service',
|
|
1126
|
+
* serverUrl: 'https://secure.example.com/mcp',
|
|
1127
|
+
* credential: credential({
|
|
1128
|
+
* id: 'api-key',
|
|
1129
|
+
* name: 'API Key',
|
|
1130
|
+
* type: 'bearer',
|
|
1131
|
+
* value: process.env.API_KEY
|
|
1132
|
+
* })
|
|
1133
|
+
* });
|
|
1134
|
+
* ```
|
|
1135
|
+
*/
|
|
1136
|
+
declare function mcpServer(config: MCPServerConfig): Tool;
|
|
1137
|
+
/**
|
|
1138
|
+
* Creates an MCP tool from a raw configuration object.
|
|
1139
|
+
*
|
|
1140
|
+
* This is a low-level builder for advanced use cases where you need
|
|
1141
|
+
* full control over the MCPToolConfig. For most cases, use `mcpServer()`.
|
|
1142
|
+
*
|
|
1143
|
+
* @param config - Complete MCP tool configuration
|
|
1144
|
+
* @returns A Tool instance
|
|
1145
|
+
*
|
|
1146
|
+
* @example
|
|
1147
|
+
* ```typescript
|
|
1148
|
+
* const customTool = mcpTool({
|
|
1149
|
+
* id: 'custom-tool',
|
|
1150
|
+
* name: 'Custom Tool',
|
|
1151
|
+
* serverUrl: 'https://example.com/mcp',
|
|
1152
|
+
* transport: { type: 'stdio' }
|
|
1153
|
+
* });
|
|
1154
|
+
* ```
|
|
1155
|
+
*/
|
|
1156
|
+
declare function mcpTool(config: MCPToolConfig$1): Tool;
|
|
1157
|
+
/**
|
|
1158
|
+
* Creates an artifact component with automatic ID generation.
|
|
1159
|
+
*
|
|
1160
|
+
* Artifact components represent structured UI components that can
|
|
1161
|
+
* be rendered with different levels of detail (summary vs full).
|
|
1162
|
+
*
|
|
1163
|
+
* @param config - Artifact component configuration
|
|
1164
|
+
* @returns An ArtifactComponent instance
|
|
1165
|
+
*
|
|
1166
|
+
* @example
|
|
1167
|
+
* ```typescript
|
|
1168
|
+
* const productCard = artifactComponent({
|
|
1169
|
+
* name: 'Product Card',
|
|
1170
|
+
* description: 'Display product information',
|
|
1171
|
+
* props: {
|
|
1172
|
+
* type: 'object',
|
|
1173
|
+
* properties: {
|
|
1174
|
+
* title: { type: 'string', inPreview: true },
|
|
1175
|
+
* price: { type: 'string', inPreview: true },
|
|
1176
|
+
* description: { type: 'string' },
|
|
1177
|
+
* image: { type: 'string' }
|
|
1178
|
+
* }
|
|
1179
|
+
* }
|
|
1180
|
+
* });
|
|
1181
|
+
* ```
|
|
1182
|
+
*/
|
|
1183
|
+
declare function artifactComponent(config: ArtifactComponentConfig): ArtifactComponent;
|
|
1184
|
+
/**
|
|
1185
|
+
* Creates a data component with automatic ID generation.
|
|
1186
|
+
*
|
|
1187
|
+
* Data components represent structured data that can be
|
|
1188
|
+
* passed between agents or used in processing.
|
|
1189
|
+
*
|
|
1190
|
+
* @param config - Data component configuration
|
|
1191
|
+
* @returns A DataComponent instance
|
|
1192
|
+
*
|
|
1193
|
+
* @example
|
|
1194
|
+
* ```typescript
|
|
1195
|
+
* const userProfile = dataComponent({
|
|
1196
|
+
* name: 'User Profile',
|
|
1197
|
+
* description: 'User profile data',
|
|
1198
|
+
* props: {
|
|
1199
|
+
* userId: '123',
|
|
1200
|
+
* name: 'John Doe',
|
|
1201
|
+
* email: 'john@example.com'
|
|
1202
|
+
* }
|
|
1203
|
+
* });
|
|
1204
|
+
* ```
|
|
1205
|
+
*/
|
|
1206
|
+
declare function dataComponent(config: DataComponentConfig): DataComponent;
|
|
1207
|
+
/**
|
|
1208
|
+
* Creates a status component for structured status updates.
|
|
1209
|
+
*
|
|
1210
|
+
* Status components define the structure of status updates
|
|
1211
|
+
* that agents can generate during long-running operations.
|
|
1212
|
+
*
|
|
1213
|
+
* @param config - Status component configuration
|
|
1214
|
+
* @returns A StatusComponent instance
|
|
1215
|
+
*
|
|
1216
|
+
* @example
|
|
1217
|
+
* ```typescript
|
|
1218
|
+
* import { z } from 'zod';
|
|
1219
|
+
*
|
|
1220
|
+
* const toolCallStatus = statusComponent({
|
|
1221
|
+
* type: 'tool_call_summary',
|
|
1222
|
+
* description: 'Summary of a tool execution',
|
|
1223
|
+
* detailsSchema: z.object({
|
|
1224
|
+
* tool_name: z.string(),
|
|
1225
|
+
* summary: z.string(),
|
|
1226
|
+
* status: z.enum(['success', 'error', 'in_progress'])
|
|
1227
|
+
* })
|
|
1228
|
+
* });
|
|
1229
|
+
* ```
|
|
1230
|
+
*/
|
|
1231
|
+
declare function statusComponent(config: StatusComponentConfig): StatusComponent;
|
|
1232
|
+
/**
|
|
1233
|
+
* (deprecated in favor of mcpTool.with()) Creates an agent MCP configuration.
|
|
1234
|
+
*
|
|
1235
|
+
* Agent MCP configurations are used to configure the MCP server for an agent.
|
|
1236
|
+
*
|
|
1237
|
+
* @param config - Agent MCP configuration
|
|
1238
|
+
* @returns An AgentMcpConfig instance
|
|
1239
|
+
*/
|
|
1240
|
+
declare function agentMcp(config: AgentMcpConfig): AgentMcpConfig;
|
|
1241
|
+
/**
|
|
1242
|
+
* Creates a function tool that executes user-defined code in a sandboxed environment.
|
|
1243
|
+
*
|
|
1244
|
+
* Function tools allow users to define custom logic that runs securely in isolated
|
|
1245
|
+
* environments. Dependencies are installed automatically in the sandbox.
|
|
1246
|
+
*
|
|
1247
|
+
* @param config - Function tool configuration
|
|
1248
|
+
* @returns A FunctionTool instance
|
|
1249
|
+
*
|
|
1250
|
+
* @example
|
|
1251
|
+
* ```typescript
|
|
1252
|
+
* const calculatorTool = functionTool({
|
|
1253
|
+
* name: 'calculator',
|
|
1254
|
+
* description: 'Performs basic math operations',
|
|
1255
|
+
* inputSchema: {
|
|
1256
|
+
* type: 'object',
|
|
1257
|
+
* properties: {
|
|
1258
|
+
* operation: { type: 'string', enum: ['add', 'subtract', 'multiply', 'divide'] },
|
|
1259
|
+
* a: { type: 'number' },
|
|
1260
|
+
* b: { type: 'number' }
|
|
1261
|
+
* },
|
|
1262
|
+
* required: ['operation', 'a', 'b']
|
|
1263
|
+
* },
|
|
1264
|
+
* dependencies: {
|
|
1265
|
+
* 'lodash': '^4.17.21'
|
|
1266
|
+
* },
|
|
1267
|
+
* execute: async (params) => {
|
|
1268
|
+
* const { operation, a, b } = params;
|
|
1269
|
+
* switch (operation) {
|
|
1270
|
+
* case 'add': return { result: a + b };
|
|
1271
|
+
* case 'subtract': return { result: a - b };
|
|
1272
|
+
* case 'multiply': return { result: a * b };
|
|
1273
|
+
* case 'divide': return { result: a / b };
|
|
1274
|
+
* default: throw new Error(`Unknown operation: ${operation}`);
|
|
1275
|
+
* }
|
|
1276
|
+
* }
|
|
1277
|
+
* });
|
|
1278
|
+
* ```
|
|
1279
|
+
*/
|
|
1280
|
+
declare function functionTool(config: FunctionToolConfig): FunctionTool;
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* Credential Reference System
|
|
1284
|
+
*
|
|
1285
|
+
* This module provides a way to reference credentials by ID without including
|
|
1286
|
+
* the full credential definition in the code. Credentials are resolved from
|
|
1287
|
+
* environment files at runtime during the push operation.
|
|
1288
|
+
*/
|
|
1289
|
+
/**
|
|
1290
|
+
* Represents a reference to a credential by its ID.
|
|
1291
|
+
* The actual credential will be resolved from the environment file at push time.
|
|
1292
|
+
*/
|
|
1293
|
+
interface CredentialReference {
|
|
1294
|
+
__type: 'credential-ref';
|
|
1295
|
+
id: string;
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Create a reference to a credential by its ID.
|
|
1299
|
+
* The credential must be defined in the environment files.
|
|
1300
|
+
*
|
|
1301
|
+
* @param id - The ID of the credential to reference
|
|
1302
|
+
* @returns A credential reference that will be resolved at push time
|
|
1303
|
+
*
|
|
1304
|
+
* @example
|
|
1305
|
+
* ```typescript
|
|
1306
|
+
* const apiKeyRef = credentialRef('api-key');
|
|
1307
|
+
*
|
|
1308
|
+
* const fetchDef = fetchDefinition({
|
|
1309
|
+
* credential: apiKeyRef,
|
|
1310
|
+
* // ...
|
|
1311
|
+
* });
|
|
1312
|
+
* ```
|
|
1313
|
+
*/
|
|
1314
|
+
declare function credentialRef<T extends string = string>(id: T): CredentialReference;
|
|
1315
|
+
/**
|
|
1316
|
+
* Type guard to check if a value is a credential reference
|
|
1317
|
+
*/
|
|
1318
|
+
declare function isCredentialReference(value: any): value is CredentialReference;
|
|
1319
|
+
/**
|
|
1320
|
+
* Type helper to extract credential IDs from environment configuration
|
|
1321
|
+
*/
|
|
1322
|
+
type ExtractCredentialIds<T> = T extends {
|
|
1323
|
+
credentials?: infer C;
|
|
1324
|
+
} ? C extends Record<string, any> ? keyof C : never : never;
|
|
1325
|
+
/**
|
|
1326
|
+
* Type helper to create a union of all available credential IDs from multiple environments
|
|
1327
|
+
*/
|
|
1328
|
+
type UnionCredentialIds<T extends Record<string, any>> = {
|
|
1329
|
+
[K in keyof T]: ExtractCredentialIds<T[K]>;
|
|
1330
|
+
}[keyof T];
|
|
1331
|
+
/**
|
|
1332
|
+
* Type helper to extract tool IDs from environment configuration
|
|
1333
|
+
*/
|
|
1334
|
+
type ExtractMcpServerIds<T> = T extends {
|
|
1335
|
+
mcpServers?: infer T;
|
|
1336
|
+
} ? T extends Record<string, any> ? keyof T : never : never;
|
|
1337
|
+
/**
|
|
1338
|
+
* Type helper to create a union of all available tool IDs from multiple environments
|
|
1339
|
+
*/
|
|
1340
|
+
type UnionMcpServerIds<T extends Record<string, any>> = {
|
|
1341
|
+
[K in keyof T]: ExtractMcpServerIds<T[K]>;
|
|
1342
|
+
}[keyof T];
|
|
1343
|
+
|
|
1344
|
+
interface EnvironmentSettingsConfig {
|
|
1345
|
+
credentials?: {
|
|
1346
|
+
[settingId: string]: CredentialReferenceApiInsert;
|
|
1347
|
+
};
|
|
1348
|
+
mcpServers?: {
|
|
1349
|
+
[mcpServerId: string]: Tool;
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Create a setting helper with TypeScript autocomplete
|
|
1354
|
+
*/
|
|
1355
|
+
declare function createEnvironmentSettings<T extends Record<string, EnvironmentSettingsConfig>>(environments: T): {
|
|
1356
|
+
getEnvironmentCredential: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
1357
|
+
getEnvironmentMcp: (key: UnionMcpServerIds<T>) => Tool;
|
|
1358
|
+
getEnvironmentSetting: (key: UnionCredentialIds<T>) => CredentialReferenceApiInsert;
|
|
1359
|
+
};
|
|
1360
|
+
/**
|
|
1361
|
+
* Create type-safe environment configurations
|
|
1362
|
+
*/
|
|
1363
|
+
declare function registerEnvironmentSettings<T extends EnvironmentSettingsConfig>(config: T): T;
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* Client-side functions for interacting with the Evaluations API
|
|
1367
|
+
* These functions make HTTP requests to the server instead of direct database calls
|
|
1368
|
+
*/
|
|
1369
|
+
declare function listDatasets(tenantId: string, projectId: string, apiUrl: string, apiKey?: string): Promise<unknown[]>;
|
|
1370
|
+
declare function getDataset(tenantId: string, projectId: string, datasetId: string, apiUrl: string, apiKey?: string): Promise<unknown | null>;
|
|
1371
|
+
declare function createDataset(tenantId: string, projectId: string, apiUrl: string, datasetData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1372
|
+
declare function updateDataset(tenantId: string, projectId: string, datasetId: string, apiUrl: string, updateData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1373
|
+
declare function deleteDataset(tenantId: string, projectId: string, datasetId: string, apiUrl: string, apiKey?: string): Promise<void>;
|
|
1374
|
+
declare function listDatasetItems(tenantId: string, projectId: string, datasetId: string, apiUrl: string, apiKey?: string): Promise<unknown[]>;
|
|
1375
|
+
declare function getDatasetItem(tenantId: string, projectId: string, datasetId: string, itemId: string, apiUrl: string, apiKey?: string): Promise<unknown | null>;
|
|
1376
|
+
declare function createDatasetItem(tenantId: string, projectId: string, datasetId: string, apiUrl: string, itemData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1377
|
+
declare function createDatasetItems(tenantId: string, projectId: string, datasetId: string, apiUrl: string, itemsData: Record<string, unknown>[], apiKey?: string): Promise<unknown[]>;
|
|
1378
|
+
declare function updateDatasetItem(tenantId: string, projectId: string, datasetId: string, itemId: string, apiUrl: string, updateData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1379
|
+
declare function deleteDatasetItem(tenantId: string, projectId: string, datasetId: string, itemId: string, apiUrl: string, apiKey?: string): Promise<void>;
|
|
1380
|
+
declare function listEvaluators(tenantId: string, projectId: string, apiUrl: string, apiKey?: string): Promise<unknown[]>;
|
|
1381
|
+
declare function getEvaluator(tenantId: string, projectId: string, evaluatorId: string, apiUrl: string, apiKey?: string): Promise<unknown | null>;
|
|
1382
|
+
declare function createEvaluator(tenantId: string, projectId: string, apiUrl: string, evaluatorData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1383
|
+
declare function updateEvaluator(tenantId: string, projectId: string, evaluatorId: string, apiUrl: string, updateData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1384
|
+
declare function deleteEvaluator(tenantId: string, projectId: string, evaluatorId: string, apiUrl: string, apiKey?: string): Promise<void>;
|
|
1385
|
+
declare function listEvaluationSuiteConfigs(tenantId: string, projectId: string, apiUrl: string, apiKey?: string): Promise<unknown[]>;
|
|
1386
|
+
declare function getEvaluationSuiteConfig(tenantId: string, projectId: string, configId: string, apiUrl: string, apiKey?: string): Promise<unknown | null>;
|
|
1387
|
+
declare function createEvaluationSuiteConfig(tenantId: string, projectId: string, apiUrl: string, configData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1388
|
+
declare function updateEvaluationSuiteConfig(tenantId: string, projectId: string, configId: string, apiUrl: string, updateData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1389
|
+
declare function deleteEvaluationSuiteConfig(tenantId: string, projectId: string, configId: string, apiUrl: string, apiKey?: string): Promise<void>;
|
|
1390
|
+
declare function listEvaluationSuiteConfigEvaluators(tenantId: string, projectId: string, configId: string, apiUrl: string, apiKey?: string): Promise<unknown[]>;
|
|
1391
|
+
declare function addEvaluatorToSuiteConfig(tenantId: string, projectId: string, configId: string, evaluatorId: string, apiUrl: string, apiKey?: string): Promise<unknown>;
|
|
1392
|
+
declare function removeEvaluatorFromSuiteConfig(tenantId: string, projectId: string, configId: string, evaluatorId: string, apiUrl: string, apiKey?: string): Promise<void>;
|
|
1393
|
+
declare function getEvaluationResult(tenantId: string, projectId: string, resultId: string, apiUrl: string, apiKey?: string): Promise<unknown | null>;
|
|
1394
|
+
declare function createEvaluationResult(tenantId: string, projectId: string, apiUrl: string, resultData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1395
|
+
declare function updateEvaluationResult(tenantId: string, projectId: string, resultId: string, apiUrl: string, updateData: Record<string, unknown>, apiKey?: string): Promise<unknown>;
|
|
1396
|
+
declare function deleteEvaluationResult(tenantId: string, projectId: string, resultId: string, apiUrl: string, apiKey?: string): Promise<void>;
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Client-side functions for interacting with the Full Project API
|
|
1400
|
+
* These functions make HTTP requests to the server instead of direct database calls
|
|
1401
|
+
*/
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* Create a full project via HTTP API
|
|
1405
|
+
*/
|
|
1406
|
+
declare function createFullProjectViaAPI(tenantId: string, apiUrl: string, projectData: FullProjectDefinition, apiKey?: string): Promise<FullProjectDefinition>;
|
|
1407
|
+
/**
|
|
1408
|
+
* Update a full project via HTTP API (upsert behavior)
|
|
1409
|
+
*/
|
|
1410
|
+
declare function updateFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string, projectData: FullProjectDefinition, apiKey?: string): Promise<FullProjectDefinition>;
|
|
1411
|
+
/**
|
|
1412
|
+
* Get a full project via HTTP API
|
|
1413
|
+
*/
|
|
1414
|
+
declare function getFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string, apiKey?: string): Promise<FullProjectDefinition | null>;
|
|
1415
|
+
/**
|
|
1416
|
+
* Delete a full project via HTTP API
|
|
1417
|
+
*/
|
|
1418
|
+
declare function deleteFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string, apiKey?: string): Promise<void>;
|
|
1419
|
+
|
|
1420
|
+
declare class Runner {
|
|
1421
|
+
/**
|
|
1422
|
+
* Run an agent until completion, handling transfers and tool calls
|
|
1423
|
+
* Similar to OpenAI's Runner.run() pattern
|
|
1424
|
+
* NOTE: This now requires an agent instead of an agent
|
|
1425
|
+
*/
|
|
1426
|
+
static run(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Stream an agent's response
|
|
1429
|
+
*/
|
|
1430
|
+
static stream(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Execute multiple agent in parallel and return the first successful result
|
|
1433
|
+
*/
|
|
1434
|
+
static raceAgents(agent: AgentInterface[], messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
1435
|
+
private static normalizeToMessageHistory;
|
|
1436
|
+
/**
|
|
1437
|
+
* Validate agent configuration before running
|
|
1438
|
+
*/
|
|
1439
|
+
static validateAgent(agent: AgentInterface): {
|
|
1440
|
+
valid: boolean;
|
|
1441
|
+
errors: string[];
|
|
1442
|
+
};
|
|
1443
|
+
/**
|
|
1444
|
+
* Get execution statistics for an agent
|
|
1445
|
+
*/
|
|
1446
|
+
static getExecutionStats(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<{
|
|
1447
|
+
estimatedTurns: number;
|
|
1448
|
+
estimatedTokens: number;
|
|
1449
|
+
subAgentCount: number;
|
|
1450
|
+
defaultSubAgent: string | undefined;
|
|
1451
|
+
}>;
|
|
1452
|
+
}
|
|
1453
|
+
declare const run: typeof Runner.run;
|
|
1454
|
+
declare const stream: typeof Runner.stream;
|
|
1455
|
+
declare const raceAgents: typeof Runner.raceAgents;
|
|
1456
|
+
|
|
1457
|
+
export { type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AgentTool, type AllDelegateInputInterface, type AllDelegateOutputInterface, 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 MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, StatusComponent, type StatusComponentInterface, type StreamEvent, type StreamResponse, SubAgent, type SubAgentCanUseType, type SubAgentConfig, type SubAgentInterface, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UnionCredentialIds, type UserMessage, addEvaluatorToSuiteConfig, agent, agentMcp, artifactComponent, createDataset, createDatasetItem, createDatasetItems, createEnvironmentSettings, createEvaluationResult, createEvaluationSuiteConfig, createEvaluator, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteDataset, deleteDatasetItem, deleteEvaluationResult, deleteEvaluationSuiteConfig, deleteEvaluator, deleteFullProjectViaAPI, externalAgent, externalAgents, functionTool, getDataset, getDatasetItem, getEvaluationResult, getEvaluationSuiteConfig, getEvaluator, getFullProjectViaAPI, isCredentialReference, listDatasetItems, listDatasets, listEvaluationSuiteConfigEvaluators, listEvaluationSuiteConfigs, listEvaluators, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, removeEvaluatorFromSuiteConfig, run, statusComponent, stream, subAgent, type subAgentExternalAgentInterface, type subAgentTeamAgentInterface, transfer, updateDataset, updateDatasetItem, updateEvaluationResult, updateEvaluationSuiteConfig, updateEvaluator, updateFullProjectViaAPI };
|