@inkeep/agents-sdk 0.41.2 → 0.43.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.
Files changed (43) hide show
  1. package/README.md +356 -2
  2. package/dist/agent.d.ts +84 -73
  3. package/dist/agent.js +42 -4
  4. package/dist/agentFullClient.d.ts +8 -8
  5. package/dist/agentFullClient.js +4 -4
  6. package/dist/artifact-component.d.ts +8 -8
  7. package/dist/artifact-component.js +2 -2
  8. package/dist/builderFunctions.d.ts +337 -248
  9. package/dist/builderFunctions.js +131 -2
  10. package/dist/builderFunctionsExperimental.d.ts +17 -17
  11. package/dist/builders.d.ts +48 -48
  12. package/dist/credential-provider.d.ts +93 -93
  13. package/dist/credential-provider.js +1 -1
  14. package/dist/credential-ref.d.ts +37 -37
  15. package/dist/data-component.d.ts +9 -9
  16. package/dist/data-component.js +2 -2
  17. package/dist/environment-settings.d.ts +4 -4
  18. package/dist/evaluationClient.d.ts +78 -0
  19. package/dist/evaluationClient.js +1202 -0
  20. package/dist/external-agent.d.ts +17 -17
  21. package/dist/external-agent.js +2 -2
  22. package/dist/index.d.ts +5 -3
  23. package/dist/index.js +4 -2
  24. package/dist/module-hosted-tool-manager.d.ts +1 -1
  25. package/dist/module-hosted-tool-manager.js +1 -1
  26. package/dist/project.d.ts +83 -83
  27. package/dist/project.js +23 -4
  28. package/dist/projectFullClient.d.ts +8 -8
  29. package/dist/projectFullClient.js +4 -4
  30. package/dist/runner.d.ts +15 -15
  31. package/dist/status-component.d.ts +3 -3
  32. package/dist/subAgent.d.ts +2 -2
  33. package/dist/subAgent.js +7 -7
  34. package/dist/telemetry-provider.d.ts +76 -76
  35. package/dist/tool.d.ts +16 -16
  36. package/dist/tool.js +23 -3
  37. package/dist/trigger.d.ts +46 -0
  38. package/dist/trigger.js +65 -0
  39. package/dist/types.d.ts +31 -22
  40. package/dist/utils/generateIdFromName.d.ts +4 -4
  41. package/dist/utils/tool-normalization.d.ts +10 -10
  42. package/dist/utils/validateFunction.d.ts +5 -5
  43. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import { Trigger } from "./trigger.js";
1
2
  import { ArtifactComponent } from "./artifact-component.js";
2
3
  import { Tool } from "./tool.js";
3
4
  import { SubAgent } from "./subAgent.js";
@@ -8,276 +9,364 @@ import { AgentConfig, FunctionToolConfig, SubAgentConfig } from "./types.js";
8
9
  import { Agent } from "./agent.js";
9
10
  import { Project, ProjectConfig } from "./project.js";
10
11
  import { StatusComponent as StatusComponent$1 } from "./status-component.js";
11
- import { CredentialReferenceApiInsert, MCPToolConfig } from "@inkeep/agents-core";
12
+ import { CredentialReferenceApiInsert, MCPToolConfig, TriggerApiInsert } from "@inkeep/agents-core";
12
13
 
13
14
  //#region src/builderFunctions.d.ts
14
15
 
15
16
  /**
16
- * Helper function to create agent - OpenAI style
17
- */
17
+ * Helper function to create agent - OpenAI style
18
+ */
18
19
  declare function agent(config: AgentConfig): Agent;
