@inkeep/agents-sdk 0.39.4 → 0.40.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/_virtual/rolldown_runtime.js +7 -0
- package/dist/agent.d.ts +186 -0
- package/dist/agent.js +720 -0
- package/dist/agentFullClient.d.ts +22 -0
- package/dist/agentFullClient.js +120 -0
- package/dist/artifact-component.d.ts +34 -0
- package/dist/artifact-component.js +104 -0
- package/dist/builderFunctions.d.ts +283 -0
- package/dist/builderFunctions.js +327 -0
- package/dist/builderFunctionsExperimental.d.ts +24 -0
- package/dist/builderFunctionsExperimental.js +27 -0
- package/dist/builders.d.ts +111 -0
- package/dist/builders.js +52 -0
- package/dist/credential-provider.d.ts +176 -0
- package/dist/credential-provider.js +237 -0
- package/dist/credential-ref.d.ts +60 -0
- package/dist/credential-ref.js +33 -0
- package/dist/data-component.d.ts +39 -0
- package/dist/data-component.js +109 -0
- package/dist/environment-settings.d.ts +27 -0
- package/dist/environment-settings.js +41 -0
- package/dist/external-agent.d.ts +64 -0
- package/dist/external-agent.js +156 -0
- package/dist/function-tool.d.ts +37 -0
- package/dist/function-tool.js +66 -0
- package/dist/index.d.ts +19 -1825
- package/dist/index.js +19 -4058
- package/dist/module-hosted-tool-manager.d.ts +40 -0
- package/dist/module-hosted-tool-manager.js +359 -0
- package/dist/project.d.ts +214 -0
- package/dist/project.js +615 -0
- package/dist/projectFullClient.d.ts +23 -0
- package/dist/projectFullClient.js +162 -0
- package/dist/runner.d.ts +41 -0
- package/dist/runner.js +145 -0
- package/dist/status-component.d.ts +22 -0
- package/dist/status-component.js +36 -0
- package/dist/subAgent.d.ts +52 -0
- package/dist/subAgent.js +616 -0
- package/dist/telemetry-provider.d.ts +218 -0
- package/dist/telemetry-provider.js +390 -0
- package/dist/tool.d.ts +53 -0
- package/dist/tool.js +130 -0
- package/dist/types.d.ts +296 -0
- package/dist/types.js +39 -0
- package/dist/utils/generateIdFromName.d.ts +9 -0
- package/dist/utils/generateIdFromName.js +12 -0
- package/dist/utils/getFunctionToolDeps.d.ts +17 -0
- package/dist/utils/getFunctionToolDeps.js +131 -0
- package/dist/utils/tool-normalization.d.ts +42 -0
- package/dist/utils/tool-normalization.js +41 -0
- package/dist/utils/validateFunction.d.ts +10 -0
- package/dist/utils/validateFunction.js +13 -0
- package/package.json +11 -16
- package/dist/index.cjs +0 -4147
- package/dist/index.d.cts +0 -1825
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { apiFetch, getLogger } from "@inkeep/agents-core";
|
|
2
|
+
|
|
3
|
+
//#region src/projectFullClient.ts
|
|
4
|
+
/**
|
|
5
|
+
* Client-side functions for interacting with the Full Project API
|
|
6
|
+
* These functions make HTTP requests to the server instead of direct database calls
|
|
7
|
+
*/
|
|
8
|
+
const logger = getLogger("projectFullClient");
|
|
9
|
+
/**
|
|
10
|
+
* Create a full project via HTTP API
|
|
11
|
+
*/
|
|
12
|
+
async function createFullProjectViaAPI(tenantId, apiUrl, projectData, apiKey) {
|
|
13
|
+
logger.info({
|
|
14
|
+
tenantId,
|
|
15
|
+
projectId: projectData.id,
|
|
16
|
+
apiUrl
|
|
17
|
+
}, "Creating full project via API");
|
|
18
|
+
const url = `${apiUrl}/tenants/${tenantId}/project-full`;
|
|
19
|
+
const headers = {};
|
|
20
|
+
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
21
|
+
let response;
|
|
22
|
+
try {
|
|
23
|
+
response = await apiFetch(url, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers,
|
|
26
|
+
body: JSON.stringify(projectData)
|
|
27
|
+
});
|
|
28
|
+
} catch (fetchError) {
|
|
29
|
+
logger.error({
|
|
30
|
+
error: fetchError instanceof Error ? fetchError.message : "Unknown fetch error",
|
|
31
|
+
url,
|
|
32
|
+
tenantId,
|
|
33
|
+
projectId: projectData.id
|
|
34
|
+
}, "Fetch request failed");
|
|
35
|
+
throw fetchError;
|
|
36
|
+
}
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
const errorMessage = parseError(await response.text()) ?? `Failed to create project: ${response.status} ${response.statusText}`;
|
|
39
|
+
logger.error({
|
|
40
|
+
status: response.status,
|
|
41
|
+
error: errorMessage
|
|
42
|
+
}, "Failed to create project via API");
|
|
43
|
+
throw new Error(errorMessage);
|
|
44
|
+
}
|
|
45
|
+
const result = await response.json();
|
|
46
|
+
logger.info({ projectId: projectData.id }, "Successfully created project via API");
|
|
47
|
+
return result.data;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Update a full project via HTTP API (upsert behavior)
|
|
51
|
+
*/
|
|
52
|
+
async function updateFullProjectViaAPI(tenantId, apiUrl, projectId, projectData, apiKey) {
|
|
53
|
+
logger.info({
|
|
54
|
+
tenantId,
|
|
55
|
+
projectId,
|
|
56
|
+
apiUrl
|
|
57
|
+
}, "Updating full project via API");
|
|
58
|
+
const url = `${apiUrl}/tenants/${tenantId}/project-full/${projectId}`;
|
|
59
|
+
const headers = {};
|
|
60
|
+
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
61
|
+
let response;
|
|
62
|
+
try {
|
|
63
|
+
response = await apiFetch(url, {
|
|
64
|
+
method: "PUT",
|
|
65
|
+
headers,
|
|
66
|
+
body: JSON.stringify(projectData)
|
|
67
|
+
});
|
|
68
|
+
} catch (fetchError) {
|
|
69
|
+
logger.error({
|
|
70
|
+
error: fetchError instanceof Error ? fetchError.message : "Unknown fetch error",
|
|
71
|
+
url,
|
|
72
|
+
tenantId,
|
|
73
|
+
projectId
|
|
74
|
+
}, "Fetch request failed");
|
|
75
|
+
throw fetchError;
|
|
76
|
+
}
|
|
77
|
+
if (!response.ok) {
|
|
78
|
+
const errorMessage = parseError(await response.text()) ?? `Failed to update project: ${response.status} ${response.statusText}`;
|
|
79
|
+
logger.error({
|
|
80
|
+
status: response.status,
|
|
81
|
+
error: errorMessage
|
|
82
|
+
}, "Failed to update project via API");
|
|
83
|
+
throw new Error(errorMessage);
|
|
84
|
+
}
|
|
85
|
+
const result = await response.json();
|
|
86
|
+
logger.info({ projectId }, "Successfully updated project via API");
|
|
87
|
+
return result.data;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get a full project via HTTP API
|
|
91
|
+
*/
|
|
92
|
+
async function getFullProjectViaAPI(tenantId, apiUrl, projectId, apiKey) {
|
|
93
|
+
logger.info({
|
|
94
|
+
tenantId,
|
|
95
|
+
projectId,
|
|
96
|
+
apiUrl
|
|
97
|
+
}, "Getting full project via API");
|
|
98
|
+
const url = `${apiUrl}/tenants/${tenantId}/project-full/${projectId}`;
|
|
99
|
+
const headers = {};
|
|
100
|
+
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
101
|
+
const response = await apiFetch(url, {
|
|
102
|
+
method: "GET",
|
|
103
|
+
headers
|
|
104
|
+
});
|
|
105
|
+
if (!response.ok) {
|
|
106
|
+
if (response.status === 404) {
|
|
107
|
+
logger.info({ projectId }, "Project not found");
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
const errorMessage = parseError(await response.text()) ?? `Failed to get project: ${response.status} ${response.statusText}`;
|
|
111
|
+
logger.error({
|
|
112
|
+
status: response.status,
|
|
113
|
+
error: errorMessage
|
|
114
|
+
}, "Failed to get project via API");
|
|
115
|
+
throw new Error(errorMessage);
|
|
116
|
+
}
|
|
117
|
+
const result = await response.json();
|
|
118
|
+
logger.info({ projectId }, "Successfully retrieved project via API");
|
|
119
|
+
return result.data;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Delete a full project via HTTP API
|
|
123
|
+
*/
|
|
124
|
+
async function deleteFullProjectViaAPI(tenantId, apiUrl, projectId, apiKey) {
|
|
125
|
+
logger.info({
|
|
126
|
+
tenantId,
|
|
127
|
+
projectId,
|
|
128
|
+
apiUrl
|
|
129
|
+
}, "Deleting full project via API");
|
|
130
|
+
const url = `${apiUrl}/tenants/${tenantId}/project-full/${projectId}`;
|
|
131
|
+
const headers = {};
|
|
132
|
+
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
133
|
+
const response = await apiFetch(url, {
|
|
134
|
+
method: "DELETE",
|
|
135
|
+
headers
|
|
136
|
+
});
|
|
137
|
+
if (!response.ok) {
|
|
138
|
+
const errorMessage = parseError(await response.text()) ?? `Failed to delete project: ${response.status} ${response.statusText}`;
|
|
139
|
+
logger.error({
|
|
140
|
+
status: response.status,
|
|
141
|
+
error: errorMessage
|
|
142
|
+
}, "Failed to delete project via API");
|
|
143
|
+
throw new Error(errorMessage);
|
|
144
|
+
}
|
|
145
|
+
logger.info({ projectId }, "Successfully deleted project via API");
|
|
146
|
+
}
|
|
147
|
+
function parseError(errorText) {
|
|
148
|
+
let result;
|
|
149
|
+
try {
|
|
150
|
+
const errorJson = JSON.parse(errorText);
|
|
151
|
+
if (errorJson.error) {
|
|
152
|
+
const { error } = errorJson;
|
|
153
|
+
result = error?.message ?? error;
|
|
154
|
+
}
|
|
155
|
+
} catch {
|
|
156
|
+
if (errorText) result = errorText;
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
//#endregion
|
|
162
|
+
export { createFullProjectViaAPI, deleteFullProjectViaAPI, getFullProjectViaAPI, parseError, updateFullProjectViaAPI };
|
package/dist/runner.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AgentInterface, GenerateOptions, MessageInput, RunResult, StreamResponse } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/runner.d.ts
|
|
4
|
+
declare class Runner {
|
|
5
|
+
/**
|
|
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
|
+
static run(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Stream an agent's response
|
|
13
|
+
*/
|
|
14
|
+
static stream(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Execute multiple agent in parallel and return the first successful result
|
|
17
|
+
*/
|
|
18
|
+
static raceAgents(agent: AgentInterface[], messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
19
|
+
private static normalizeToMessageHistory;
|
|
20
|
+
/**
|
|
21
|
+
* Validate agent configuration before running
|
|
22
|
+
*/
|
|
23
|
+
static validateAgent(agent: AgentInterface): {
|
|
24
|
+
valid: boolean;
|
|
25
|
+
errors: string[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Get execution statistics for an agent
|
|
29
|
+
*/
|
|
30
|
+
static getExecutionStats(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<{
|
|
31
|
+
estimatedTurns: number;
|
|
32
|
+
estimatedTokens: number;
|
|
33
|
+
subAgentCount: number;
|
|
34
|
+
defaultSubAgent: string | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
declare const run: typeof Runner.run;
|
|
38
|
+
declare const stream: typeof Runner.stream;
|
|
39
|
+
declare const raceAgents: typeof Runner.raceAgents;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Runner, raceAgents, run, stream };
|
package/dist/runner.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { MaxTurnsExceededError } from "./types.js";
|
|
2
|
+
import { getLogger } from "@inkeep/agents-core";
|
|
3
|
+
|
|
4
|
+
//#region src/runner.ts
|
|
5
|
+
const logger = getLogger("runner");
|
|
6
|
+
var Runner = class Runner {
|
|
7
|
+
/**
|
|
8
|
+
* Run an agent until completion, handling transfers and tool calls
|
|
9
|
+
* Similar to OpenAI's Runner.run() pattern
|
|
10
|
+
* NOTE: This now requires an agent instead of an agent
|
|
11
|
+
*/
|
|
12
|
+
static async run(agent, messages, options) {
|
|
13
|
+
const maxTurns = options?.maxTurns || 10;
|
|
14
|
+
let turnCount = 0;
|
|
15
|
+
const messageHistory = Runner.normalizeToMessageHistory(messages);
|
|
16
|
+
const allToolCalls = [];
|
|
17
|
+
logger.info({
|
|
18
|
+
agentId: agent.getId(),
|
|
19
|
+
defaultSubAgent: agent.getDefaultSubAgent()?.getName(),
|
|
20
|
+
maxTurns,
|
|
21
|
+
initialMessageCount: messageHistory.length
|
|
22
|
+
}, "Starting agent run");
|
|
23
|
+
while (turnCount < maxTurns) {
|
|
24
|
+
logger.debug({
|
|
25
|
+
agentId: agent.getId(),
|
|
26
|
+
turnCount,
|
|
27
|
+
messageHistoryLength: messageHistory.length
|
|
28
|
+
}, "Starting turn");
|
|
29
|
+
const response = await agent.generate(messageHistory, options);
|
|
30
|
+
turnCount++;
|
|
31
|
+
logger.info({
|
|
32
|
+
agentId: agent.getId(),
|
|
33
|
+
turnCount,
|
|
34
|
+
responseLength: response.length
|
|
35
|
+
}, "Agent generation completed");
|
|
36
|
+
return {
|
|
37
|
+
finalOutput: response,
|
|
38
|
+
agent: agent.getDefaultSubAgent() || {},
|
|
39
|
+
turnCount,
|
|
40
|
+
usage: {
|
|
41
|
+
inputTokens: 0,
|
|
42
|
+
outputTokens: 0
|
|
43
|
+
},
|
|
44
|
+
metadata: {
|
|
45
|
+
toolCalls: allToolCalls,
|
|
46
|
+
transfers: []
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
logger.error({
|
|
51
|
+
agentId: agent.getId(),
|
|
52
|
+
maxTurns,
|
|
53
|
+
finalTurnCount: turnCount
|
|
54
|
+
}, "Maximum turns exceeded");
|
|
55
|
+
throw new MaxTurnsExceededError(maxTurns);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Stream an agent's response
|
|
59
|
+
*/
|
|
60
|
+
static async stream(agent, messages, options) {
|
|
61
|
+
logger.info({
|
|
62
|
+
agentId: agent.getId(),
|
|
63
|
+
defaultSubAgent: agent.getDefaultSubAgent()?.getName()
|
|
64
|
+
}, "Starting agent stream");
|
|
65
|
+
return agent.stream(messages, options);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Execute multiple agent in parallel and return the first successful result
|
|
69
|
+
*/
|
|
70
|
+
static async raceAgents(agent, messages, options) {
|
|
71
|
+
if (agent.length === 0) throw new Error("No agent provided for race");
|
|
72
|
+
logger.info({
|
|
73
|
+
agentCount: agent.length,
|
|
74
|
+
agentIds: agent.map((g) => g.getId())
|
|
75
|
+
}, "Starting agent race");
|
|
76
|
+
const promises = agent.map(async (agent$1, index) => {
|
|
77
|
+
try {
|
|
78
|
+
return {
|
|
79
|
+
...await Runner.run(agent$1, messages, options),
|
|
80
|
+
raceIndex: index
|
|
81
|
+
};
|
|
82
|
+
} catch (error) {
|
|
83
|
+
logger.error({
|
|
84
|
+
agentId: agent$1.getId(),
|
|
85
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
86
|
+
}, "Agent failed in race");
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const result = await Promise.race(promises);
|
|
91
|
+
logger.info({
|
|
92
|
+
winningAgentId: result.agentId || "unknown",
|
|
93
|
+
raceIndex: result.raceIndex
|
|
94
|
+
}, "Agent race completed");
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
static normalizeToMessageHistory(messages) {
|
|
98
|
+
if (typeof messages === "string") return [{
|
|
99
|
+
role: "user",
|
|
100
|
+
content: messages
|
|
101
|
+
}];
|
|
102
|
+
if (Array.isArray(messages)) return messages.map((msg) => typeof msg === "string" ? {
|
|
103
|
+
role: "user",
|
|
104
|
+
content: msg
|
|
105
|
+
} : msg);
|
|
106
|
+
return [messages];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Validate agent configuration before running
|
|
110
|
+
*/
|
|
111
|
+
static validateAgent(agent) {
|
|
112
|
+
const errors = [];
|
|
113
|
+
if (!agent.getId()) errors.push("Agent ID is required");
|
|
114
|
+
const defaultSubAgent = agent.getDefaultSubAgent();
|
|
115
|
+
if (!defaultSubAgent) errors.push("Default agent is required");
|
|
116
|
+
else if (!defaultSubAgent.getName()) errors.push("Default agent name is required");
|
|
117
|
+
const subAgents = agent.getSubAgents();
|
|
118
|
+
if (subAgents.length === 0) errors.push("Agent must contain at least one subagent");
|
|
119
|
+
for (const subAgent of subAgents) if (!subAgent.getName()) errors.push(`Agent missing name`);
|
|
120
|
+
return {
|
|
121
|
+
valid: errors.length === 0,
|
|
122
|
+
errors
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get execution statistics for an agent
|
|
127
|
+
*/
|
|
128
|
+
static async getExecutionStats(agent, messages, options) {
|
|
129
|
+
const subAgents = agent.getSubAgents();
|
|
130
|
+
const defaultSubAgent = agent.getDefaultSubAgent();
|
|
131
|
+
const messageCount = Array.isArray(messages) ? messages.length : 1;
|
|
132
|
+
return {
|
|
133
|
+
estimatedTurns: Math.min(Math.max(messageCount, 1), options?.maxTurns || 10),
|
|
134
|
+
estimatedTokens: messageCount * 100,
|
|
135
|
+
subAgentCount: subAgents.length,
|
|
136
|
+
defaultSubAgent: defaultSubAgent?.getName()
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const run = Runner.run.bind(Runner);
|
|
141
|
+
const stream = Runner.stream.bind(Runner);
|
|
142
|
+
const raceAgents = Runner.raceAgents.bind(Runner);
|
|
143
|
+
|
|
144
|
+
//#endregion
|
|
145
|
+
export { Runner, raceAgents, run, stream };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StatusComponent as StatusComponent$1 } from "@inkeep/agents-core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/status-component.d.ts
|
|
5
|
+
type StatusComponentConfigWithZod = Omit<StatusComponent$1, 'detailsSchema'> & {
|
|
6
|
+
detailsSchema?: Record<string, unknown> | z.ZodObject<any>;
|
|
7
|
+
};
|
|
8
|
+
interface StatusComponentInterface {
|
|
9
|
+
config: StatusComponent$1;
|
|
10
|
+
getType(): string;
|
|
11
|
+
getDescription(): string | undefined;
|
|
12
|
+
getDetailsSchema(): StatusComponent$1['detailsSchema'];
|
|
13
|
+
}
|
|
14
|
+
declare class StatusComponent implements StatusComponentInterface {
|
|
15
|
+
config: StatusComponent$1;
|
|
16
|
+
constructor(config: StatusComponentConfigWithZod);
|
|
17
|
+
getType(): string;
|
|
18
|
+
getDescription(): string | undefined;
|
|
19
|
+
getDetailsSchema(): StatusComponent$1['detailsSchema'];
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { StatusComponent, StatusComponentInterface };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getLogger } from "@inkeep/agents-core";
|
|
2
|
+
import { convertZodToJsonSchema, isZodSchema } from "@inkeep/agents-core/utils/schema-conversion";
|
|
3
|
+
|
|
4
|
+
//#region src/status-component.ts
|
|
5
|
+
const logger = getLogger("statusComponent");
|
|
6
|
+
var StatusComponent = class {
|
|
7
|
+
config;
|
|
8
|
+
constructor(config) {
|
|
9
|
+
let processedDetailsSchema;
|
|
10
|
+
if (config.detailsSchema && isZodSchema(config.detailsSchema)) {
|
|
11
|
+
const jsonSchema = convertZodToJsonSchema(config.detailsSchema);
|
|
12
|
+
processedDetailsSchema = {
|
|
13
|
+
type: "object",
|
|
14
|
+
properties: jsonSchema.properties || {},
|
|
15
|
+
required: jsonSchema.required || void 0
|
|
16
|
+
};
|
|
17
|
+
} else processedDetailsSchema = config.detailsSchema;
|
|
18
|
+
this.config = {
|
|
19
|
+
...config,
|
|
20
|
+
detailsSchema: processedDetailsSchema
|
|
21
|
+
};
|
|
22
|
+
logger.info({ statusComponentType: config.type }, "StatusComponent constructor initialized");
|
|
23
|
+
}
|
|
24
|
+
getType() {
|
|
25
|
+
return this.config.type;
|
|
26
|
+
}
|
|
27
|
+
getDescription() {
|
|
28
|
+
return this.config.description;
|
|
29
|
+
}
|
|
30
|
+
getDetailsSchema() {
|
|
31
|
+
return this.config.detailsSchema;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { StatusComponent };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Tool } from "./tool.js";
|
|
2
|
+
import { AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, SubAgentConfig, SubAgentInterface, subAgentExternalAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
3
|
+
import { ArtifactComponentApiInsert, DataComponentApiInsert } from "@inkeep/agents-core";
|
|
4
|
+
|
|
5
|
+
//#region src/subAgent.d.ts
|
|
6
|
+
declare class SubAgent implements SubAgentInterface {
|
|
7
|
+
config: SubAgentConfig;
|
|
8
|
+
readonly type: "internal";
|
|
9
|
+
private baseURL;
|
|
10
|
+
private tenantId;
|
|
11
|
+
private projectId;
|
|
12
|
+
private initialized;
|
|
13
|
+
constructor(config: SubAgentConfig);
|
|
14
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
15
|
+
getId(): string;
|
|
16
|
+
getName(): string;
|
|
17
|
+
getInstructions(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get the agent's description (the human-readable description field)
|
|
20
|
+
*/
|
|
21
|
+
getDescription(): string;
|
|
22
|
+
getTools(): Record<string, AgentTool>;
|
|
23
|
+
getModels(): typeof this.config.models;
|
|
24
|
+
setModels(models: typeof this.config.models): void;
|
|
25
|
+
getTransfers(): SubAgentInterface[];
|
|
26
|
+
getSubAgentDelegates(): SubAgentInterface[];
|
|
27
|
+
getExternalAgentDelegates(): subAgentExternalAgentInterface[];
|
|
28
|
+
getTeamAgentDelegates(): subAgentTeamAgentInterface[];
|
|
29
|
+
getDelegates(): AllDelegateOutputInterface[];
|
|
30
|
+
getDataComponents(): DataComponentApiInsert[];
|
|
31
|
+
getArtifactComponents(): ArtifactComponentApiInsert[];
|
|
32
|
+
addTool(_name: string, tool: Tool): void;
|
|
33
|
+
addTransfer(...agents: SubAgentInterface[]): void;
|
|
34
|
+
addDelegate(...agents: AllDelegateInputInterface[]): void;
|
|
35
|
+
init(): Promise<void>;
|
|
36
|
+
private upsertAgent;
|
|
37
|
+
private saveToolsAndRelations;
|
|
38
|
+
private saveDataComponents;
|
|
39
|
+
private saveArtifactComponents;
|
|
40
|
+
private loadDataComponents;
|
|
41
|
+
private loadArtifactComponents;
|
|
42
|
+
private createFunctionTool;
|
|
43
|
+
private createTool;
|
|
44
|
+
private createDataComponent;
|
|
45
|
+
private createArtifactComponent;
|
|
46
|
+
private createAgentDataComponentRelation;
|
|
47
|
+
private createAgentArtifactComponentRelation;
|
|
48
|
+
private createAgentToolRelation;
|
|
49
|
+
}
|
|
50
|
+
declare function agent(config: SubAgentConfig): SubAgent;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { SubAgent, agent };
|