@inkeep/agents-sdk 0.0.0-dev-20251012022558 → 0.0.0-dev-20251012045242

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 CHANGED
@@ -78,7 +78,7 @@ var ArtifactComponent = class {
78
78
  "ArtifactComponent constructor initialized"
79
79
  );
80
80
  }
81
- // Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
81
+ // Set context (tenantId, projectId, and baseURL) from external source (agent, agent, CLI, etc)
82
82
  setContext(tenantId, projectId, baseURL) {
83
83
  this.tenantId = tenantId;
84
84
  this.projectId = projectId;
@@ -226,7 +226,7 @@ var DataComponent = class {
226
226
  "DataComponent constructor initialized"
227
227
  );
228
228
  }
229
- // Set context (tenantId, projectId, and baseURL) from external source (sub-agent, graph, CLI, etc)
229
+ // Set context (tenantId, projectId, and baseURL) from external source (sub-agent, agent, CLI, etc)
230
230
  setContext(tenantId, projectId, baseURL) {
231
231
  this.tenantId = tenantId;
232
232
  this.projectId = projectId;
@@ -579,7 +579,7 @@ var Tool = class {
579
579
  "Tool constructor initialized"
580
580
  );
581
581
  }
582
- // Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
582
+ // Set context (tenantId, projectId, and baseURL) from external source (agent, agent, CLI, etc)
583
583
  setContext(tenantId, projectId, baseURL) {
584
584
  this.tenantId = tenantId;
585
585
  this.projectId = projectId;
@@ -734,7 +734,7 @@ function normalizeAgentCanUseType(value, fallbackName) {
734
734
  throw new Error(`Invalid AgentCanUseType: expected Tool or AgentMcpConfig, got ${typeof value}`);
735
735
  }
736
736
 
737
- // src/agent.ts
737
+ // src/subAgent.ts
738
738
  var logger6 = agentsCore.getLogger("agent");
739
739
  function resolveGetter(value) {
740
740
  if (typeof value === "function") {
@@ -763,7 +763,7 @@ var SubAgent = class {
763
763
  "Agent constructor initialized"
764
764
  );
765
765
  }
766
- // Set context (tenantId, projectId, and baseURL) from external source (graph, CLI, etc)
766
+ // Set context (tenantId, projectId, and baseURL) from external source (agent, CLI, etc)
767
767
  setContext(tenantId, projectId, baseURL) {
768
768
  this.tenantId = tenantId;
769
769
  this.projectId = projectId;
@@ -845,7 +845,7 @@ var SubAgent = class {
845
845
  id: comp.id,
846
846
  name: comp.name,
847
847
  description: comp.description,
848
- props: schemaConversion.convertZodToJsonSchema(comp.props)
848
+ props: schemaConversion.convertZodToJsonSchemaWithPreview(comp.props)
849
849
  };
850
850
  }
851
851
  return comp;
@@ -1481,28 +1481,28 @@ var SubAgent = class {
1481
1481
  }
1482
1482
  }
1483
1483
  };