19
20
  /**
20
- * Helper function to create projects - OpenAI style
21
- *
22
- * Projects are the top-level organizational unit that contains Agents, Sub Agents, and shared configurations.
23
- * They provide model inheritance and execution limits that cascade down to Agents and Sub Agents.
24
- *
25
- * @param config - Project configuration
26
- * @returns A new Project instance
27
- *
28
- * @example
29
- * ```typescript
30
- * const customerSupport = project({
31
- * id: 'customer-support-project',
32
- * name: 'Customer Support System',
33
- * description: 'Multi-agent customer support system',
34
- * models: {
35
- * base: { model: 'gpt-4.1-mini' },
36
- * structuredOutput: { model: 'gpt-4.1' }
37
- * },
38
- * stopWhen: {
39
- * transferCountIs: 10,
40
- * stepCountIs: 50
41
- * },
42
- * agent: () => [
43
- * agent({
44
- * id: 'support-agent',
45
- * name: 'Support Agent',
46
- * // ... agent config
47
- * })
48
- * ]
49
- * });
50
- * ```
51
- */
21
+ * Helper function to create projects - OpenAI style
22
+ *
23
+ * Projects are the top-level organizational unit that contains Agents, Sub Agents, and shared configurations.
24
+ * They provide model inheritance and execution limits that cascade down to Agents and Sub Agents.
25
+ *
26
+ * @param config - Project configuration
27
+ * @returns A new Project instance
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const customerSupport = project({
32
+ * id: 'customer-support-project',
33
+ * name: 'Customer Support System',
34
+ * description: 'Multi-agent customer support system',
35
+ * models: {
36
+ * base: { model: 'gpt-4.1-mini' },
37
+ * structuredOutput: { model: 'gpt-4.1' }
38
+ * },
39
+ * stopWhen: {
40
+ * transferCountIs: 10,
41
+ * stepCountIs: 50
42
+ * },
43
+ * agent: () => [
44
+ * agent({
45
+ * id: 'support-agent',
46
+ * name: 'Support Agent',
47
+ * // ... agent config
48
+ * })
49
+ * ]
50
+ * });
51
+ * ```
52
+ */
52
53
  declare function project(config: ProjectConfig): Project;
53
54
  /**
54
- * Creates a new agent with stable ID enforcement.
55
- *
56
- * Agents require explicit stable IDs to ensure consistency across deployments.
57
- * This is different from tools which auto-generate IDs from their names.
58
- *
59
- * @param config - Agent configuration including required stable ID
60
- * @returns A new SubAgent instance
61
- * @throws {Error} If config.id is not provided
62
- *
63
- * @example
64
- * ```typescript
65
- * const myAgent = agent({
66
- * id: 'customer-support-agent',
67
- * name: 'Customer Support',
68
- * prompt: 'Help customers with their questions'
69
- * });
70
- * ```
71
- */
55
+ * Creates a new agent with stable ID enforcement.
56
+ *
57
+ * Agents require explicit stable IDs to ensure consistency across deployments.
58
+ * This is different from tools which auto-generate IDs from their names.
59
+ *
60
+ * @param config - Agent configuration including required stable ID
61
+ * @returns A new SubAgent instance
62
+ * @throws {Error} If config.id is not provided
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * const myAgent = agent({
67
+ * id: 'customer-support-agent',
68
+ * name: 'Customer Support',
69
+ * prompt: 'Help customers with their questions'
70
+ * });
71
+ * ```
72
+ */
72
73
  declare function subAgent(config: SubAgentConfig): SubAgent;
