@inkeep/agents-run-api 0.24.2 → 0.25.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.cjs +62 -30
- package/dist/index.js +63 -31
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1485,7 +1485,9 @@ var apiKeyAuth = () => factory.createMiddleware(async (c, next) => {
|
|
|
1485
1485
|
if (authHeader?.startsWith("Bearer ")) {
|
|
1486
1486
|
try {
|
|
1487
1487
|
executionContext = await extractContextFromApiKey(authHeader.substring(7), baseUrl);
|
|
1488
|
-
|
|
1488
|
+
if (subAgentId) {
|
|
1489
|
+
executionContext.subAgentId = subAgentId;
|
|
1490
|
+
}
|
|
1489
1491
|
logger2.info({}, "Development/test environment - API key authenticated successfully");
|
|
1490
1492
|
} catch {
|
|
1491
1493
|
executionContext = createExecutionContext({
|
|
@@ -1549,7 +1551,9 @@ var apiKeyAuth = () => factory.createMiddleware(async (c, next) => {
|
|
|
1549
1551
|
return;
|
|
1550
1552
|
} else if (apiKey) {
|
|
1551
1553
|
const executionContext = await extractContextFromApiKey(apiKey, baseUrl);
|
|
1552
|
-
|
|
1554
|
+
if (subAgentId) {
|
|
1555
|
+
executionContext.subAgentId = subAgentId;
|
|
1556
|
+
}
|
|
1553
1557
|
c.set("executionContext", executionContext);
|
|
1554
1558
|
logger2.info({}, "API key authenticated successfully");
|
|
1555
1559
|
await next();
|
|
@@ -1567,7 +1571,9 @@ var apiKeyAuth = () => factory.createMiddleware(async (c, next) => {
|
|
|
1567
1571
|
}
|
|
1568
1572
|
try {
|
|
1569
1573
|
const executionContext = await extractContextFromApiKey(apiKey, baseUrl);
|
|
1570
|
-
|
|
1574
|
+
if (subAgentId) {
|
|
1575
|
+
executionContext.subAgentId = subAgentId;
|
|
1576
|
+
}
|
|
1571
1577
|
c.set("executionContext", executionContext);
|
|
1572
1578
|
logger2.debug(
|
|
1573
1579
|
{
|
|
@@ -1596,13 +1602,28 @@ var extractContextFromApiKey = async (apiKey, baseUrl) => {
|
|
|
1596
1602
|
message: "Invalid or expired API key"
|
|
1597
1603
|
});
|
|
1598
1604
|
}
|
|
1605
|
+
const agent = await agentsCore.getAgentById(dbClient_default)({
|
|
1606
|
+
scopes: {
|
|
1607
|
+
tenantId: apiKeyRecord.tenantId,
|
|
1608
|
+
projectId: apiKeyRecord.projectId,
|
|
1609
|
+
agentId: apiKeyRecord.agentId
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
if (!agent) {
|
|
1613
|
+
throw new httpException.HTTPException(401, {
|
|
1614
|
+
message: "Invalid or expired API key"
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
logger2.info({ agent }, "agent");
|
|
1618
|
+
logger2.info({ defaultSubAgentId: agent.defaultSubAgentId }, "agent.defaultSubAgentId");
|
|
1599
1619
|
return createExecutionContext({
|
|
1600
1620
|
apiKey,
|
|
1601
1621
|
tenantId: apiKeyRecord.tenantId,
|
|
1602
1622
|
projectId: apiKeyRecord.projectId,
|
|
1603
1623
|
agentId: apiKeyRecord.agentId,
|
|
1604
1624
|
apiKeyId: apiKeyRecord.id,
|
|
1605
|
-
baseUrl
|
|
1625
|
+
baseUrl,
|
|
1626
|
+
subAgentId: agent.defaultSubAgentId || void 0
|
|
1606
1627
|
});
|
|
1607
1628
|
};
|
|
1608
1629
|
|
|
@@ -6696,15 +6717,7 @@ function createDelegateToAgentTool({
|
|
|
6696
6717
|
const isInternal = delegateConfig.type === "internal";
|
|
6697
6718
|
let resolvedHeaders = {};
|
|
6698
6719
|
if (!isInternal) {
|
|
6699
|
-
|
|
6700
|
-
scopes: {
|
|
6701
|
-
tenantId,
|
|
6702
|
-
projectId,
|
|
6703
|
-
agentId
|
|
6704
|
-
},
|
|
6705
|
-
subAgentId: delegateConfig.config.id
|
|
6706
|
-
});
|
|
6707
|
-
if (externalAgent && (externalAgent.credentialReferenceId || externalAgent.headers) && credentialStoreRegistry) {
|
|
6720
|
+
if ((delegateConfig.config.credentialReferenceId || delegateConfig.config.headers) && credentialStoreRegistry) {
|
|
6708
6721
|
const contextResolver = new agentsCore.ContextResolver(
|
|
6709
6722
|
tenantId,
|
|
6710
6723
|
projectId,
|
|
@@ -6720,13 +6733,13 @@ function createDelegateToAgentTool({
|
|
|
6720
6733
|
metadata
|
|
6721
6734
|
};
|
|
6722
6735
|
let storeReference;
|
|
6723
|
-
if (
|
|
6736
|
+
if (delegateConfig.config.credentialReferenceId) {
|
|
6724
6737
|
const credentialReference = await agentsCore.getCredentialReference(dbClient_default)({
|
|
6725
6738
|
scopes: {
|
|
6726
6739
|
tenantId,
|
|
6727
6740
|
projectId
|
|
6728
6741
|
},
|
|
6729
|
-
id:
|
|
6742
|
+
id: delegateConfig.config.credentialReferenceId
|
|
6730
6743
|
});
|
|
6731
6744
|
if (credentialReference) {
|
|
6732
6745
|
storeReference = {
|
|
@@ -6738,7 +6751,7 @@ function createDelegateToAgentTool({
|
|
|
6738
6751
|
resolvedHeaders = await credentialStuffer.getCredentialHeaders({
|
|
6739
6752
|
context: credentialContext,
|
|
6740
6753
|
storeReference,
|
|
6741
|
-
headers:
|
|
6754
|
+
headers: delegateConfig.config.headers || void 0
|
|
6742
6755
|
});
|
|
6743
6756
|
}
|
|
6744
6757
|
} else {
|
|
@@ -9727,7 +9740,8 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9727
9740
|
};
|
|
9728
9741
|
}
|
|
9729
9742
|
const [
|
|
9730
|
-
|
|
9743
|
+
internalRelations,
|
|
9744
|
+
externalRelations,
|
|
9731
9745
|
toolsForAgent,
|
|
9732
9746
|
dataComponents,
|
|
9733
9747
|
artifactComponents
|
|
@@ -9740,6 +9754,14 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9740
9754
|
},
|
|
9741
9755
|
subAgentId: config.subAgentId
|
|
9742
9756
|
}),
|
|
9757
|
+
agentsCore.getExternalAgentsForSubAgent(dbClient_default)({
|
|
9758
|
+
scopes: {
|
|
9759
|
+
tenantId: config.tenantId,
|
|
9760
|
+
projectId: config.projectId,
|
|
9761
|
+
agentId: config.agentId,
|
|
9762
|
+
subAgentId: config.subAgentId
|
|
9763
|
+
}
|
|
9764
|
+
}),
|
|
9743
9765
|
agentsCore.getToolsForAgent(dbClient_default)({
|
|
9744
9766
|
scopes: {
|
|
9745
9767
|
tenantId: config.tenantId,
|
|
@@ -9767,7 +9789,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9767
9789
|
]);
|
|
9768
9790
|
logger20.info({ toolsForAgent, internalRelations, externalRelations }, "agent stuff");
|
|
9769
9791
|
const enhancedInternalRelations = await Promise.all(
|
|
9770
|
-
internalRelations.map(async (relation) => {
|
|
9792
|
+
internalRelations.data.map(async (relation) => {
|
|
9771
9793
|
try {
|
|
9772
9794
|
const relatedAgent = await agentsCore.getSubAgentById(dbClient_default)({
|
|
9773
9795
|
scopes: {
|
|
@@ -9786,10 +9808,20 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9786
9808
|
},
|
|
9787
9809
|
subAgentId: relation.id
|
|
9788
9810
|
});
|
|
9811
|
+
const relatedAgentExternalAgentRelations = await agentsCore.getExternalAgentsForSubAgent(
|
|
9812
|
+
dbClient_default
|
|
9813
|
+
)({
|
|
9814
|
+
scopes: {
|
|
9815
|
+
tenantId: config.tenantId,
|
|
9816
|
+
projectId: config.projectId,
|
|
9817
|
+
agentId: config.agentId,
|
|
9818
|
+
subAgentId: relation.id
|
|
9819
|
+
}
|
|
9820
|
+
});
|
|
9789
9821
|
const enhancedDescription = generateDescriptionWithTransfers(
|
|
9790
9822
|
relation.description || "",
|
|
9791
|
-
relatedAgentRelations.
|
|
9792
|
-
|
|
9823
|
+
relatedAgentRelations.data,
|
|
9824
|
+
relatedAgentExternalAgentRelations.data
|
|
9793
9825
|
);
|
|
9794
9826
|
return { ...relation, description: enhancedDescription };
|
|
9795
9827
|
}
|
|
@@ -9866,14 +9898,17 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9866
9898
|
transferRelations: []
|
|
9867
9899
|
}
|
|
9868
9900
|
})),
|
|
9869
|
-
...externalRelations.map((relation) => ({
|
|
9901
|
+
...externalRelations.data.map((relation) => ({
|
|
9870
9902
|
type: "external",
|
|
9871
9903
|
config: {
|
|
9872
9904
|
id: relation.externalAgent.id,
|
|
9873
9905
|
name: relation.externalAgent.name,
|
|
9874
9906
|
description: relation.externalAgent.description || "",
|
|
9875
9907
|
baseUrl: relation.externalAgent.baseUrl,
|
|
9876
|
-
|
|
9908
|
+
headers: relation.headers,
|
|
9909
|
+
credentialReferenceId: relation.externalAgent.credentialReferenceId,
|
|
9910
|
+
relationId: relation.id,
|
|
9911
|
+
relationType: "delegate"
|
|
9877
9912
|
}
|
|
9878
9913
|
}))
|
|
9879
9914
|
],
|
|
@@ -10126,13 +10161,10 @@ function createAgentCard({
|
|
|
10126
10161
|
};
|
|
10127
10162
|
}
|
|
10128
10163
|
function generateDescriptionWithTransfers(baseDescription, internalRelations, externalRelations) {
|
|
10129
|
-
const transfers = [
|
|
10130
|
-
...internalRelations.filter((rel) => rel.relationType === "transfer"),
|
|
10131
|
-
...externalRelations.filter((rel) => rel.relationType === "transfer")
|
|
10132
|
-
];
|
|
10164
|
+
const transfers = [...internalRelations.filter((rel) => rel.relationType === "transfer")];
|
|
10133
10165
|
const delegates = [
|
|
10134
10166
|
...internalRelations.filter((rel) => rel.relationType === "delegate"),
|
|
10135
|
-
...externalRelations.
|
|
10167
|
+
...externalRelations.map((data) => data.externalAgent)
|
|
10136
10168
|
];
|
|
10137
10169
|
if (transfers.length === 0 && delegates.length === 0) {
|
|
10138
10170
|
return baseDescription;
|
|
@@ -10151,8 +10183,8 @@ ${transferList}`;
|
|
|
10151
10183
|
}
|
|
10152
10184
|
if (delegates.length > 0) {
|
|
10153
10185
|
const delegateList = delegates.map((rel) => {
|
|
10154
|
-
const name = rel.
|
|
10155
|
-
const desc = rel.
|
|
10186
|
+
const name = rel.name;
|
|
10187
|
+
const desc = rel.description || "";
|
|
10156
10188
|
return `- ${name}: ${desc}`;
|
|
10157
10189
|
}).join("\n");
|
|
10158
10190
|
enhancedDescription += `
|
|
@@ -10274,7 +10306,7 @@ app.openapi(
|
|
|
10274
10306
|
);
|
|
10275
10307
|
const executionContext = agentsCore.getRequestExecutionContext(c);
|
|
10276
10308
|
const { tenantId, projectId, agentId, subAgentId } = executionContext;
|
|
10277
|
-
|
|
10309
|
+
logger21.info({ executionContext }, "executionContext");
|
|
10278
10310
|
if (subAgentId) {
|
|
10279
10311
|
logger21.info(
|
|
10280
10312
|
{
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { dbClient_default } from './chunk-IBMWBEXH.js';
|
|
|
4
4
|
import { env } from './chunk-LHCIBW34.js';
|
|
5
5
|
import { getLogger } from './chunk-A2S7GSHL.js';
|
|
6
6
|
import { __publicField } from './chunk-PKBMQBKP.js';
|
|
7
|
-
import { getTracer, HeadersScopeSchema, getRequestExecutionContext, createApiError, getAgentWithDefaultSubAgent, contextValidationMiddleware, getConversationId, getFullAgent, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getSubAgentById, handleContextResolution, createMessage, generateId, commonGetErrorResponses, loggerFactory, getDataComponent, getProject, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, upsertLedgerArtifact, createTask, updateTask, setSpanWithError, updateConversation, handleApiError, TaskState, setActiveAgentForThread, getConversation, getAgentById, getRelatedAgentsForAgent, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, dbResultToMcpTool, validateAndGetApiKey, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getFunctionToolsForSubAgent, getFunction, getContextConfigById, getFullAgentDefinition, TemplateEngine, agentHasArtifactComponents, MCPTransportType, SPAN_KEYS
|
|
7
|
+
import { getTracer, HeadersScopeSchema, getRequestExecutionContext, createApiError, getAgentWithDefaultSubAgent, contextValidationMiddleware, getConversationId, getFullAgent, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getSubAgentById, handleContextResolution, createMessage, generateId, commonGetErrorResponses, loggerFactory, getDataComponent, getProject, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, upsertLedgerArtifact, createTask, updateTask, setSpanWithError, updateConversation, handleApiError, TaskState, setActiveAgentForThread, getConversation, getAgentById, getRelatedAgentsForAgent, getExternalAgentsForSubAgent, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, dbResultToMcpTool, validateAndGetApiKey, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getFunctionToolsForSubAgent, getFunction, getContextConfigById, getFullAgentDefinition, TemplateEngine, agentHasArtifactComponents, MCPTransportType, SPAN_KEYS } from '@inkeep/agents-core';
|
|
8
8
|
import { otel } from '@hono/otel';
|
|
9
9
|
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
10
10
|
import { trace, propagation, context, SpanStatusCode } from '@opentelemetry/api';
|
|
@@ -66,7 +66,9 @@ var apiKeyAuth = () => createMiddleware(async (c, next) => {
|
|
|
66
66
|
if (authHeader?.startsWith("Bearer ")) {
|
|
67
67
|
try {
|
|
68
68
|
executionContext = await extractContextFromApiKey(authHeader.substring(7), baseUrl);
|
|
69
|
-
|
|
69
|
+
if (subAgentId) {
|
|
70
|
+
executionContext.subAgentId = subAgentId;
|
|
71
|
+
}
|
|
70
72
|
logger.info({}, "Development/test environment - API key authenticated successfully");
|
|
71
73
|
} catch {
|
|
72
74
|
executionContext = createExecutionContext({
|
|
@@ -130,7 +132,9 @@ var apiKeyAuth = () => createMiddleware(async (c, next) => {
|
|
|
130
132
|
return;
|
|
131
133
|
} else if (apiKey) {
|
|
132
134
|
const executionContext = await extractContextFromApiKey(apiKey, baseUrl);
|
|
133
|
-
|
|
135
|
+
if (subAgentId) {
|
|
136
|
+
executionContext.subAgentId = subAgentId;
|
|
137
|
+
}
|
|
134
138
|
c.set("executionContext", executionContext);
|
|
135
139
|
logger.info({}, "API key authenticated successfully");
|
|
136
140
|
await next();
|
|
@@ -148,7 +152,9 @@ var apiKeyAuth = () => createMiddleware(async (c, next) => {
|
|
|
148
152
|
}
|
|
149
153
|
try {
|
|
150
154
|
const executionContext = await extractContextFromApiKey(apiKey, baseUrl);
|
|
151
|
-
|
|
155
|
+
if (subAgentId) {
|
|
156
|
+
executionContext.subAgentId = subAgentId;
|
|
157
|
+
}
|
|
152
158
|
c.set("executionContext", executionContext);
|
|
153
159
|
logger.debug(
|
|
154
160
|
{
|
|
@@ -177,13 +183,28 @@ var extractContextFromApiKey = async (apiKey, baseUrl) => {
|
|
|
177
183
|
message: "Invalid or expired API key"
|
|
178
184
|
});
|
|
179
185
|
}
|
|
186
|
+
const agent = await getAgentById(dbClient_default)({
|
|
187
|
+
scopes: {
|
|
188
|
+
tenantId: apiKeyRecord.tenantId,
|
|
189
|
+
projectId: apiKeyRecord.projectId,
|
|
190
|
+
agentId: apiKeyRecord.agentId
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
if (!agent) {
|
|
194
|
+
throw new HTTPException(401, {
|
|
195
|
+
message: "Invalid or expired API key"
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
logger.info({ agent }, "agent");
|
|
199
|
+
logger.info({ defaultSubAgentId: agent.defaultSubAgentId }, "agent.defaultSubAgentId");
|
|
180
200
|
return createExecutionContext({
|
|
181
201
|
apiKey,
|
|
182
202
|
tenantId: apiKeyRecord.tenantId,
|
|
183
203
|
projectId: apiKeyRecord.projectId,
|
|
184
204
|
agentId: apiKeyRecord.agentId,
|
|
185
205
|
apiKeyId: apiKeyRecord.id,
|
|
186
|
-
baseUrl
|
|
206
|
+
baseUrl,
|
|
207
|
+
subAgentId: agent.defaultSubAgentId || void 0
|
|
187
208
|
});
|
|
188
209
|
};
|
|
189
210
|
function setupOpenAPIRoutes(app7) {
|
|
@@ -5226,15 +5247,7 @@ function createDelegateToAgentTool({
|
|
|
5226
5247
|
const isInternal = delegateConfig.type === "internal";
|
|
5227
5248
|
let resolvedHeaders = {};
|
|
5228
5249
|
if (!isInternal) {
|
|
5229
|
-
|
|
5230
|
-
scopes: {
|
|
5231
|
-
tenantId,
|
|
5232
|
-
projectId,
|
|
5233
|
-
agentId
|
|
5234
|
-
},
|
|
5235
|
-
subAgentId: delegateConfig.config.id
|
|
5236
|
-
});
|
|
5237
|
-
if (externalAgent && (externalAgent.credentialReferenceId || externalAgent.headers) && credentialStoreRegistry) {
|
|
5250
|
+
if ((delegateConfig.config.credentialReferenceId || delegateConfig.config.headers) && credentialStoreRegistry) {
|
|
5238
5251
|
const contextResolver = new ContextResolver(
|
|
5239
5252
|
tenantId,
|
|
5240
5253
|
projectId,
|
|
@@ -5250,13 +5263,13 @@ function createDelegateToAgentTool({
|
|
|
5250
5263
|
metadata
|
|
5251
5264
|
};
|
|
5252
5265
|
let storeReference;
|
|
5253
|
-
if (
|
|
5266
|
+
if (delegateConfig.config.credentialReferenceId) {
|
|
5254
5267
|
const credentialReference = await getCredentialReference(dbClient_default)({
|
|
5255
5268
|
scopes: {
|
|
5256
5269
|
tenantId,
|
|
5257
5270
|
projectId
|
|
5258
5271
|
},
|
|
5259
|
-
id:
|
|
5272
|
+
id: delegateConfig.config.credentialReferenceId
|
|
5260
5273
|
});
|
|
5261
5274
|
if (credentialReference) {
|
|
5262
5275
|
storeReference = {
|
|
@@ -5268,7 +5281,7 @@ function createDelegateToAgentTool({
|
|
|
5268
5281
|
resolvedHeaders = await credentialStuffer.getCredentialHeaders({
|
|
5269
5282
|
context: credentialContext,
|
|
5270
5283
|
storeReference,
|
|
5271
|
-
headers:
|
|
5284
|
+
headers: delegateConfig.config.headers || void 0
|
|
5272
5285
|
});
|
|
5273
5286
|
}
|
|
5274
5287
|
} else {
|
|
@@ -8255,7 +8268,8 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8255
8268
|
};
|
|
8256
8269
|
}
|
|
8257
8270
|
const [
|
|
8258
|
-
|
|
8271
|
+
internalRelations,
|
|
8272
|
+
externalRelations,
|
|
8259
8273
|
toolsForAgent,
|
|
8260
8274
|
dataComponents,
|
|
8261
8275
|
artifactComponents
|
|
@@ -8268,6 +8282,14 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8268
8282
|
},
|
|
8269
8283
|
subAgentId: config.subAgentId
|
|
8270
8284
|
}),
|
|
8285
|
+
getExternalAgentsForSubAgent(dbClient_default)({
|
|
8286
|
+
scopes: {
|
|
8287
|
+
tenantId: config.tenantId,
|
|
8288
|
+
projectId: config.projectId,
|
|
8289
|
+
agentId: config.agentId,
|
|
8290
|
+
subAgentId: config.subAgentId
|
|
8291
|
+
}
|
|
8292
|
+
}),
|
|
8271
8293
|
getToolsForAgent(dbClient_default)({
|
|
8272
8294
|
scopes: {
|
|
8273
8295
|
tenantId: config.tenantId,
|
|
@@ -8295,7 +8317,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8295
8317
|
]);
|
|
8296
8318
|
logger16.info({ toolsForAgent, internalRelations, externalRelations }, "agent stuff");
|
|
8297
8319
|
const enhancedInternalRelations = await Promise.all(
|
|
8298
|
-
internalRelations.map(async (relation) => {
|
|
8320
|
+
internalRelations.data.map(async (relation) => {
|
|
8299
8321
|
try {
|
|
8300
8322
|
const relatedAgent = await getSubAgentById(dbClient_default)({
|
|
8301
8323
|
scopes: {
|
|
@@ -8314,10 +8336,20 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8314
8336
|
},
|
|
8315
8337
|
subAgentId: relation.id
|
|
8316
8338
|
});
|
|
8339
|
+
const relatedAgentExternalAgentRelations = await getExternalAgentsForSubAgent(
|
|
8340
|
+
dbClient_default
|
|
8341
|
+
)({
|
|
8342
|
+
scopes: {
|
|
8343
|
+
tenantId: config.tenantId,
|
|
8344
|
+
projectId: config.projectId,
|
|
8345
|
+
agentId: config.agentId,
|
|
8346
|
+
subAgentId: relation.id
|
|
8347
|
+
}
|
|
8348
|
+
});
|
|
8317
8349
|
const enhancedDescription = generateDescriptionWithTransfers(
|
|
8318
8350
|
relation.description || "",
|
|
8319
|
-
relatedAgentRelations.
|
|
8320
|
-
|
|
8351
|
+
relatedAgentRelations.data,
|
|
8352
|
+
relatedAgentExternalAgentRelations.data
|
|
8321
8353
|
);
|
|
8322
8354
|
return { ...relation, description: enhancedDescription };
|
|
8323
8355
|
}
|
|
@@ -8394,14 +8426,17 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8394
8426
|
transferRelations: []
|
|
8395
8427
|
}
|
|
8396
8428
|
})),
|
|
8397
|
-
...externalRelations.map((relation) => ({
|
|
8429
|
+
...externalRelations.data.map((relation) => ({
|
|
8398
8430
|
type: "external",
|
|
8399
8431
|
config: {
|
|
8400
8432
|
id: relation.externalAgent.id,
|
|
8401
8433
|
name: relation.externalAgent.name,
|
|
8402
8434
|
description: relation.externalAgent.description || "",
|
|
8403
8435
|
baseUrl: relation.externalAgent.baseUrl,
|
|
8404
|
-
|
|
8436
|
+
headers: relation.headers,
|
|
8437
|
+
credentialReferenceId: relation.externalAgent.credentialReferenceId,
|
|
8438
|
+
relationId: relation.id,
|
|
8439
|
+
relationType: "delegate"
|
|
8405
8440
|
}
|
|
8406
8441
|
}))
|
|
8407
8442
|
],
|
|
@@ -8653,13 +8688,10 @@ function createAgentCard({
|
|
|
8653
8688
|
};
|
|
8654
8689
|
}
|
|
8655
8690
|
function generateDescriptionWithTransfers(baseDescription, internalRelations, externalRelations) {
|
|
8656
|
-
const transfers = [
|
|
8657
|
-
...internalRelations.filter((rel) => rel.relationType === "transfer"),
|
|
8658
|
-
...externalRelations.filter((rel) => rel.relationType === "transfer")
|
|
8659
|
-
];
|
|
8691
|
+
const transfers = [...internalRelations.filter((rel) => rel.relationType === "transfer")];
|
|
8660
8692
|
const delegates = [
|
|
8661
8693
|
...internalRelations.filter((rel) => rel.relationType === "delegate"),
|
|
8662
|
-
...externalRelations.
|
|
8694
|
+
...externalRelations.map((data) => data.externalAgent)
|
|
8663
8695
|
];
|
|
8664
8696
|
if (transfers.length === 0 && delegates.length === 0) {
|
|
8665
8697
|
return baseDescription;
|
|
@@ -8678,8 +8710,8 @@ ${transferList}`;
|
|
|
8678
8710
|
}
|
|
8679
8711
|
if (delegates.length > 0) {
|
|
8680
8712
|
const delegateList = delegates.map((rel) => {
|
|
8681
|
-
const name = rel.
|
|
8682
|
-
const desc = rel.
|
|
8713
|
+
const name = rel.name;
|
|
8714
|
+
const desc = rel.description || "";
|
|
8683
8715
|
return `- ${name}: ${desc}`;
|
|
8684
8716
|
}).join("\n");
|
|
8685
8717
|
enhancedDescription += `
|
|
@@ -8799,7 +8831,7 @@ app.openapi(
|
|
|
8799
8831
|
);
|
|
8800
8832
|
const executionContext = getRequestExecutionContext(c);
|
|
8801
8833
|
const { tenantId, projectId, agentId, subAgentId } = executionContext;
|
|
8802
|
-
|
|
8834
|
+
logger17.info({ executionContext }, "executionContext");
|
|
8803
8835
|
if (subAgentId) {
|
|
8804
8836
|
logger17.info(
|
|
8805
8837
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"traverse": "^0.6.11",
|
|
53
53
|
"ts-pattern": "^5.7.1",
|
|
54
54
|
"zod": "^4.1.11",
|
|
55
|
-
"@inkeep/agents-core": "^0.
|
|
55
|
+
"@inkeep/agents-core": "^0.25.0"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
58
|
"keytar": "^7.9.0"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"nodemon": "^3.1.0",
|
|
70
70
|
"tsx": "^4.7.1",
|
|
71
71
|
"typescript": "^5.3.3",
|
|
72
|
-
"vite": "^7.1.
|
|
72
|
+
"vite": "^7.1.11",
|
|
73
73
|
"vite-tsconfig-paths": "^5.1.4",
|
|
74
74
|
"vitest": "^3.2.4"
|
|
75
75
|
},
|