@inkeep/agents-sdk 0.0.0-dev-20251009194333 → 0.0.0-dev-20251009215610
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 +1 -1
- package/dist/index.cjs +101 -101
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +101 -101
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -184,7 +184,7 @@ var DataComponent = class {
|
|
|
184
184
|
"DataComponent constructor initialized"
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
|
-
// Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
|
|
187
|
+
// Set context (tenantId, projectId, and baseURL) from external source (sub-agent, graph, CLI, etc)
|
|
188
188
|
setContext(tenantId, projectId, baseURL) {
|
|
189
189
|
this.tenantId = tenantId;
|
|
190
190
|
this.projectId = projectId;
|
|
@@ -706,7 +706,7 @@ var Agent = class {
|
|
|
706
706
|
logger6.info(
|
|
707
707
|
{
|
|
708
708
|
tenantId: this.tenantId,
|
|
709
|
-
|
|
709
|
+
subAgentId: this.config.id,
|
|
710
710
|
agentName: config.name
|
|
711
711
|
},
|
|
712
712
|
"Agent constructor initialized"
|
|
@@ -856,7 +856,7 @@ var Agent = class {
|
|
|
856
856
|
await this.saveArtifactComponents();
|
|
857
857
|
logger6.info(
|
|
858
858
|
{
|
|
859
|
-
|
|
859
|
+
subAgentId: this.getId()
|
|
860
860
|
},
|
|
861
861
|
"Agent initialized successfully"
|
|
862
862
|
);
|
|
@@ -864,7 +864,7 @@ var Agent = class {
|
|
|
864
864
|
} catch (error) {
|
|
865
865
|
logger6.error(
|
|
866
866
|
{
|
|
867
|
-
|
|
867
|
+
subAgentId: this.getId(),
|
|
868
868
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
869
869
|
},
|
|
870
870
|
"Failed to initialize agent"
|
|
@@ -896,7 +896,7 @@ var Agent = class {
|
|
|
896
896
|
if (updateResponse.ok) {
|
|
897
897
|
logger6.info(
|
|
898
898
|
{
|
|
899
|
-
|
|
899
|
+
subAgentId: this.getId()
|
|
900
900
|
},
|
|
901
901
|
"Agent updated successfully"
|
|
902
902
|
);
|
|
@@ -905,7 +905,7 @@ var Agent = class {
|
|
|
905
905
|
if (updateResponse.status === 404) {
|
|
906
906
|
logger6.info(
|
|
907
907
|
{
|
|
908
|
-
|
|
908
|
+
subAgentId: this.getId()
|
|
909
909
|
},
|
|
910
910
|
"Agent not found, creating new agent"
|
|
911
911
|
);
|
|
@@ -924,7 +924,7 @@ var Agent = class {
|
|
|
924
924
|
}
|
|
925
925
|
logger6.info(
|
|
926
926
|
{
|
|
927
|
-
|
|
927
|
+
subAgentId: this.getId()
|
|
928
928
|
},
|
|
929
929
|
"Agent created successfully"
|
|
930
930
|
);
|
|
@@ -1031,7 +1031,7 @@ var Agent = class {
|
|
|
1031
1031
|
this.config.dataComponents = () => uniqueComponents;
|
|
1032
1032
|
logger6.info(
|
|
1033
1033
|
{
|
|
1034
|
-
|
|
1034
|
+
subAgentId: this.getId(),
|
|
1035
1035
|
dbComponentCount: dbDataComponents.length,
|
|
1036
1036
|
configComponentCount: configComponents.length,
|
|
1037
1037
|
totalComponentCount: uniqueComponents.length
|
|
@@ -1041,7 +1041,7 @@ var Agent = class {
|
|
|
1041
1041
|
} catch (error) {
|
|
1042
1042
|
logger6.error(
|
|
1043
1043
|
{
|
|
1044
|
-
|
|
1044
|
+
subAgentId: this.getId(),
|
|
1045
1045
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1046
1046
|
},
|
|
1047
1047
|
"Failed to load data components from database"
|
|
@@ -1088,7 +1088,7 @@ var Agent = class {
|
|
|
1088
1088
|
this.config.artifactComponents = () => uniqueComponents;
|
|
1089
1089
|
logger6.info(
|
|
1090
1090
|
{
|
|
1091
|
-
|
|
1091
|
+
subAgentId: this.getId(),
|
|
1092
1092
|
dbComponentCount: dbArtifactComponents.length,
|
|
1093
1093
|
configComponentCount: configComponents.length,
|
|
1094
1094
|
totalComponentCount: uniqueComponents.length
|
|
@@ -1098,7 +1098,7 @@ var Agent = class {
|
|
|
1098
1098
|
} catch (error) {
|
|
1099
1099
|
logger6.error(
|
|
1100
1100
|
{
|
|
1101
|
-
|
|
1101
|
+
subAgentId: this.getId(),
|
|
1102
1102
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1103
1103
|
},
|
|
1104
1104
|
"Failed to load artifact components from database"
|
|
@@ -1232,7 +1232,7 @@ var Agent = class {
|
|
|
1232
1232
|
if (toolConfig.type === "function") {
|
|
1233
1233
|
logger6.info(
|
|
1234
1234
|
{
|
|
1235
|
-
|
|
1235
|
+
subAgentId: this.getId(),
|
|
1236
1236
|
toolId
|
|
1237
1237
|
},
|
|
1238
1238
|
"Skipping function tool creation - will be handled at runtime"
|
|
@@ -1264,7 +1264,7 @@ var Agent = class {
|
|
|
1264
1264
|
await this.createAgentToolRelation(tool.getId(), selectedTools, headers);
|
|
1265
1265
|
logger6.info(
|
|
1266
1266
|
{
|
|
1267
|
-
|
|
1267
|
+
subAgentId: this.getId(),
|
|
1268
1268
|
toolId: tool.getId()
|
|
1269
1269
|
},
|
|
1270
1270
|
"Tool created and linked to agent"
|
|
@@ -1272,7 +1272,7 @@ var Agent = class {
|
|
|
1272
1272
|
} catch (error) {
|
|
1273
1273
|
logger6.error(
|
|
1274
1274
|
{
|
|
1275
|
-
|
|
1275
|
+
subAgentId: this.getId(),
|
|
1276
1276
|
toolId,
|
|
1277
1277
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1278
1278
|
},
|
|
@@ -1294,7 +1294,7 @@ var Agent = class {
|
|
|
1294
1294
|
await this.createAgentDataComponentRelation(dc.getId());
|
|
1295
1295
|
logger6.info(
|
|
1296
1296
|
{
|
|
1297
|
-
|
|
1297
|
+
subAgentId: this.getId(),
|
|
1298
1298
|
dataComponentId: dc.getId()
|
|
1299
1299
|
},
|
|
1300
1300
|
"DataComponent created and linked to agent"
|
|
@@ -1302,7 +1302,7 @@ var Agent = class {
|
|
|
1302
1302
|
} catch (error) {
|
|
1303
1303
|
logger6.error(
|
|
1304
1304
|
{
|
|
1305
|
-
|
|
1305
|
+
subAgentId: this.getId(),
|
|
1306
1306
|
dataComponentName: dataComponent2.name,
|
|
1307
1307
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1308
1308
|
},
|
|
@@ -1324,7 +1324,7 @@ var Agent = class {
|
|
|
1324
1324
|
await this.createAgentArtifactComponentRelation(ac.getId());
|
|
1325
1325
|
logger6.info(
|
|
1326
1326
|
{
|
|
1327
|
-
|
|
1327
|
+
subAgentId: this.getId(),
|
|
1328
1328
|
artifactComponentId: ac.getId()
|
|
1329
1329
|
},
|
|
1330
1330
|
"ArtifactComponent created and linked to agent"
|
|
@@ -1332,7 +1332,7 @@ var Agent = class {
|
|
|
1332
1332
|
} catch (error) {
|
|
1333
1333
|
logger6.error(
|
|
1334
1334
|
{
|
|
1335
|
-
|
|
1335
|
+
subAgentId: this.getId(),
|
|
1336
1336
|
artifactComponentName: artifactComponent2.name,
|
|
1337
1337
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1338
1338
|
},
|
|
@@ -1352,7 +1352,7 @@ var Agent = class {
|
|
|
1352
1352
|
body: JSON.stringify({
|
|
1353
1353
|
id: `${this.getId()}-dc-${dataComponentId}`,
|
|
1354
1354
|
tenantId: this.tenantId,
|
|
1355
|
-
|
|
1355
|
+
subAgentId: this.getId(),
|
|
1356
1356
|
dataComponentId
|
|
1357
1357
|
})
|
|
1358
1358
|
}
|
|
@@ -1364,7 +1364,7 @@ var Agent = class {
|
|
|
1364
1364
|
}
|
|
1365
1365
|
logger6.info(
|
|
1366
1366
|
{
|
|
1367
|
-
|
|
1367
|
+
subAgentId: this.getId(),
|
|
1368
1368
|
dataComponentId
|
|
1369
1369
|
},
|
|
1370
1370
|
"Created agent-dataComponent relation"
|
|
@@ -1381,7 +1381,7 @@ var Agent = class {
|
|
|
1381
1381
|
body: JSON.stringify({
|
|
1382
1382
|
id: crypto.randomUUID(),
|
|
1383
1383
|
tenantId: this.tenantId,
|
|
1384
|
-
|
|
1384
|
+
subAgentId: this.getId(),
|
|
1385
1385
|
artifactComponentId
|
|
1386
1386
|
})
|
|
1387
1387
|
}
|
|
@@ -1393,7 +1393,7 @@ var Agent = class {
|
|
|
1393
1393
|
}
|
|
1394
1394
|
logger6.info(
|
|
1395
1395
|
{
|
|
1396
|
-
|
|
1396
|
+
subAgentId: this.getId(),
|
|
1397
1397
|
artifactComponentId
|
|
1398
1398
|
},
|
|
1399
1399
|
"Created agent-artifactComponent relation"
|
|
@@ -1404,7 +1404,7 @@ var Agent = class {
|
|
|
1404
1404
|
id: `${this.getId()}-tool-${toolId}`,
|
|
1405
1405
|
tenantId: this.tenantId,
|
|
1406
1406
|
projectId: this.projectId,
|
|
1407
|
-
|
|
1407
|
+
subAgentId: this.getId(),
|
|
1408
1408
|
toolId
|
|
1409
1409
|
};
|
|
1410
1410
|
if (selectedTools !== void 0) {
|
|
@@ -1494,7 +1494,7 @@ var AgentGraph = class {
|
|
|
1494
1494
|
constructor(config) {
|
|
1495
1495
|
__publicField(this, "agents", []);
|
|
1496
1496
|
__publicField(this, "agentMap", /* @__PURE__ */ new Map());
|
|
1497
|
-
__publicField(this, "
|
|
1497
|
+
__publicField(this, "defaultSubAgent");
|
|
1498
1498
|
__publicField(this, "baseURL");
|
|
1499
1499
|
__publicField(this, "tenantId");
|
|
1500
1500
|
__publicField(this, "projectId");
|
|
@@ -1510,7 +1510,7 @@ var AgentGraph = class {
|
|
|
1510
1510
|
__publicField(this, "graphPrompt");
|
|
1511
1511
|
__publicField(this, "stopWhen");
|
|
1512
1512
|
__publicField(this, "dbClient");
|
|
1513
|
-
this.
|
|
1513
|
+
this.defaultSubAgent = config.defaultSubAgent;
|
|
1514
1514
|
this.tenantId = "default";
|
|
1515
1515
|
this.projectId = "default";
|
|
1516
1516
|
this.graphId = config.id;
|
|
@@ -1531,9 +1531,9 @@ var AgentGraph = class {
|
|
|
1531
1531
|
} : void 0;
|
|
1532
1532
|
this.agents = resolveGetter2(config.agents) || [];
|
|
1533
1533
|
this.agentMap = new Map(this.agents.map((agent2) => [agent2.getId(), agent2]));
|
|
1534
|
-
if (this.
|
|
1535
|
-
this.agents.push(this.
|
|
1536
|
-
this.agentMap.set(this.
|
|
1534
|
+
if (this.defaultSubAgent) {
|
|
1535
|
+
this.agents.push(this.defaultSubAgent);
|
|
1536
|
+
this.agentMap.set(this.defaultSubAgent.getId(), this.defaultSubAgent);
|
|
1537
1537
|
}
|
|
1538
1538
|
if (this.models) {
|
|
1539
1539
|
this.propagateImmediateModelSettings();
|
|
@@ -1543,7 +1543,7 @@ var AgentGraph = class {
|
|
|
1543
1543
|
graphId: this.graphId,
|
|
1544
1544
|
tenantId: this.tenantId,
|
|
1545
1545
|
agentCount: this.agents.length,
|
|
1546
|
-
|
|
1546
|
+
defaultSubAgent: this.defaultSubAgent?.getName()
|
|
1547
1547
|
},
|
|
1548
1548
|
"AgentGraph created"
|
|
1549
1549
|
);
|
|
@@ -1618,17 +1618,17 @@ var AgentGraph = class {
|
|
|
1618
1618
|
tools.push(toolId);
|
|
1619
1619
|
}
|
|
1620
1620
|
const dataComponents = [];
|
|
1621
|
-
const
|
|
1622
|
-
if (
|
|
1623
|
-
for (const dataComponent2 of
|
|
1621
|
+
const subAgentDataComponents = internalAgent.getDataComponents();
|
|
1622
|
+
if (subAgentDataComponents) {
|
|
1623
|
+
for (const dataComponent2 of subAgentDataComponents) {
|
|
1624
1624
|
const dataComponentId = dataComponent2.id || dataComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
1625
1625
|
dataComponents.push(dataComponentId);
|
|
1626
1626
|
}
|
|
1627
1627
|
}
|
|
1628
1628
|
const artifactComponents = [];
|
|
1629
|
-
const
|
|
1630
|
-
if (
|
|
1631
|
-
for (const artifactComponent2 of
|
|
1629
|
+
const subAgentArtifactComponents = internalAgent.getArtifactComponents();
|
|
1630
|
+
if (subAgentArtifactComponents) {
|
|
1631
|
+
for (const artifactComponent2 of subAgentArtifactComponents) {
|
|
1632
1632
|
const artifactComponentId = artifactComponent2.id || artifactComponent2.name.toLowerCase().replace(/\s+/g, "-");
|
|
1633
1633
|
artifactComponents.push(artifactComponentId);
|
|
1634
1634
|
}
|
|
@@ -1669,8 +1669,8 @@ var AgentGraph = class {
|
|
|
1669
1669
|
id: this.graphId,
|
|
1670
1670
|
name: this.graphName,
|
|
1671
1671
|
description: this.graphDescription,
|
|
1672
|
-
|
|
1673
|
-
|
|
1672
|
+
defaultSubAgentId: this.defaultSubAgent?.getId() || "",
|
|
1673
|
+
subAgents: agentsObject,
|
|
1674
1674
|
contextConfig: this.contextConfig?.toObject(),
|
|
1675
1675
|
models: this.models,
|
|
1676
1676
|
statusUpdates: this.statusUpdateSettings,
|
|
@@ -1709,7 +1709,7 @@ var AgentGraph = class {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
logger8.debug(
|
|
1711
1711
|
{
|
|
1712
|
-
|
|
1712
|
+
subAgentId: agent2.getId(),
|
|
1713
1713
|
toolName,
|
|
1714
1714
|
toolType: toolInstance.constructor.name,
|
|
1715
1715
|
skipDbRegistration
|
|
@@ -1719,7 +1719,7 @@ var AgentGraph = class {
|
|
|
1719
1719
|
} catch (error) {
|
|
1720
1720
|
logger8.error(
|
|
1721
1721
|
{
|
|
1722
|
-
|
|
1722
|
+
subAgentId: agent2.getId(),
|
|
1723
1723
|
toolName,
|
|
1724
1724
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1725
1725
|
},
|
|
@@ -1825,7 +1825,7 @@ var AgentGraph = class {
|
|
|
1825
1825
|
await agent2.init();
|
|
1826
1826
|
logger8.debug(
|
|
1827
1827
|
{
|
|
1828
|
-
|
|
1828
|
+
subAgentId: agent2.getId(),
|
|
1829
1829
|
graphId: this.graphId
|
|
1830
1830
|
},
|
|
1831
1831
|
"Agent initialized in graph"
|
|
@@ -1833,7 +1833,7 @@ var AgentGraph = class {
|
|
|
1833
1833
|
} catch (error) {
|
|
1834
1834
|
logger8.error(
|
|
1835
1835
|
{
|
|
1836
|
-
|
|
1836
|
+
subAgentId: agent2.getId(),
|
|
1837
1837
|
graphId: this.graphId,
|
|
1838
1838
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1839
1839
|
},
|
|
@@ -1871,13 +1871,13 @@ var AgentGraph = class {
|
|
|
1871
1871
|
*/
|
|
1872
1872
|
async generate(input, options) {
|
|
1873
1873
|
await this._init();
|
|
1874
|
-
if (!this.
|
|
1874
|
+
if (!this.defaultSubAgent) {
|
|
1875
1875
|
throw new Error("No default agent configured for this graph");
|
|
1876
1876
|
}
|
|
1877
1877
|
logger8.info(
|
|
1878
1878
|
{
|
|
1879
1879
|
graphId: this.graphId,
|
|
1880
|
-
|
|
1880
|
+
defaultSubAgent: this.defaultSubAgent.getName(),
|
|
1881
1881
|
conversationId: options?.conversationId
|
|
1882
1882
|
},
|
|
1883
1883
|
"Generating response with default agent"
|
|
@@ -1890,13 +1890,13 @@ var AgentGraph = class {
|
|
|
1890
1890
|
*/
|
|
1891
1891
|
async stream(input, options) {
|
|
1892
1892
|
await this._init();
|
|
1893
|
-
if (!this.
|
|
1893
|
+
if (!this.defaultSubAgent) {
|
|
1894
1894
|
throw new Error("No default agent configured for this graph");
|
|
1895
1895
|
}
|
|
1896
1896
|
logger8.info(
|
|
1897
1897
|
{
|
|
1898
1898
|
graphId: this.graphId,
|
|
1899
|
-
|
|
1899
|
+
defaultSubAgent: this.defaultSubAgent.getName(),
|
|
1900
1900
|
conversationId: options?.conversationId
|
|
1901
1901
|
},
|
|
1902
1902
|
"Streaming response with default agent"
|
|
@@ -1921,21 +1921,21 @@ var AgentGraph = class {
|
|
|
1921
1921
|
/**
|
|
1922
1922
|
* Run with a specific agent from the graph
|
|
1923
1923
|
*/
|
|
1924
|
-
async runWith(
|
|
1924
|
+
async runWith(subAgentId, input, options) {
|
|
1925
1925
|
await this._init();
|
|
1926
|
-
const agent2 = this.getAgent(
|
|
1926
|
+
const agent2 = this.getAgent(subAgentId);
|
|
1927
1927
|
if (!agent2) {
|
|
1928
|
-
throw new Error(`Agent '${
|
|
1928
|
+
throw new Error(`Agent '${subAgentId}' not found in graph`);
|
|
1929
1929
|
}
|
|
1930
1930
|
if (!this.isInternalAgent(agent2)) {
|
|
1931
1931
|
throw new Error(
|
|
1932
|
-
`Agent '${
|
|
1932
|
+
`Agent '${subAgentId}' is an external agent and cannot be run directly. External agents are only accessible via delegation.`
|
|
1933
1933
|
);
|
|
1934
1934
|
}
|
|
1935
1935
|
logger8.info(
|
|
1936
1936
|
{
|
|
1937
1937
|
graphId: this.graphId,
|
|
1938
|
-
|
|
1938
|
+
subAgentId,
|
|
1939
1939
|
conversationId: options?.conversationId
|
|
1940
1940
|
},
|
|
1941
1941
|
"Running with specific agent"
|
|
@@ -1970,7 +1970,7 @@ var AgentGraph = class {
|
|
|
1970
1970
|
logger8.info(
|
|
1971
1971
|
{
|
|
1972
1972
|
graphId: this.graphId,
|
|
1973
|
-
|
|
1973
|
+
subAgentId: agent2.getId(),
|
|
1974
1974
|
agentType: this.isInternalAgent(agent2) ? "internal" : "external"
|
|
1975
1975
|
},
|
|
1976
1976
|
"Agent added to graph"
|
|
@@ -1987,7 +1987,7 @@ var AgentGraph = class {
|
|
|
1987
1987
|
logger8.info(
|
|
1988
1988
|
{
|
|
1989
1989
|
graphId: this.graphId,
|
|
1990
|
-
|
|
1990
|
+
subAgentId: agentToRemove.getId()
|
|
1991
1991
|
},
|
|
1992
1992
|
"Agent removed from graph"
|
|
1993
1993
|
);
|
|
@@ -2010,13 +2010,13 @@ var AgentGraph = class {
|
|
|
2010
2010
|
/**
|
|
2011
2011
|
* Set the default agent
|
|
2012
2012
|
*/
|
|
2013
|
-
|
|
2014
|
-
this.
|
|
2013
|
+
setdefaultSubAgent(agent2) {
|
|
2014
|
+
this.defaultSubAgent = agent2;
|
|
2015
2015
|
this.addAgent(agent2);
|
|
2016
2016
|
logger8.info(
|
|
2017
2017
|
{
|
|
2018
2018
|
graphId: this.graphId,
|
|
2019
|
-
|
|
2019
|
+
defaultSubAgent: agent2.getId()
|
|
2020
2020
|
},
|
|
2021
2021
|
"Default agent updated"
|
|
2022
2022
|
);
|
|
@@ -2024,8 +2024,8 @@ var AgentGraph = class {
|
|
|
2024
2024
|
/**
|
|
2025
2025
|
* Get the default agent
|
|
2026
2026
|
*/
|
|
2027
|
-
|
|
2028
|
-
return this.
|
|
2027
|
+
getdefaultSubAgent() {
|
|
2028
|
+
return this.defaultSubAgent;
|
|
2029
2029
|
}
|
|
2030
2030
|
/**
|
|
2031
2031
|
* Get the graph ID
|
|
@@ -2084,7 +2084,7 @@ var AgentGraph = class {
|
|
|
2084
2084
|
getStats() {
|
|
2085
2085
|
return {
|
|
2086
2086
|
agentCount: this.agents.length,
|
|
2087
|
-
|
|
2087
|
+
defaultSubAgent: this.defaultSubAgent?.getName() || null,
|
|
2088
2088
|
initialized: this.initialized,
|
|
2089
2089
|
graphId: this.graphId,
|
|
2090
2090
|
tenantId: this.tenantId
|
|
@@ -2098,7 +2098,7 @@ var AgentGraph = class {
|
|
|
2098
2098
|
if (this.agents.length === 0) {
|
|
2099
2099
|
errors.push("Graph must contain at least one agent");
|
|
2100
2100
|
}
|
|
2101
|
-
if (!this.
|
|
2101
|
+
if (!this.defaultSubAgent) {
|
|
2102
2102
|
errors.push("Graph must have a default agent");
|
|
2103
2103
|
}
|
|
2104
2104
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -2395,7 +2395,7 @@ var AgentGraph = class {
|
|
|
2395
2395
|
body: JSON.stringify({
|
|
2396
2396
|
id: this.graphId,
|
|
2397
2397
|
name: this.graphName,
|
|
2398
|
-
|
|
2398
|
+
defaultSubAgentId: this.defaultSubAgent?.getId() || "",
|
|
2399
2399
|
contextConfigId: this.contextConfig?.getId(),
|
|
2400
2400
|
models: this.models
|
|
2401
2401
|
})
|
|
@@ -2413,7 +2413,7 @@ var AgentGraph = class {
|
|
|
2413
2413
|
}
|
|
2414
2414
|
}
|
|
2415
2415
|
async saveRelations() {
|
|
2416
|
-
if (this.
|
|
2416
|
+
if (this.defaultSubAgent) {
|
|
2417
2417
|
try {
|
|
2418
2418
|
const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
|
|
2419
2419
|
const updateResponse = await fetch(updateUrl, {
|
|
@@ -2423,7 +2423,7 @@ var AgentGraph = class {
|
|
|
2423
2423
|
},
|
|
2424
2424
|
body: JSON.stringify({
|
|
2425
2425
|
id: this.graphId,
|
|
2426
|
-
|
|
2426
|
+
defaultSubAgentId: this.defaultSubAgent.getId(),
|
|
2427
2427
|
contextConfigId: this.contextConfig?.getId()
|
|
2428
2428
|
})
|
|
2429
2429
|
});
|
|
@@ -2433,7 +2433,7 @@ var AgentGraph = class {
|
|
|
2433
2433
|
logger8.debug(
|
|
2434
2434
|
{
|
|
2435
2435
|
graphId: this.graphId,
|
|
2436
|
-
|
|
2436
|
+
defaultSubAgent: this.defaultSubAgent.getName()
|
|
2437
2437
|
},
|
|
2438
2438
|
"Graph relationships configured"
|
|
2439
2439
|
);
|
|
@@ -2510,8 +2510,8 @@ var AgentGraph = class {
|
|
|
2510
2510
|
},
|
|
2511
2511
|
body: JSON.stringify({
|
|
2512
2512
|
graphId: this.graphId,
|
|
2513
|
-
|
|
2514
|
-
|
|
2513
|
+
sourceSubAgentId: sourceAgent.getId(),
|
|
2514
|
+
targetSubAgentId: targetAgent.getId(),
|
|
2515
2515
|
relationType
|
|
2516
2516
|
})
|
|
2517
2517
|
});
|
|
@@ -2520,8 +2520,8 @@ var AgentGraph = class {
|
|
|
2520
2520
|
if (response.status === 422 && errorText.includes("already exists")) {
|
|
2521
2521
|
logger8.info(
|
|
2522
2522
|
{
|
|
2523
|
-
|
|
2524
|
-
|
|
2523
|
+
sourceSubAgentId: sourceAgent.getId(),
|
|
2524
|
+
targetSubAgentId: targetAgent.getId(),
|
|
2525
2525
|
graphId: this.graphId,
|
|
2526
2526
|
relationType
|
|
2527
2527
|
},
|
|
@@ -2533,8 +2533,8 @@ var AgentGraph = class {
|
|
|
2533
2533
|
}
|
|
2534
2534
|
logger8.info(
|
|
2535
2535
|
{
|
|
2536
|
-
|
|
2537
|
-
|
|
2536
|
+
sourceSubAgentId: sourceAgent.getId(),
|
|
2537
|
+
targetSubAgentId: targetAgent.getId(),
|
|
2538
2538
|
graphId: this.graphId,
|
|
2539
2539
|
relationType
|
|
2540
2540
|
},
|
|
@@ -2543,8 +2543,8 @@ var AgentGraph = class {
|
|
|
2543
2543
|
} catch (error) {
|
|
2544
2544
|
logger8.error(
|
|
2545
2545
|
{
|
|
2546
|
-
|
|
2547
|
-
|
|
2546
|
+
sourceSubAgentId: sourceAgent.getId(),
|
|
2547
|
+
targetSubAgentId: targetAgent.getId(),
|
|
2548
2548
|
graphId: this.graphId,
|
|
2549
2549
|
relationType,
|
|
2550
2550
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -2563,8 +2563,8 @@ var AgentGraph = class {
|
|
|
2563
2563
|
},
|
|
2564
2564
|
body: JSON.stringify({
|
|
2565
2565
|
graphId: this.graphId,
|
|
2566
|
-
|
|
2567
|
-
|
|
2566
|
+
sourceSubAgentId: sourceAgent.getId(),
|
|
2567
|
+
externalSubAgentId: externalAgent2.getId(),
|
|
2568
2568
|
relationType
|
|
2569
2569
|
})
|
|
2570
2570
|
});
|
|
@@ -2573,8 +2573,8 @@ var AgentGraph = class {
|
|
|
2573
2573
|
if (response.status === 422 && errorText.includes("already exists")) {
|
|
2574
2574
|
logger8.info(
|
|
2575
2575
|
{
|
|
2576
|
-
|
|
2577
|
-
|
|
2576
|
+
sourceSubAgentId: sourceAgent.getId(),
|
|
2577
|
+
externalSubAgentId: externalAgent2.getId(),
|
|
2578
2578
|
graphId: this.graphId,
|
|
2579
2579
|
relationType
|
|
2580
2580
|
},
|
|
@@ -2588,8 +2588,8 @@ var AgentGraph = class {
|
|
|
2588
2588
|
}
|
|
2589
2589
|
logger8.info(
|
|
2590
2590
|
{
|
|
2591
|
-
|
|
2592
|
-
|
|
2591
|
+
sourceSubAgentId: sourceAgent.getId(),
|
|
2592
|
+
externalSubAgentId: externalAgent2.getId(),
|
|
2593
2593
|
graphId: this.graphId,
|
|
2594
2594
|
relationType
|
|
2595
2595
|
},
|
|
@@ -2598,8 +2598,8 @@ var AgentGraph = class {
|
|
|
2598
2598
|
} catch (error) {
|
|
2599
2599
|
logger8.error(
|
|
2600
2600
|
{
|
|
2601
|
-
|
|
2602
|
-
|
|
2601
|
+
sourceSubAgentId: sourceAgent.getId(),
|
|
2602
|
+
externalSubAgentId: externalAgent2.getId(),
|
|
2603
2603
|
graphId: this.graphId,
|
|
2604
2604
|
relationType,
|
|
2605
2605
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -2626,7 +2626,7 @@ var AgentGraph = class {
|
|
|
2626
2626
|
await externalAgent2.init();
|
|
2627
2627
|
logger8.debug(
|
|
2628
2628
|
{
|
|
2629
|
-
|
|
2629
|
+
externalSubAgentId: externalAgent2.getId(),
|
|
2630
2630
|
graphId: this.graphId
|
|
2631
2631
|
},
|
|
2632
2632
|
"External agent created in database"
|
|
@@ -2634,7 +2634,7 @@ var AgentGraph = class {
|
|
|
2634
2634
|
} catch (error) {
|
|
2635
2635
|
logger8.error(
|
|
2636
2636
|
{
|
|
2637
|
-
|
|
2637
|
+
externalSubAgentId: externalAgent2.getId(),
|
|
2638
2638
|
graphId: this.graphId,
|
|
2639
2639
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
2640
2640
|
},
|
|
@@ -3348,9 +3348,9 @@ var Project = class {
|
|
|
3348
3348
|
}
|
|
3349
3349
|
}
|
|
3350
3350
|
}
|
|
3351
|
-
const
|
|
3352
|
-
if (
|
|
3353
|
-
for (const dataComponent2 of
|
|
3351
|
+
const subAgentDataComponents = agent2.getDataComponents?.();
|
|
3352
|
+
if (subAgentDataComponents) {
|
|
3353
|
+
for (const dataComponent2 of subAgentDataComponents) {
|
|
3354
3354
|
let dataComponentId;
|
|
3355
3355
|
let dataComponentName;
|
|
3356
3356
|
let dataComponentDescription;
|
|
@@ -3376,9 +3376,9 @@ var Project = class {
|
|
|
3376
3376
|
}
|
|
3377
3377
|
}
|
|
3378
3378
|
}
|
|
3379
|
-
const
|
|
3380
|
-
if (
|
|
3381
|
-
for (const artifactComponent2 of
|
|
3379
|
+
const subAgentArtifactComponents = agent2.getArtifactComponents?.();
|
|
3380
|
+
if (subAgentArtifactComponents) {
|
|
3381
|
+
for (const artifactComponent2 of subAgentArtifactComponents) {
|
|
3382
3382
|
let artifactComponentId;
|
|
3383
3383
|
let artifactComponentName;
|
|
3384
3384
|
let artifactComponentDescription;
|
|
@@ -3657,7 +3657,7 @@ var ExternalAgent = class {
|
|
|
3657
3657
|
await this.upsertExternalAgent();
|
|
3658
3658
|
logger11.info(
|
|
3659
3659
|
{
|
|
3660
|
-
|
|
3660
|
+
externalSubAgentId: this.getId()
|
|
3661
3661
|
},
|
|
3662
3662
|
"External agent initialized successfully"
|
|
3663
3663
|
);
|
|
@@ -3665,7 +3665,7 @@ var ExternalAgent = class {
|
|
|
3665
3665
|
} catch (error) {
|
|
3666
3666
|
logger11.error(
|
|
3667
3667
|
{
|
|
3668
|
-
|
|
3668
|
+
externalSubAgentId: this.getId(),
|
|
3669
3669
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
3670
3670
|
},
|
|
3671
3671
|
"Failed to initialize external agent"
|
|
@@ -3707,7 +3707,7 @@ var ExternalAgent = class {
|
|
|
3707
3707
|
if (updateResponse.ok) {
|
|
3708
3708
|
logger11.info(
|
|
3709
3709
|
{
|
|
3710
|
-
|
|
3710
|
+
externalSubAgentId: this.getId()
|
|
3711
3711
|
},
|
|
3712
3712
|
"External agent updated successfully"
|
|
3713
3713
|
);
|
|
@@ -3716,7 +3716,7 @@ var ExternalAgent = class {
|
|
|
3716
3716
|
if (updateResponse.status === 404) {
|
|
3717
3717
|
logger11.info(
|
|
3718
3718
|
{
|
|
3719
|
-
|
|
3719
|
+
externalSubAgentId: this.getId()
|
|
3720
3720
|
},
|
|
3721
3721
|
"External agent not found, creating new external agent"
|
|
3722
3722
|
);
|
|
@@ -3738,7 +3738,7 @@ var ExternalAgent = class {
|
|
|
3738
3738
|
}
|
|
3739
3739
|
logger11.info(
|
|
3740
3740
|
{
|
|
3741
|
-
|
|
3741
|
+
externalSubAgentId: this.getId()
|
|
3742
3742
|
},
|
|
3743
3743
|
"External agent created successfully"
|
|
3744
3744
|
);
|
|
@@ -3826,7 +3826,7 @@ var Runner = class _Runner {
|
|
|
3826
3826
|
logger12.info(
|
|
3827
3827
|
{
|
|
3828
3828
|
graphId: graph.getId(),
|
|
3829
|
-
|
|
3829
|
+
defaultSubAgent: graph.getdefaultSubAgent()?.getName(),
|
|
3830
3830
|
maxTurns,
|
|
3831
3831
|
initialMessageCount: messageHistory.length
|
|
3832
3832
|
},
|
|
@@ -3853,7 +3853,7 @@ var Runner = class _Runner {
|
|
|
3853
3853
|
);
|
|
3854
3854
|
return {
|
|
3855
3855
|
finalOutput: response,
|
|
3856
|
-
agent: graph.
|
|
3856
|
+
agent: graph.getdefaultSubAgent() || {},
|
|
3857
3857
|
turnCount,
|
|
3858
3858
|
usage: { inputTokens: 0, outputTokens: 0 },
|
|
3859
3859
|
metadata: {
|
|
@@ -3880,7 +3880,7 @@ var Runner = class _Runner {
|
|
|
3880
3880
|
logger12.info(
|
|
3881
3881
|
{
|
|
3882
3882
|
graphId: graph.getId(),
|
|
3883
|
-
|
|
3883
|
+
defaultSubAgent: graph.getdefaultSubAgent()?.getName()
|
|
3884
3884
|
},
|
|
3885
3885
|
"Starting graph stream"
|
|
3886
3886
|
);
|
|
@@ -3945,14 +3945,14 @@ var Runner = class _Runner {
|
|
|
3945
3945
|
if (!graph.getId()) {
|
|
3946
3946
|
errors.push("Graph ID is required");
|
|
3947
3947
|
}
|
|
3948
|
-
const
|
|
3949
|
-
if (!
|
|
3948
|
+
const defaultSubAgent = graph.getdefaultSubAgent();
|
|
3949
|
+
if (!defaultSubAgent) {
|
|
3950
3950
|
errors.push("Default agent is required");
|
|
3951
3951
|
} else {
|
|
3952
|
-
if (!
|
|
3952
|
+
if (!defaultSubAgent.getName()) {
|
|
3953
3953
|
errors.push("Default agent name is required");
|
|
3954
3954
|
}
|
|
3955
|
-
if (!
|
|
3955
|
+
if (!defaultSubAgent.getInstructions()) {
|
|
3956
3956
|
errors.push("Default agent instructions are required");
|
|
3957
3957
|
}
|
|
3958
3958
|
}
|
|
@@ -3975,14 +3975,14 @@ var Runner = class _Runner {
|
|
|
3975
3975
|
*/
|
|
3976
3976
|
static async getExecutionStats(graph, messages, options) {
|
|
3977
3977
|
const agents = graph.getAgents();
|
|
3978
|
-
const
|
|
3978
|
+
const defaultSubAgent = graph.getdefaultSubAgent();
|
|
3979
3979
|
const messageCount = Array.isArray(messages) ? messages.length : 1;
|
|
3980
3980
|
return {
|
|
3981
3981
|
estimatedTurns: Math.min(Math.max(messageCount, 1), options?.maxTurns || 10),
|
|
3982
3982
|
estimatedTokens: messageCount * 100,
|
|
3983
3983
|
// Rough estimate
|
|
3984
3984
|
agentCount: agents.length,
|
|
3985
|
-
|
|
3985
|
+
defaultSubAgent: defaultSubAgent?.getName()
|
|
3986
3986
|
};
|
|
3987
3987
|
}
|
|
3988
3988
|
};
|