73
74
  /**
74
- * Creates a credential reference for authentication.
75
- *
76
- * Credentials are used to authenticate with external services.
77
- * They should be stored securely and referenced by ID.
78
- *
79
- * @param config - Credential configuration
80
- * @returns A validated credential reference
81
- *
82
- * @example
83
- * ```typescript
84
- * const apiCredential = credential({
85
- * id: 'github-token',
86
- * name: 'GitHub Token',
87
- * type: 'bearer',
88
- * value: process.env.GITHUB_TOKEN
89
- * });
90
- * ```
91
- */
92
- declare function credential(config: CredentialReferenceApiInsert): {
93
- id: string;
94
- name: string;
95
- credentialStoreId: string;
96
- type: "memory" | "keychain" | "nango";
97
- createdAt?: string | undefined;
98
- updatedAt?: string | undefined;
99
- retrievalParams?: Record<string, unknown> | null | undefined;
100
- userId?: string | null | undefined;
101
- toolId?: string | null | undefined;
102
- createdBy?: string | null | undefined;
103
- };
75
+ * Creates a credential reference for authentication.
76
+ *
77
+ * Credentials are used to authenticate with external services.
78
+ * They should be stored securely and referenced by ID.
79
+ *
80
+ * @param config - Credential configuration
81
+ * @returns A validated credential reference
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const apiCredential = credential({
86
+ * id: 'github-token',
87
+ * name: 'GitHub Token',
88
+ * type: 'bearer',
89
+ * value: process.env.GITHUB_TOKEN
90
+ * });
91
+ * ```
92
+ */
93
+ declare function credential(config: CredentialReferenceApiInsert): CredentialReferenceApiInsert;
104
94
  /**
105
- * Creates an MCP (Model Context Protocol) server for tool functionality.
106
- *
107
- * MCP servers provide tool functionality through a standardized protocol.
108
- * They can be remote services accessed via HTTP/WebSocket.
109
- *
110
- * @param config - MCP server configuration
111
- * @returns A Tool instance configured as an MCP server
112
- * @throws {Error} If serverUrl is not provided
113
- *
114
- * @example
115
- * ```typescript
116
- * // Remote MCP server
117
- * const apiServer = mcpServer({
118
- * name: 'external_api',
119
- * description: 'External API service',
120
- * serverUrl: 'https://api.example.com/mcp'
121
- * });
122
- *
123
- * // With authentication
124
- * const secureServer = mcpServer({
125
- * name: 'secure_api',
126
- * description: 'Secure API service',
127
- * serverUrl: 'https://secure.example.com/mcp',
128
- * credential: credential({
129
- * id: 'api-key',
130
- * name: 'API Key',
131
- * type: 'bearer',
132
- * value: process.env.API_KEY
133
- * })
134
- * });
135
- * ```
136
- */
95
+ * Creates an MCP (Model Context Protocol) server for tool functionality.
96
+ *
97
+ * MCP servers provide tool functionality through a standardized protocol.
98
+ * They can be remote services accessed via HTTP/WebSocket.
99
+ *
100
+ * @param config - MCP server configuration
101
+ * @returns A Tool instance configured as an MCP server
102
+ * @throws {Error} If serverUrl is not provided
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * // Remote MCP server
107
+ * const apiServer = mcpServer({
108
+ * name: 'external_api',
109
+ * description: 'External API service',
110
+ * serverUrl: 'https://api.example.com/mcp'
111
+ * });
112
+ *
113
+ * // With authentication
114
+ * const secureServer = mcpServer({
115
+ * name: 'secure_api',
116
+ * description: 'Secure API service',
117
+ * serverUrl: 'https://secure.example.com/mcp',
118
+ * credential: credential({
119
+ * id: 'api-key',
120
+ * name: 'API Key',
121
+ * type: 'bearer',
122
+ * value: process.env.API_KEY
123
+ * })
124
+ * });
125
+ * ```
126
+ */
137
127
  declare function mcpServer(config: MCPServerConfig): Tool;
