@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.
- package/README.md +356 -2
- package/dist/agent.d.ts +84 -73
- package/dist/agent.js +42 -4
- package/dist/agentFullClient.d.ts +8 -8
- package/dist/agentFullClient.js +4 -4
- package/dist/artifact-component.d.ts +8 -8
- package/dist/artifact-component.js +2 -2
- package/dist/builderFunctions.d.ts +337 -248
- package/dist/builderFunctions.js +131 -2
- package/dist/builderFunctionsExperimental.d.ts +17 -17
- package/dist/builders.d.ts +48 -48
- package/dist/credential-provider.d.ts +93 -93
- package/dist/credential-provider.js +1 -1
- package/dist/credential-ref.d.ts +37 -37
- package/dist/data-component.d.ts +9 -9
- package/dist/data-component.js +2 -2
- package/dist/environment-settings.d.ts +4 -4
- package/dist/evaluationClient.d.ts +78 -0
- package/dist/evaluationClient.js +1202 -0
- package/dist/external-agent.d.ts +17 -17
- package/dist/external-agent.js +2 -2
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -2
- package/dist/module-hosted-tool-manager.d.ts +1 -1
- package/dist/module-hosted-tool-manager.js +1 -1
- package/dist/project.d.ts +83 -83
- package/dist/project.js +23 -4
- package/dist/projectFullClient.d.ts +8 -8
- package/dist/projectFullClient.js +4 -4
- package/dist/runner.d.ts +15 -15
- package/dist/status-component.d.ts +3 -3
- package/dist/subAgent.d.ts +2 -2
- package/dist/subAgent.js +7 -7
- package/dist/telemetry-provider.d.ts +76 -76
- package/dist/tool.d.ts +16 -16
- package/dist/tool.js +23 -3
- package/dist/trigger.d.ts +46 -0
- package/dist/trigger.js +65 -0
- package/dist/types.d.ts +31 -22
- package/dist/utils/generateIdFromName.d.ts +4 -4
- package/dist/utils/tool-normalization.d.ts +10 -10
- package/dist/utils/validateFunction.d.ts +5 -5
- package/package.json +2 -2
package/dist/external-agent.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CredentialReferenceApiInsert } from "@inkeep/agents-core";
|
|
|
3
3
|
|
|
4
4
|
//#region src/external-agent.d.ts
|
|
5
5
|
type ExternalAgentConfig = {
|
|
6
|
-
type?:
|
|
6
|
+
type?: "external";
|
|
7
7
|
id: string;
|
|
8
8
|
name: string;
|
|
9
9
|
description: string;
|
|
@@ -19,8 +19,8 @@ declare class ExternalAgent implements ExternalAgentInterface {
|
|
|
19
19
|
private baseURL;
|
|
20
20
|
constructor(config: ExternalAgentConfig);
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* Initialize the external agent by upserting it in the database
|
|
23
|
+
*/
|
|
24
24
|
init(): Promise<void>;
|
|
25
25
|
setContext(tenantId: string, projectId: string): void;
|
|
26
26
|
getId(): string;
|
|
@@ -29,36 +29,36 @@ declare class ExternalAgent implements ExternalAgentInterface {
|
|
|
29
29
|
}): subAgentExternalAgentInterface;
|
|
30
30
|
private upsertExternalAgent;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Get the external agent configuration
|
|
33
|
+
*/
|
|
34
34
|
getConfig(): ExternalAgentConfig;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* Get the external agent name
|
|
37
|
+
*/
|
|
38
38
|
getName(): string;
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
* Get the external agent base URL
|
|
41
|
+
*/
|
|
42
42
|
getBaseUrl(): string;
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
* Get the tenant ID
|
|
45
|
+
*/
|
|
46
46
|
getTenantId(): string;
|
|
47
47
|
getDescription(): string;
|
|
48
48
|
getCredentialReferenceId(): string | undefined;
|
|
49
49
|
getCredentialReference(): CredentialReferenceApiInsert | undefined;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
* Factory function to create external agents - follows the same pattern as agent()
|
|
53
|
+
*/
|
|
54
54
|
declare function externalAgent(config: ExternalAgentConfig): ExternalAgent;
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
* Helper function to create multiple external agents
|
|
57
|
+
*/
|
|
58
58
|
declare function externalAgents(configs: Record<string, ExternalAgentConfig>): Record<string, ExternalAgent>;
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
* Helper to batch initialize external agents
|
|
61
|
+
*/
|
|
62
62
|
declare function initializeExternalAgents(builders: ExternalAgent[]): Promise<void>;
|
|
63
63
|
//#endregion
|
|
64
64
|
export { ExternalAgent, ExternalAgentConfig, externalAgent, externalAgents, initializeExternalAgents };
|
package/dist/external-agent.js
CHANGED
|
@@ -61,7 +61,7 @@ var ExternalAgent = class {
|
|
|
61
61
|
baseUrl: this.config.baseUrl,
|
|
62
62
|
credentialReferenceId: this.config.credentialReference?.id || void 0
|
|
63
63
|
};
|
|
64
|
-
const updateResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/external-agents/${this.getId()}`, {
|
|
64
|
+
const updateResponse = await fetch(`${this.baseURL}/manage/tenants/${this.tenantId}/projects/${this.projectId}/external-agents/${this.getId()}`, {
|
|
65
65
|
method: "PUT",
|
|
66
66
|
headers: { "Content-Type": "application/json" },
|
|
67
67
|
body: JSON.stringify(externalAgentData)
|
|
@@ -72,7 +72,7 @@ var ExternalAgent = class {
|
|
|
72
72
|
}
|
|
73
73
|
if (updateResponse.status === 404) {
|
|
74
74
|
logger.info({ externalSubAgentId: this.getId() }, "External agent not found, creating new external agent");
|
|
75
|
-
const createResponse = await fetch(`${this.baseURL}/tenants/${this.tenantId}/projects/${this.projectId}/external-agents`, {
|
|
75
|
+
const createResponse = await fetch(`${this.baseURL}/manage/tenants/${this.tenantId}/projects/${this.projectId}/external-agents`, {
|
|
76
76
|
method: "POST",
|
|
77
77
|
headers: { "Content-Type": "application/json" },
|
|
78
78
|
body: JSON.stringify(externalAgentData)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Trigger, TriggerConfig, TriggerInterface } from "./trigger.js";
|
|
1
2
|
import { ArtifactComponent, ArtifactComponentInterface } from "./artifact-component.js";
|
|
2
3
|
import { Tool } from "./tool.js";
|
|
3
4
|
import { SubAgent } from "./subAgent.js";
|
|
@@ -8,12 +9,13 @@ import { FunctionTool } from "./function-tool.js";
|
|
|
8
9
|
import { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponentWithZodProps, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, DataComponentWithZodProps, ExternalAgentInterface, FetchDefinitionConfig, FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, ModelSettings, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
9
10
|
import { Project } from "./project.js";
|
|
10
11
|
import { StatusComponent, StatusComponentInterface } from "./status-component.js";
|
|
11
|
-
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent } from "./builderFunctions.js";
|
|
12
|
+
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
12
13
|
import { CredentialProviderConfig, CredentialProviderType, CredentialStore, CustomCredentialConfig, InkeepCredentialProvider, KeychainCredentialConfig, MemoryCredentialConfig, NangoCredentialConfig, createCredentialProvider } from "./credential-provider.js";
|
|
13
14
|
import { CredentialReference, ExtractCredentialIds, UnionCredentialIds, credentialRef, isCredentialReference } from "./credential-ref.js";
|
|
14
15
|
import { createEnvironmentSettings, registerEnvironmentSettings } from "./environment-settings.js";
|
|
16
|
+
import { EvaluationClient, EvaluationClientConfig, evaluationClient } from "./evaluationClient.js";
|
|
15
17
|
import { createFullProjectViaAPI, deleteFullProjectViaAPI, getFullProjectViaAPI, updateFullProjectViaAPI } from "./projectFullClient.js";
|
|
16
18
|
import { Runner, raceAgents, run, stream } from "./runner.js";
|
|
17
19
|
import { ConsoleTelemetryProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OpenTelemetryConfig, SpanOptions, SpanStatus, SpanStatusType, TelemetryConfig, TelemetryLogger, TelemetryMetrics, TelemetryProvider, TelemetrySpan, TelemetryTracer, createConsoleTelemetryProvider, createNoOpTelemetryProvider, createOpenTelemetryProvider, getGlobalTelemetryProvider, setGlobalTelemetryProvider } from "./telemetry-provider.js";
|
|
18
|
-
import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from "@inkeep/agents-core";
|
|
19
|
-
export { ANTHROPIC_MODELS, AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponent, type ArtifactComponentInterface, ArtifactComponentWithZodProps, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ConsoleTelemetryProvider, type CredentialProviderConfig, type CredentialProviderType, type CredentialReference, type CredentialStore, type CustomCredentialConfig, DataComponent, type DataComponentInterface, DataComponentWithZodProps, ExternalAgent, ExternalAgentInterface, type ExtractCredentialIds, FetchDefinitionConfig, FunctionTool, FunctionToolConfig, GOOGLE_MODELS, GenerateOptions, InkeepCredentialProvider, InkeepTelemetryProvider, type KeychainCredentialConfig, MCPToolConfig, MaxTurnsExceededError, type MemoryCredentialConfig, Message, MessageInput, ModelSettings, type NangoCredentialConfig, NoOpTelemetryProvider, OPENAI_MODELS, type OpenTelemetryConfig, Project, RequestSchemaConfig, RequestSchemaDefinition, RunResult, Runner, ServerConfig, type SpanOptions, SpanStatus, type SpanStatusType, StatusComponent, type StatusComponentInterface, StreamEvent, StreamResponse, SubAgent, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, type TelemetryConfig, type TelemetryLogger, type TelemetryMetrics, type TelemetryProvider, type TelemetrySpan, type TelemetryTracer, Tool, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, type UnionCredentialIds, UserMessage, agent, agentMcp, artifactComponent, createConsoleTelemetryProvider, createCredentialProvider, createEnvironmentSettings, createFullProjectViaAPI, createNoOpTelemetryProvider, createOpenTelemetryProvider, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, getGlobalTelemetryProvider, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, subAgentExternalAgentInterface, subAgentTeamAgentInterface, transfer, updateFullProjectViaAPI };
|
|
20
|
+
import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS, SignatureSource, SignatureVerificationConfig, SignedComponent } from "@inkeep/agents-core";
|
|
21
|
+
export { ANTHROPIC_MODELS, AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponent, type ArtifactComponentInterface, ArtifactComponentWithZodProps, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ConsoleTelemetryProvider, type CredentialProviderConfig, type CredentialProviderType, type CredentialReference, type CredentialStore, type CustomCredentialConfig, DataComponent, type DataComponentInterface, DataComponentWithZodProps, EvaluationClient, type EvaluationClientConfig, ExternalAgent, ExternalAgentInterface, type ExtractCredentialIds, FetchDefinitionConfig, FunctionTool, FunctionToolConfig, GOOGLE_MODELS, GenerateOptions, InkeepCredentialProvider, InkeepTelemetryProvider, type KeychainCredentialConfig, MCPToolConfig, MaxTurnsExceededError, type MemoryCredentialConfig, Message, MessageInput, ModelSettings, type NangoCredentialConfig, NoOpTelemetryProvider, OPENAI_MODELS, type OpenTelemetryConfig, Project, RequestSchemaConfig, RequestSchemaDefinition, RunResult, Runner, ServerConfig, type SignatureSource, type SignatureVerificationConfig, type SignedComponent, type SpanOptions, SpanStatus, type SpanStatusType, StatusComponent, type StatusComponentInterface, StreamEvent, StreamResponse, SubAgent, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, type TelemetryConfig, type TelemetryLogger, type TelemetryMetrics, type TelemetryProvider, type TelemetrySpan, type TelemetryTracer, Tool, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, Trigger, type TriggerConfig, type TriggerInterface, type UnionCredentialIds, UserMessage, agent, agentMcp, artifactComponent, createConsoleTelemetryProvider, createCredentialProvider, createEnvironmentSettings, createFullProjectViaAPI, createNoOpTelemetryProvider, createOpenTelemetryProvider, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, evaluationClient, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, getGlobalTelemetryProvider, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, subAgentExternalAgentInterface, subAgentTeamAgentInterface, transfer, trigger, updateFullProjectViaAPI };
|
package/dist/index.js
CHANGED
|
@@ -6,14 +6,16 @@ import { Project } from "./project.js";
|
|
|
6
6
|
import { StatusComponent } from "./status-component.js";
|
|
7
7
|
import { Tool } from "./tool.js";
|
|
8
8
|
import { SubAgent } from "./subAgent.js";
|
|
9
|
-
import {
|
|
9
|
+
import { Trigger } from "./trigger.js";
|
|
10
|
+
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
10
11
|
import { transfer } from "./builders.js";
|
|
11
12
|
import { InkeepCredentialProvider, createCredentialProvider } from "./credential-provider.js";
|
|
12
13
|
import { credentialRef, isCredentialReference } from "./credential-ref.js";
|
|
13
14
|
import { createEnvironmentSettings, registerEnvironmentSettings } from "./environment-settings.js";
|
|
15
|
+
import { EvaluationClient, evaluationClient } from "./evaluationClient.js";
|
|
14
16
|
import { ExternalAgent, externalAgent, externalAgents } from "./external-agent.js";
|
|
15
17
|
import { Runner, raceAgents, run, stream } from "./runner.js";
|
|
16
18
|
import { ConsoleTelemetryProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, SpanStatus, createConsoleTelemetryProvider, createNoOpTelemetryProvider, createOpenTelemetryProvider, getGlobalTelemetryProvider, setGlobalTelemetryProvider } from "./telemetry-provider.js";
|
|
17
19
|
import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from "@inkeep/agents-core";
|
|
18
20
|
|
|
19
|
-
export { ANTHROPIC_MODELS, ArtifactComponent, ConsoleTelemetryProvider, DataComponent, ExternalAgent, FunctionTool, GOOGLE_MODELS, InkeepCredentialProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OPENAI_MODELS, Project, Runner, SpanStatus, StatusComponent, SubAgent, Tool, agent, agentMcp, artifactComponent, createConsoleTelemetryProvider, createCredentialProvider, createEnvironmentSettings, createFullProjectViaAPI, createNoOpTelemetryProvider, createOpenTelemetryProvider, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, getGlobalTelemetryProvider, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, transfer, updateFullProjectViaAPI };
|
|
21
|
+
export { ANTHROPIC_MODELS, ArtifactComponent, ConsoleTelemetryProvider, DataComponent, EvaluationClient, ExternalAgent, FunctionTool, GOOGLE_MODELS, InkeepCredentialProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OPENAI_MODELS, Project, Runner, SpanStatus, StatusComponent, SubAgent, Tool, Trigger, agent, agentMcp, artifactComponent, createConsoleTelemetryProvider, createCredentialProvider, createEnvironmentSettings, createFullProjectViaAPI, createNoOpTelemetryProvider, createOpenTelemetryProvider, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, evaluationClient, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, getGlobalTelemetryProvider, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, transfer, trigger, updateFullProjectViaAPI };
|
|
@@ -347,7 +347,7 @@ process.on('SIGTERM', () => {
|
|
|
347
347
|
logger.info({ toolId: this.getToolId(server.toolFunction.name) }, "Server health check passed");
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
350
|
-
} catch
|
|
350
|
+
} catch {}
|
|
351
351
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
352
352
|
}
|
|
353
353
|
throw new Error(`Server failed to become ready after ${maxRetries} attempts`);
|
package/dist/project.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ import { CredentialReferenceApiInsert, FullProjectDefinition, StopWhen } from "@
|
|
|
9
9
|
//#region src/project.d.ts
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* Project configuration interface for the SDK
|
|
13
|
+
*/
|
|
14
14
|
interface ProjectConfig {
|
|
15
15
|
id: string;
|
|
16
16
|
name: string;
|
|
@@ -29,8 +29,8 @@ interface ProjectConfig {
|
|
|
29
29
|
credentialReferences?: () => CredentialReferenceApiInsert[];
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Project interface for operations
|
|
33
|
+
*/
|
|
34
34
|
interface ProjectInterface {
|
|
35
35
|
init(): Promise<void>;
|
|
36
36
|
setConfig(tenantId: string, apiUrl: string): void;
|
|
@@ -38,8 +38,8 @@ interface ProjectInterface {
|
|
|
38
38
|
getName(): string;
|
|
39
39
|
getDescription(): string | undefined;
|
|
40
40
|
getTenantId(): string;
|
|
41
|
-
getModels(): ProjectConfig[
|
|
42
|
-
getStopWhen(): ProjectConfig[
|
|
41
|
+
getModels(): ProjectConfig["models"];
|
|
42
|
+
getStopWhen(): ProjectConfig["stopWhen"];
|
|
43
43
|
getAgents(): Agent[];
|
|
44
44
|
addAgent(agent: Agent): void;
|
|
45
45
|
removeAgent(id: string): boolean;
|
|
@@ -55,30 +55,30 @@ interface ProjectInterface {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
58
|
+
* Project class for managing agent projects
|
|
59
|
+
*
|
|
60
|
+
* Projects are the top-level organizational unit that contains Agents, Sub Agents, and shared configurations.
|
|
61
|
+
* They provide model inheritance and execution limits that cascade down to Agents and Sub Agents.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const myProject = new Project({
|
|
66
|
+
* id: 'customer-support-project',
|
|
67
|
+
* name: 'Customer Support System',
|
|
68
|
+
* description: 'Multi-agent customer support system',
|
|
69
|
+
* models: {
|
|
70
|
+
* base: { model: 'gpt-4.1-mini' },
|
|
71
|
+
* structuredOutput: { model: 'gpt-4.1' }
|
|
72
|
+
* },
|
|
73
|
+
* stopWhen: {
|
|
74
|
+
* transferCountIs: 10,
|
|
75
|
+
* stepCountIs: 50
|
|
76
|
+
* }
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* await myProject.init();
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
82
|
declare class Project implements ProjectInterface {
|
|
83
83
|
readonly __type: "project";
|
|
84
84
|
private projectId;
|
|
@@ -100,54 +100,54 @@ declare class Project implements ProjectInterface {
|
|
|
100
100
|
private externalAgentMap;
|
|
101
101
|
constructor(config: ProjectConfig);
|
|
102
102
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
setConfig(tenantId: string, apiUrl: string, models?: ProjectConfig[
|
|
103
|
+
* Set or update the configuration (tenantId and apiUrl)
|
|
104
|
+
* This is used by the CLI to inject configuration from inkeep.config.ts
|
|
105
|
+
*/
|
|
106
|
+
setConfig(tenantId: string, apiUrl: string, models?: ProjectConfig["models"], apiKey?: string): void;
|
|
107
107
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
* Set credential references for the project
|
|
109
|
+
* This is used by the CLI to inject environment-specific credentials
|
|
110
|
+
*/
|
|
111
111
|
setCredentials(credentials: Record<string, CredentialReferenceApiInsert>): void;
|
|
112
112
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
* Initialize the project and create/update it in the backend using full project approach
|
|
114
|
+
*/
|
|
115
115
|
init(): Promise<void>;
|
|
116
116
|
/**
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
* Get the project ID
|
|
118
|
+
*/
|
|
119
119
|
getId(): string;
|
|
120
120
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
* Get the project name
|
|
122
|
+
*/
|
|
123
123
|
getName(): string;
|
|
124
124
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
* Get the project description
|
|
126
|
+
*/
|
|
127
127
|
getDescription(): string | undefined;
|
|
128
128
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
* Get the tenant ID
|
|
130
|
+
*/
|
|
131
131
|
getTenantId(): string;
|
|
132
132
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
getModels(): ProjectConfig[
|
|
133
|
+
* Get the project's model configuration
|
|
134
|
+
*/
|
|
135
|
+
getModels(): ProjectConfig["models"];
|
|
136
136
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
setModels(models: ProjectConfig[
|
|
137
|
+
* Set the project's model configuration
|
|
138
|
+
*/
|
|
139
|
+
setModels(models: ProjectConfig["models"]): void;
|
|
140
140
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
getStopWhen(): ProjectConfig[
|
|
141
|
+
* Get the project's stopWhen configuration
|
|
142
|
+
*/
|
|
143
|
+
getStopWhen(): ProjectConfig["stopWhen"];
|
|
144
144
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
setStopWhen(stopWhen: ProjectConfig[
|
|
145
|
+
* Set the project's stopWhen configuration
|
|
146
|
+
*/
|
|
147
|
+
setStopWhen(stopWhen: ProjectConfig["stopWhen"]): void;
|
|
148
148
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
* Get credential tracking information
|
|
150
|
+
*/
|
|
151
151
|
getCredentialTracking(): Promise<{
|
|
152
152
|
credentials: Record<string, any>;
|
|
153
153
|
usage: Record<string, Array<{
|
|
@@ -158,40 +158,40 @@ declare class Project implements ProjectInterface {
|
|
|
158
158
|
}>;
|
|
159
159
|
getFullDefinition(): Promise<FullProjectDefinition>;
|
|
160
160
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
* Get all agent in the project
|
|
162
|
+
*/
|
|
163
163
|
getAgents(): Agent[];
|
|
164
164
|
/**
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
* Get all external agents in the project
|
|
166
|
+
*/
|
|
167
167
|
getExternalAgents(): ExternalAgent[];
|
|
168
168
|
/**
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
* Get an external agent by ID
|
|
170
|
+
*/
|
|
171
171
|
getExternalAgent(id: string): ExternalAgent | undefined;
|
|
172
172
|
/**
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
* Add an external agent to the project
|
|
174
|
+
*/
|
|
175
175
|
addExternalAgent(externalAgent: ExternalAgent): void;
|
|
176
176
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
* Remove an external agent from the project
|
|
178
|
+
*/
|
|
179
179
|
removeExternalAgent(id: string): boolean;
|
|
180
180
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
* Get an agent by ID
|
|
182
|
+
*/
|
|
183
183
|
getAgent(id: string): Agent | undefined;
|
|
184
184
|
/**
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
* Add an agent to the project
|
|
186
|
+
*/
|
|
187
187
|
addAgent(agent: Agent): void;
|
|
188
188
|
/**
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
* Remove an agent from the project
|
|
190
|
+
*/
|
|
191
191
|
removeAgent(id: string): boolean;
|
|
192
192
|
/**
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
* Get project statistics
|
|
194
|
+
*/
|
|
195
195
|
getStats(): {
|
|
196
196
|
projectId: string;
|
|
197
197
|
tenantId: string;
|
|
@@ -199,15 +199,15 @@ declare class Project implements ProjectInterface {
|
|
|
199
199
|
initialized: boolean;
|
|
200
200
|
};
|
|
201
201
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
* Validate the project configuration
|
|
203
|
+
*/
|
|
204
204
|
validate(): {
|
|
205
205
|
valid: boolean;
|
|
206
206
|
errors: string[];
|
|
207
207
|
};
|
|
208
208
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
* Convert the Project to FullProjectDefinition format
|
|
210
|
+
*/
|
|
211
211
|
private toFullProjectDefinition;
|
|
212
212
|
}
|
|
213
213
|
//#endregion
|
package/dist/project.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { updateFullProjectViaAPI } from "./projectFullClient.js";
|
|
2
2
|
import { FunctionTool } from "./function-tool.js";
|
|
3
3
|
import { getLogger } from "@inkeep/agents-core";
|
|
4
|
+
import { convertZodToJsonSchema, isZodSchema } from "@inkeep/agents-core/utils/schema-conversion";
|
|
4
5
|
|
|
5
6
|
//#region src/project.ts
|
|
6
7
|
const logger = getLogger("project");
|
|
@@ -73,7 +74,7 @@ var Project = class {
|
|
|
73
74
|
projectId: this.projectId,
|
|
74
75
|
tenantId: this.tenantId,
|
|
75
76
|
agentCount: this.agents.length
|
|
76
|
-
}, "Project
|
|
77
|
+
}, "Project loaded");
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
80
|
* Set or update the configuration (tenantId and apiUrl)
|
|
@@ -92,7 +93,7 @@ var Project = class {
|
|
|
92
93
|
apiUrl: this.baseURL,
|
|
93
94
|
hasModels: !!this.models,
|
|
94
95
|
hasApiKey: !!this.apiKey
|
|
95
|
-
}, "Project
|
|
96
|
+
}, "Project configured");
|
|
96
97
|
}
|
|
97
98
|
/**
|
|
98
99
|
* Set credential references for the project
|
|
@@ -407,12 +408,29 @@ var Project = class {
|
|
|
407
408
|
} else if (!toolsObject[toolId]) {
|
|
408
409
|
if ("config" in actualTool && "serverUrl" in actualTool.config) {
|
|
409
410
|
const mcpTool = actualTool;
|
|
411
|
+
const convertedToolOverrides = mcpTool.config.toolOverrides ? Object.fromEntries(Object.entries(mcpTool.config.toolOverrides).map(([toolName, config]) => {
|
|
412
|
+
const originalSchema = config?.schema;
|
|
413
|
+
const convertedSchema = isZodSchema(originalSchema) ? convertZodToJsonSchema(originalSchema) : originalSchema;
|
|
414
|
+
logger.info({
|
|
415
|
+
projectId: this.projectId,
|
|
416
|
+
toolId,
|
|
417
|
+
toolName,
|
|
418
|
+
isZod: isZodSchema(originalSchema),
|
|
419
|
+
originalType: typeof originalSchema,
|
|
420
|
+
convertedType: typeof convertedSchema
|
|
421
|
+
}, "Project: Converting toolOverride schema");
|
|
422
|
+
return [toolName, {
|
|
423
|
+
...config || {},
|
|
424
|
+
schema: convertedSchema
|
|
425
|
+
}];
|
|
426
|
+
})) : mcpTool.config.toolOverrides;
|
|
410
427
|
const toolConfig = {
|
|
411
428
|
type: "mcp",
|
|
412
429
|
mcp: {
|
|
413
430
|
server: { url: mcpTool.config.serverUrl },
|
|
414
431
|
transport: mcpTool.config.transport,
|
|
415
|
-
activeTools: mcpTool.config.activeTools
|
|
432
|
+
activeTools: mcpTool.config.activeTools,
|
|
433
|
+
toolOverrides: convertedToolOverrides
|
|
416
434
|
}
|
|
417
435
|
};
|
|
418
436
|
const toolData = {
|
|
@@ -543,7 +561,8 @@ var Project = class {
|
|
|
543
561
|
mcp: {
|
|
544
562
|
server: { url: tool.config.serverUrl },
|
|
545
563
|
transport: tool.config.transport,
|
|
546
|
-
activeTools: tool.config.activeTools
|
|
564
|
+
activeTools: tool.config.activeTools,
|
|
565
|
+
toolOverrides: tool.config.toolOverrides
|
|
547
566
|
}
|
|
548
567
|
};
|
|
549
568
|
const toolData = {
|
|
@@ -3,20 +3,20 @@ import { FullProjectDefinition } from "@inkeep/agents-core";
|
|
|
3
3
|
//#region src/projectFullClient.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* Create a full project via HTTP API
|
|
7
|
+
*/
|
|
8
8
|
declare function createFullProjectViaAPI(tenantId: string, apiUrl: string, projectData: FullProjectDefinition, apiKey?: string): Promise<FullProjectDefinition>;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* Update a full project via HTTP API (upsert behavior)
|
|
11
|
+
*/
|
|
12
12
|
declare function updateFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string, projectData: FullProjectDefinition, apiKey?: string): Promise<FullProjectDefinition>;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* Get a full project via HTTP API
|
|
15
|
+
*/
|
|
16
16
|
declare function getFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string, apiKey?: string): Promise<FullProjectDefinition | null>;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* Delete a full project via HTTP API
|
|
19
|
+
*/
|
|
20
20
|
declare function deleteFullProjectViaAPI(tenantId: string, apiUrl: string, projectId: string, apiKey?: string): Promise<void>;
|
|
21
21
|
declare function parseError(errorText: string): string | undefined;
|
|
22
22
|
//#endregion
|
|
@@ -15,7 +15,7 @@ async function createFullProjectViaAPI(tenantId, apiUrl, projectData, apiKey) {
|
|
|
15
15
|
projectId: projectData.id,
|
|
16
16
|
apiUrl
|
|
17
17
|
}, "Creating full project via API");
|
|
18
|
-
const url = `${apiUrl}/tenants/${tenantId}/project-full`;
|
|
18
|
+
const url = `${apiUrl}/manage/tenants/${tenantId}/project-full`;
|
|
19
19
|
const headers = {};
|
|
20
20
|
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
21
21
|
let response;
|
|
@@ -55,7 +55,7 @@ async function updateFullProjectViaAPI(tenantId, apiUrl, projectId, projectData,
|
|
|
55
55
|
projectId,
|
|
56
56
|
apiUrl
|
|
57
57
|
}, "Updating full project via API");
|
|
58
|
-
const url = `${apiUrl}/tenants/${tenantId}/project-full/${projectId}`;
|
|
58
|
+
const url = `${apiUrl}/manage/tenants/${tenantId}/project-full/${projectId}`;
|
|
59
59
|
const headers = {};
|
|
60
60
|
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
61
61
|
let response;
|
|
@@ -95,7 +95,7 @@ async function getFullProjectViaAPI(tenantId, apiUrl, projectId, apiKey) {
|
|
|
95
95
|
projectId,
|
|
96
96
|
apiUrl
|
|
97
97
|
}, "Getting full project via API");
|
|
98
|
-
const url = `${apiUrl}/tenants/${tenantId}/project-full/${projectId}`;
|
|
98
|
+
const url = `${apiUrl}/manage/tenants/${tenantId}/project-full/${projectId}`;
|
|
99
99
|
const headers = {};
|
|
100
100
|
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
101
101
|
const response = await apiFetch(url, {
|
|
@@ -127,7 +127,7 @@ async function deleteFullProjectViaAPI(tenantId, apiUrl, projectId, apiKey) {
|
|
|
127
127
|
projectId,
|
|
128
128
|
apiUrl
|
|
129
129
|
}, "Deleting full project via API");
|
|
130
|
-
const url = `${apiUrl}/tenants/${tenantId}/project-full/${projectId}`;
|
|
130
|
+
const url = `${apiUrl}/manage/tenants/${tenantId}/project-full/${projectId}`;
|
|
131
131
|
const headers = {};
|
|
132
132
|
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
133
133
|
const response = await apiFetch(url, {
|
package/dist/runner.d.ts
CHANGED
|
@@ -3,30 +3,30 @@ import { AgentInterface, GenerateOptions, MessageInput, RunResult, StreamRespons
|
|
|
3
3
|
//#region src/runner.d.ts
|
|
4
4
|
declare class Runner {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
* Run an agent until completion, handling transfers and tool calls
|
|
7
|
+
* Similar to OpenAI's Runner.run() pattern
|
|
8
|
+
* NOTE: This now requires an agent instead of an agent
|
|
9
|
+
*/
|
|
10
10
|
static run(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* Stream an agent's response
|
|
13
|
+
*/
|
|
14
14
|
static stream(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
* Execute multiple agent in parallel and return the first successful result
|
|
17
|
+
*/
|
|
18
18
|
static raceAgents(agent: AgentInterface[], messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
19
19
|
private static normalizeToMessageHistory;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
* Validate agent configuration before running
|
|
22
|
+
*/
|
|
23
23
|
static validateAgent(agent: AgentInterface): {
|
|
24
24
|
valid: boolean;
|
|
25
25
|
errors: string[];
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
* Get execution statistics for an agent
|
|
29
|
+
*/
|
|
30
30
|
static getExecutionStats(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<{
|
|
31
31
|
estimatedTurns: number;
|
|
32
32
|
estimatedTokens: number;
|
|
@@ -34,8 +34,8 @@ declare class Runner {
|
|
|
34
34
|
defaultSubAgent: string | undefined;
|
|
35
35
|
}>;
|
|
36
36
|
}
|
|
37
|
-
declare const run: typeof Runner
|
|
38
|
-
declare const stream: typeof Runner
|
|
39
|
-
declare const raceAgents: typeof Runner
|
|
37
|
+
declare const run: (typeof Runner)["run"];
|
|
38
|
+
declare const stream: (typeof Runner)["stream"];
|
|
39
|
+
declare const raceAgents: (typeof Runner)["raceAgents"];
|
|
40
40
|
//#endregion
|
|
41
41
|
export { Runner, raceAgents, run, stream };
|
|
@@ -2,21 +2,21 @@ import { StatusComponent as StatusComponent$1 } from "@inkeep/agents-core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/status-component.d.ts
|
|
5
|
-
type StatusComponentConfigWithZod = Omit<StatusComponent$1,
|
|
5
|
+
type StatusComponentConfigWithZod = Omit<StatusComponent$1, "detailsSchema"> & {
|
|
6
6
|
detailsSchema?: Record<string, unknown> | z.ZodObject<any>;
|
|
7
7
|
};
|
|
8
8
|
interface StatusComponentInterface {
|
|
9
9
|
config: StatusComponent$1;
|
|
10
10
|
getType(): string;
|
|
11
11
|
getDescription(): string | undefined;
|
|
12
|
-
getDetailsSchema(): StatusComponent$1[
|
|
12
|
+
getDetailsSchema(): StatusComponent$1["detailsSchema"];
|
|
13
13
|
}
|
|
14
14
|
declare class StatusComponent implements StatusComponentInterface {
|
|
15
15
|
config: StatusComponent$1;
|
|
16
16
|
constructor(config: StatusComponentConfigWithZod);
|
|
17
17
|
getType(): string;
|
|
18
18
|
getDescription(): string | undefined;
|
|
19
|
-
getDetailsSchema(): StatusComponent$1[
|
|
19
|
+
getDetailsSchema(): StatusComponent$1["detailsSchema"];
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
22
|
export { StatusComponent, StatusComponentInterface };
|
package/dist/subAgent.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ declare class SubAgent implements SubAgentInterface {
|
|
|
16
16
|
getName(): string;
|
|
17
17
|
getInstructions(): string;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
* Get the agent's description (the human-readable description field)
|
|
20
|
+
*/
|
|
21
21
|
getDescription(): string;
|
|
22
22
|
getTools(): Record<string, AgentTool>;
|
|
23
23
|
getModels(): typeof this.config.models;
|