@inkeep/agents-sdk 0.73.5 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/subAgent.d.ts +1 -0
- package/dist/subAgent.js +17 -1
- package/dist/types.d.ts +4 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { transfer } from "./builders.js";
|
|
|
6
6
|
import { DataComponent, DataComponentInterface } from "./data-component.js";
|
|
7
7
|
import { ExternalAgent, externalAgent, externalAgents } from "./external-agent.js";
|
|
8
8
|
import { FunctionTool } from "./function-tool.js";
|
|
9
|
-
import { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ExternalAgentInterface, FetchDefinitionConfig, FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, ModelSettings, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, SkillDefinition, SkillReference, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
9
|
+
import { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ExternalAgentInterface, FetchDefinitionConfig, FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, ModelSettings, OutputContract, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, SkillDefinition, SkillReference, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
10
10
|
import { Project, ProjectConfig } from "./project.js";
|
|
11
11
|
import { StatusComponent, StatusComponentInterface } from "./status-component.js";
|
|
12
12
|
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
@@ -19,4 +19,4 @@ import { Runner, raceAgents, run, stream } from "./runner.js";
|
|
|
19
19
|
import { loadSkills } from "./skill-loader.js";
|
|
20
20
|
import { ConsoleTelemetryProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OpenTelemetryConfig, SpanOptions, SpanStatus, SpanStatusType, TelemetryConfig, TelemetryLogger, TelemetryMetrics, TelemetryProvider, TelemetrySpan, TelemetryTracer, createConsoleTelemetryProvider, createNoOpTelemetryProvider, createOpenTelemetryProvider, getGlobalTelemetryProvider, setGlobalTelemetryProvider } from "./telemetry-provider.js";
|
|
21
21
|
import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS, SignatureSource, SignatureVerificationConfig, SignedComponent } from "@inkeep/agents-core";
|
|
22
|
-
export { ANTHROPIC_MODELS, AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponent, type ArtifactComponentInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ConsoleTelemetryProvider, type CredentialProviderConfig, type CredentialProviderType, type CredentialReference, type CredentialStore, type CustomCredentialConfig, DataComponent, type DataComponentInterface, 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, type ProjectConfig, RequestSchemaConfig, RequestSchemaDefinition, RunResult, Runner, ServerConfig, type SignatureSource, type SignatureVerificationConfig, type SignedComponent, SkillDefinition, SkillReference, 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, loadSkills, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, subAgentExternalAgentInterface, subAgentTeamAgentInterface, transfer, trigger, updateFullProjectViaAPI };
|
|
22
|
+
export { ANTHROPIC_MODELS, AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponent, type ArtifactComponentInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ConsoleTelemetryProvider, type CredentialProviderConfig, type CredentialProviderType, type CredentialReference, type CredentialStore, type CustomCredentialConfig, DataComponent, type DataComponentInterface, 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, OutputContract, Project, type ProjectConfig, RequestSchemaConfig, RequestSchemaDefinition, RunResult, Runner, ServerConfig, type SignatureSource, type SignatureVerificationConfig, type SignedComponent, SkillDefinition, SkillReference, 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, loadSkills, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, subAgentExternalAgentInterface, subAgentTeamAgentInterface, transfer, trigger, updateFullProjectViaAPI };
|
package/dist/subAgent.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ declare class SubAgent implements SubAgentInterface {
|
|
|
38
38
|
addTool(_name: string, tool: Tool): void;
|
|
39
39
|
addTransfer(...agents: SubAgentInterface[]): void;
|
|
40
40
|
addDelegate(...agents: AllDelegateInputInterface[]): void;
|
|
41
|
+
private validateOutputContract;
|
|
41
42
|
init(): Promise<void>;
|
|
42
43
|
private upsertAgent;
|
|
43
44
|
private saveToolsAndRelations;
|
package/dist/subAgent.js
CHANGED
|
@@ -211,8 +211,23 @@ var SubAgent = class {
|
|
|
211
211
|
this.config.canDelegateTo = () => [...existingDelegates(), ...agents];
|
|
212
212
|
} else this.config.canDelegateTo = () => agents;
|
|
213
213
|
}
|
|
214
|
+
validateOutputContract() {
|
|
215
|
+
const contract = this.config.outputContract;
|
|
216
|
+
if (!contract) return;
|
|
217
|
+
if (contract.requireTransfer === true && ((contract.requireComponent?.length ?? 0) > 0 || (contract.requireArtifact?.length ?? 0) > 0)) throw new Error(`outputContract on sub-agent '${this.getId()}' combines requireTransfer with requireComponent/requireArtifact — a turn has a single terminal output shape, so requireTransfer is mutually exclusive with them`);
|
|
218
|
+
if (contract.requireComponent?.length) {
|
|
219
|
+
const declared = this.getDataComponents().map((component) => component.name);
|
|
220
|
+
for (const name of contract.requireComponent) if (!declared.includes(name)) throw new Error(`outputContract.requireComponent='${name}' references an undeclared dataComponent on sub-agent '${this.getId()}'`);
|
|
221
|
+
}
|
|
222
|
+
if (contract.requireArtifact?.length) {
|
|
223
|
+
const declared = this.getArtifactComponents().map((component) => component.name);
|
|
224
|
+
for (const name of contract.requireArtifact) if (!declared.includes(name)) throw new Error(`outputContract.requireArtifact='${name}' references an undeclared artifactComponent on sub-agent '${this.getId()}'`);
|
|
225
|
+
}
|
|
226
|
+
if (contract.requireTransfer && this.getTransfers().length === 0) throw new Error(`outputContract.requireTransfer is true but sub-agent '${this.getId()}' declares no canTransferTo() targets`);
|
|
227
|
+
}
|
|
214
228
|
async init() {
|
|
215
229
|
if (this.initialized) return;
|
|
230
|
+
this.validateOutputContract();
|
|
216
231
|
try {
|
|
217
232
|
await this.upsertAgent();
|
|
218
233
|
await this.loadDataComponents();
|
|
@@ -238,7 +253,8 @@ var SubAgent = class {
|
|
|
238
253
|
prompt: this.config.prompt || "",
|
|
239
254
|
conversationHistoryConfig: this.config.conversationHistoryConfig,
|
|
240
255
|
models: this.config.models,
|
|
241
|
-
stopWhen: this.config.stopWhen
|
|
256
|
+
stopWhen: this.config.stopWhen,
|
|
257
|
+
outputContract: this.config.outputContract
|
|
242
258
|
};
|
|
243
259
|
const updateResponse = await fetch(`${this.baseURL}/manage/tenants/${this.tenantId}/agents/${this.getId()}`, {
|
|
244
260
|
method: "PUT",
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { AgentMcpConfig } from "./builders.js";
|
|
|
5
5
|
import { DataComponentInterface } from "./data-component.js";
|
|
6
6
|
import { ExternalAgentConfig } from "./external-agent.js";
|
|
7
7
|
import { FunctionTool } from "./function-tool.js";
|
|
8
|
-
import { AgentConversationHistoryConfig, AgentStopWhen, ArtifactComponentApiInsert, CredentialReferenceApiInsert, DataComponentApiInsert, FullAgentDefinition, FunctionToolConfig, McpTransportConfig, ModelSettings, SkillApiInsertSchema, StatusUpdateSettings, SubAgentApiInsert, ToolInsert, ToolPolicy } from "@inkeep/agents-core";
|
|
8
|
+
import { AgentConversationHistoryConfig, AgentStopWhen, ArtifactComponentApiInsert, CredentialReferenceApiInsert, DataComponentApiInsert, FullAgentDefinition, FunctionToolConfig, McpTransportConfig, ModelSettings, OutputContract, SkillApiInsertSchema, StatusUpdateSettings, SubAgentApiInsert, ToolInsert, ToolPolicy } from "@inkeep/agents-core";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
|
|
11
11
|
//#region src/types.d.ts
|
|
@@ -73,7 +73,7 @@ type SkillReference = string | {
|
|
|
73
73
|
type AllDelegateInputInterface = SubAgentInterface | subAgentExternalAgentInterface | ExternalAgentInterface | AgentInterface | subAgentTeamAgentInterface;
|
|
74
74
|
type AllDelegateOutputInterface = SubAgentInterface | subAgentExternalAgentInterface | subAgentTeamAgentInterface;
|
|
75
75
|
type SubAgentCanUseType = Tool | AgentMcpConfig | FunctionTool;
|
|
76
|
-
interface SubAgentConfig extends Omit<SubAgentApiInsert, "projectId"> {
|
|
76
|
+
interface SubAgentConfig extends Omit<SubAgentApiInsert, "projectId" | "outputContract"> {
|
|
77
77
|
type?: "internal";
|
|
78
78
|
canUse?: () => SubAgentCanUseType[];
|
|
79
79
|
canTransferTo?: () => SubAgentInterface[];
|
|
@@ -82,6 +82,7 @@ interface SubAgentConfig extends Omit<SubAgentApiInsert, "projectId"> {
|
|
|
82
82
|
dataComponents?: () => (DataComponentApiInsert | DataComponentInterface)[];
|
|
83
83
|
artifactComponents?: () => (ArtifactComponentApiInsert | ArtifactComponentInterface)[];
|
|
84
84
|
conversationHistoryConfig?: AgentConversationHistoryConfig;
|
|
85
|
+
outputContract?: OutputContract;
|
|
85
86
|
}
|
|
86
87
|
interface ToolConfig extends ToolInsert {
|
|
87
88
|
execute: (params: any) => Promise<any>;
|
|
@@ -314,4 +315,4 @@ interface BuilderAgentConfig {
|
|
|
314
315
|
relations?: BuilderRelationConfig[];
|
|
315
316
|
}
|
|
316
317
|
//#endregion
|
|
317
|
-
export { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ExternalAgentInterface, FetchDefinitionConfig, type FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, type ModelSettings, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, SkillDefinition, SkillReference, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, type TriggerInterface, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface };
|
|
318
|
+
export { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ExternalAgentInterface, FetchDefinitionConfig, type FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, type ModelSettings, type OutputContract, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, SkillDefinition, SkillReference, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, type TriggerInterface, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.74.0",
|
|
4
4
|
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"js-yaml": "^4.1.0",
|
|
17
17
|
"typescript": "^6.0.2",
|
|
18
18
|
"zod": "^4.3.6",
|
|
19
|
-
"@inkeep/agents-core": "^0.
|
|
19
|
+
"@inkeep/agents-core": "^0.74.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@opentelemetry/api": "^1.0.0"
|