138
128
  /**
139
- * Creates an MCP tool from a raw configuration object.
140
- *
141
- * This is a low-level builder for advanced use cases where you need
142
- * full control over the MCPToolConfig. For most cases, use `mcpServer()`.
143
- *
144
- * @param config - Complete MCP tool configuration
145
- * @returns A Tool instance
146
- *
147
- * @example
148
- * ```typescript
149
- * const customTool = mcpTool({
150
- * id: 'custom-tool',
151
- * name: 'Custom Tool',
152
- * serverUrl: 'https://example.com/mcp',
153
- * transport: { type: 'stdio' }
154
- * });
155
- * ```
156
- */
129
+ * Creates an MCP tool from a raw configuration object.
130
+ *
131
+ * This is a low-level builder for advanced use cases where you need
132
+ * full control over the MCPToolConfig. For most cases, use `mcpServer()`.
133
+ *
134
+ * @param config - Complete MCP tool configuration
135
+ * @returns A Tool instance
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * const customTool = mcpTool({
140
+ * id: 'custom-tool',
141
+ * name: 'Custom Tool',
142
+ * serverUrl: 'https://example.com/mcp',
143
+ * transport: { type: 'stdio' }
144
+ * });
145
+ * ```
146
+ */
157
147
  declare function mcpTool(config: MCPToolConfig): Tool;
158
148
  /**
159
- * Creates an artifact component with automatic ID generation.
160
- *
161
- * Artifact components represent structured UI components that can
162
- * be rendered with different levels of detail (summary vs full).
163
- *
164
- * @param config - Artifact component configuration
165
- * @returns An ArtifactComponent instance
166
- *
167
- * @example
168
- * ```typescript
169
- * const productCard = artifactComponent({
170
- * name: 'Product Card',
171
- * description: 'Display product information',
172
- * props: {
173
- * type: 'object',
174
- * properties: {
175
- * title: { type: 'string', inPreview: true },
176
- * price: { type: 'string', inPreview: true },
177
- * description: { type: 'string' },
178
- * image: { type: 'string' }
179
- * }
180
- * }
181
- * });
182
- * ```
183
- */
149
+ * Creates an artifact component with automatic ID generation.
150
+ *
151
+ * Artifact components represent structured UI components that can
152
+ * be rendered with different levels of detail (summary vs full).
153
+ *
154
+ * @param config - Artifact component configuration
155
+ * @returns An ArtifactComponent instance
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * const productCard = artifactComponent({
160
+ * name: 'Product Card',
161
+ * description: 'Display product information',
162
+ * props: {
163
+ * type: 'object',
164
+ * properties: {
165
+ * title: { type: 'string', inPreview: true },
166
+ * price: { type: 'string', inPreview: true },
167
+ * description: { type: 'string' },
168
+ * image: { type: 'string' }
169
+ * }
170
+ * }
171
+ * });
172
+ * ```
173
+ */
184
174
  declare function artifactComponent(config: ArtifactComponentConfig): ArtifactComponent;
185
175
  /**
186
- * Creates a data component with automatic ID generation.
187
- *
188
- * Data components represent structured data that can be
189
- * passed between agents or used in processing.
190
- *
191
- * @param config - Data component configuration
192
- * @returns A DataComponent instance
193
- *
194
- * @example
195
- * ```typescript
196
- * const userProfile = dataComponent({
197
- * name: 'User Profile',
198
- * description: 'User profile data',
199
- * props: {
200
- * userId: '123',
201
- * name: 'John Doe',
202
- * email: 'john@example.com'
203
- * }
204
- * });
205
- * ```
206
- */
176
+ * Creates a data component with automatic ID generation.
177
+ *
178
+ * Data components represent structured data that can be
179
+ * passed between agents or used in processing.
180
+ *
181
+ * @param config - Data component configuration
182
+ * @returns A DataComponent instance
183
+ *
184
+ * @example
185
+ * ```typescript
186
+ * const userProfile = dataComponent({
187
+ * name: 'User Profile',
188
+ * description: 'User profile data',
189
+ * props: {
190
+ * userId: '123',
191
+ * name: 'John Doe',
192
+ * email: 'john@example.com'
193
+ * }
194
+ * });
195
+ * ```
196
+ */
207
197
  declare function dataComponent(config: DataComponentConfig): DataComponent;