1484
- var logger7 = agentsCore.getLogger("graphFullClient");
1485
- async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graphData) {
1484
+ var logger7 = agentsCore.getLogger("agentFullClient");
1485
+ async function updateFullAgentViaAPI(tenantId, projectId, apiUrl, agentId, agentData) {
1486
1486
  logger7.info(
1487
1487
  {
1488
1488
  tenantId,
1489
1489
  projectId,
1490
- graphId,
1490
+ agentId,
1491
1491
  apiUrl
1492
1492
  },
1493
- "Updating full graph via API"
1493
+ "Updating full agent via API"
1494
1494
  );
1495
- const url = `${apiUrl}/tenants/${tenantId}/projects/${projectId}/graph/${graphId}`;
1495
+ const url = `${apiUrl}/tenants/${tenantId}/projects/${projectId}/agent/${agentId}`;
1496
1496
  const response = await fetch(url, {
1497
1497
  method: "PUT",
1498
1498
  headers: {
1499
1499
  "Content-Type": "application/json"
1500
1500
  },
1501
- body: JSON.stringify(graphData)
1501
+ body: JSON.stringify(agentData)
1502
1502
  });
1503
1503
  if (!response.ok) {
1504
1504
  const errorText = await response.text();
1505
- let errorMessage = `Failed to update graph: ${response.status} ${response.statusText}`;
1505
+ let errorMessage = `Failed to update agent: ${response.status} ${response.statusText}`;
1506
1506
  try {
1507
1507
  const errorJson = JSON.parse(errorText);
1508
1508
  if (errorJson.error) {
@@ -1518,29 +1518,29 @@ async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graph
1518
1518
  status: response.status,
1519
1519
  error: errorMessage
1520
1520
  },
1521
- "Failed to update graph via API"
1521
+ "Failed to update agent via API"
1522
1522
  );
1523
1523
  throw new Error(errorMessage);
1524
1524
  }
1525
1525
  const result = await response.json();
1526
1526
  logger7.info(
1527
1527
  {
1528
- graphId
1528
+ agentId
1529
1529
  },
1530
- "Successfully updated graph via API"
1530
+ "Successfully updated agent via API"
1531
1531
  );
1532
1532
  return result.data;
1533
1533
  }
1534
1534
 
1535
- // src/graph.ts
1536
- var logger8 = agentsCore.getLogger("graph");
1535
+ // src/agent.ts
1536
+ var logger8 = agentsCore.getLogger("agent");
1537
1537
  function resolveGetter2(value) {
1538
1538
  if (typeof value === "function") {
1539
1539
  return value();
1540
1540
  }
1541
1541
  return value;
1542
1542
  }
1543
- var AgentGraph = class {
1543
+ var Agent = class {
1544
1544
  constructor(config) {
1545
1545
  __publicField(this, "subAgents", []);
1546
1546
  __publicField(this, "agentMap", /* @__PURE__ */ new Map());
@@ -1548,24 +1548,24 @@ var AgentGraph = class {
1548
1548
  __publicField(this, "baseURL");
1549
1549
  __publicField(this, "tenantId");
1550
1550
  __publicField(this, "projectId");
1551
- __publicField(this, "graphId");
1552
- __publicField(this, "graphName");
1553
- __publicField(this, "graphDescription");
1551
+ __publicField(this, "agentId");
1552
+ __publicField(this, "agentName");
1553
+ __publicField(this, "agentDescription");
1554
1554
  __publicField(this, "initialized", false);
1555
1555
  __publicField(this, "contextConfig");
1556
1556
  // ContextConfigBuilder
1557
1557
  __publicField(this, "credentials");
1558
1558
  __publicField(this, "models");
1559
1559
  __publicField(this, "statusUpdateSettings");
1560
- __publicField(this, "graphPrompt");
1560
+ __publicField(this, "agentPrompt");
1561
1561
  __publicField(this, "stopWhen");
1562
1562
  __publicField(this, "dbClient");
1563
1563
  this.defaultSubAgent = config.defaultSubAgent;
1564
1564
  this.tenantId = "default";
1565
1565
  this.projectId = "default";
1566
- this.graphId = config.id;
1567
- this.graphName = config.name || this.graphId;
1568
- this.graphDescription = config.description;
1566
+ this.agentId = config.id;
1567
+ this.agentName = config.name || this.agentId;
1568
+ this.agentDescription = config.description;
1569
1569
  this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
1570
1570
  this.contextConfig = config.contextConfig;
1571
1571
  this.credentials = resolveGetter2(config.credentials);
@@ -1575,12 +1575,12 @@ var AgentGraph = class {
1575
1575
  url: dbUrl
1576
1576
  });
1577
1577
  this.statusUpdateSettings = config.statusUpdates;
1578
- this.graphPrompt = config.graphPrompt;
1578
+ this.agentPrompt = config.agentPrompt;
1579
1579
  this.stopWhen = config.stopWhen ? {
1580
1580
  transferCountIs: config.stopWhen.transferCountIs
1581
1581
  } : void 0;
1582
1582
  this.subAgents = resolveGetter2(config.subAgents) || [];
1583
- this.agentMap = new Map(this.subAgents.map((agent) => [agent.getId(), agent]));
1583
+ this.agentMap = new Map(this.subAgents.map((agent2) => [agent2.getId(), agent2]));
1584
1584
  if (this.defaultSubAgent) {
1585
1585
  this.subAgents.push(this.defaultSubAgent);
1586
1586
  this.agentMap.set(this.defaultSubAgent.getId(), this.defaultSubAgent);
@@ -1590,12 +1590,12 @@ var AgentGraph = class {
1590
1590
  }
1591
1591
  logger8.info(
1592
1592
  {
1593
- graphId: this.graphId,
1593
+ agentId: this.agentId,
1594
1594
  tenantId: this.tenantId,
1595
1595
  agentCount: this.subAgents.length,
1596
1596
  defaultSubAgent: this.defaultSubAgent?.getName()
1597
1597
  },
1598
- "AgentGraph created"
1598
+ "Agent created"
1599
1599
  );
1600
1600
  }
1601
1601
  /**
@@ -1604,14 +1604,14 @@ var AgentGraph = class {
1604
1604
  */
1605
1605
  setConfig(tenantId, projectId, apiUrl) {
1606
1606
  if (this.initialized) {
1607
- throw new Error("Cannot set config after graph has been initialized");
1607
+ throw new Error("Cannot set config after agent has been initialized");
1608
1608
  }
1609
1609
  this.tenantId = tenantId;
1610
1610
  this.projectId = projectId;
1611
1611
  this.baseURL = apiUrl;
1612
- for (const agent of this.subAgents) {
1613
- if (this.isInternalAgent(agent)) {
1614
- const internalAgent = agent;
1612
+ for (const agent2 of this.subAgents) {
1613
+ if (this.isInternalAgent(agent2)) {
1614
+ const internalAgent = agent2;
1615
1615
  if (internalAgent.setContext) {
1616
1616
  internalAgent.setContext(tenantId, projectId, apiUrl);
1617
1617
  }
@@ -1624,35 +1624,35 @@ var AgentGraph = class {
1624
1624
  }
1625
1625
  }
1626
1626
  } else {
1627
- const externalAgent2 = agent;
1627
+ const externalAgent2 = agent2;
1628
1628
  if (externalAgent2.setContext) {
1629
1629
  externalAgent2.setContext(tenantId, apiUrl);
1630
1630
  }
1631
1631
  }
1632
1632
  }
1633
1633
  if (this.contextConfig?.setContext) {
1634
- this.contextConfig.setContext(tenantId, projectId, this.graphId, this.baseURL);
1634
+ this.contextConfig.setContext(tenantId, projectId, this.agentId, this.baseURL);
1635
1635
  }
1636
1636
  logger8.info(
1637
1637
  {
1638
- graphId: this.graphId,
1638
+ agentId: this.agentId,
1639
1639
  tenantId: this.tenantId,
1640
1640
  projectId: this.projectId,
1641
1641
  apiUrl: this.baseURL
1642
1642
  },
1643
- "Graph configuration updated"
1643
+ "Agent configuration updated"
1644
1644
  );
1645
1645
  }
1646
1646
  /**
1647
- * Convert the AgentGraph to FullGraphDefinition format for the new graph endpoint
1647
+ * Convert the Agent to FullAgentDefinition format for the new agent endpoint
1648
1648
  */
1649
- async toFullGraphDefinition() {
1649
+ async toFullAgentDefinition() {
1650
1650
  const agentsObject = {};
1651
1651
  const functionToolsObject = {};
1652
1652
  const functionsObject = {};
1653
- for (const agent of this.subAgents) {
1654
- if (this.isInternalAgent(agent)) {
1655
- const internalAgent = agent;
1653
+ for (const agent2 of this.subAgents) {
1654
+ if (this.isInternalAgent(agent2)) {
1655
+ const internalAgent = agent2;
1656
1656
  const transfers = internalAgent.getTransfers();
1657
1657
  const delegates = internalAgent.getDelegates();
1658
1658
  const tools = [];
@@ -1680,8 +1680,8 @@ var AgentGraph = class {
1680
1680
  name: toolData.name,
1681
1681
  description: toolData.description,
1682
1682
  functionId: toolData.functionId,
1683
- graphId: this.graphId
1684
- // Include graphId for graph-scoped function tools
1683
+ agentId: this.agentId
1684
+ // Include agentId for agent-scoped function tools
1685
1685
  };
1686
1686
  }
1687
1687
  }
@@ -1722,7 +1722,7 @@ var AgentGraph = class {
1722
1722
  type: "internal"
1723
1723
  };
1724
1724
  } else {
1725
- const externalAgent2 = agent;
1725
+ const externalAgent2 = agent2;
1726
1726
  agentsObject[externalAgent2.getId()] = {
1727
1727
  id: externalAgent2.getId(),
1728
1728
  name: externalAgent2.getName(),
@@ -1735,9 +1735,9 @@ var AgentGraph = class {
1735
1735
  }
1736
1736
  }
1737
1737
  return {
1738
- id: this.graphId,
1739
- name: this.graphName,
1740
- description: this.graphDescription,
1738
+ id: this.agentId,
1739
+ name: this.agentName,
1740
+ description: this.agentDescription,
1741
1741
  defaultSubAgentId: this.defaultSubAgent?.getId() || "",
1742
1742
  subAgents: agentsObject,
1743
1743
  contextConfig: this.contextConfig?.toObject(),
@@ -1745,7 +1745,7 @@ var AgentGraph = class {
1745
1745
  ...Object.keys(functionsObject).length > 0 && { functions: functionsObject },
1746
1746
  models: this.models,
1747
1747
  statusUpdates: this.statusUpdateSettings,
1748
- graphPrompt: this.graphPrompt,
1748
+ prompt: this.agentPrompt,
1749
1749
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1750
1750
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1751
1751
  };
@@ -1754,13 +1754,13 @@ var AgentGraph = class {
1754
1754
  * Initialize all tools in all agents (especially IPCTools that need MCP server URLs)
1755
1755
  */
1756
1756
  async initializeAllTools() {
1757
- logger8.info({ graphId: this.graphId }, "Initializing all tools in graph");
1757
+ logger8.info({ agentId: this.agentId }, "Initializing all tools in agent");
1758
1758
  const toolInitPromises = [];
1759
- for (const agent of this.subAgents) {
1760
- if (!agent.getTools) {
1759
+ for (const agent2 of this.subAgents) {
1760
+ if (!agent2.getTools) {
1761
1761
  continue;
1762
1762
  }
1763
- const internalAgent = agent;
1763
+ const internalAgent = agent2;
1764
1764
  const agentTools = internalAgent.getTools();
1765
1765
  for (const [toolName, toolInstance] of Object.entries(agentTools)) {
1766
1766
  if (toolInstance && typeof toolInstance === "object") {
@@ -1780,7 +1780,7 @@ var AgentGraph = class {
1780
1780
  }
1781
1781
  logger8.debug(
1782
1782
  {
1783
- subAgentId: agent.getId(),
1783
+ subAgentId: agent2.getId(),
1784
1784
  toolName,
1785
1785
  toolType: toolInstance.constructor.name,
1786
1786
  skipDbRegistration
@@ -1790,7 +1790,7 @@ var AgentGraph = class {
1790
1790
  } catch (error) {
1791
1791
  logger8.error(
1792
1792
  {
1793
- subAgentId: agent.getId(),
1793
+ subAgentId: agent2.getId(),
1794
1794
  toolName,
1795
1795
  error: error instanceof Error ? error.message : "Unknown error"
1796
1796
  },
@@ -1806,109 +1806,109 @@ var AgentGraph = class {
1806
1806
  }
1807
1807
  await Promise.all(toolInitPromises);
1808
1808
  logger8.info(
1809
- { graphId: this.graphId, toolCount: toolInitPromises.length },
1809
+ { agentId: this.agentId, toolCount: toolInitPromises.length },
1810
1810
  "All tools initialized successfully"
1811
1811
  );
1812
1812
  }
1813
1813
  /**
1814
- * Initialize the graph and all agents in the backend using the new graph endpoint
1814
+ * Initialize the agent and all agents in the backend using the new agent endpoint
1815
1815
  */
1816
1816
  async init() {
1817
1817
  if (this.initialized) {
1818
- logger8.info({ graphId: this.graphId }, "Graph already initialized");
1818
+ logger8.info({ agentId: this.agentId }, "Agent already initialized");
1819
1819
  return;
1820
1820
  }
1821
1821
  logger8.info(
1822
1822
  {
1823
- graphId: this.graphId,
1823
+ agentId: this.agentId,
1824
1824
  agentCount: this.subAgents.length
1825
1825
  },
1826
- "Initializing agent graph using new graph endpoint"
1826
+ "Initializing agent agent using new agent endpoint"
1827
1827
  );
1828
1828
  try {
1829
1829
  await this.initializeAllTools();
1830
1830
  await this.applyModelInheritance();
1831
- const graphDefinition = await this.toFullGraphDefinition();
1831
+ const agentDefinition = await this.toFullAgentDefinition();
1832
1832
  logger8.info(
1833
1833
  {
1834
- graphId: this.graphId,
1834
+ agentId: this.agentId,
1835
1835
  mode: "api-client",
1836
1836
  apiUrl: this.baseURL
1837
1837
  },
1838
- "Using API client to create/update graph"
1838
+ "Using API client to create/update agent"
1839
1839
  );
1840
- const createdGraph = await updateFullGraphViaAPI(
1840
+ const createdAgent = await updateFullAgentViaAPI(
1841
1841
  this.tenantId,
1842
1842
  this.projectId,
1843
1843
  this.baseURL,
1844
- this.graphId,
1845
- graphDefinition
1844
+ this.agentId,
1845
+ agentDefinition
1846
1846
  );
1847
1847
  logger8.info(
1848
1848
  {
1849
- graphId: this.graphId,
1850
- agentCount: Object.keys(createdGraph.subAgents || {}).length
1849
+ agentId: this.agentId,
1850
+ agentCount: Object.keys(createdAgent.subAgents || {}).length
1851
1851
  },
1852
- "Agent graph initialized successfully using graph endpoint"
1852
+ "Agent agent initialized successfully using agent endpoint"
1853
1853
  );
1854
1854
  this.initialized = true;
1855
1855
  } catch (error) {
1856
1856
  logger8.error(
1857
1857
  {
1858
- graphId: this.graphId,
1858
+ agentId: this.agentId,
1859
1859
  error: error instanceof Error ? error.message : "Unknown error"
1860
1860
  },
1861
- "Failed to initialize agent graph using graph endpoint"
1861
+ "Failed to initialize agent agent using agent endpoint"
1862
1862
  );
1863
1863
  throw error;
1864
1864
  }
1865
1865
  }
1866
1866
  /**
1867
1867
  * Legacy initialization method - kept for backward compatibility
1868
- * Initialize the graph and all agents in the backend using individual endpoints
1868
+ * Initialize the agent and all agents in the backend using individual endpoints
1869
1869
  */
1870
1870
  async initLegacy() {
1871
1871
  if (this.initialized) {
1872
- logger8.info({ graphId: this.graphId }, "Graph already initialized");
1872
+ logger8.info({ agentId: this.agentId }, "Agent already initialized");
1873
1873
  return;
1874
1874
  }
1875
1875
  logger8.info(
1876
1876
  {
1877
- graphId: this.graphId,
1877
+ agentId: this.agentId,
1878
1878
  agentCount: this.subAgents.length
1879
1879
  },
1880
- "Initializing agent graph"
1880
+ "Initializing agent agent"
1881
1881
  );
1882
1882
  try {
1883
1883
  if (this.contextConfig) {
1884
1884
  await this.contextConfig.init();
1885
1885
  logger8.info(
1886
1886
  {
1887
- graphId: this.graphId,
1887
+ agentId: this.agentId,
1888
1888
  contextConfigId: this.contextConfig.getId()
1889
1889
  },
1890
- "Context configuration initialized for graph"
1890
+ "Context configuration initialized for agent"
1891
1891
  );
1892
1892
  }
1893
- const initPromises = this.subAgents.map(async (agent) => {
1893
+ const initPromises = this.subAgents.map(async (agent2) => {
1894
1894
  try {
1895
- agent.config.graphId = this.graphId;
1896
- await agent.init();
1895
+ agent2.config.agentId = this.agentId;
1896
+ await agent2.init();
1897
1897
  logger8.debug(
1898
1898
  {
1899
- subAgentId: agent.getId(),
1900
- graphId: this.graphId
1899
+ subAgentId: agent2.getId(),
1900
+ agentId: this.agentId
1901
1901
  },
1902
- "Agent initialized in graph"
1902
+ "Agent initialized in agent"
1903
1903
  );
1904
1904
  } catch (error) {
1905
1905
  logger8.error(
1906
1906
  {
1907
- subAgentId: agent.getId(),
1908
- graphId: this.graphId,
1907
+ subAgentId: agent2.getId(),
1908
+ agentId: this.agentId,
1909
1909
  error: error instanceof Error ? error.message : "Unknown error"
1910
1910
  },
1911
- "Failed to initialize agent in graph"
1911
+ "Failed to initialize agent in agent"
1912
1912
  );
1913
1913
  throw error;
1914
1914
  }
@@ -1921,18 +1921,18 @@ var AgentGraph = class {
1921
1921
  this.initialized = true;
1922
1922
  logger8.info(
1923
1923
  {
1924
- graphId: this.graphId,
1924
+ agentId: this.agentId,
1925
1925
  agentCount: this.subAgents.length
1926
1926
  },
1927
- "Agent graph initialized successfully"
1927
+ "Agent agent initialized successfully"
1928
1928
  );
1929
1929
  } catch (error) {
1930
1930
  logger8.error(
1931
1931
  {
1932
- graphId: this.graphId,
1932
+ agentId: this.agentId,
1933
1933
  error: error instanceof Error ? error.message : "Unknown error"
1934
1934
  },
1935
- "Failed to initialize agent graph"
1935
+ "Failed to initialize agent agent"
1936
1936
  );
1937
1937
  throw error;
1938
1938
  }
@@ -1943,11 +1943,11 @@ var AgentGraph = class {
1943
1943
  async generate(input, options) {
1944
1944
  await this._init();
1945
1945
  if (!this.defaultSubAgent) {
1946
- throw new Error("No default agent configured for this graph");
1946
+ throw new Error("No default agent configured for this agent");
1947
1947
  }
1948
1948
  logger8.info(
1949
1949
  {
1950
- graphId: this.graphId,
1950
+ agentId: this.agentId,
1951
1951
  defaultSubAgent: this.defaultSubAgent.getName(),
1952
1952
  conversationId: options?.conversationId
1953
1953
  },
@@ -1962,18 +1962,18 @@ var AgentGraph = class {
1962
1962
  async stream(input, options) {
1963
1963
  await this._init();
1964
1964
  if (!this.defaultSubAgent) {
1965
- throw new Error("No default agent configured for this graph");
1965
+ throw new Error("No default agent configured for this agent");
1966
1966
  }
1967
1967
  logger8.info(
1968
1968
  {
1969
- graphId: this.graphId,
1969
+ agentId: this.agentId,
1970
1970
  defaultSubAgent: this.defaultSubAgent.getName(),
1971
1971
  conversationId: options?.conversationId
1972
1972
  },
1973
1973
  "Streaming response with default agent"
1974
1974
  );
1975
- const textStream = async function* (graph) {
1976
- const response = await graph.executeWithBackend(input, options);
1975
+ const textStream = async function* (agent2) {
1976
+ const response = await agent2.executeWithBackend(input, options);
1977
1977
  const words = response.split(" ");
1978
1978
  for (const word of words) {
1979
1979
  yield `${word} `;
@@ -1990,22 +1990,22 @@ var AgentGraph = class {
1990
1990
  return await this.stream(input, options);
1991
1991
  }
1992
1992
  /**
1993
- * Run with a specific agent from the graph
1993
+ * Run with a specific agent from the agent
1994
1994
  */
1995
1995
  async runWith(subAgentId, input, options) {
1996
1996
  await this._init();
1997
- const agent = this.getAgent(subAgentId);
1998
- if (!agent) {
1999
- throw new Error(`Agent '${subAgentId}' not found in graph`);
1997
+ const agent2 = this.getSubAgent(subAgentId);
1998
+ if (!agent2) {
1999
+ throw new Error(`Agent '${subAgentId}' not found in agent`);
2000
2000
  }
2001
- if (!this.isInternalAgent(agent)) {
2001
+ if (!this.isInternalAgent(agent2)) {
2002
2002
  throw new Error(
2003
2003
  `Agent '${subAgentId}' is an external agent and cannot be run directly. External agents are only accessible via delegation.`
2004
2004
  );
2005
2005
  }
2006
2006
  logger8.info(
2007
2007
  {
2008
- graphId: this.graphId,
2008
+ agentId: this.agentId,
2009
2009
  subAgentId,
2010
2010
  conversationId: options?.conversationId
2011
2011
  },
@@ -2014,7 +2014,7 @@ var AgentGraph = class {
2014
2014
  const response = await this.executeWithBackend(input, options);
2015
2015
  return {
2016
2016
  finalOutput: response,
2017
- agent,
2017
+ agent: agent2,
2018
2018
  turnCount: 1,
2019
2019
  usage: { inputTokens: 0, outputTokens: 0 },
2020
2020
  metadata: {
@@ -2026,48 +2026,48 @@ var AgentGraph = class {
2026
2026
  /**
2027
2027
  * Get an agent by name (unified method for all agent types)
2028
2028
  */
2029
- getAgent(name) {
2029
+ getSubAgent(name) {
2030
2030
  return this.agentMap.get(name);
2031
2031
  }
2032
2032
  /**
2033
- * Add an agent to the graph
2033
+ * Add an agent to the agent
2034
2034
  */
2035
- addSubAgent(agent) {
2036
- this.subAgents.push(agent);
2037
- this.agentMap.set(agent.getId(), agent);
2038
- if (this.models && this.isInternalAgent(agent)) {
2039
- this.propagateModelSettingsToAgent(agent);
2035
+ addSubAgent(agent2) {
2036
+ this.subAgents.push(agent2);
2037
+ this.agentMap.set(agent2.getId(), agent2);
2038
+ if (this.models && this.isInternalAgent(agent2)) {
2039
+ this.propagateModelSettingsToAgent(agent2);
2040
2040
  }
2041
2041
  logger8.info(
2042
2042
  {
2043
- graphId: this.graphId,
2044
- subAgentId: agent.getId(),
2045
- agentType: this.isInternalAgent(agent) ? "internal" : "external"
2043
+ agentId: this.agentId,
2044
+ subAgentId: agent2.getId(),
2045
+ agentType: this.isInternalAgent(agent2) ? "internal" : "external"
2046
2046
  },
2047
- "Agent added to graph"
2047
+ "Agent added to agent"
2048
2048
  );
2049
2049
  }
2050
2050
  /**
2051
- * Remove an agent from the graph
2051
+ * Remove an agent from the agent
2052
2052
  */
2053
2053
  removeSubAgent(id) {
2054
2054
  const agentToRemove = this.agentMap.get(id);
2055
2055
  if (agentToRemove) {
2056
2056
  this.agentMap.delete(agentToRemove.getId());
2057
- this.subAgents = this.subAgents.filter((agent) => agent.getId() !== agentToRemove.getId());
2057
+ this.subAgents = this.subAgents.filter((agent2) => agent2.getId() !== agentToRemove.getId());
2058
2058
  logger8.info(
2059
2059
  {
2060
- graphId: this.graphId,
2060
+ agentId: this.agentId,
2061
2061
  subAgentId: agentToRemove.getId()
2062
2062
  },
2063
- "Agent removed from graph"
2063
+ "Agent removed from agent"
2064
2064
  );
2065
2065
  return true;
2066
2066
  }
2067
2067
  return false;
2068
2068
  }
2069
2069
  /**
2070
- * Get all agents in the graph
2070
+ * Get all agents in the agent
2071
2071
  */
2072
2072
  getSubAgents() {
2073
2073
  return this.subAgents;
@@ -2081,13 +2081,13 @@ var AgentGraph = class {
2081
2081
  /**
2082
2082
  * Set the default agent
2083
2083
  */
2084
- setdefaultSubAgent(agent) {
2085
- this.defaultSubAgent = agent;
2086
- this.addSubAgent(agent);
2084
+ setDefaultSubAgent(agent2) {
2085
+ this.defaultSubAgent = agent2;
2086
+ this.addSubAgent(agent2);
2087
2087
  logger8.info(
2088
2088
  {
2089
- graphId: this.graphId,
2090
- defaultSubAgent: agent.getId()
2089
+ agentId: this.agentId,
2090
+ defaultSubAgent: agent2.getId()
2091
2091
  },
2092
2092
  "Default agent updated"
2093
2093
  );
@@ -2095,106 +2095,106 @@ var AgentGraph = class {
2095
2095
  /**
2096
2096
  * Get the default agent
2097
2097
  */
2098
- getdefaultSubAgent() {
2098
+ getDefaultSubAgent() {
2099
2099
  return this.defaultSubAgent;
2100
2100
  }
2101
2101
  /**
2102
- * Get the graph ID
2102
+ * Get the agent ID
2103
2103
  */
2104
2104
  getId() {
2105
- return this.graphId;
2105
+ return this.agentId;
2106
2106
  }
2107
2107
  getName() {
2108
- return this.graphName;
2108
+ return this.agentName;
2109
2109
  }
2110
2110
  getDescription() {
2111
- return this.graphDescription;
2111
+ return this.agentDescription;
2112
2112
  }
2113
2113
  getTenantId() {
2114
2114
  return this.tenantId;
2115
2115
  }
2116
2116
  /**
2117
- * Get the graph's model settingsuration
2117
+ * Get the agent's model settingsuration
2118
2118
  */
2119
2119
  getModels() {
2120
2120
  return this.models;
2121
2121
  }
2122
2122
  /**
2123
- * Set the graph's model settingsuration
2123
+ * Set the agent's model settingsuration
2124
2124
  */
2125
2125
  setModels(models) {
2126
2126
  this.models = models;
2127
2127
  }
2128
2128
  /**
2129
- * Get the graph's prompt configuration
2129
+ * Get the agent's prompt configuration
2130
2130
  */
2131
- getGraphPrompt() {
2132
- return this.graphPrompt;
2131
+ getAgentPrompt() {
2132
+ return this.agentPrompt;
2133
2133
  }
2134
2134
  /**
2135
- * Get the graph's stopWhen configuration
2135
+ * Get the agent's stopWhen configuration
2136
2136
  */
2137
2137
  getStopWhen() {
2138
2138
  return this.stopWhen || { transferCountIs: 10 };
2139
2139
  }
2140
2140
  /**
2141
- * Get the graph's status updates configuration
2141
+ * Get the agent's status updates configuration
2142
2142
  */
2143
2143
  getStatusUpdateSettings() {
2144
2144
  return this.statusUpdateSettings;
2145
2145
  }
2146
2146
  /**
2147
- * Get the summarizer model from the graph's model settings
2147
+ * Get the summarizer model from the agent's model settings
2148
2148
  */
2149
2149
  getSummarizerModel() {
2150
2150
  return this.models?.summarizer;
2151
2151
  }
2152
2152
  /**
2153
- * Get graph statistics
2153
+ * Get agent statistics
2154
2154
  */
2155
2155
  getStats() {
2156
2156
  return {
2157
2157
  agentCount: this.subAgents.length,
2158
2158
  defaultSubAgent: this.defaultSubAgent?.getName() || null,
2159
2159
  initialized: this.initialized,
2160
- graphId: this.graphId,
2160
+ agentId: this.agentId,
2161
2161
  tenantId: this.tenantId
2162
2162
  };
2163
2163
  }
2164
2164
  /**
2165
- * Validate the graph configuration
2165
+ * Validate the agent configuration
2166
2166
  */
2167
2167
  validate() {
2168
2168
  const errors = [];
2169
2169
  if (this.subAgents.length === 0) {
2170
- errors.push("Graph must contain at least one agent");
2170
+ errors.push("Agent must contain at least one agent");
2171
2171
  }
2172
2172
  if (!this.defaultSubAgent) {
2173
- errors.push("Graph must have a default agent");
2173
+ errors.push("Agent must have a default agent");
2174
2174
  }
2175
2175
  const names = /* @__PURE__ */ new Set();
2176
- for (const agent of this.subAgents) {
2177
- const name = agent.getName();
2176
+ for (const agent2 of this.subAgents) {
2177
+ const name = agent2.getName();
2178
2178
  if (names.has(name)) {
2179
2179
  errors.push(`Duplicate agent name: ${name}`);
2180
2180
  }
2181
2181
  names.add(name);
2182
2182
  }
2183
- for (const agent of this.subAgents) {
2184
- if (!this.isInternalAgent(agent)) continue;
2185
- const transfers = agent.getTransfers();
2183
+ for (const agent2 of this.subAgents) {
2184
+ if (!this.isInternalAgent(agent2)) continue;
2185
+ const transfers = agent2.getTransfers();
2186
2186
  for (const transferAgent of transfers) {
2187
2187
  if (!this.agentMap.has(transferAgent.getName())) {
2188
2188
  errors.push(
2189
- `Agent '${agent.getName()}' has transfer to '${transferAgent.getName()}' which is not in the graph`
2189
+ `Agent '${agent2.getName()}' has transfer to '${transferAgent.getName()}' which is not in the agent`
2190
2190
  );
2191
2191
  }
2192
2192
  }
2193
- const delegates = agent.getDelegates();
2193
+ const delegates = agent2.getDelegates();
2194
2194
  for (const delegateAgent of delegates) {
2195
2195
  if (!this.agentMap.has(delegateAgent.getName())) {
2196
2196
  errors.push(
2197
- `Agent '${agent.getName()}' has delegation to '${delegateAgent.getName()}' which is not in the graph`
2197
+ `Agent '${agent2.getName()}' has delegation to '${delegateAgent.getName()}' which is not in the agent`
2198
2198
  );
2199
2199
  }
2200
2200
  }
@@ -2213,8 +2213,8 @@ var AgentGraph = class {
2213
2213
  /**
2214
2214
  * Type guard to check if an agent is an internal AgentInterface
2215
2215
  */
2216
- isInternalAgent(agent) {
2217
- return "getTransfers" in agent && typeof agent.getTransfers === "function";
2216
+ isInternalAgent(agent2) {
2217
+ return "getTransfers" in agent2 && typeof agent2.getTransfers === "function";
2218
2218
  }
2219
2219
  /**
2220
2220
  * Get project-level model settingsuration defaults
@@ -2259,7 +2259,7 @@ var AgentGraph = class {
2259
2259
  }
2260
2260
  }
2261
2261
  /**
2262
- * Apply model inheritance hierarchy: Project -> Graph -> Agent
2262
+ * Apply model inheritance hierarchy: Project -> Agent -> Agent
2263
2263
  */
2264
2264
  async applyModelInheritance() {
2265
2265
  const projectModels = await this.getProjectModelDefaults();
@@ -2278,14 +2278,14 @@ var AgentGraph = class {
2278
2278
  }
2279
2279
  }
2280
2280
  await this.applyStopWhenInheritance();
2281
- for (const agent of this.subAgents) {
2282
- if (this.isInternalAgent(agent)) {
2283
- this.propagateModelSettingsToAgent(agent);
2281
+ for (const agent2 of this.subAgents) {
2282
+ if (this.isInternalAgent(agent2)) {
2283
+ this.propagateModelSettingsToAgent(agent2);
2284
2284
  }
2285
2285
  }
2286
2286
  }
2287
2287
  /**
2288
- * Apply stopWhen inheritance hierarchy: Project -> Graph -> Agent
2288
+ * Apply stopWhen inheritance hierarchy: Project -> Agent -> Agent
2289
2289
  */
2290
2290
  async applyStopWhenInheritance() {
2291
2291
  const projectStopWhen = await this.getProjectStopWhenDefaults();
@@ -2299,9 +2299,9 @@ var AgentGraph = class {
2299
2299
  this.stopWhen.transferCountIs = 10;
2300
2300
  }
2301
2301
  if (projectStopWhen?.stepCountIs !== void 0) {
2302
- for (const agent of this.subAgents) {
2303
- if (this.isInternalAgent(agent)) {
2304
- const internalAgent = agent;
2302
+ for (const agent2 of this.subAgents) {
2303
+ if (this.isInternalAgent(agent2)) {
2304
+ const internalAgent = agent2;
2305
2305
  if (!internalAgent.config.stopWhen) {
2306
2306
  internalAgent.config.stopWhen = {};
2307
2307
  }
@@ -2313,57 +2313,57 @@ var AgentGraph = class {
2313
2313
  }
2314
2314
  logger8.debug(
2315
2315
  {
2316
- graphId: this.graphId,
2317
- graphStopWhen: this.stopWhen,
2316
+ agentId: this.agentId,
2317
+ agentStopWhen: this.stopWhen,
2318
2318
  projectStopWhen
2319
2319
  },
2320
- "Applied stopWhen inheritance from project to graph"
2320
+ "Applied stopWhen inheritance from project to agent"
2321
2321
  );
2322
2322
  }
2323
2323
  /**
2324
- * Propagate graph-level model settings to agents (supporting partial inheritance)
2324
+ * Propagate agent-level model settings to agents (supporting partial inheritance)
2325
2325
  */
2326
- propagateModelSettingsToAgent(agent) {
2326
+ propagateModelSettingsToAgent(agent2) {
2327
2327
  if (this.models) {
2328
- if (!agent.config.models) {
2329
- agent.config.models = {};
2328
+ if (!agent2.config.models) {
2329
+ agent2.config.models = {};
2330
2330
  }
2331
- if (!agent.config.models.base && this.models.base) {
2332
- agent.config.models.base = this.models.base;
2331
+ if (!agent2.config.models.base && this.models.base) {
2332
+ agent2.config.models.base = this.models.base;
2333
2333
  }
2334
- if (!agent.config.models.structuredOutput && this.models.structuredOutput) {
2335
- agent.config.models.structuredOutput = this.models.structuredOutput;
2334
+ if (!agent2.config.models.structuredOutput && this.models.structuredOutput) {
2335
+ agent2.config.models.structuredOutput = this.models.structuredOutput;
2336
2336
  }
2337
- if (!agent.config.models.summarizer && this.models.summarizer) {
2338
- agent.config.models.summarizer = this.models.summarizer;
2337
+ if (!agent2.config.models.summarizer && this.models.summarizer) {
2338
+ agent2.config.models.summarizer = this.models.summarizer;
2339
2339
  }
2340
2340
  }
2341
2341
  }
2342
2342
  /**
2343
- * Immediately propagate graph-level models to all agents during construction
2343
+ * Immediately propagate agent-level models to all agents during construction
2344
2344
  */
2345
2345
  propagateImmediateModelSettings() {
2346
- for (const agent of this.subAgents) {
2347
- if (this.isInternalAgent(agent)) {
2348
- this.propagateModelSettingsToAgent(agent);
2346
+ for (const agent2 of this.subAgents) {
2347
+ if (this.isInternalAgent(agent2)) {
2348
+ this.propagateModelSettingsToAgent(agent2);
2349
2349
  }
2350
2350
  }
2351
2351
  }
2352
2352
  /**
2353
2353
  * Type guard to check if an agent is an external AgentInterface
2354
2354
  */
2355
- isExternalAgent(agent) {
2356
- return !this.isInternalAgent(agent);
2355
+ isExternalAgent(agent2) {
2356
+ return !this.isInternalAgent(agent2);
2357
2357
  }
2358
2358
  /**
2359
2359
  * Execute agent using the backend system instead of local runner
2360
2360
  */
2361
2361
  async executeWithBackend(input, options) {
2362
2362
  const normalizedMessages = this.normalizeMessages(input);
2363
- const url = `${this.baseURL}/tenants/${this.tenantId}/graphs/${this.graphId}/v1/chat/completions`;
2363
+ const url = `${this.baseURL}/tenants/${this.tenantId}/agent/${this.agentId}/v1/chat/completions`;
2364
2364
  logger8.info({ url }, "Executing with backend");
2365
2365
  const requestBody = {
2366
- model: agentsCore.OPENAI_MODELS.GPT_4_1_MINI,
2366
+ model: "gpt-4o-mini",
2367
2367
  messages: normalizedMessages.map((msg) => ({
2368
2368
  role: msg.role,
2369
2369
  content: msg.content
@@ -2397,7 +2397,7 @@ var AgentGraph = class {
2397
2397
  const data = JSON.parse(responseText);
2398
2398
  return data.result || data.choices?.[0]?.message?.content || "";
2399
2399
  } catch (error) {
2400
- throw new Error(`Graph execution failed: ${error.message || "Unknown error"}`);
2400
+ throw new Error(`Agent execution failed: ${error.message || "Unknown error"}`);
2401
2401
  }
2402
2402
  }
2403
2403
  /**
@@ -2436,7 +2436,7 @@ var AgentGraph = class {
2436
2436
  }
2437
2437
  async saveToDatabase() {
2438
2438
  try {
2439
- const getUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
2439
+ const getUrl = `${this.baseURL}/tenants/${this.tenantId}/agents/${this.agentId}`;
2440
2440
  try {
2441
2441
  const getResponse = await fetch(getUrl, {
2442
2442
  method: "GET",
@@ -2445,7 +2445,7 @@ var AgentGraph = class {
2445
2445
  }
2446
2446
  });
2447
2447
  if (getResponse.ok) {
2448
- logger8.info({ graphId: this.graphId }, "Graph already exists in backend");
2448
+ logger8.info({ agentId: this.agentId }, "Agent already exists in backend");
2449
2449
  return;
2450
2450
  }
2451
2451
  if (getResponse.status !== 404) {
@@ -2456,16 +2456,16 @@ var AgentGraph = class {
2456
2456
  throw error;
2457
2457
  }
2458
2458
  }
2459
- logger8.info({ graphId: this.graphId }, "Creating graph in backend");
2460
- const createUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs`;
2459
+ logger8.info({ agentId: this.agentId }, "Creating agent in backend");
2460
+ const createUrl = `${this.baseURL}/tenants/${this.tenantId}/agents`;
2461
2461
  const createResponse = await fetch(createUrl, {
2462
2462
  method: "POST",
2463
2463
  headers: {
2464
2464
  "Content-Type": "application/json"
2465
2465
  },
2466
2466
  body: JSON.stringify({
2467
- id: this.graphId,
2468
- name: this.graphName,
2467
+ id: this.agentId,
2468
+ name: this.agentName,
2469
2469
  defaultSubAgentId: this.defaultSubAgent?.getId() || "",
2470
2470
  contextConfigId: this.contextConfig?.getId(),
2471
2471
  models: this.models
@@ -2475,25 +2475,25 @@ var AgentGraph = class {
2475
2475
  throw new Error(`HTTP ${createResponse.status}: ${createResponse.statusText}`);
2476
2476
  }
2477
2477
  const createData = await createResponse.json();
2478
- this.graphId = createData.data.id;
2479
- logger8.info({ graph: createData.data }, "Graph created in backend");
2478
+ this.agentId = createData.data.id;
2479
+ logger8.info({ agent: createData.data }, "Agent created in backend");
2480
2480
  } catch (error) {
2481
2481
  throw new Error(
2482
- `Failed to save graph to database: ${error instanceof Error ? error.message : "Unknown error"}`
2482
+ `Failed to save agent to database: ${error instanceof Error ? error.message : "Unknown error"}`
2483
2483
  );
2484
2484
  }
2485
2485
  }
2486
2486
  async saveRelations() {
2487
2487
  if (this.defaultSubAgent) {
2488
2488
  try {
2489
- const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
2489
+ const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/agents/${this.agentId}`;
2490
2490
  const updateResponse = await fetch(updateUrl, {
2491
2491
  method: "PUT",
2492
2492
  headers: {
2493
2493
  "Content-Type": "application/json"
2494
2494
  },
2495
2495
  body: JSON.stringify({
2496
- id: this.graphId,
2496
+ id: this.agentId,
2497
2497
  defaultSubAgentId: this.defaultSubAgent.getId(),
2498
2498
  contextConfigId: this.contextConfig?.getId()
2499
2499
  })
@@ -2503,18 +2503,18 @@ var AgentGraph = class {
2503
2503
  }
2504
2504
  logger8.debug(
2505
2505
  {
2506
- graphId: this.graphId,
2506
+ agentId: this.agentId,
2507
2507
  defaultSubAgent: this.defaultSubAgent.getName()
2508
2508
  },
2509
- "Graph relationships configured"
2509
+ "Agent relationships configured"
2510
2510
  );
2511
2511
  } catch (error) {
2512
2512
  logger8.error(
2513
2513
  {
2514
- graphId: this.graphId,
2514
+ agentId: this.agentId,
2515
2515
  error: error instanceof Error ? error.message : "Unknown error"
2516
2516
  },
2517
- "Failed to update graph relationships"
2517
+ "Failed to update agent relationships"
2518
2518
  );
2519
2519
  throw error;
2520
2520
  }
@@ -2522,21 +2522,21 @@ var AgentGraph = class {
2522
2522
  }
2523
2523
  async createAgentRelations() {
2524
2524
  const allRelationPromises = [];
2525
- for (const agent of this.subAgents) {
2526
- if (this.isInternalAgent(agent)) {
2527
- const transfers = agent.getTransfers();
2525
+ for (const agent2 of this.subAgents) {
2526
+ if (this.isInternalAgent(agent2)) {
2527
+ const transfers = agent2.getTransfers();
2528
2528
  for (const transferAgent of transfers) {
2529
2529
  allRelationPromises.push(
2530
- this.createInternalAgentRelation(agent, transferAgent, "transfer")
2530
+ this.createInternalAgentRelation(agent2, transferAgent, "transfer")
2531
2531
  );
2532
2532
  }
2533
- const delegates = agent.getDelegates();
2533
+ const delegates = agent2.getDelegates();
2534
2534
  for (const delegate of delegates) {
2535
2535
  if (delegate.type === "external") {
2536
- allRelationPromises.push(this.createExternalAgentRelation(agent, delegate, "delegate"));
2536
+ allRelationPromises.push(this.createExternalAgentRelation(agent2, delegate, "delegate"));
2537
2537
  } else {
2538
2538
  allRelationPromises.push(
2539
- this.createInternalAgentRelation(agent, delegate, "delegate")
2539
+ this.createInternalAgentRelation(agent2, delegate, "delegate")
2540
2540
  );
2541
2541
  }
2542
2542
  }
@@ -2553,7 +2553,7 @@ var AgentGraph = class {
2553
2553
  logger8.error(
2554
2554
  {
2555
2555
  error: result.reason instanceof Error ? result.reason.message : "Unknown error",
2556
- graphId: this.graphId
2556
+ agentId: this.agentId
2557
2557
  },
2558
2558
  "Failed to create agent relation"
2559
2559
  );
@@ -2561,7 +2561,7 @@ var AgentGraph = class {
2561
2561
  }
2562
2562
  logger8.info(
2563
2563
  {
2564
- graphId: this.graphId,
2564
+ agentId: this.agentId,
2565
2565
  totalRelations: allRelationPromises.length,
2566
2566
  successCount,
2567
2567
  errorCount: errors.length
@@ -2580,7 +2580,7 @@ var AgentGraph = class {
2580
2580
  "Content-Type": "application/json"
2581
2581
  },
2582
2582
  body: JSON.stringify({
2583
- graphId: this.graphId,
2583
+ agentId: this.agentId,
2584
2584
  sourceSubAgentId: sourceAgent.getId(),
2585
2585
  targetSubAgentId: targetAgent.getId(),
2586
2586
  relationType
@@ -2593,7 +2593,7 @@ var AgentGraph = class {
2593
2593
  {
2594
2594
  sourceSubAgentId: sourceAgent.getId(),
2595
2595
  targetSubAgentId: targetAgent.getId(),
2596
- graphId: this.graphId,
2596
+ agentId: this.agentId,
2597
2597
  relationType
2598
2598
  },
2599
2599
  `${relationType} relation already exists, skipping creation`
@@ -2606,7 +2606,7 @@ var AgentGraph = class {
2606
2606
  {
2607
2607
  sourceSubAgentId: sourceAgent.getId(),
2608
2608
  targetSubAgentId: targetAgent.getId(),
2609
- graphId: this.graphId,
2609
+ agentId: this.agentId,
2610
2610
  relationType
2611
2611
  },
2612
2612
  `${relationType} relation created successfully`
@@ -2616,7 +2616,7 @@ var AgentGraph = class {
2616
2616
  {
2617
2617
  sourceSubAgentId: sourceAgent.getId(),
2618
2618
  targetSubAgentId: targetAgent.getId(),
2619
- graphId: this.graphId,
2619
+ agentId: this.agentId,
2620
2620
  relationType,
2621
2621
  error: error instanceof Error ? error.message : "Unknown error"
2622
2622
  },
@@ -2633,7 +2633,7 @@ var AgentGraph = class {
2633
2633
  "Content-Type": "application/json"
2634
2634
  },
2635
2635
  body: JSON.stringify({
2636
- graphId: this.graphId,
2636
+ agentId: this.agentId,
2637
2637
  sourceSubAgentId: sourceAgent.getId(),
2638
2638
  externalSubAgentId: externalAgent2.getId(),
2639
2639
  relationType
@@ -2646,7 +2646,7 @@ var AgentGraph = class {
2646
2646
  {
2647
2647
  sourceSubAgentId: sourceAgent.getId(),
2648
2648
  externalSubAgentId: externalAgent2.getId(),
2649
- graphId: this.graphId,
2649
+ agentId: this.agentId,
2650
2650
  relationType
2651
2651
  },
2652
2652
  `${relationType} relation already exists, skipping creation`
@@ -2661,7 +2661,7 @@ var AgentGraph = class {
2661
2661
  {
2662
2662
  sourceSubAgentId: sourceAgent.getId(),
2663
2663
  externalSubAgentId: externalAgent2.getId(),
2664
- graphId: this.graphId,
2664
+ agentId: this.agentId,
2665
2665
  relationType
2666
2666
  },
2667
2667
  `${relationType} relation created successfully`
@@ -2671,7 +2671,7 @@ var AgentGraph = class {
2671
2671
  {
2672
2672
  sourceSubAgentId: sourceAgent.getId(),
2673
2673
  externalSubAgentId: externalAgent2.getId(),
2674
- graphId: this.graphId,
2674
+ agentId: this.agentId,
2675
2675
  relationType,
2676
2676
  error: error instanceof Error ? error.message : "Unknown error"
2677
2677
  },
@@ -2684,10 +2684,10 @@ var AgentGraph = class {
2684
2684
  * Create external agents in the database
2685
2685
  */
2686
2686
  async createExternalAgents() {
2687
- const externalAgents2 = this.subAgents.filter((agent) => this.isExternalAgent(agent));
2687
+ const externalAgents2 = this.subAgents.filter((agent2) => this.isExternalAgent(agent2));
2688
2688
  logger8.info(
2689
2689
  {
2690
- graphId: this.graphId,
2690
+ agentId: this.agentId,
2691
2691
  externalAgentCount: externalAgents2.length
2692
2692
  },
2693
2693
  "Creating external agents in database"
@@ -2698,7 +2698,7 @@ var AgentGraph = class {
2698
2698
  logger8.debug(
2699
2699
  {
2700
2700
  externalSubAgentId: externalAgent2.getId(),
2701
- graphId: this.graphId
2701
+ agentId: this.agentId
2702
2702
  },
2703
2703
  "External agent created in database"
2704
2704
  );
@@ -2706,7 +2706,7 @@ var AgentGraph = class {
2706
2706
  logger8.error(
2707
2707
  {
2708
2708
  externalSubAgentId: externalAgent2.getId(),
2709
- graphId: this.graphId,
2709
+ agentId: this.agentId,
2710
2710
  error: error instanceof Error ? error.message : "Unknown error"
2711
2711
  },
2712
2712
  "Failed to create external agent in database"
@@ -2718,7 +2718,7 @@ var AgentGraph = class {
2718
2718
  await Promise.all(initPromises);
2719
2719
  logger8.info(
2720
2720
  {
2721
- graphId: this.graphId,
2721
+ agentId: this.agentId,
2722
2722
  externalAgentCount: externalAgents2.length
2723
2723
  },
2724
2724
  "All external agents created successfully"
@@ -2726,7 +2726,7 @@ var AgentGraph = class {
2726
2726
  } catch (error) {
2727
2727
  logger8.error(
2728
2728
  {
2729
- graphId: this.graphId,
2729
+ agentId: this.agentId,
2730
2730
  error: error instanceof Error ? error.message : "Unknown error"
2731
2731
  },
2732
2732
  "Failed to create some external agents"
@@ -2985,8 +2985,8 @@ var Project = class {
2985
2985
  __publicField(this, "models");
2986
2986
  __publicField(this, "stopWhen");
2987
2987
  __publicField(this, "sandboxConfig");
2988
- __publicField(this, "graphs", []);
2989
- __publicField(this, "graphMap", /* @__PURE__ */ new Map());
2988
+ __publicField(this, "agents", []);
2989
+ __publicField(this, "agentMap", /* @__PURE__ */ new Map());
2990
2990
  __publicField(this, "credentialReferences", []);
2991
2991
  __publicField(this, "projectTools", []);
2992
2992
  __publicField(this, "projectDataComponents", []);
@@ -2999,11 +2999,11 @@ var Project = class {
2999
2999
  this.models = config.models;
3000
3000
  this.stopWhen = config.stopWhen;
3001
3001
  this.sandboxConfig = config.sandboxConfig;
3002
- if (config.graphs) {
3003
- this.graphs = config.graphs();
3004
- this.graphMap = new Map(this.graphs.map((graph) => [graph.getId(), graph]));
3005
- for (const graph of this.graphs) {
3006
- graph.setConfig(this.tenantId, this.projectId, this.baseURL);
3002
+ if (config.agents) {
3003
+ this.agents = config.agents();
3004
+ this.agentMap = new Map(this.agents.map((agent2) => [agent2.getId(), agent2]));
3005
+ for (const agent2 of this.agents) {
3006
+ agent2.setConfig(this.tenantId, this.projectId, this.baseURL);
3007
3007
  }
3008
3008
  }
3009
3009
  if (config.tools) {
@@ -3022,7 +3022,7 @@ var Project = class {
3022
3022
  {
3023
3023
  projectId: this.projectId,
3024
3024
  tenantId: this.tenantId,
3025
- graphCount: this.graphs.length
3025
+ agentCount: this.agents.length
3026
3026
  },
3027
3027
  "Project created"
3028
3028
  );
@@ -3041,8 +3041,8 @@ var Project = class {
3041
3041
  if (models) {
3042
3042
  this.models = models;
3043
3043
  }
3044
- for (const graph of this.graphs) {
3045
- graph.setConfig(tenantId, this.projectId, apiUrl);
3044
+ for (const agent2 of this.agents) {
3045
+ agent2.setConfig(tenantId, this.projectId, apiUrl);
3046
3046
  }
3047
3047
  logger10.info(
3048
3048
  {
@@ -3081,7 +3081,7 @@ var Project = class {
3081
3081
  {
3082
3082
  projectId: this.projectId,
3083
3083
  tenantId: this.tenantId,
3084
- graphCount: this.graphs.length
3084
+ agentCount: this.agents.length
3085
3085
  },
3086
3086
  "Initializing project using full project endpoint"
3087
3087
  );
@@ -3107,7 +3107,7 @@ var Project = class {
3107
3107
  {
3108
3108
  projectId: this.projectId,
3109
3109
  tenantId: this.tenantId,
3110
- graphCount: Object.keys(createdProject.graphs || {}).length
3110
+ agentCount: Object.keys(createdProject.agent || {}).length
3111
3111
  },
3112
3112
  "Project initialized successfully using full project endpoint"
3113
3113
  );
@@ -3188,46 +3188,46 @@ var Project = class {
3188
3188
  return await this.toFullProjectDefinition();
3189
3189
  }
3190
3190
  /**
3191
- * Get all graphs in the project
3191
+ * Get all agent in the project
3192
3192
  */
3193
- getGraphs() {
3194
- return this.graphs;
3193
+ getAgents() {
3194
+ return this.agents;
3195
3195
  }
3196
3196
  /**
3197
- * Get a graph by ID
3197
+ * Get an agent by ID
3198
3198
  */
3199
- getGraph(id) {
3200
- return this.graphMap.get(id);
3199
+ getAgent(id) {
3200
+ return this.agentMap.get(id);
3201
3201
  }
3202
3202
  /**
3203
- * Add a graph to the project
3203
+ * Add an agent to the project
3204
3204
  */
3205
- addGraph(graph) {
3206
- this.graphs.push(graph);
3207
- this.graphMap.set(graph.getId(), graph);
3208
- graph.setConfig(this.tenantId, this.projectId, this.baseURL);
3205
+ addAgent(agent2) {
3206
+ this.agents.push(agent2);
3207
+ this.agentMap.set(agent2.getId(), agent2);
3208
+ agent2.setConfig(this.tenantId, this.projectId, this.baseURL);
3209
3209
  logger10.info(
3210
3210
  {
3211
3211
  projectId: this.projectId,
3212
- graphId: graph.getId()
3212
+ agentId: agent2.getId()
3213
3213
  },
3214
- "Graph added to project"
3214
+ "Agent added to project"
3215
3215
  );
3216
3216
  }
3217
3217
  /**
3218
- * Remove a graph from the project
3218
+ * Remove an agent from the project
3219
3219
  */
3220
- removeGraph(id) {
3221
- const graphToRemove = this.graphMap.get(id);
3222
- if (graphToRemove) {
3223
- this.graphMap.delete(id);
3224
- this.graphs = this.graphs.filter((graph) => graph.getId() !== id);
3220
+ removeAgent(id) {
3221
+ const agentToRemove = this.agentMap.get(id);
3222
+ if (agentToRemove) {
3223
+ this.agentMap.delete(id);
3224
+ this.agents = this.agents.filter((agent2) => agent2.getId() !== id);
3225
3225
  logger10.info(
3226
3226
  {
3227
3227
  projectId: this.projectId,
3228
- graphId: id
3228
+ agentId: id
3229
3229
  },
3230
- "Graph removed from project"
3230
+ "Agent removed from project"
3231
3231
  );
3232
3232
  return true;
3233
3233
  }
@@ -3240,7 +3240,7 @@ var Project = class {
3240
3240
  return {
3241
3241
  projectId: this.projectId,
3242
3242
  tenantId: this.tenantId,
3243
- graphCount: this.graphs.length,
3243
+ agentCount: this.agents.length,
3244
3244
  initialized: this.initialized
3245
3245
  };
3246
3246
  }
@@ -3255,18 +3255,18 @@ var Project = class {
3255
3255
  if (!this.projectName) {
3256
3256
  errors.push("Project must have a name");
3257
3257
  }
3258
- const graphIds = /* @__PURE__ */ new Set();
3259
- for (const graph of this.graphs) {
3260
- const id = graph.getId();
3261
- if (graphIds.has(id)) {
3262
- errors.push(`Duplicate graph ID: ${id}`);
3258
+ const agentIds = /* @__PURE__ */ new Set();
3259
+ for (const agent2 of this.agents) {
3260
+ const id = agent2.getId();
3261
+ if (agentIds.has(id)) {
3262
+ errors.push(`Duplicate agent ID: ${id}`);
3263
3263
  }
3264
- graphIds.add(id);
3264
+ agentIds.add(id);
3265
3265
  }
3266
- for (const graph of this.graphs) {
3267
- const graphValidation = graph.validate();
3268
- if (!graphValidation.valid) {
3269
- errors.push(...graphValidation.errors.map((error) => `Graph '${graph.getId()}': ${error}`));
3266
+ for (const agent2 of this.agents) {
3267
+ const agentValidation = agent2.validate();
3268
+ if (!agentValidation.valid) {
3269
+ errors.push(...agentValidation.errors.map((error) => `Agent '${agent2.getId()}': ${error}`));
3270
3270
  }
3271
3271
  }
3272
3272
  return {
@@ -3278,7 +3278,7 @@ var Project = class {
3278
3278
  * Convert the Project to FullProjectDefinition format
3279
3279
  */
3280
3280
  async toFullProjectDefinition() {
3281
- const graphsObject = {};
3281
+ const agentsObject = {};
3282
3282
  const toolsObject = {};
3283
3283
  const functionToolsObject = {};
3284
3284
  const functionsObject = {};
@@ -3286,12 +3286,12 @@ var Project = class {
3286
3286
  const artifactComponentsObject = {};
3287
3287
  const credentialReferencesObject = {};
3288
3288
  const credentialUsageMap = {};
3289
- for (const graph of this.graphs) {
3290
- const graphDefinition = await graph.toFullGraphDefinition();
3291
- graphsObject[graph.getId()] = graphDefinition;
3292
- const graphCredentials = graph.credentials;
3293
- if (graphCredentials && Array.isArray(graphCredentials)) {
3294
- for (const credential2 of graphCredentials) {
3289
+ for (const agent2 of this.agents) {
3290
+ const agentDefinition = await agent2.toFullAgentDefinition();
3291
+ agentsObject[agent2.getId()] = agentDefinition;
3292
+ const agentCredentials = agent2.credentials;
3293
+ if (agentCredentials && Array.isArray(agentCredentials)) {
3294
+ for (const credential2 of agentCredentials) {
3295
3295
  if (credential2?.__type === "credential-ref") {
3296
3296
  continue;
3297
3297
  }
@@ -3306,15 +3306,15 @@ var Project = class {
3306
3306
  credentialUsageMap[credential2.id] = [];
3307
3307
  }
3308
3308
  credentialUsageMap[credential2.id].push({
3309
- type: "graph",
3310
- id: graph.getId()
3309
+ type: "agent",
3310
+ id: agent2.getId()
3311
3311
  });
3312
3312
  }
3313
3313
  }
3314
3314
  }
3315
- const graphContextConfig = graph.contextConfig;
3316
- if (graphContextConfig) {
3317
- const contextVariables = graphContextConfig.getContextVariables?.() || graphContextConfig.contextVariables;
3315
+ const agentContextConfig = agent2.contextConfig;
3316
+ if (agentContextConfig) {
3317
+ const contextVariables = agentContextConfig.getContextVariables?.() || agentContextConfig.contextVariables;
3318
3318
  if (contextVariables) {
3319
3319
  for (const [key, variable] of Object.entries(contextVariables)) {
3320
3320
  if (variable?.credential) {
@@ -3343,7 +3343,7 @@ var Project = class {
3343
3343
  credentialUsageMap[credId].push({
3344
3344
  type: "contextVariable",
3345
3345
  id: key,
3346
- graphId: graph.getId()
3346
+ agentId: agent2.getId()
3347
3347
  });
3348
3348
  }
3349
3349
  } else if (variable?.credentialReferenceId) {
@@ -3354,17 +3354,17 @@ var Project = class {
3354
3354
  credentialUsageMap[credId].push({
3355
3355
  type: "contextVariable",
3356
3356
  id: key,
3357
- graphId: graph.getId()
3357
+ agentId: agent2.getId()
3358
3358
  });
3359
3359
  }
3360
3360
  }
3361
3361
  }
3362
3362
  }
3363
- for (const agent of graph.getSubAgents()) {
3364
- if (agent.type === "external") {
3363
+ for (const subAgent2 of agent2.getSubAgents()) {
3364
+ if (subAgent2.type === "external") {
3365
3365
  continue;
3366
3366
  }
3367
- const agentTools = agent.getTools();
3367
+ const agentTools = subAgent2.getTools();
3368
3368
  for (const [, toolInstance] of Object.entries(agentTools)) {
3369
3369
  const actualTool = toolInstance;
3370
3370
  const toolId = actualTool.getId();
@@ -3418,7 +3418,7 @@ var Project = class {
3418
3418
  }
3419
3419
  }
3420
3420
  }
3421
- const subAgentDataComponents = agent.getDataComponents?.();
3421
+ const subAgentDataComponents = subAgent2.getDataComponents?.();
3422
3422
  if (subAgentDataComponents) {
3423
3423
  for (const dataComponent2 of subAgentDataComponents) {
3424
3424
  let dataComponentId;
@@ -3446,18 +3446,19 @@ var Project = class {
3446
3446
  }
3447
3447
  }
3448
3448
  }
3449
- const subAgentArtifactComponents = agent.getArtifactComponents?.();
3449
+ const subAgentArtifactComponents = subAgent2.getArtifactComponents();
3450
3450
  if (subAgentArtifactComponents) {
3451
3451
  for (const artifactComponent2 of subAgentArtifactComponents) {
3452
3452
  let artifactComponentId;
3453
3453
  let artifactComponentName;
3454
3454
  let artifactComponentDescription;
3455
3455
  let artifactComponentProps;
3456
- if (artifactComponent2.getId) {
3457
- artifactComponentId = artifactComponent2.getId();
3458
- artifactComponentName = artifactComponent2.getName();
3459
- artifactComponentDescription = artifactComponent2.getDescription() || "";
3460
- artifactComponentProps = artifactComponent2.getProps() || {};
3456
+ if ("getId" in artifactComponent2 && typeof artifactComponent2.getId === "function") {
3457
+ const component = artifactComponent2;
3458
+ artifactComponentId = component.getId();
3459
+ artifactComponentName = component.getName();
3460
+ artifactComponentDescription = component.getDescription() || "";
3461
+ artifactComponentProps = component.getProps() || {};
3461
3462
  } else {
3462
3463
  artifactComponentId = artifactComponent2.id || (artifactComponent2.name ? artifactComponent2.name.toLowerCase().replace(/\s+/g, "-") : "");
3463
3464
  artifactComponentName = artifactComponent2.name || "";
@@ -3557,7 +3558,7 @@ var Project = class {
3557
3558
  models: this.models,
3558
3559
  stopWhen: this.stopWhen,
3559
3560
  sandboxConfig: this.sandboxConfig,
3560
- graphs: graphsObject,
3561
+ agents: agentsObject,
3561
3562
  tools: toolsObject,
3562
3563
  functions: Object.keys(functionsObject).length > 0 ? functionsObject : void 0,
3563
3564
  dataComponents: Object.keys(dataComponentsObject).length > 0 ? dataComponentsObject : void 0,
@@ -3570,8 +3571,8 @@ var Project = class {
3570
3571
  };
3571
3572
 
3572
3573
  // src/builderFunctions.ts
3573
- function agentGraph(config) {
3574
- return new AgentGraph(config);
3574
+ function agent(config) {
3575
+ return new Agent(config);
3575
3576
  }
3576
3577
  function project(config) {
3577
3578
  return new Project(config);
@@ -3743,7 +3744,7 @@ var ExternalAgent = class {
3743
3744
  throw error;
3744
3745
  }
3745
3746
  }
3746
- // Set context (tenantId and baseURL) from external source (graph, CLI, etc)
3747
+ // Set context (tenantId and baseURL) from external source (agent, CLI, etc)
3747
3748
  setContext(tenantId, baseURL) {
3748
3749
  this.tenantId = tenantId;
3749
3750
  if (baseURL) {
@@ -3884,58 +3885,58 @@ var MaxTurnsExceededError = class extends AgentError {
3884
3885
  var logger12 = agentsCore.getLogger("runner");
3885
3886
  var Runner = class _Runner {
3886
3887
  /**
3887
- * Run a graph until completion, handling transfers and tool calls
3888
+ * Run an agent until completion, handling transfers and tool calls
3888
3889
  * Similar to OpenAI's Runner.run() pattern
3889
- * NOTE: This now requires a graph instead of an agent
3890
+ * NOTE: This now requires an agent instead of an agent
3890
3891
  */
3891
- static async run(graph, messages, options) {
3892
+ static async run(agent2, messages, options) {
3892
3893
  const maxTurns = options?.maxTurns || 10;
3893
3894
  let turnCount = 0;
3894
3895
  const messageHistory = _Runner.normalizeToMessageHistory(messages);
3895
3896
  const allToolCalls = [];
3896
3897
  logger12.info(
3897
3898
  {
3898
- graphId: graph.getId(),
3899
- defaultSubAgent: graph.getdefaultSubAgent()?.getName(),
3899
+ agentId: agent2.getId(),
3900
+ defaultSubAgent: agent2.getDefaultSubAgent()?.getName(),
3900
3901
  maxTurns,
3901
3902
  initialMessageCount: messageHistory.length
3902
3903
  },
3903
- "Starting graph run"
3904
+ "Starting agent run"
3904
3905
  );
3905
3906
  while (turnCount < maxTurns) {
3906
3907
  logger12.debug(
3907
3908
  {
3908
- graphId: graph.getId(),
3909
+ agentId: agent2.getId(),
3909
3910
  turnCount,
3910
3911
  messageHistoryLength: messageHistory.length
3911
3912
  },
3912
3913
  "Starting turn"
3913
3914
  );
3914
- const response = await graph.generate(messageHistory, options);
3915
+ const response = await agent2.generate(messageHistory, options);
3915
3916
  turnCount++;
3916
3917
  logger12.info(
3917
3918
  {
3918
- graphId: graph.getId(),
3919
+ agentId: agent2.getId(),
3919
3920
  turnCount,
3920
3921
  responseLength: response.length
3921
3922
  },
3922
- "Graph generation completed"
3923
+ "Agent generation completed"
3923
3924
  );
3924
3925
  return {
3925
3926
  finalOutput: response,
3926
- agent: graph.getdefaultSubAgent() || {},
3927
+ agent: agent2.getDefaultSubAgent() || {},
3927
3928
  turnCount,
3928
3929
  usage: { inputTokens: 0, outputTokens: 0 },
3929
3930
  metadata: {
3930
3931
  toolCalls: allToolCalls,
3931
3932
  transfers: []
3932
- // Graph handles transfers internally
3933
+ // Agent handles transfers internally
3933
3934
  }
3934
3935
  };
3935
3936
  }
3936
3937
  logger12.error(
3937
3938
  {
3938
- graphId: graph.getId(),
3939
+ agentId: agent2.getId(),
3939
3940
  maxTurns,
3940
3941
  finalTurnCount: turnCount
3941
3942
  },
@@ -3944,43 +3945,43 @@ var Runner = class _Runner {
3944
3945
  throw new MaxTurnsExceededError(maxTurns);
3945
3946
  }
3946
3947
  /**
3947
- * Stream a graph's response
3948
+ * Stream an agent's response
3948
3949
  */
3949
- static async stream(graph, messages, options) {
3950
+ static async stream(agent2, messages, options) {
3950
3951
  logger12.info(
3951
3952
  {
3952
- graphId: graph.getId(),
3953
- defaultSubAgent: graph.getdefaultSubAgent()?.getName()
3953
+ agentId: agent2.getId(),
3954
+ defaultSubAgent: agent2.getDefaultSubAgent()?.getName()
3954
3955
  },
3955
- "Starting graph stream"
3956
+ "Starting agent stream"
3956
3957
  );
3957
- return graph.stream(messages, options);
3958
+ return agent2.stream(messages, options);
3958
3959
  }
3959
3960
  /**
3960
- * Execute multiple graphs in parallel and return the first successful result
3961
+ * Execute multiple agent in parallel and return the first successful result
3961
3962
  */
3962
- static async raceGraphs(graphs, messages, options) {
3963
- if (graphs.length === 0) {
3964
- throw new Error("No graphs provided for race");
3963
+ static async raceAgents(agent2, messages, options) {
3964
+ if (agent2.length === 0) {
3965
+ throw new Error("No agent provided for race");
3965
3966
  }
3966
3967
  logger12.info(
3967
3968
  {
3968
- graphCount: graphs.length,
3969
- graphIds: graphs.map((g) => g.getId())
3969
+ agentCount: agent2.length,
3970
+ agentIds: agent2.map((g) => g.getId())
3970
3971
  },
3971
- "Starting graph race"
3972
+ "Starting agent race"
3972
3973
  );
3973
- const promises = graphs.map(async (graph, index) => {
3974
+ const promises = agent2.map(async (agent3, index) => {
3974
3975
  try {
3975
- const result2 = await _Runner.run(graph, messages, options);
3976
+ const result2 = await _Runner.run(agent3, messages, options);
3976
3977
  return { ...result2, raceIndex: index };
3977
3978
  } catch (error) {
3978
3979
  logger12.error(
3979
3980
  {
3980
- graphId: graph.getId(),
3981
+ agentId: agent3.getId(),
3981
3982
  error: error instanceof Error ? error.message : "Unknown error"
3982
3983
  },
3983
- "Graph failed in race"
3984
+ "Agent failed in race"
3984
3985
  );
3985
3986
  throw error;
3986
3987
  }
@@ -3988,10 +3989,10 @@ var Runner = class _Runner {
3988
3989
  const result = await Promise.race(promises);
3989
3990
  logger12.info(
3990
3991
  {
3991
- winningGraphId: result.graphId || "unknown",
3992
+ winningAgentId: result.agentId || "unknown",
3992
3993
  raceIndex: result.raceIndex
3993
3994
  },
3994
- "Graph race completed"
3995
+ "Agent race completed"
3995
3996
  );
3996
3997
  return result;
3997
3998
  }
@@ -4008,14 +4009,14 @@ var Runner = class _Runner {
4008
4009
  return [messages];
4009
4010
  }
4010
4011
  /**
4011
- * Validate graph configuration before running
4012
+ * Validate agent configuration before running
4012
4013
  */
4013
- static validateGraph(graph) {
4014
+ static validateAgent(agent2) {
4014
4015
  const errors = [];
4015
- if (!graph.getId()) {
4016
- errors.push("Graph ID is required");
4016
+ if (!agent2.getId()) {
4017
+ errors.push("Agent ID is required");
4017
4018
  }
4018
- const defaultSubAgent = graph.getdefaultSubAgent();
4019
+ const defaultSubAgent = agent2.getDefaultSubAgent();
4019
4020
  if (!defaultSubAgent) {
4020
4021
  errors.push("Default agent is required");
4021
4022
  } else {
@@ -4026,12 +4027,12 @@ var Runner = class _Runner {
4026
4027
  errors.push("Default agent instructions are required");
4027
4028
  }
4028
4029
  }
4029
- const agents = graph.getSubAgents();
4030
- if (agents.length === 0) {
4031
- errors.push("Graph must contain at least one agent");
4030
+ const subAgents = agent2.getSubAgents();
4031
+ if (subAgents.length === 0) {
4032
+ errors.push("Agent must contain at least one subagent");
4032
4033
  }
4033
- for (const agent of agents) {
4034
- if (!agent.getName()) {
4034
+ for (const subAgent2 of subAgents) {
4035
+ if (!subAgent2.getName()) {
4035
4036
  errors.push(`Agent missing name`);
4036
4037
  }
4037
4038
  }
@@ -4041,24 +4042,24 @@ var Runner = class _Runner {
4041
4042
  };
4042
4043
  }
4043
4044
  /**
4044
- * Get execution statistics for a graph
4045
+ * Get execution statistics for an agent
4045
4046
  */
4046
- static async getExecutionStats(graph, messages, options) {
4047
- const agents = graph.getSubAgents();
4048
- const defaultSubAgent = graph.getdefaultSubAgent();
4047
+ static async getExecutionStats(agent2, messages, options) {
4048
+ const subAgents = agent2.getSubAgents();
4049
+ const defaultSubAgent = agent2.getDefaultSubAgent();
4049
4050
  const messageCount = Array.isArray(messages) ? messages.length : 1;
4050
4051
  return {
4051
4052
  estimatedTurns: Math.min(Math.max(messageCount, 1), options?.maxTurns || 10),
4052
4053
  estimatedTokens: messageCount * 100,
4053
4054
  // Rough estimate
4054
- agentCount: agents.length,
4055
+ subAgentCount: subAgents.length,
4055
4056
  defaultSubAgent: defaultSubAgent?.getName()
4056
4057
  };
4057
4058
  }
4058
4059
  };
4059
4060
  var run = Runner.run.bind(Runner);
4060
4061
  var stream = Runner.stream.bind(Runner);
4061
- var raceGraphs = Runner.raceGraphs.bind(Runner);
4062
+ var raceAgents = Runner.raceAgents.bind(Runner);
4062
4063
 
4063
4064
  Object.defineProperty(exports, "ANTHROPIC_MODELS", {
4064
4065
  enumerable: true,
@@ -4072,16 +4073,15 @@ Object.defineProperty(exports, "OPENAI_MODELS", {
4072
4073
  enumerable: true,
4073
4074
  get: function () { return agentsCore.OPENAI_MODELS; }
4074
4075
  });
4075
- exports.Agent = SubAgent;
4076
4076
  exports.ArtifactComponent = ArtifactComponent;
4077
4077
  exports.DataComponent = DataComponent;
4078
4078
  exports.ExternalAgent = ExternalAgent;
4079
4079
  exports.FunctionTool = FunctionTool;
4080
4080
  exports.Project = Project;
4081
4081
  exports.Runner = Runner;
4082
+ exports.SubAgent = SubAgent;
4082
4083
  exports.Tool = Tool;
4083
- exports.agent = subAgent;
4084
- exports.agentGraph = agentGraph;
4084
+ exports.agent = agent;
4085
4085
  exports.agentMcp = agentMcp;
4086
4086
  exports.artifactComponent = artifactComponent;
4087
4087
  exports.createEnvironmentSettings = createEnvironmentSettings;
@@ -4098,9 +4098,10 @@ exports.isCredentialReference = isCredentialReference;
4098
4098
  exports.mcpServer = mcpServer;
4099
4099
  exports.mcpTool = mcpTool;
4100
4100
  exports.project = project;
4101
- exports.raceGraphs = raceGraphs;
4101
+ exports.raceAgents = raceAgents;
4102
4102
  exports.registerEnvironmentSettings = registerEnvironmentSettings;
4103
4103
  exports.run = run;
4104
4104
  exports.stream = stream;
4105
+ exports.subAgent = subAgent;
4105
4106
  exports.transfer = transfer;
4106
4107
  exports.updateFullProjectViaAPI = updateFullProjectViaAPI;