@inkeep/agents-sdk 0.0.0-dev-20251009233425 → 0.0.0-dev-20251010165126

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 CHANGED
@@ -27,7 +27,7 @@ export const graph = agentGraph({
27
27
  name: 'My Graph',
28
28
  description: 'My agent graph',
29
29
  defaultSubAgent: myAgent,
30
- agents: [myAgent],
30
+ subAgents: () => [myAgent],
31
31
  });
32
32
  ```
33
33
 
package/dist/index.cjs CHANGED
@@ -717,20 +717,18 @@ function resolveGetter(value) {
717
717
  }
718
718
  return value;
719
719
  }
720
- var Agent = class {
720
+ var SubAgent = class {
721
721
  constructor(config) {
722
722
  __publicField(this, "config");
723
723
  __publicField(this, "type", "internal");
724
724
  __publicField(this, "baseURL");
725
725
  __publicField(this, "tenantId");
726
726
  __publicField(this, "projectId");
727
- __publicField(this, "graphId");
728
727
  __publicField(this, "initialized", false);
729
728
  this.config = { ...config, type: "internal" };
730
729
  this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
731
730
  this.tenantId = "default";
732
731
  this.projectId = "default";
733
- this.graphId = "default";
734
732
  logger6.info(
735
733
  {
736
734
  tenantId: this.tenantId,
@@ -740,11 +738,10 @@ var Agent = class {
740
738
  "Agent constructor initialized"
741
739
  );
742
740
  }
743
- // Set context (tenantId, projectId, graphId, and baseURL) from external source (graph, CLI, etc)
744
- setContext(tenantId, projectId, graphId, baseURL) {
741
+ // Set context (tenantId, projectId, and baseURL) from external source (graph, CLI, etc)
742
+ setContext(tenantId, projectId, baseURL) {
745
743
  this.tenantId = tenantId;
746
744
  this.projectId = projectId;
747
- this.graphId = graphId;
748
745
  if (baseURL) {
749
746
  this.baseURL = baseURL;
750
747
  }
@@ -1520,7 +1517,7 @@ function resolveGetter2(value) {
1520
1517
  }
1521
1518
  var AgentGraph = class {
1522
1519
  constructor(config) {
1523
- __publicField(this, "agents", []);
1520
+ __publicField(this, "subAgents", []);
1524
1521
  __publicField(this, "agentMap", /* @__PURE__ */ new Map());
1525
1522
  __publicField(this, "defaultSubAgent");
1526
1523
  __publicField(this, "baseURL");
@@ -1557,10 +1554,10 @@ var AgentGraph = class {
1557
1554
  this.stopWhen = config.stopWhen ? {
1558
1555
  transferCountIs: config.stopWhen.transferCountIs
1559
1556
  } : void 0;
1560
- this.agents = resolveGetter2(config.agents) || [];
1561
- this.agentMap = new Map(this.agents.map((agent2) => [agent2.getId(), agent2]));
1557
+ this.subAgents = resolveGetter2(config.subAgents) || [];
1558
+ this.agentMap = new Map(this.subAgents.map((agent) => [agent.getId(), agent]));
1562
1559
  if (this.defaultSubAgent) {
1563
- this.agents.push(this.defaultSubAgent);
1560
+ this.subAgents.push(this.defaultSubAgent);
1564
1561
  this.agentMap.set(this.defaultSubAgent.getId(), this.defaultSubAgent);
1565
1562
  }
1566
1563
  if (this.models) {
@@ -1570,7 +1567,7 @@ var AgentGraph = class {
1570
1567
  {
1571
1568
  graphId: this.graphId,
1572
1569
  tenantId: this.tenantId,
1573
- agentCount: this.agents.length,
1570
+ agentCount: this.subAgents.length,
1574
1571
  defaultSubAgent: this.defaultSubAgent?.getName()
1575
1572
  },
1576
1573
  "AgentGraph created"
@@ -1587,9 +1584,9 @@ var AgentGraph = class {
1587
1584
  this.tenantId = tenantId;
1588
1585
  this.projectId = projectId;
1589
1586
  this.baseURL = apiUrl;
1590
- for (const agent2 of this.agents) {
1591
- if (this.isInternalAgent(agent2)) {
1592
- const internalAgent = agent2;
1587
+ for (const agent of this.subAgents) {
1588
+ if (this.isInternalAgent(agent)) {
1589
+ const internalAgent = agent;
1593
1590
  if (internalAgent.setContext) {
1594
1591
  internalAgent.setContext(tenantId, projectId, apiUrl);
1595
1592
  }
@@ -1602,7 +1599,7 @@ var AgentGraph = class {
1602
1599
  }
1603
1600
  }
1604
1601
  } else {
1605
- const externalAgent2 = agent2;
1602
+ const externalAgent2 = agent;
1606
1603
  if (externalAgent2.setContext) {
1607
1604
  externalAgent2.setContext(tenantId, apiUrl);
1608
1605
  }
@@ -1626,9 +1623,9 @@ var AgentGraph = class {
1626
1623
  */
1627
1624
  async toFullGraphDefinition() {
1628
1625
  const agentsObject = {};
1629
- for (const agent2 of this.agents) {
1630
- if (this.isInternalAgent(agent2)) {
1631
- const internalAgent = agent2;
1626
+ for (const agent of this.subAgents) {
1627
+ if (this.isInternalAgent(agent)) {
1628
+ const internalAgent = agent;
1632
1629
  const transfers = internalAgent.getTransfers();
1633
1630
  const delegates = internalAgent.getDelegates();
1634
1631
  const tools = [];
@@ -1681,7 +1678,7 @@ var AgentGraph = class {
1681
1678
  type: "internal"
1682
1679
  };
1683
1680
  } else {
1684
- const externalAgent2 = agent2;
1681
+ const externalAgent2 = agent;
1685
1682
  agentsObject[externalAgent2.getId()] = {
1686
1683
  id: externalAgent2.getId(),
1687
1684
  name: externalAgent2.getName(),
@@ -1713,11 +1710,11 @@ var AgentGraph = class {
1713
1710
  async initializeAllTools() {
1714
1711
  logger8.info({ graphId: this.graphId }, "Initializing all tools in graph");
1715
1712
  const toolInitPromises = [];
1716
- for (const agent2 of this.agents) {
1717
- if (!agent2.getTools) {
1713
+ for (const agent of this.subAgents) {
1714
+ if (!agent.getTools) {
1718
1715
  continue;
1719
1716
  }
1720
- const internalAgent = agent2;
1717
+ const internalAgent = agent;
1721
1718
  const agentTools = internalAgent.getTools();
1722
1719
  for (const [toolName, toolInstance] of Object.entries(agentTools)) {
1723
1720
  if (toolInstance && typeof toolInstance === "object") {
@@ -1737,7 +1734,7 @@ var AgentGraph = class {
1737
1734
  }
1738
1735
  logger8.debug(
1739
1736
  {
1740
- subAgentId: agent2.getId(),
1737
+ subAgentId: agent.getId(),
1741
1738
  toolName,
1742
1739
  toolType: toolInstance.constructor.name,
1743
1740
  skipDbRegistration
@@ -1747,7 +1744,7 @@ var AgentGraph = class {
1747
1744
  } catch (error) {
1748
1745
  logger8.error(
1749
1746
  {
1750
- subAgentId: agent2.getId(),
1747
+ subAgentId: agent.getId(),
1751
1748
  toolName,
1752
1749
  error: error instanceof Error ? error.message : "Unknown error"
1753
1750
  },
@@ -1778,7 +1775,7 @@ var AgentGraph = class {
1778
1775
  logger8.info(
1779
1776
  {
1780
1777
  graphId: this.graphId,
1781
- agentCount: this.agents.length
1778
+ agentCount: this.subAgents.length
1782
1779
  },
1783
1780
  "Initializing agent graph using new graph endpoint"
1784
1781
  );
@@ -1832,7 +1829,7 @@ var AgentGraph = class {
1832
1829
  logger8.info(
1833
1830
  {
1834
1831
  graphId: this.graphId,
1835
- agentCount: this.agents.length
1832
+ agentCount: this.subAgents.length
1836
1833
  },
1837
1834
  "Initializing agent graph"
1838
1835
  );
@@ -1847,13 +1844,13 @@ var AgentGraph = class {
1847
1844
  "Context configuration initialized for graph"
1848
1845
  );
1849
1846
  }
1850
- const initPromises = this.agents.map(async (agent2) => {
1847
+ const initPromises = this.subAgents.map(async (agent) => {
1851
1848
  try {
1852
- agent2.config.graphId = this.graphId;
1853
- await agent2.init();
1849
+ agent.config.graphId = this.graphId;
1850
+ await agent.init();
1854
1851
  logger8.debug(
1855
1852
  {
1856
- subAgentId: agent2.getId(),
1853
+ subAgentId: agent.getId(),
1857
1854
  graphId: this.graphId
1858
1855
  },
1859
1856
  "Agent initialized in graph"
@@ -1861,7 +1858,7 @@ var AgentGraph = class {
1861
1858
  } catch (error) {
1862
1859
  logger8.error(
1863
1860
  {
1864
- subAgentId: agent2.getId(),
1861
+ subAgentId: agent.getId(),
1865
1862
  graphId: this.graphId,
1866
1863
  error: error instanceof Error ? error.message : "Unknown error"
1867
1864
  },
@@ -1879,7 +1876,7 @@ var AgentGraph = class {
1879
1876
  logger8.info(
1880
1877
  {
1881
1878
  graphId: this.graphId,
1882
- agentCount: this.agents.length
1879
+ agentCount: this.subAgents.length
1883
1880
  },
1884
1881
  "Agent graph initialized successfully"
1885
1882
  );
@@ -1951,11 +1948,11 @@ var AgentGraph = class {
1951
1948
  */
1952
1949
  async runWith(subAgentId, input, options) {
1953
1950
  await this._init();
1954
- const agent2 = this.getAgent(subAgentId);
1955
- if (!agent2) {
1951
+ const agent = this.getAgent(subAgentId);
1952
+ if (!agent) {
1956
1953
  throw new Error(`Agent '${subAgentId}' not found in graph`);
1957
1954
  }
1958
- if (!this.isInternalAgent(agent2)) {
1955
+ if (!this.isInternalAgent(agent)) {
1959
1956
  throw new Error(
1960
1957
  `Agent '${subAgentId}' is an external agent and cannot be run directly. External agents are only accessible via delegation.`
1961
1958
  );
@@ -1971,7 +1968,7 @@ var AgentGraph = class {
1971
1968
  const response = await this.executeWithBackend(input, options);
1972
1969
  return {
1973
1970
  finalOutput: response,
1974
- agent: agent2,
1971
+ agent,
1975
1972
  turnCount: 1,
1976
1973
  usage: { inputTokens: 0, outputTokens: 0 },
1977
1974
  metadata: {
@@ -1989,17 +1986,17 @@ var AgentGraph = class {
1989
1986
  /**
1990
1987
  * Add an agent to the graph
1991
1988
  */
1992
- addAgent(agent2) {
1993
- this.agents.push(agent2);
1994
- this.agentMap.set(agent2.getId(), agent2);
1995
- if (this.models && this.isInternalAgent(agent2)) {
1996
- this.propagateModelSettingsToAgent(agent2);
1989
+ addSubAgent(agent) {
1990
+ this.subAgents.push(agent);
1991
+ this.agentMap.set(agent.getId(), agent);
1992
+ if (this.models && this.isInternalAgent(agent)) {
1993
+ this.propagateModelSettingsToAgent(agent);
1997
1994
  }
1998
1995
  logger8.info(
1999
1996
  {
2000
1997
  graphId: this.graphId,
2001
- subAgentId: agent2.getId(),
2002
- agentType: this.isInternalAgent(agent2) ? "internal" : "external"
1998
+ subAgentId: agent.getId(),
1999
+ agentType: this.isInternalAgent(agent) ? "internal" : "external"
2003
2000
  },
2004
2001
  "Agent added to graph"
2005
2002
  );
@@ -2007,11 +2004,11 @@ var AgentGraph = class {
2007
2004
  /**
2008
2005
  * Remove an agent from the graph
2009
2006
  */
2010
- removeAgent(id) {
2007
+ removeSubAgent(id) {
2011
2008
  const agentToRemove = this.agentMap.get(id);
2012
2009
  if (agentToRemove) {
2013
2010
  this.agentMap.delete(agentToRemove.getId());
2014
- this.agents = this.agents.filter((agent2) => agent2.getId() !== agentToRemove.getId());
2011
+ this.subAgents = this.subAgents.filter((agent) => agent.getId() !== agentToRemove.getId());
2015
2012
  logger8.info(
2016
2013
  {
2017
2014
  graphId: this.graphId,
@@ -2026,25 +2023,25 @@ var AgentGraph = class {
2026
2023
  /**
2027
2024
  * Get all agents in the graph
2028
2025
  */
2029
- getAgents() {
2030
- return this.agents;
2026
+ getSubAgents() {
2027
+ return this.subAgents;
2031
2028
  }
2032
2029
  /**
2033
2030
  * Get all agent ids (unified method for all agent types)
2034
2031
  */
2035
- getAgentIds() {
2032
+ getSubAgentIds() {
2036
2033
  return Array.from(this.agentMap.keys());
2037
2034
  }
2038
2035
  /**
2039
2036
  * Set the default agent
2040
2037
  */
2041
- setdefaultSubAgent(agent2) {
2042
- this.defaultSubAgent = agent2;
2043
- this.addAgent(agent2);
2038
+ setdefaultSubAgent(agent) {
2039
+ this.defaultSubAgent = agent;
2040
+ this.addSubAgent(agent);
2044
2041
  logger8.info(
2045
2042
  {
2046
2043
  graphId: this.graphId,
2047
- defaultSubAgent: agent2.getId()
2044
+ defaultSubAgent: agent.getId()
2048
2045
  },
2049
2046
  "Default agent updated"
2050
2047
  );
@@ -2111,7 +2108,7 @@ var AgentGraph = class {
2111
2108
  */
2112
2109
  getStats() {
2113
2110
  return {
2114
- agentCount: this.agents.length,
2111
+ agentCount: this.subAgents.length,
2115
2112
  defaultSubAgent: this.defaultSubAgent?.getName() || null,
2116
2113
  initialized: this.initialized,
2117
2114
  graphId: this.graphId,
@@ -2123,35 +2120,35 @@ var AgentGraph = class {
2123
2120
  */
2124
2121
  validate() {
2125
2122
  const errors = [];
2126
- if (this.agents.length === 0) {
2123
+ if (this.subAgents.length === 0) {
2127
2124
  errors.push("Graph must contain at least one agent");
2128
2125
  }
2129
2126
  if (!this.defaultSubAgent) {
2130
2127
  errors.push("Graph must have a default agent");
2131
2128
  }
2132
2129
  const names = /* @__PURE__ */ new Set();
2133
- for (const agent2 of this.agents) {
2134
- const name = agent2.getName();
2130
+ for (const agent of this.subAgents) {
2131
+ const name = agent.getName();
2135
2132
  if (names.has(name)) {
2136
2133
  errors.push(`Duplicate agent name: ${name}`);
2137
2134
  }
2138
2135
  names.add(name);
2139
2136
  }
2140
- for (const agent2 of this.agents) {
2141
- if (!this.isInternalAgent(agent2)) continue;
2142
- const transfers = agent2.getTransfers();
2137
+ for (const agent of this.subAgents) {
2138
+ if (!this.isInternalAgent(agent)) continue;
2139
+ const transfers = agent.getTransfers();
2143
2140
  for (const transferAgent of transfers) {
2144
2141
  if (!this.agentMap.has(transferAgent.getName())) {
2145
2142
  errors.push(
2146
- `Agent '${agent2.getName()}' has transfer to '${transferAgent.getName()}' which is not in the graph`
2143
+ `Agent '${agent.getName()}' has transfer to '${transferAgent.getName()}' which is not in the graph`
2147
2144
  );
2148
2145
  }
2149
2146
  }
2150
- const delegates = agent2.getDelegates();
2147
+ const delegates = agent.getDelegates();
2151
2148
  for (const delegateAgent of delegates) {
2152
2149
  if (!this.agentMap.has(delegateAgent.getName())) {
2153
2150
  errors.push(
2154
- `Agent '${agent2.getName()}' has delegation to '${delegateAgent.getName()}' which is not in the graph`
2151
+ `Agent '${agent.getName()}' has delegation to '${delegateAgent.getName()}' which is not in the graph`
2155
2152
  );
2156
2153
  }
2157
2154
  }
@@ -2170,8 +2167,8 @@ var AgentGraph = class {
2170
2167
  /**
2171
2168
  * Type guard to check if an agent is an internal AgentInterface
2172
2169
  */
2173
- isInternalAgent(agent2) {
2174
- return "getTransfers" in agent2 && typeof agent2.getTransfers === "function";
2170
+ isInternalAgent(agent) {
2171
+ return "getTransfers" in agent && typeof agent.getTransfers === "function";
2175
2172
  }
2176
2173
  /**
2177
2174
  * Get project-level model settingsuration defaults
@@ -2235,9 +2232,9 @@ var AgentGraph = class {
2235
2232
  }
2236
2233
  }
2237
2234
  await this.applyStopWhenInheritance();
2238
- for (const agent2 of this.agents) {
2239
- if (this.isInternalAgent(agent2)) {
2240
- this.propagateModelSettingsToAgent(agent2);
2235
+ for (const agent of this.subAgents) {
2236
+ if (this.isInternalAgent(agent)) {
2237
+ this.propagateModelSettingsToAgent(agent);
2241
2238
  }
2242
2239
  }
2243
2240
  }
@@ -2256,9 +2253,9 @@ var AgentGraph = class {
2256
2253
  this.stopWhen.transferCountIs = 10;
2257
2254
  }
2258
2255
  if (projectStopWhen?.stepCountIs !== void 0) {
2259
- for (const agent2 of this.agents) {
2260
- if (this.isInternalAgent(agent2)) {
2261
- const internalAgent = agent2;
2256
+ for (const agent of this.subAgents) {
2257
+ if (this.isInternalAgent(agent)) {
2258
+ const internalAgent = agent;
2262
2259
  if (!internalAgent.config.stopWhen) {
2263
2260
  internalAgent.config.stopWhen = {};
2264
2261
  }
@@ -2280,19 +2277,19 @@ var AgentGraph = class {
2280
2277
  /**
2281
2278
  * Propagate graph-level model settings to agents (supporting partial inheritance)
2282
2279
  */
2283
- propagateModelSettingsToAgent(agent2) {
2280
+ propagateModelSettingsToAgent(agent) {
2284
2281
  if (this.models) {
2285
- if (!agent2.config.models) {
2286
- agent2.config.models = {};
2282
+ if (!agent.config.models) {
2283
+ agent.config.models = {};
2287
2284
  }
2288
- if (!agent2.config.models.base && this.models.base) {
2289
- agent2.config.models.base = this.models.base;
2285
+ if (!agent.config.models.base && this.models.base) {
2286
+ agent.config.models.base = this.models.base;
2290
2287
  }
2291
- if (!agent2.config.models.structuredOutput && this.models.structuredOutput) {
2292
- agent2.config.models.structuredOutput = this.models.structuredOutput;
2288
+ if (!agent.config.models.structuredOutput && this.models.structuredOutput) {
2289
+ agent.config.models.structuredOutput = this.models.structuredOutput;
2293
2290
  }
2294
- if (!agent2.config.models.summarizer && this.models.summarizer) {
2295
- agent2.config.models.summarizer = this.models.summarizer;
2291
+ if (!agent.config.models.summarizer && this.models.summarizer) {
2292
+ agent.config.models.summarizer = this.models.summarizer;
2296
2293
  }
2297
2294
  }
2298
2295
  }
@@ -2300,17 +2297,17 @@ var AgentGraph = class {
2300
2297
  * Immediately propagate graph-level models to all agents during construction
2301
2298
  */
2302
2299
  propagateImmediateModelSettings() {
2303
- for (const agent2 of this.agents) {
2304
- if (this.isInternalAgent(agent2)) {
2305
- this.propagateModelSettingsToAgent(agent2);
2300
+ for (const agent of this.subAgents) {
2301
+ if (this.isInternalAgent(agent)) {
2302
+ this.propagateModelSettingsToAgent(agent);
2306
2303
  }
2307
2304
  }
2308
2305
  }
2309
2306
  /**
2310
2307
  * Type guard to check if an agent is an external AgentInterface
2311
2308
  */
2312
- isExternalAgent(agent2) {
2313
- return !this.isInternalAgent(agent2);
2309
+ isExternalAgent(agent) {
2310
+ return !this.isInternalAgent(agent);
2314
2311
  }
2315
2312
  /**
2316
2313
  * Execute agent using the backend system instead of local runner
@@ -2479,21 +2476,21 @@ var AgentGraph = class {
2479
2476
  }
2480
2477
  async createAgentRelations() {
2481
2478
  const allRelationPromises = [];
2482
- for (const agent2 of this.agents) {
2483
- if (this.isInternalAgent(agent2)) {
2484
- const transfers = agent2.getTransfers();
2479
+ for (const agent of this.subAgents) {
2480
+ if (this.isInternalAgent(agent)) {
2481
+ const transfers = agent.getTransfers();
2485
2482
  for (const transferAgent of transfers) {
2486
2483
  allRelationPromises.push(
2487
- this.createInternalAgentRelation(agent2, transferAgent, "transfer")
2484
+ this.createInternalAgentRelation(agent, transferAgent, "transfer")
2488
2485
  );
2489
2486
  }
2490
- const delegates = agent2.getDelegates();
2487
+ const delegates = agent.getDelegates();
2491
2488
  for (const delegate of delegates) {
2492
2489
  if (delegate.type === "external") {
2493
- allRelationPromises.push(this.createExternalAgentRelation(agent2, delegate, "delegate"));
2490
+ allRelationPromises.push(this.createExternalAgentRelation(agent, delegate, "delegate"));
2494
2491
  } else {
2495
2492
  allRelationPromises.push(
2496
- this.createInternalAgentRelation(agent2, delegate, "delegate")
2493
+ this.createInternalAgentRelation(agent, delegate, "delegate")
2497
2494
  );
2498
2495
  }
2499
2496
  }
@@ -2641,7 +2638,7 @@ var AgentGraph = class {
2641
2638
  * Create external agents in the database
2642
2639
  */
2643
2640
  async createExternalAgents() {
2644
- const externalAgents2 = this.agents.filter((agent2) => this.isExternalAgent(agent2));
2641
+ const externalAgents2 = this.subAgents.filter((agent) => this.isExternalAgent(agent));
2645
2642
  logger8.info(
2646
2643
  {
2647
2644
  graphId: this.graphId,
@@ -3313,11 +3310,11 @@ var Project = class {
3313
3310
  }
3314
3311
  }
3315
3312
  }
3316
- for (const agent2 of graph.getAgents()) {
3317
- if (agent2.type === "external") {
3313
+ for (const agent of graph.getSubAgents()) {
3314
+ if (agent.type === "external") {
3318
3315
  continue;
3319
3316
  }
3320
- const agentTools = agent2.getTools();
3317
+ const agentTools = agent.getTools();
3321
3318
  for (const [, toolInstance] of Object.entries(agentTools)) {
3322
3319
  const actualTool = toolInstance;
3323
3320
  const toolId = actualTool.getId();
@@ -3376,7 +3373,7 @@ var Project = class {
3376
3373
  }
3377
3374
  }
3378
3375
  }
3379
- const subAgentDataComponents = agent2.getDataComponents?.();
3376
+ const subAgentDataComponents = agent.getDataComponents?.();
3380
3377
  if (subAgentDataComponents) {
3381
3378
  for (const dataComponent2 of subAgentDataComponents) {
3382
3379
  let dataComponentId;
@@ -3404,7 +3401,7 @@ var Project = class {
3404
3401
  }
3405
3402
  }
3406
3403
  }
3407
- const subAgentArtifactComponents = agent2.getArtifactComponents?.();
3404
+ const subAgentArtifactComponents = agent.getArtifactComponents?.();
3408
3405
  if (subAgentArtifactComponents) {
3409
3406
  for (const artifactComponent2 of subAgentArtifactComponents) {
3410
3407
  let artifactComponentId;
@@ -3534,13 +3531,13 @@ function agentGraph(config) {
3534
3531
  function project(config) {
3535
3532
  return new Project(config);
3536
3533
  }
3537
- function agent(config) {
3534
+ function subAgent(config) {
3538
3535
  if (!config.id) {
3539
3536
  throw new Error(
3540
- "Agent ID is required. Agents must have stable IDs for consistency across deployments."
3537
+ "Sub-Agent ID is required. Sub-Agents must have stable IDs for consistency across deployments."
3541
3538
  );
3542
3539
  }
3543
- return new Agent(config);
3540
+ return new SubAgent(config);
3544
3541
  }
3545
3542
  function credential(config) {
3546
3543
  return agentsCore.CredentialReferenceApiInsertSchema.parse(config);
@@ -3595,17 +3592,6 @@ function functionTool(config) {
3595
3592
  return new FunctionTool(config);
3596
3593
  }
3597
3594
 
3598
- // src/credential-ref.ts
3599
- function credentialRef(id) {
3600
- return {
3601
- __type: "credential-ref",
3602
- id
3603
- };
3604
- }
3605
- function isCredentialReference(value) {
3606
- return value && typeof value === "object" && value.__type === "credential-ref";
3607
- }
3608
-
3609
3595
  // src/utils/validateFunction.ts
3610
3596
  function validateFunction(value, name) {
3611
3597
  if (typeof value !== "function") {
@@ -3615,7 +3601,7 @@ function validateFunction(value, name) {
3615
3601
 
3616
3602
  // src/builders.ts
3617
3603
  var TransferConfigSchema = zod.z.object({
3618
- agent: zod.z.instanceof(Agent),
3604
+ agent: zod.z.instanceof(SubAgent),
3619
3605
  description: zod.z.string().optional()
3620
3606
  });
3621
3607
  function transfer(targetAgent, description, condition) {
@@ -3634,6 +3620,17 @@ function transfer(targetAgent, description, condition) {
3634
3620
  return config;
3635
3621
  }
3636
3622
 
3623
+ // src/credential-ref.ts
3624
+ function credentialRef(id) {
3625
+ return {
3626
+ __type: "credential-ref",
3627
+ id
3628
+ };
3629
+ }
3630
+ function isCredentialReference(value) {
3631
+ return value && typeof value === "object" && value.__type === "credential-ref";
3632
+ }
3633
+
3637
3634
  // src/environment-settings.ts
3638
3635
  function createEnvironmentSettings(environments) {
3639
3636
  return {
@@ -3984,12 +3981,12 @@ var Runner = class _Runner {
3984
3981
  errors.push("Default agent instructions are required");
3985
3982
  }
3986
3983
  }
3987
- const agents = graph.getAgents();
3984
+ const agents = graph.getSubAgents();
3988
3985
  if (agents.length === 0) {
3989
3986
  errors.push("Graph must contain at least one agent");
3990
3987
  }
3991
- for (const agent2 of agents) {
3992
- if (!agent2.getName()) {
3988
+ for (const agent of agents) {
3989
+ if (!agent.getName()) {
3993
3990
  errors.push(`Agent missing name`);
3994
3991
  }
3995
3992
  }
@@ -4002,7 +3999,7 @@ var Runner = class _Runner {
4002
3999
  * Get execution statistics for a graph
4003
4000
  */
4004
4001
  static async getExecutionStats(graph, messages, options) {
4005
- const agents = graph.getAgents();
4002
+ const agents = graph.getSubAgents();
4006
4003
  const defaultSubAgent = graph.getdefaultSubAgent();
4007
4004
  const messageCount = Array.isArray(messages) ? messages.length : 1;
4008
4005
  return {
@@ -4018,7 +4015,7 @@ var run = Runner.run.bind(Runner);
4018
4015
  var stream = Runner.stream.bind(Runner);
4019
4016
  var raceGraphs = Runner.raceGraphs.bind(Runner);
4020
4017
 
4021
- exports.Agent = Agent;
4018
+ exports.Agent = SubAgent;
4022
4019
  exports.ArtifactComponent = ArtifactComponent;
4023
4020
  exports.DataComponent = DataComponent;
4024
4021
  exports.ExternalAgent = ExternalAgent;
@@ -4026,7 +4023,7 @@ exports.FunctionTool = FunctionTool;
4026
4023
  exports.Project = Project;
4027
4024
  exports.Runner = Runner;
4028
4025
  exports.Tool = Tool;
4029
- exports.agent = agent;
4026
+ exports.agent = subAgent;
4030
4027
  exports.agentGraph = agentGraph;
4031
4028
  exports.agentMcp = agentMcp;
4032
4029
  exports.artifactComponent = artifactComponent;