208
198
  /**
209
- * Creates a status component for structured status updates.
210
- *
211
- * Status components define the structure of status updates
212
- * that agents can generate during long-running operations.
213
- *
214
- * @param config - Status component configuration
215
- * @returns A StatusComponent instance
216
- *
217
- * @example
218
- * ```typescript
219
- * import { z } from 'zod';
220
- *
221
- * const toolCallStatus = statusComponent({
222
- * type: 'tool_call_summary',
223
- * description: 'Summary of a tool execution',
224
- * detailsSchema: z.object({
225
- * tool_name: z.string(),
226
- * summary: z.string(),
227
- * status: z.enum(['success', 'error', 'in_progress'])
228
- * })
229
- * });
230
- * ```
231
- */
199
+ * Creates a status component for structured status updates.
200
+ *
201
+ * Status components define the structure of status updates
202
+ * that agents can generate during long-running operations.
203
+ *
204
+ * @param config - Status component configuration
205
+ * @returns A StatusComponent instance
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * import { z } from 'zod';
210
+ *
211
+ * const toolCallStatus = statusComponent({
212
+ * type: 'tool_call_summary',
213
+ * description: 'Summary of a tool execution',
214
+ * detailsSchema: z.object({
215
+ * tool_name: z.string(),
216
+ * summary: z.string(),
217
+ * status: z.enum(['success', 'error', 'in_progress'])
218
+ * })
219
+ * });
220
+ * ```
221
+ */
232
222
  declare function statusComponent(config: StatusComponentConfig): StatusComponent$1;
233
223
  /**
234
- * (deprecated in favor of mcpTool.with()) Creates an agent MCP configuration.
235
- *
236
- * Agent MCP configurations are used to configure the MCP server for an agent.
237
- *
238
- * @param config - Agent MCP configuration
239
- * @returns An AgentMcpConfig instance
240
- */
224
+ * (deprecated in favor of mcpTool.with()) Creates an agent MCP configuration.
225
+ *
226
+ * Agent MCP configurations are used to configure the MCP server for an agent.
227
+ *
228
+ * @param config - Agent MCP configuration
229
+ * @returns An AgentMcpConfig instance
230
+ */
241
231
  declare function agentMcp(config: AgentMcpConfig): AgentMcpConfig;
242
232
  /**
243
- * Creates a function tool that executes user-defined code in a sandboxed environment.
244
- *
245
- * Function tools allow users to define custom logic that runs securely in isolated
246
- * environments. Dependencies are installed automatically in the sandbox.
247
- *
248
- * @param config - Function tool configuration
249
- * @returns A FunctionTool instance
250
- *
251
- * @example
252
- * ```typescript
253
- * const calculatorTool = functionTool({
254
- * name: 'calculator',
255
- * description: 'Performs basic math operations',
256
- * inputSchema: {
257
- * type: 'object',
258
- * properties: {
259
- * operation: { type: 'string', enum: ['add', 'subtract', 'multiply', 'divide'] },
260
- * a: { type: 'number' },
261
- * b: { type: 'number' }
262
- * },
263
- * required: ['operation', 'a', 'b']
264
- * },
265
- * dependencies: {
266
- * 'lodash': '^4.17.21'
267
- * },
268
- * execute: async (params) => {
269
- * const { operation, a, b } = params;
270
- * switch (operation) {
271
- * case 'add': return { result: a + b };
272
- * case 'subtract': return { result: a - b };
273
- * case 'multiply': return { result: a * b };
274
- * case 'divide': return { result: a / b };
275
- * default: throw new Error(`Unknown operation: ${operation}`);
276
- * }
277
- * }
278
- * });
279
- * ```
280
- */
233
+ * Creates a function tool that executes user-defined code in a sandboxed environment.
234
+ *
235
+ * Function tools allow users to define custom logic that runs securely in isolated
236
+ * environments. Dependencies are installed automatically in the sandbox.
237
+ *
238
+ * @param config - Function tool configuration
239
+ * @returns A FunctionTool instance
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * const calculatorTool = functionTool({
244
+ * name: 'calculator',
245
+ * description: 'Performs basic math operations',
246
+ * inputSchema: {
247
+ * type: 'object',
248
+ * properties: {
249
+ * operation: { type: 'string', enum: ['add', 'subtract', 'multiply', 'divide'] },
250
+ * a: { type: 'number' },
251
+ * b: { type: 'number' }
252
+ * },
253
+ * required: ['operation', 'a', 'b']
254
+ * },
255
+ * dependencies: {
256
+ * 'lodash': '^4.17.21'
257
+ * },
258
+ * execute: async (params) => {
259
+ * const { operation, a, b } = params;
260
+ * switch (operation) {
261
+ * case 'add': return { result: a + b };
262
+ * case 'subtract': return { result: a - b };
263
+ * case 'multiply': return { result: a * b };
264
+ * case 'divide': return { result: a / b };
265
+ * default: throw new Error(`Unknown operation: ${operation}`);
266
+ * }
267
+ * }
268
+ * });
269
+ * ```
270
+ */
281
271
  declare function functionTool(config: FunctionToolConfig): FunctionTool;
272
+ /**
273
+ * Creates a webhook trigger for external service integration.
274
+ *
275
+ * Triggers allow external services to invoke agents via webhooks.
276
+ * They support authentication via arbitrary header key-value pairs,
277
+ * payload transformation, input validation, and signature verification.
278
+ *
279
+ * @param config - Trigger configuration
280
+ * @returns A Trigger instance
281
+ * @throws {Error} If signatureVerification config validation fails
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * import { z } from 'zod';
286
+ *
287
+ * // GitHub webhook trigger with signature verification
288
+ * const githubWebhookSecret = credential({
289
+ * id: 'github-webhook-secret',
290
+ * name: 'GitHub Webhook Secret',
291
+ * type: 'bearer',
292
+ * value: process.env.GITHUB_WEBHOOK_SECRET
293
+ * });
294
+ *
295
+ * const githubTrigger = trigger({
296
+ * name: 'GitHub Events',
297
+ * description: 'Handle GitHub webhook events',
298
+ * enabled: true,
299
+ * inputSchema: z.object({
300
+ * action: z.string(),
301
+ * repository: z.object({
302
+ * name: z.string(),
303
+ * url: z.string()
304
+ * })
305
+ * }),
306
+ * outputTransform: {
307
+ * jmespath: '{action: action, repo: repository.name, url: repository.url}'
308
+ * },
309
+ * messageTemplate: 'GitHub {{action}} on repository {{repo}}: {{url}}',
310
+ * authentication: {
311
+ * headers: [
312
+ * { name: 'X-GitHub-Token', value: process.env.GITHUB_TOKEN }
313
+ * ]
314
+ * },
315
+ * signingSecretCredentialReference: githubWebhookSecret,
316
+ * signatureVerification: {
317
+ * algorithm: 'sha256',
318
+ * encoding: 'hex',
319
+ * signature: {
320
+ * source: 'header',
321
+ * key: 'x-hub-signature-256',
322
+ * prefix: 'sha256='
323
+ * },
324
+ * signedComponents: [
325
+ * { source: 'body', required: true }
326
+ * ],
327
+ * componentJoin: {
328
+ * strategy: 'concatenate',
329
+ * separator: ''
330
+ * }
331
+ * }
332
+ * });
333
+ *
334
+ * // Slack webhook trigger with complex signature
335
+ * const slackTrigger = trigger({
336
+ * name: 'Slack Events',
337
+ * description: 'Handle Slack webhook events',
338
+ * messageTemplate: 'Slack event: {{type}}',
339
+ * signingSecretCredentialReference: slackSecret,
340
+ * signatureVerification: {
341
+ * algorithm: 'sha256',
342
+ * encoding: 'hex',
343
+ * signature: {
344
+ * source: 'header',
345
+ * key: 'x-slack-signature',
346
+ * prefix: 'v0='
347
+ * },
348
+ * signedComponents: [
349
+ * { source: 'literal', value: 'v0', required: true },
350
+ * { source: 'header', key: 'x-slack-request-timestamp', required: true },
351
+ * { source: 'body', required: true }
352
+ * ],
353
+ * componentJoin: {
354
+ * strategy: 'concatenate',
355
+ * separator: ':'
356
+ * }
357
+ * }
358
+ * });
359
+ *
360
+ * // Simple webhook trigger with no signature verification
361
+ * const simpleTrigger = trigger({
362
+ * name: 'Internal Webhook',
363
+ * description: 'Internal webhook with no signature',
364
+ * messageTemplate: 'New message: {{text}}'
365
+ * });
366
+ * ```
367
+ */
368
+ declare function trigger(config: Omit<TriggerApiInsert, "id"> & {
369
+ id?: string;
370
+ }): Trigger;
282
371
  //#endregion
283
- export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent };
372
+ export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger };