@inkeep/agents-sdk 0.18.1 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -56,9 +56,16 @@ var ArtifactComponent = class {
56
56
  __publicField(this, "initialized", false);
57
57
  __publicField(this, "id");
58
58
  this.id = config.id || generateIdFromName(config.name);
59
+ let processedProps;
60
+ if (config.props && schemaConversion.isZodSchema(config.props)) {
61
+ processedProps = schemaConversion.convertZodToJsonSchemaWithPreview(config.props);
62
+ } else {
63
+ processedProps = config.props;
64
+ }
59
65
  this.config = {
60
66
  ...config,
61
- id: this.id
67
+ id: this.id,
68
+ props: processedProps
62
69
  };
63
70
  this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
64
71
  this.tenantId = "default";
@@ -71,7 +78,7 @@ var ArtifactComponent = class {
71
78
  "ArtifactComponent constructor initialized"
72
79
  );
73
80
  }
74
- // 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)
75
82
  setContext(tenantId, projectId, baseURL) {
76
83
  this.tenantId = tenantId;
77
84
  this.projectId = projectId;
@@ -197,9 +204,16 @@ var DataComponent = class {
197
204
  __publicField(this, "initialized", false);
198
205
  __publicField(this, "id");
199
206
  this.id = config.id || generateIdFromName(config.name);
207
+ let processedProps;
208
+ if (config.props && schemaConversion.isZodSchema(config.props)) {
209
+ processedProps = schemaConversion.convertZodToJsonSchema(config.props);
210
+ } else {
211
+ processedProps = config.props;
212
+ }
200
213
  this.config = {
201
214
  ...config,
202
- id: this.id
215
+ id: this.id,
216
+ props: processedProps
203
217
  };
204
218
  this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
205
219
  this.tenantId = "default";
@@ -212,7 +226,7 @@ var DataComponent = class {
212
226
  "DataComponent constructor initialized"
213
227
  );
214
228
  }
215
- // 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)
216
230
  setContext(tenantId, projectId, baseURL) {
217
231
  this.tenantId = tenantId;
218
232
  this.projectId = projectId;
@@ -565,7 +579,7 @@ var Tool = class {
565
579
  "Tool constructor initialized"
566
580
  );
567
581
  }
568
- // 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)
569
583
  setContext(tenantId, projectId, baseURL) {
570
584
  this.tenantId = tenantId;
571
585
  this.projectId = projectId;
@@ -720,7 +734,7 @@ function normalizeAgentCanUseType(value, fallbackName) {
720
734
  throw new Error(`Invalid AgentCanUseType: expected Tool or AgentMcpConfig, got ${typeof value}`);
721
735
  }
722
736
 
723
- // src/agent.ts
737
+ // src/subAgent.ts
724
738
  var logger6 = agentsCore.getLogger("agent");
725
739
  function resolveGetter(value) {
726
740
  if (typeof value === "function") {
@@ -749,7 +763,7 @@ var SubAgent = class {
749
763
  "Agent constructor initialized"
750
764
  );
751
765
  }
752
- // 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)
753
767
  setContext(tenantId, projectId, baseURL) {
754
768
  this.tenantId = tenantId;
755
769
  this.projectId = projectId;
@@ -1467,28 +1481,28 @@ var SubAgent = class {
1467
1481
  }
1468
1482
  }
1469
1483
  };
1470
- var logger7 = agentsCore.getLogger("graphFullClient");
1471
- async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graphData) {
1484
+ var logger7 = agentsCore.getLogger("agentFullClient");
1485
+ async function updateFullAgentViaAPI(tenantId, projectId, apiUrl, agentId, agentData) {
1472
1486
  logger7.info(
1473
1487
  {
1474
1488
  tenantId,
1475
1489
  projectId,
1476
- graphId,
1490
+ agentId,
1477
1491
  apiUrl
1478
1492
  },
1479
- "Updating full graph via API"
1493
+ "Updating full agent via API"
1480
1494
  );
1481
- const url = `${apiUrl}/tenants/${tenantId}/projects/${projectId}/graph/${graphId}`;
1495
+ const url = `${apiUrl}/tenants/${tenantId}/projects/${projectId}/agent/${agentId}`;
1482
1496
  const response = await fetch(url, {
1483
1497
  method: "PUT",
1484
1498
  headers: {
1485
1499
  "Content-Type": "application/json"
1486
1500
  },
1487
- body: JSON.stringify(graphData)
1501
+ body: JSON.stringify(agentData)
1488
1502
  });
1489
1503
  if (!response.ok) {
1490
1504
  const errorText = await response.text();
1491
- let errorMessage = `Failed to update graph: ${response.status} ${response.statusText}`;
1505
+ let errorMessage = `Failed to update agent: ${response.status} ${response.statusText}`;
1492
1506
  try {
1493
1507
  const errorJson = JSON.parse(errorText);
1494
1508
  if (errorJson.error) {
@@ -1504,29 +1518,29 @@ async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graph
1504
1518
  status: response.status,
1505
1519
  error: errorMessage
1506
1520
  },
1507
- "Failed to update graph via API"
1521
+ "Failed to update agent via API"
1508
1522
  );
1509
1523
  throw new Error(errorMessage);
1510
1524
  }
1511
1525
  const result = await response.json();
1512
1526
  logger7.info(
1513
1527
  {
1514
- graphId
1528
+ agentId
1515
1529
  },
1516
- "Successfully updated graph via API"
1530
+ "Successfully updated agent via API"
1517
1531
  );
1518
1532
  return result.data;
1519
1533
  }
1520
1534
 
1521
- // src/graph.ts
1522
- var logger8 = agentsCore.getLogger("graph");
1535
+ // src/agent.ts
1536
+ var logger8 = agentsCore.getLogger("agent");
1523
1537
  function resolveGetter2(value) {
1524
1538
  if (typeof value === "function") {
1525
1539
  return value();
1526
1540
  }
1527
1541
  return value;
1528
1542
  }
1529
- var AgentGraph = class {
1543
+ var Agent = class {
1530
1544
  constructor(config) {
1531
1545
  __publicField(this, "subAgents", []);
1532
1546
  __publicField(this, "agentMap", /* @__PURE__ */ new Map());
@@ -1534,24 +1548,24 @@ var AgentGraph = class {
1534
1548
  __publicField(this, "baseURL");
1535
1549
  __publicField(this, "tenantId");
1536
1550
  __publicField(this, "projectId");
1537
- __publicField(this, "graphId");
1538
- __publicField(this, "graphName");
1539
- __publicField(this, "graphDescription");
1551
+ __publicField(this, "agentId");
1552
+ __publicField(this, "agentName");
1553
+ __publicField(this, "agentDescription");
1540
1554
  __publicField(this, "initialized", false);
1541
1555
  __publicField(this, "contextConfig");
1542
1556
  // ContextConfigBuilder
1543
1557
  __publicField(this, "credentials");
1544
1558
  __publicField(this, "models");
1545
1559
  __publicField(this, "statusUpdateSettings");
1546
- __publicField(this, "graphPrompt");
1560
+ __publicField(this, "agentPrompt");
1547
1561
  __publicField(this, "stopWhen");
1548
1562
  __publicField(this, "dbClient");
1549
1563
  this.defaultSubAgent = config.defaultSubAgent;
1550
1564
  this.tenantId = "default";
1551
1565
  this.projectId = "default";
1552
- this.graphId = config.id;
1553
- this.graphName = config.name || this.graphId;
1554
- this.graphDescription = config.description;
1566
+ this.agentId = config.id;
1567
+ this.agentName = config.name || this.agentId;
1568
+ this.agentDescription = config.description;
1555
1569
  this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
1556
1570
  this.contextConfig = config.contextConfig;
1557
1571
  this.credentials = resolveGetter2(config.credentials);
@@ -1561,12 +1575,12 @@ var AgentGraph = class {
1561
1575
  url: dbUrl
1562
1576
  });
1563
1577
  this.statusUpdateSettings = config.statusUpdates;
1564
- this.graphPrompt = config.graphPrompt;
1578
+ this.agentPrompt = config.agentPrompt;
1565
1579
  this.stopWhen = config.stopWhen ? {
1566
1580
  transferCountIs: config.stopWhen.transferCountIs
1567
1581
  } : void 0;
1568
1582
  this.subAgents = resolveGetter2(config.subAgents) || [];
1569
- this.agentMap = new Map(this.subAgents.map((agent) => [agent.getId(), agent]));
1583
+ this.agentMap = new Map(this.subAgents.map((agent2) => [agent2.getId(), agent2]));
1570
1584
  if (this.defaultSubAgent) {
1571
1585
  this.subAgents.push(this.defaultSubAgent);
1572
1586
  this.agentMap.set(this.defaultSubAgent.getId(), this.defaultSubAgent);
@@ -1576,12 +1590,12 @@ var AgentGraph = class {
1576
1590
  }
1577
1591
  logger8.info(
1578
1592
  {
1579
- graphId: this.graphId,
1593
+ agentId: this.agentId,
1580
1594
  tenantId: this.tenantId,
1581
1595
  agentCount: this.subAgents.length,
1582
1596
  defaultSubAgent: this.defaultSubAgent?.getName()
1583
1597
  },
1584
- "AgentGraph created"
1598
+ "Agent created"
1585
1599
  );
1586
1600
  }
1587
1601
  /**
@@ -1590,14 +1604,14 @@ var AgentGraph = class {
1590
1604
  */
1591
1605
  setConfig(tenantId, projectId, apiUrl) {
1592
1606
  if (this.initialized) {
1593
- throw new Error("Cannot set config after graph has been initialized");
1607
+ throw new Error("Cannot set config after agent has been initialized");
1594
1608
  }
1595
1609
  this.tenantId = tenantId;
1596
1610
  this.projectId = projectId;
1597
1611
  this.baseURL = apiUrl;
1598
- for (const agent of this.subAgents) {
1599
- if (this.isInternalAgent(agent)) {
1600
- const internalAgent = agent;
1612
+ for (const agent2 of this.subAgents) {
1613
+ if (this.isInternalAgent(agent2)) {
1614
+ const internalAgent = agent2;
1601
1615
  if (internalAgent.setContext) {
1602
1616
  internalAgent.setContext(tenantId, projectId, apiUrl);
1603
1617
  }
@@ -1610,35 +1624,35 @@ var AgentGraph = class {
1610
1624
  }
1611
1625
  }
1612
1626
  } else {
1613
- const externalAgent2 = agent;
1627
+ const externalAgent2 = agent2;
1614
1628
  if (externalAgent2.setContext) {
1615
1629
  externalAgent2.setContext(tenantId, apiUrl);
1616
1630
  }
1617
1631
  }
1618
1632
  }
1619
1633
  if (this.contextConfig?.setContext) {
1620
- this.contextConfig.setContext(tenantId, projectId, this.graphId, this.baseURL);
1634
+ this.contextConfig.setContext(tenantId, projectId, this.agentId, this.baseURL);
1621
1635
  }
1622
1636
  logger8.info(
1623
1637
  {
1624
- graphId: this.graphId,
1638
+ agentId: this.agentId,
1625
1639
  tenantId: this.tenantId,
1626
1640
  projectId: this.projectId,
1627
1641
  apiUrl: this.baseURL
1628
1642
  },
1629
- "Graph configuration updated"
1643
+ "Agent configuration updated"
1630
1644
  );
1631
1645
  }
1632
1646
  /**
1633
- * Convert the AgentGraph to FullGraphDefinition format for the new graph endpoint
1647
+ * Convert the Agent to FullAgentDefinition format for the new agent endpoint
1634
1648
  */
1635
- async toFullGraphDefinition() {
1649
+ async toFullAgentDefinition() {
1636
1650
  const agentsObject = {};
1637
1651
  const functionToolsObject = {};
1638
1652
  const functionsObject = {};
1639
- for (const agent of this.subAgents) {
1640
- if (this.isInternalAgent(agent)) {
1641
- const internalAgent = agent;
1653
+ for (const agent2 of this.subAgents) {
1654
+ if (this.isInternalAgent(agent2)) {
1655
+ const internalAgent = agent2;
1642
1656
  const transfers = internalAgent.getTransfers();
1643
1657
  const delegates = internalAgent.getDelegates();
1644
1658
  const tools = [];
@@ -1666,8 +1680,8 @@ var AgentGraph = class {
1666
1680
  name: toolData.name,
1667
1681
  description: toolData.description,
1668
1682
  functionId: toolData.functionId,
1669
- graphId: this.graphId
1670
- // Include graphId for graph-scoped function tools
1683
+ agentId: this.agentId
1684
+ // Include agentId for agent-scoped function tools
1671
1685
  };
1672
1686
  }
1673
1687
  }
@@ -1708,7 +1722,7 @@ var AgentGraph = class {
1708
1722
  type: "internal"
1709
1723
  };
1710
1724
  } else {
1711
- const externalAgent2 = agent;
1725
+ const externalAgent2 = agent2;
1712
1726
  agentsObject[externalAgent2.getId()] = {
1713
1727
  id: externalAgent2.getId(),
1714
1728
  name: externalAgent2.getName(),
@@ -1721,9 +1735,9 @@ var AgentGraph = class {
1721
1735
  }
1722
1736
  }
1723
1737
  return {
1724
- id: this.graphId,
1725
- name: this.graphName,
1726
- description: this.graphDescription,
1738
+ id: this.agentId,
1739
+ name: this.agentName,
1740
+ description: this.agentDescription,
1727
1741
  defaultSubAgentId: this.defaultSubAgent?.getId() || "",
1728
1742
  subAgents: agentsObject,
1729
1743
  contextConfig: this.contextConfig?.toObject(),
@@ -1731,7 +1745,7 @@ var AgentGraph = class {
1731
1745
  ...Object.keys(functionsObject).length > 0 && { functions: functionsObject },
1732
1746
  models: this.models,
1733
1747
  statusUpdates: this.statusUpdateSettings,
1734
- graphPrompt: this.graphPrompt,
1748
+ prompt: this.agentPrompt,
1735
1749
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1736
1750
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1737
1751
  };
@@ -1740,13 +1754,13 @@ var AgentGraph = class {
1740
1754
  * Initialize all tools in all agents (especially IPCTools that need MCP server URLs)
1741
1755
  */
1742
1756
  async initializeAllTools() {
1743
- logger8.info({ graphId: this.graphId }, "Initializing all tools in graph");
1757
+ logger8.info({ agentId: this.agentId }, "Initializing all tools in agent");
1744
1758
  const toolInitPromises = [];
1745
- for (const agent of this.subAgents) {
1746
- if (!agent.getTools) {
1759
+ for (const agent2 of this.subAgents) {
1760
+ if (!agent2.getTools) {
1747
1761
  continue;
1748
1762
  }
1749
- const internalAgent = agent;
1763
+ const internalAgent = agent2;
1750
1764
  const agentTools = internalAgent.getTools();
1751
1765
  for (const [toolName, toolInstance] of Object.entries(agentTools)) {
1752
1766
  if (toolInstance && typeof toolInstance === "object") {
@@ -1766,7 +1780,7 @@ var AgentGraph = class {
1766
1780
  }
1767
1781
  logger8.debug(
1768
1782
  {
1769
- subAgentId: agent.getId(),
1783
+ subAgentId: agent2.getId(),
1770
1784
  toolName,
1771
1785
  toolType: toolInstance.constructor.name,
1772
1786
  skipDbRegistration
@@ -1776,7 +1790,7 @@ var AgentGraph = class {
1776
1790
  } catch (error) {
1777
1791
  logger8.error(
1778
1792
  {
1779
- subAgentId: agent.getId(),
1793
+ subAgentId: agent2.getId(),
1780
1794
  toolName,
1781
1795
  error: error instanceof Error ? error.message : "Unknown error"
1782
1796
  },
@@ -1792,109 +1806,109 @@ var AgentGraph = class {
1792
1806
  }
1793
1807
  await Promise.all(toolInitPromises);
1794
1808
  logger8.info(
1795
- { graphId: this.graphId, toolCount: toolInitPromises.length },
1809
+ { agentId: this.agentId, toolCount: toolInitPromises.length },
1796
1810
  "All tools initialized successfully"
1797
1811
  );
1798
1812
  }
1799
1813
  /**
1800
- * 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
1801
1815
  */
1802
1816
  async init() {
1803
1817
  if (this.initialized) {
1804
- logger8.info({ graphId: this.graphId }, "Graph already initialized");
1818
+ logger8.info({ agentId: this.agentId }, "Agent already initialized");
1805
1819
  return;
1806
1820
  }
1807
1821
  logger8.info(
1808
1822
  {
1809
- graphId: this.graphId,
1823
+ agentId: this.agentId,
1810
1824
  agentCount: this.subAgents.length
1811
1825
  },
1812
- "Initializing agent graph using new graph endpoint"
1826
+ "Initializing agent using new agent endpoint"
1813
1827
  );
1814
1828
  try {
1815
1829
  await this.initializeAllTools();
1816
1830
  await this.applyModelInheritance();
1817
- const graphDefinition = await this.toFullGraphDefinition();
1831
+ const agentDefinition = await this.toFullAgentDefinition();
1818
1832
  logger8.info(
1819
1833
  {
1820
- graphId: this.graphId,
1834
+ agentId: this.agentId,
1821
1835
  mode: "api-client",
1822
1836
  apiUrl: this.baseURL
1823
1837
  },
1824
- "Using API client to create/update graph"
1838
+ "Using API client to create/update agent"
1825
1839
  );
1826
- const createdGraph = await updateFullGraphViaAPI(
1840
+ const createdAgent = await updateFullAgentViaAPI(
1827
1841
  this.tenantId,
1828
1842
  this.projectId,
1829
1843
  this.baseURL,
1830
- this.graphId,
1831
- graphDefinition
1844
+ this.agentId,
1845
+ agentDefinition
1832
1846
  );
1833
1847
  logger8.info(
1834
1848
  {
1835
- graphId: this.graphId,
1836
- agentCount: Object.keys(createdGraph.agents || {}).length
1849
+ agentId: this.agentId,
1850
+ agentCount: Object.keys(createdAgent.subAgents || {}).length
1837
1851
  },
1838
- "Agent graph initialized successfully using graph endpoint"
1852
+ "Agent initialized successfully using agent endpoint"
1839
1853
  );
1840
1854
  this.initialized = true;
1841
1855
  } catch (error) {
1842
1856
  logger8.error(
1843
1857
  {
1844
- graphId: this.graphId,
1858
+ agentId: this.agentId,
1845
1859
  error: error instanceof Error ? error.message : "Unknown error"
1846
1860
  },
1847
- "Failed to initialize agent graph using graph endpoint"
1861
+ "Failed to initialize agent using agent endpoint"
1848
1862
  );
1849
1863
  throw error;
1850
1864
  }
1851
1865
  }
1852
1866
  /**
1853
1867
  * Legacy initialization method - kept for backward compatibility
1854
- * 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
1855
1869
  */
1856
1870
  async initLegacy() {
1857
1871
  if (this.initialized) {
1858
- logger8.info({ graphId: this.graphId }, "Graph already initialized");
1872
+ logger8.info({ agentId: this.agentId }, "Agent already initialized");
1859
1873
  return;
1860
1874
  }
1861
1875
  logger8.info(
1862
1876
  {
1863
- graphId: this.graphId,
1877
+ agentId: this.agentId,
1864
1878
  agentCount: this.subAgents.length
1865
1879
  },
1866
- "Initializing agent graph"
1880
+ "Initializing agent"
1867
1881
  );
1868
1882
  try {
1869
1883
  if (this.contextConfig) {
1870
1884
  await this.contextConfig.init();
1871
1885
  logger8.info(
1872
1886
  {
1873
- graphId: this.graphId,
1887
+ agentId: this.agentId,
1874
1888
  contextConfigId: this.contextConfig.getId()
1875
1889
  },
1876
- "Context configuration initialized for graph"
1890
+ "Context configuration initialized for agent"
1877
1891
  );
1878
1892
  }
1879
- const initPromises = this.subAgents.map(async (agent) => {
1893
+ const initPromises = this.subAgents.map(async (agent2) => {
1880
1894
  try {
1881
- agent.config.graphId = this.graphId;
1882
- await agent.init();
1895
+ agent2.config.agentId = this.agentId;
1896
+ await agent2.init();
1883
1897
  logger8.debug(
1884
1898
  {
1885
- subAgentId: agent.getId(),
1886
- graphId: this.graphId
1899
+ subAgentId: agent2.getId(),
1900
+ agentId: this.agentId
1887
1901
  },
1888
- "Agent initialized in graph"
1902
+ "Agent initialized in agent"
1889
1903
  );
1890
1904
  } catch (error) {
1891
1905
  logger8.error(
1892
1906
  {
1893
- subAgentId: agent.getId(),
1894
- graphId: this.graphId,
1907
+ subAgentId: agent2.getId(),
1908
+ agentId: this.agentId,
1895
1909
  error: error instanceof Error ? error.message : "Unknown error"
1896
1910
  },
1897
- "Failed to initialize agent in graph"
1911
+ "Failed to initialize agent in agent"
1898
1912
  );
1899
1913
  throw error;
1900
1914
  }
@@ -1907,18 +1921,18 @@ var AgentGraph = class {
1907
1921
  this.initialized = true;
1908
1922
  logger8.info(
1909
1923
  {
1910
- graphId: this.graphId,
1924
+ agentId: this.agentId,
1911
1925
  agentCount: this.subAgents.length
1912
1926
  },
1913
- "Agent graph initialized successfully"
1927
+ "Agent initialized successfully"
1914
1928
  );
1915
1929
  } catch (error) {
1916
1930
  logger8.error(
1917
1931
  {
1918
- graphId: this.graphId,
1932
+ agentId: this.agentId,
1919
1933
  error: error instanceof Error ? error.message : "Unknown error"
1920
1934
  },
1921
- "Failed to initialize agent graph"
1935
+ "Failed to initialize agent"
1922
1936
  );
1923
1937
  throw error;
1924
1938
  }
@@ -1929,11 +1943,11 @@ var AgentGraph = class {
1929
1943
  async generate(input, options) {
1930
1944
  await this._init();
1931
1945
  if (!this.defaultSubAgent) {
1932
- throw new Error("No default agent configured for this graph");
1946
+ throw new Error("No default agent configured for this agent");
1933
1947
  }
1934
1948
  logger8.info(
1935
1949
  {
1936
- graphId: this.graphId,
1950
+ agentId: this.agentId,
1937
1951
  defaultSubAgent: this.defaultSubAgent.getName(),
1938
1952
  conversationId: options?.conversationId
1939
1953
  },
@@ -1948,18 +1962,18 @@ var AgentGraph = class {
1948
1962
  async stream(input, options) {
1949
1963
  await this._init();
1950
1964
  if (!this.defaultSubAgent) {
1951
- throw new Error("No default agent configured for this graph");
1965
+ throw new Error("No default agent configured for this agent");
1952
1966
  }
1953
1967
  logger8.info(
1954
1968
  {
1955
- graphId: this.graphId,
1969
+ agentId: this.agentId,
1956
1970
  defaultSubAgent: this.defaultSubAgent.getName(),
1957
1971
  conversationId: options?.conversationId
1958
1972
  },
1959
1973
  "Streaming response with default agent"
1960
1974
  );
1961
- const textStream = async function* (graph) {
1962
- const response = await graph.executeWithBackend(input, options);
1975
+ const textStream = async function* (agent2) {
1976
+ const response = await agent2.executeWithBackend(input, options);
1963
1977
  const words = response.split(" ");
1964
1978
  for (const word of words) {
1965
1979
  yield `${word} `;
@@ -1976,22 +1990,22 @@ var AgentGraph = class {
1976
1990
  return await this.stream(input, options);
1977
1991
  }
1978
1992
  /**
1979
- * Run with a specific agent from the graph
1993
+ * Run with a specific agent from the agent
1980
1994
  */
1981
1995
  async runWith(subAgentId, input, options) {
1982
1996
  await this._init();
1983
- const agent = this.getAgent(subAgentId);
1984
- if (!agent) {
1985
- 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`);
1986
2000
  }
1987
- if (!this.isInternalAgent(agent)) {
2001
+ if (!this.isInternalAgent(agent2)) {
1988
2002
  throw new Error(
1989
2003
  `Agent '${subAgentId}' is an external agent and cannot be run directly. External agents are only accessible via delegation.`
1990
2004
  );
1991
2005
  }
1992
2006
  logger8.info(
1993
2007
  {
1994
- graphId: this.graphId,
2008
+ agentId: this.agentId,
1995
2009
  subAgentId,
1996
2010
  conversationId: options?.conversationId
1997
2011
  },
@@ -2000,7 +2014,7 @@ var AgentGraph = class {
2000
2014
  const response = await this.executeWithBackend(input, options);
2001
2015
  return {
2002
2016
  finalOutput: response,
2003
- agent,
2017
+ agent: agent2,
2004
2018
  turnCount: 1,
2005
2019
  usage: { inputTokens: 0, outputTokens: 0 },
2006
2020
  metadata: {
@@ -2012,48 +2026,48 @@ var AgentGraph = class {
2012
2026
  /**
2013
2027
  * Get an agent by name (unified method for all agent types)
2014
2028
  */
2015
- getAgent(name) {
2029
+ getSubAgent(name) {
2016
2030
  return this.agentMap.get(name);
2017
2031
  }
2018
2032
  /**
2019
- * Add an agent to the graph
2033
+ * Add an agent to the agent
2020
2034
  */
2021
- addSubAgent(agent) {
2022
- this.subAgents.push(agent);
2023
- this.agentMap.set(agent.getId(), agent);
2024
- if (this.models && this.isInternalAgent(agent)) {
2025
- 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);
2026
2040
  }
2027
2041
  logger8.info(
2028
2042
  {
2029
- graphId: this.graphId,
2030
- subAgentId: agent.getId(),
2031
- agentType: this.isInternalAgent(agent) ? "internal" : "external"
2043
+ agentId: this.agentId,
2044
+ subAgentId: agent2.getId(),
2045
+ agentType: this.isInternalAgent(agent2) ? "internal" : "external"
2032
2046
  },
2033
- "Agent added to graph"
2047
+ "Agent added to agent"
2034
2048
  );
2035
2049
  }
2036
2050
  /**
2037
- * Remove an agent from the graph
2051
+ * Remove an agent from the agent
2038
2052
  */
2039
2053
  removeSubAgent(id) {
2040
2054
  const agentToRemove = this.agentMap.get(id);
2041
2055
  if (agentToRemove) {
2042
2056
  this.agentMap.delete(agentToRemove.getId());
2043
- this.subAgents = this.subAgents.filter((agent) => agent.getId() !== agentToRemove.getId());
2057
+ this.subAgents = this.subAgents.filter((agent2) => agent2.getId() !== agentToRemove.getId());
2044
2058
  logger8.info(
2045
2059
  {
2046
- graphId: this.graphId,
2060
+ agentId: this.agentId,
2047
2061
  subAgentId: agentToRemove.getId()
2048
2062
  },
2049
- "Agent removed from graph"
2063
+ "Agent removed from agent"
2050
2064
  );
2051
2065
  return true;
2052
2066
  }
2053
2067
  return false;
2054
2068
  }
2055
2069
  /**
2056
- * Get all agents in the graph
2070
+ * Get all agents in the agent
2057
2071
  */
2058
2072
  getSubAgents() {
2059
2073
  return this.subAgents;
@@ -2067,13 +2081,13 @@ var AgentGraph = class {
2067
2081
  /**
2068
2082
  * Set the default agent
2069
2083
  */
2070
- setdefaultSubAgent(agent) {
2071
- this.defaultSubAgent = agent;
2072
- this.addSubAgent(agent);
2084
+ setDefaultSubAgent(agent2) {
2085
+ this.defaultSubAgent = agent2;
2086
+ this.addSubAgent(agent2);
2073
2087
  logger8.info(
2074
2088
  {
2075
- graphId: this.graphId,
2076
- defaultSubAgent: agent.getId()
2089
+ agentId: this.agentId,
2090
+ defaultSubAgent: agent2.getId()
2077
2091
  },
2078
2092
  "Default agent updated"
2079
2093
  );
@@ -2081,106 +2095,106 @@ var AgentGraph = class {
2081
2095
  /**
2082
2096
  * Get the default agent
2083
2097
  */
2084
- getdefaultSubAgent() {
2098
+ getDefaultSubAgent() {
2085
2099
  return this.defaultSubAgent;
2086
2100
  }
2087
2101
  /**
2088
- * Get the graph ID
2102
+ * Get the agent ID
2089
2103
  */
2090
2104
  getId() {
2091
- return this.graphId;
2105
+ return this.agentId;
2092
2106
  }
2093
2107
  getName() {
2094
- return this.graphName;
2108
+ return this.agentName;
2095
2109
  }
2096
2110
  getDescription() {
2097
- return this.graphDescription;
2111
+ return this.agentDescription;
2098
2112
  }
2099
2113
  getTenantId() {
2100
2114
  return this.tenantId;
2101
2115
  }
2102
2116
  /**
2103
- * Get the graph's model settingsuration
2117
+ * Get the agent's model settingsuration
2104
2118
  */
2105
2119
  getModels() {
2106
2120
  return this.models;
2107
2121
  }
2108
2122
  /**
2109
- * Set the graph's model settingsuration
2123
+ * Set the agent's model settingsuration
2110
2124
  */
2111
2125
  setModels(models) {
2112
2126
  this.models = models;
2113
2127
  }
2114
2128
  /**
2115
- * Get the graph's prompt configuration
2129
+ * Get the agent's prompt configuration
2116
2130
  */
2117
- getGraphPrompt() {
2118
- return this.graphPrompt;
2131
+ getAgentPrompt() {
2132
+ return this.agentPrompt;
2119
2133
  }
2120
2134
  /**
2121
- * Get the graph's stopWhen configuration
2135
+ * Get the agent's stopWhen configuration
2122
2136
  */
2123
2137
  getStopWhen() {
2124
2138
  return this.stopWhen || { transferCountIs: 10 };
2125
2139
  }
2126
2140
  /**
2127
- * Get the graph's status updates configuration
2141
+ * Get the agent's status updates configuration
2128
2142
  */
2129
2143
  getStatusUpdateSettings() {
2130
2144
  return this.statusUpdateSettings;
2131
2145
  }
2132
2146
  /**
2133
- * Get the summarizer model from the graph's model settings
2147
+ * Get the summarizer model from the agent's model settings
2134
2148
  */
2135
2149
  getSummarizerModel() {
2136
2150
  return this.models?.summarizer;
2137
2151
  }
2138
2152
  /**
2139
- * Get graph statistics
2153
+ * Get agent statistics
2140
2154
  */
2141
2155
  getStats() {
2142
2156
  return {
2143
2157
  agentCount: this.subAgents.length,
2144
2158
  defaultSubAgent: this.defaultSubAgent?.getName() || null,
2145
2159
  initialized: this.initialized,
2146
- graphId: this.graphId,
2160
+ agentId: this.agentId,
2147
2161
  tenantId: this.tenantId
2148
2162
  };
2149
2163
  }
2150
2164
  /**
2151
- * Validate the graph configuration
2165
+ * Validate the agent configuration
2152
2166
  */
2153
2167
  validate() {
2154
2168
  const errors = [];
2155
2169
  if (this.subAgents.length === 0) {
2156
- errors.push("Graph must contain at least one agent");
2170
+ errors.push("Agent must contain at least one agent");
2157
2171
  }
2158
2172
  if (!this.defaultSubAgent) {
2159
- errors.push("Graph must have a default agent");
2173
+ errors.push("Agent must have a default agent");
2160
2174
  }
2161
2175
  const names = /* @__PURE__ */ new Set();
2162
- for (const agent of this.subAgents) {
2163
- const name = agent.getName();
2176
+ for (const agent2 of this.subAgents) {
2177
+ const name = agent2.getName();
2164
2178
  if (names.has(name)) {
2165
2179
  errors.push(`Duplicate agent name: ${name}`);
2166
2180
  }
2167
2181
  names.add(name);
2168
2182
  }
2169
- for (const agent of this.subAgents) {
2170
- if (!this.isInternalAgent(agent)) continue;
2171
- const transfers = agent.getTransfers();
2183
+ for (const agent2 of this.subAgents) {
2184
+ if (!this.isInternalAgent(agent2)) continue;
2185
+ const transfers = agent2.getTransfers();
2172
2186
  for (const transferAgent of transfers) {
2173
2187
  if (!this.agentMap.has(transferAgent.getName())) {
2174
2188
  errors.push(
2175
- `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`
2176
2190
  );
2177
2191
  }
2178
2192
  }
2179
- const delegates = agent.getDelegates();
2193
+ const delegates = agent2.getDelegates();
2180
2194
  for (const delegateAgent of delegates) {
2181
2195
  if (!this.agentMap.has(delegateAgent.getName())) {
2182
2196
  errors.push(
2183
- `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`
2184
2198
  );
2185
2199
  }
2186
2200
  }
@@ -2199,8 +2213,8 @@ var AgentGraph = class {
2199
2213
  /**
2200
2214
  * Type guard to check if an agent is an internal AgentInterface
2201
2215
  */
2202
- isInternalAgent(agent) {
2203
- return "getTransfers" in agent && typeof agent.getTransfers === "function";
2216
+ isInternalAgent(agent2) {
2217
+ return "getTransfers" in agent2 && typeof agent2.getTransfers === "function";
2204
2218
  }
2205
2219
  /**
2206
2220
  * Get project-level model settingsuration defaults
@@ -2245,7 +2259,7 @@ var AgentGraph = class {
2245
2259
  }
2246
2260
  }
2247
2261
  /**
2248
- * Apply model inheritance hierarchy: Project -> Graph -> Agent
2262
+ * Apply model inheritance hierarchy: Project -> Agent -> Agent
2249
2263
  */
2250
2264
  async applyModelInheritance() {
2251
2265
  const projectModels = await this.getProjectModelDefaults();
@@ -2264,14 +2278,14 @@ var AgentGraph = class {
2264
2278
  }
2265
2279
  }
2266
2280
  await this.applyStopWhenInheritance();
2267
- for (const agent of this.subAgents) {
2268
- if (this.isInternalAgent(agent)) {
2269
- this.propagateModelSettingsToAgent(agent);
2281
+ for (const agent2 of this.subAgents) {
2282
+ if (this.isInternalAgent(agent2)) {
2283
+ this.propagateModelSettingsToAgent(agent2);
2270
2284
  }
2271
2285
  }
2272
2286
  }
2273
2287
  /**
2274
- * Apply stopWhen inheritance hierarchy: Project -> Graph -> Agent
2288
+ * Apply stopWhen inheritance hierarchy: Project -> Agent -> Agent
2275
2289
  */
2276
2290
  async applyStopWhenInheritance() {
2277
2291
  const projectStopWhen = await this.getProjectStopWhenDefaults();
@@ -2285,9 +2299,9 @@ var AgentGraph = class {
2285
2299
  this.stopWhen.transferCountIs = 10;
2286
2300
  }
2287
2301
  if (projectStopWhen?.stepCountIs !== void 0) {
2288
- for (const agent of this.subAgents) {
2289
- if (this.isInternalAgent(agent)) {
2290
- const internalAgent = agent;
2302
+ for (const agent2 of this.subAgents) {
2303
+ if (this.isInternalAgent(agent2)) {
2304
+ const internalAgent = agent2;
2291
2305
  if (!internalAgent.config.stopWhen) {
2292
2306
  internalAgent.config.stopWhen = {};
2293
2307
  }
@@ -2299,54 +2313,54 @@ var AgentGraph = class {
2299
2313
  }
2300
2314
  logger8.debug(
2301
2315
  {
2302
- graphId: this.graphId,
2303
- graphStopWhen: this.stopWhen,
2316
+ agentId: this.agentId,
2317
+ agentStopWhen: this.stopWhen,
2304
2318
  projectStopWhen
2305
2319
  },
2306
- "Applied stopWhen inheritance from project to graph"
2320
+ "Applied stopWhen inheritance from project to agent"
2307
2321
  );
2308
2322
  }
2309
2323
  /**
2310
- * Propagate graph-level model settings to agents (supporting partial inheritance)
2324
+ * Propagate agent-level model settings to agents (supporting partial inheritance)
2311
2325
  */
2312
- propagateModelSettingsToAgent(agent) {
2326
+ propagateModelSettingsToAgent(agent2) {
2313
2327
  if (this.models) {
2314
- if (!agent.config.models) {
2315
- agent.config.models = {};
2328
+ if (!agent2.config.models) {
2329
+ agent2.config.models = {};
2316
2330
  }
2317
- if (!agent.config.models.base && this.models.base) {
2318
- agent.config.models.base = this.models.base;
2331
+ if (!agent2.config.models.base && this.models.base) {
2332
+ agent2.config.models.base = this.models.base;
2319
2333
  }
2320
- if (!agent.config.models.structuredOutput && this.models.structuredOutput) {
2321
- agent.config.models.structuredOutput = this.models.structuredOutput;
2334
+ if (!agent2.config.models.structuredOutput && this.models.structuredOutput) {
2335
+ agent2.config.models.structuredOutput = this.models.structuredOutput;
2322
2336
  }
2323
- if (!agent.config.models.summarizer && this.models.summarizer) {
2324
- agent.config.models.summarizer = this.models.summarizer;
2337
+ if (!agent2.config.models.summarizer && this.models.summarizer) {
2338
+ agent2.config.models.summarizer = this.models.summarizer;
2325
2339
  }
2326
2340
  }
2327
2341
  }
2328
2342
  /**
2329
- * Immediately propagate graph-level models to all agents during construction
2343
+ * Immediately propagate agent-level models to all agents during construction
2330
2344
  */
2331
2345
  propagateImmediateModelSettings() {
2332
- for (const agent of this.subAgents) {
2333
- if (this.isInternalAgent(agent)) {
2334
- this.propagateModelSettingsToAgent(agent);
2346
+ for (const agent2 of this.subAgents) {
2347
+ if (this.isInternalAgent(agent2)) {
2348
+ this.propagateModelSettingsToAgent(agent2);
2335
2349
  }
2336
2350
  }
2337
2351
  }
2338
2352
  /**
2339
2353
  * Type guard to check if an agent is an external AgentInterface
2340
2354
  */
2341
- isExternalAgent(agent) {
2342
- return !this.isInternalAgent(agent);
2355
+ isExternalAgent(agent2) {
2356
+ return !this.isInternalAgent(agent2);
2343
2357
  }
2344
2358
  /**
2345
2359
  * Execute agent using the backend system instead of local runner
2346
2360
  */
2347
2361
  async executeWithBackend(input, options) {
2348
2362
  const normalizedMessages = this.normalizeMessages(input);
2349
- 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`;
2350
2364
  logger8.info({ url }, "Executing with backend");
2351
2365
  const requestBody = {
2352
2366
  model: "gpt-4o-mini",
@@ -2383,7 +2397,7 @@ var AgentGraph = class {
2383
2397
  const data = JSON.parse(responseText);
2384
2398
  return data.result || data.choices?.[0]?.message?.content || "";
2385
2399
  } catch (error) {
2386
- throw new Error(`Graph execution failed: ${error.message || "Unknown error"}`);
2400
+ throw new Error(`Agent execution failed: ${error.message || "Unknown error"}`);
2387
2401
  }
2388
2402
  }
2389
2403
  /**
@@ -2422,7 +2436,7 @@ var AgentGraph = class {
2422
2436
  }
2423
2437
  async saveToDatabase() {
2424
2438
  try {
2425
- const getUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
2439
+ const getUrl = `${this.baseURL}/tenants/${this.tenantId}/agents/${this.agentId}`;
2426
2440
  try {
2427
2441
  const getResponse = await fetch(getUrl, {
2428
2442
  method: "GET",
@@ -2431,7 +2445,7 @@ var AgentGraph = class {
2431
2445
  }
2432
2446
  });
2433
2447
  if (getResponse.ok) {
2434
- logger8.info({ graphId: this.graphId }, "Graph already exists in backend");
2448
+ logger8.info({ agentId: this.agentId }, "Agent already exists in backend");
2435
2449
  return;
2436
2450
  }
2437
2451
  if (getResponse.status !== 404) {
@@ -2442,16 +2456,16 @@ var AgentGraph = class {
2442
2456
  throw error;
2443
2457
  }
2444
2458
  }
2445
- logger8.info({ graphId: this.graphId }, "Creating graph in backend");
2446
- 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`;
2447
2461
  const createResponse = await fetch(createUrl, {
2448
2462
  method: "POST",
2449
2463
  headers: {
2450
2464
  "Content-Type": "application/json"
2451
2465
  },
2452
2466
  body: JSON.stringify({
2453
- id: this.graphId,
2454
- name: this.graphName,
2467
+ id: this.agentId,
2468
+ name: this.agentName,
2455
2469
  defaultSubAgentId: this.defaultSubAgent?.getId() || "",
2456
2470
  contextConfigId: this.contextConfig?.getId(),
2457
2471
  models: this.models
@@ -2461,25 +2475,25 @@ var AgentGraph = class {
2461
2475
  throw new Error(`HTTP ${createResponse.status}: ${createResponse.statusText}`);
2462
2476
  }
2463
2477
  const createData = await createResponse.json();
2464
- this.graphId = createData.data.id;
2465
- 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");
2466
2480
  } catch (error) {
2467
2481
  throw new Error(
2468
- `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"}`
2469
2483
  );
2470
2484
  }
2471
2485
  }
2472
2486
  async saveRelations() {
2473
2487
  if (this.defaultSubAgent) {
2474
2488
  try {
2475
- const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/agent-graphs/${this.graphId}`;
2489
+ const updateUrl = `${this.baseURL}/tenants/${this.tenantId}/agents/${this.agentId}`;
2476
2490
  const updateResponse = await fetch(updateUrl, {
2477
2491
  method: "PUT",
2478
2492
  headers: {
2479
2493
  "Content-Type": "application/json"
2480
2494
  },
2481
2495
  body: JSON.stringify({
2482
- id: this.graphId,
2496
+ id: this.agentId,
2483
2497
  defaultSubAgentId: this.defaultSubAgent.getId(),
2484
2498
  contextConfigId: this.contextConfig?.getId()
2485
2499
  })
@@ -2489,18 +2503,18 @@ var AgentGraph = class {
2489
2503
  }
2490
2504
  logger8.debug(
2491
2505
  {
2492
- graphId: this.graphId,
2506
+ agentId: this.agentId,
2493
2507
  defaultSubAgent: this.defaultSubAgent.getName()
2494
2508
  },
2495
- "Graph relationships configured"
2509
+ "Agent relationships configured"
2496
2510
  );
2497
2511
  } catch (error) {
2498
2512
  logger8.error(
2499
2513
  {
2500
- graphId: this.graphId,
2514
+ agentId: this.agentId,
2501
2515
  error: error instanceof Error ? error.message : "Unknown error"
2502
2516
  },
2503
- "Failed to update graph relationships"
2517
+ "Failed to update agent relationships"
2504
2518
  );
2505
2519
  throw error;
2506
2520
  }
@@ -2508,21 +2522,21 @@ var AgentGraph = class {
2508
2522
  }
2509
2523
  async createAgentRelations() {
2510
2524
  const allRelationPromises = [];
2511
- for (const agent of this.subAgents) {
2512
- if (this.isInternalAgent(agent)) {
2513
- const transfers = agent.getTransfers();
2525
+ for (const agent2 of this.subAgents) {
2526
+ if (this.isInternalAgent(agent2)) {
2527
+ const transfers = agent2.getTransfers();
2514
2528
  for (const transferAgent of transfers) {
2515
2529
  allRelationPromises.push(
2516
- this.createInternalAgentRelation(agent, transferAgent, "transfer")
2530
+ this.createInternalAgentRelation(agent2, transferAgent, "transfer")
2517
2531
  );
2518
2532
  }
2519
- const delegates = agent.getDelegates();
2533
+ const delegates = agent2.getDelegates();
2520
2534
  for (const delegate of delegates) {
2521
2535
  if (delegate.type === "external") {
2522
- allRelationPromises.push(this.createExternalAgentRelation(agent, delegate, "delegate"));
2536
+ allRelationPromises.push(this.createExternalAgentRelation(agent2, delegate, "delegate"));
2523
2537
  } else {
2524
2538
  allRelationPromises.push(
2525
- this.createInternalAgentRelation(agent, delegate, "delegate")
2539
+ this.createInternalAgentRelation(agent2, delegate, "delegate")
2526
2540
  );
2527
2541
  }
2528
2542
  }
@@ -2539,7 +2553,7 @@ var AgentGraph = class {
2539
2553
  logger8.error(
2540
2554
  {
2541
2555
  error: result.reason instanceof Error ? result.reason.message : "Unknown error",
2542
- graphId: this.graphId
2556
+ agentId: this.agentId
2543
2557
  },
2544
2558
  "Failed to create agent relation"
2545
2559
  );
@@ -2547,7 +2561,7 @@ var AgentGraph = class {
2547
2561
  }
2548
2562
  logger8.info(
2549
2563
  {
2550
- graphId: this.graphId,
2564
+ agentId: this.agentId,
2551
2565
  totalRelations: allRelationPromises.length,
2552
2566
  successCount,
2553
2567
  errorCount: errors.length
@@ -2566,7 +2580,7 @@ var AgentGraph = class {
2566
2580
  "Content-Type": "application/json"
2567
2581
  },
2568
2582
  body: JSON.stringify({
2569
- graphId: this.graphId,
2583
+ agentId: this.agentId,
2570
2584
  sourceSubAgentId: sourceAgent.getId(),
2571
2585
  targetSubAgentId: targetAgent.getId(),
2572
2586
  relationType
@@ -2579,7 +2593,7 @@ var AgentGraph = class {
2579
2593
  {
2580
2594
  sourceSubAgentId: sourceAgent.getId(),
2581
2595
  targetSubAgentId: targetAgent.getId(),
2582
- graphId: this.graphId,
2596
+ agentId: this.agentId,
2583
2597
  relationType
2584
2598
  },
2585
2599
  `${relationType} relation already exists, skipping creation`
@@ -2592,7 +2606,7 @@ var AgentGraph = class {
2592
2606
  {
2593
2607
  sourceSubAgentId: sourceAgent.getId(),
2594
2608
  targetSubAgentId: targetAgent.getId(),
2595
- graphId: this.graphId,
2609
+ agentId: this.agentId,
2596
2610
  relationType
2597
2611
  },
2598
2612
  `${relationType} relation created successfully`
@@ -2602,7 +2616,7 @@ var AgentGraph = class {
2602
2616
  {
2603
2617
  sourceSubAgentId: sourceAgent.getId(),
2604
2618
  targetSubAgentId: targetAgent.getId(),
2605
- graphId: this.graphId,
2619
+ agentId: this.agentId,
2606
2620
  relationType,
2607
2621
  error: error instanceof Error ? error.message : "Unknown error"
2608
2622
  },
@@ -2619,7 +2633,7 @@ var AgentGraph = class {
2619
2633
  "Content-Type": "application/json"
2620
2634
  },
2621
2635
  body: JSON.stringify({
2622
- graphId: this.graphId,
2636
+ agentId: this.agentId,
2623
2637
  sourceSubAgentId: sourceAgent.getId(),
2624
2638
  externalSubAgentId: externalAgent2.getId(),
2625
2639
  relationType
@@ -2632,7 +2646,7 @@ var AgentGraph = class {
2632
2646
  {
2633
2647
  sourceSubAgentId: sourceAgent.getId(),
2634
2648
  externalSubAgentId: externalAgent2.getId(),
2635
- graphId: this.graphId,
2649
+ agentId: this.agentId,
2636
2650
  relationType
2637
2651
  },
2638
2652
  `${relationType} relation already exists, skipping creation`
@@ -2647,7 +2661,7 @@ var AgentGraph = class {
2647
2661
  {
2648
2662
  sourceSubAgentId: sourceAgent.getId(),
2649
2663
  externalSubAgentId: externalAgent2.getId(),
2650
- graphId: this.graphId,
2664
+ agentId: this.agentId,
2651
2665
  relationType
2652
2666
  },
2653
2667
  `${relationType} relation created successfully`
@@ -2657,7 +2671,7 @@ var AgentGraph = class {
2657
2671
  {
2658
2672
  sourceSubAgentId: sourceAgent.getId(),
2659
2673
  externalSubAgentId: externalAgent2.getId(),
2660
- graphId: this.graphId,
2674
+ agentId: this.agentId,
2661
2675
  relationType,
2662
2676
  error: error instanceof Error ? error.message : "Unknown error"
2663
2677
  },
@@ -2670,10 +2684,10 @@ var AgentGraph = class {
2670
2684
  * Create external agents in the database
2671
2685
  */
2672
2686
  async createExternalAgents() {
2673
- const externalAgents2 = this.subAgents.filter((agent) => this.isExternalAgent(agent));
2687
+ const externalAgents2 = this.subAgents.filter((agent2) => this.isExternalAgent(agent2));
2674
2688
  logger8.info(
2675
2689
  {
2676
- graphId: this.graphId,
2690
+ agentId: this.agentId,
2677
2691
  externalAgentCount: externalAgents2.length
2678
2692
  },
2679
2693
  "Creating external agents in database"
@@ -2684,7 +2698,7 @@ var AgentGraph = class {
2684
2698
  logger8.debug(
2685
2699
  {
2686
2700
  externalSubAgentId: externalAgent2.getId(),
2687
- graphId: this.graphId
2701
+ agentId: this.agentId
2688
2702
  },
2689
2703
  "External agent created in database"
2690
2704
  );
@@ -2692,7 +2706,7 @@ var AgentGraph = class {
2692
2706
  logger8.error(
2693
2707
  {
2694
2708
  externalSubAgentId: externalAgent2.getId(),
2695
- graphId: this.graphId,
2709
+ agentId: this.agentId,
2696
2710
  error: error instanceof Error ? error.message : "Unknown error"
2697
2711
  },
2698
2712
  "Failed to create external agent in database"
@@ -2704,7 +2718,7 @@ var AgentGraph = class {
2704
2718
  await Promise.all(initPromises);
2705
2719
  logger8.info(
2706
2720
  {
2707
- graphId: this.graphId,
2721
+ agentId: this.agentId,
2708
2722
  externalAgentCount: externalAgents2.length
2709
2723
  },
2710
2724
  "All external agents created successfully"
@@ -2712,7 +2726,7 @@ var AgentGraph = class {
2712
2726
  } catch (error) {
2713
2727
  logger8.error(
2714
2728
  {
2715
- graphId: this.graphId,
2729
+ agentId: this.agentId,
2716
2730
  error: error instanceof Error ? error.message : "Unknown error"
2717
2731
  },
2718
2732
  "Failed to create some external agents"
@@ -2971,8 +2985,8 @@ var Project = class {
2971
2985
  __publicField(this, "models");
2972
2986
  __publicField(this, "stopWhen");
2973
2987
  __publicField(this, "sandboxConfig");
2974
- __publicField(this, "graphs", []);
2975
- __publicField(this, "graphMap", /* @__PURE__ */ new Map());
2988
+ __publicField(this, "agents", []);
2989
+ __publicField(this, "agentMap", /* @__PURE__ */ new Map());
2976
2990
  __publicField(this, "credentialReferences", []);
2977
2991
  __publicField(this, "projectTools", []);
2978
2992
  __publicField(this, "projectDataComponents", []);
@@ -2985,11 +2999,11 @@ var Project = class {
2985
2999
  this.models = config.models;
2986
3000
  this.stopWhen = config.stopWhen;
2987
3001
  this.sandboxConfig = config.sandboxConfig;
2988
- if (config.graphs) {
2989
- this.graphs = config.graphs();
2990
- this.graphMap = new Map(this.graphs.map((graph) => [graph.getId(), graph]));
2991
- for (const graph of this.graphs) {
2992
- 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);
2993
3007
  }
2994
3008
  }
2995
3009
  if (config.tools) {
@@ -3008,7 +3022,7 @@ var Project = class {
3008
3022
  {
3009
3023
  projectId: this.projectId,
3010
3024
  tenantId: this.tenantId,
3011
- graphCount: this.graphs.length
3025
+ agentCount: this.agents.length
3012
3026
  },
3013
3027
  "Project created"
3014
3028
  );
@@ -3027,8 +3041,8 @@ var Project = class {
3027
3041
  if (models) {
3028
3042
  this.models = models;
3029
3043
  }
3030
- for (const graph of this.graphs) {
3031
- graph.setConfig(tenantId, this.projectId, apiUrl);
3044
+ for (const agent2 of this.agents) {
3045
+ agent2.setConfig(tenantId, this.projectId, apiUrl);
3032
3046
  }
3033
3047
  logger10.info(
3034
3048
  {
@@ -3067,7 +3081,7 @@ var Project = class {
3067
3081
  {
3068
3082
  projectId: this.projectId,
3069
3083
  tenantId: this.tenantId,
3070
- graphCount: this.graphs.length
3084
+ agentCount: this.agents.length
3071
3085
  },
3072
3086
  "Initializing project using full project endpoint"
3073
3087
  );
@@ -3093,7 +3107,7 @@ var Project = class {
3093
3107
  {
3094
3108
  projectId: this.projectId,
3095
3109
  tenantId: this.tenantId,
3096
- graphCount: Object.keys(createdProject.graphs || {}).length
3110
+ agentCount: Object.keys(createdProject.agent || {}).length
3097
3111
  },
3098
3112
  "Project initialized successfully using full project endpoint"
3099
3113
  );
@@ -3170,47 +3184,50 @@ var Project = class {
3170
3184
  }
3171
3185
  return { credentials, usage };
3172
3186
  }
3187
+ async getFullDefinition() {
3188
+ return await this.toFullProjectDefinition();
3189
+ }
3173
3190
  /**
3174
- * Get all graphs in the project
3191
+ * Get all agent in the project
3175
3192
  */
3176
- getGraphs() {
3177
- return this.graphs;
3193
+ getAgents() {
3194
+ return this.agents;
3178
3195
  }
3179
3196
  /**
3180
- * Get a graph by ID
3197
+ * Get an agent by ID
3181
3198
  */
3182
- getGraph(id) {
3183
- return this.graphMap.get(id);
3199
+ getAgent(id) {
3200
+ return this.agentMap.get(id);
3184
3201
  }
3185
3202
  /**
3186
- * Add a graph to the project
3203
+ * Add an agent to the project
3187
3204
  */
3188
- addGraph(graph) {
3189
- this.graphs.push(graph);
3190
- this.graphMap.set(graph.getId(), graph);
3191
- 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);
3192
3209
  logger10.info(
3193
3210
  {
3194
3211
  projectId: this.projectId,
3195
- graphId: graph.getId()
3212
+ agentId: agent2.getId()
3196
3213
  },
3197
- "Graph added to project"
3214
+ "Agent added to project"
3198
3215
  );
3199
3216
  }
3200
3217
  /**
3201
- * Remove a graph from the project
3218
+ * Remove an agent from the project
3202
3219
  */
3203
- removeGraph(id) {
3204
- const graphToRemove = this.graphMap.get(id);
3205
- if (graphToRemove) {
3206
- this.graphMap.delete(id);
3207
- 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);
3208
3225
  logger10.info(
3209
3226
  {
3210
3227
  projectId: this.projectId,
3211
- graphId: id
3228
+ agentId: id
3212
3229
  },
3213
- "Graph removed from project"
3230
+ "Agent removed from project"
3214
3231
  );
3215
3232
  return true;
3216
3233
  }
@@ -3223,7 +3240,7 @@ var Project = class {
3223
3240
  return {
3224
3241
  projectId: this.projectId,
3225
3242
  tenantId: this.tenantId,
3226
- graphCount: this.graphs.length,
3243
+ agentCount: this.agents.length,
3227
3244
  initialized: this.initialized
3228
3245
  };
3229
3246
  }
@@ -3238,18 +3255,18 @@ var Project = class {
3238
3255
  if (!this.projectName) {
3239
3256
  errors.push("Project must have a name");
3240
3257
  }
3241
- const graphIds = /* @__PURE__ */ new Set();
3242
- for (const graph of this.graphs) {
3243
- const id = graph.getId();
3244
- if (graphIds.has(id)) {
3245
- 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}`);
3246
3263
  }
3247
- graphIds.add(id);
3264
+ agentIds.add(id);
3248
3265
  }
3249
- for (const graph of this.graphs) {
3250
- const graphValidation = graph.validate();
3251
- if (!graphValidation.valid) {
3252
- 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}`));
3253
3270
  }
3254
3271
  }
3255
3272
  return {
@@ -3261,7 +3278,7 @@ var Project = class {
3261
3278
  * Convert the Project to FullProjectDefinition format
3262
3279
  */
3263
3280
  async toFullProjectDefinition() {
3264
- const graphsObject = {};
3281
+ const agentsObject = {};
3265
3282
  const toolsObject = {};
3266
3283
  const functionToolsObject = {};
3267
3284
  const functionsObject = {};
@@ -3269,12 +3286,12 @@ var Project = class {
3269
3286
  const artifactComponentsObject = {};
3270
3287
  const credentialReferencesObject = {};
3271
3288
  const credentialUsageMap = {};
3272
- for (const graph of this.graphs) {
3273
- const graphDefinition = await graph.toFullGraphDefinition();
3274
- graphsObject[graph.getId()] = graphDefinition;
3275
- const graphCredentials = graph.credentials;
3276
- if (graphCredentials && Array.isArray(graphCredentials)) {
3277
- 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) {
3278
3295
  if (credential2?.__type === "credential-ref") {
3279
3296
  continue;
3280
3297
  }
@@ -3289,15 +3306,15 @@ var Project = class {
3289
3306
  credentialUsageMap[credential2.id] = [];
3290
3307
  }
3291
3308
  credentialUsageMap[credential2.id].push({
3292
- type: "graph",
3293
- id: graph.getId()
3309
+ type: "agent",
3310
+ id: agent2.getId()
3294
3311
  });
3295
3312
  }
3296
3313
  }
3297
3314
  }
3298
- const graphContextConfig = graph.contextConfig;
3299
- if (graphContextConfig) {
3300
- const contextVariables = graphContextConfig.getContextVariables?.() || graphContextConfig.contextVariables;
3315
+ const agentContextConfig = agent2.contextConfig;
3316
+ if (agentContextConfig) {
3317
+ const contextVariables = agentContextConfig.getContextVariables?.() || agentContextConfig.contextVariables;
3301
3318
  if (contextVariables) {
3302
3319
  for (const [key, variable] of Object.entries(contextVariables)) {
3303
3320
  if (variable?.credential) {
@@ -3326,7 +3343,7 @@ var Project = class {
3326
3343
  credentialUsageMap[credId].push({
3327
3344
  type: "contextVariable",
3328
3345
  id: key,
3329
- graphId: graph.getId()
3346
+ agentId: agent2.getId()
3330
3347
  });
3331
3348
  }
3332
3349
  } else if (variable?.credentialReferenceId) {
@@ -3337,17 +3354,17 @@ var Project = class {
3337
3354
  credentialUsageMap[credId].push({
3338
3355
  type: "contextVariable",
3339
3356
  id: key,
3340
- graphId: graph.getId()
3357
+ agentId: agent2.getId()
3341
3358
  });
3342
3359
  }
3343
3360
  }
3344
3361
  }
3345
3362
  }
3346
- for (const agent of graph.getSubAgents()) {
3347
- if (agent.type === "external") {
3363
+ for (const subAgent2 of agent2.getSubAgents()) {
3364
+ if (subAgent2.type === "external") {
3348
3365
  continue;
3349
3366
  }
3350
- const agentTools = agent.getTools();
3367
+ const agentTools = subAgent2.getTools();
3351
3368
  for (const [, toolInstance] of Object.entries(agentTools)) {
3352
3369
  const actualTool = toolInstance;
3353
3370
  const toolId = actualTool.getId();
@@ -3401,7 +3418,7 @@ var Project = class {
3401
3418
  }
3402
3419
  }
3403
3420
  }
3404
- const subAgentDataComponents = agent.getDataComponents?.();
3421
+ const subAgentDataComponents = subAgent2.getDataComponents?.();
3405
3422
  if (subAgentDataComponents) {
3406
3423
  for (const dataComponent2 of subAgentDataComponents) {
3407
3424
  let dataComponentId;
@@ -3429,18 +3446,19 @@ var Project = class {
3429
3446
  }
3430
3447
  }
3431
3448
  }
3432
- const subAgentArtifactComponents = agent.getArtifactComponents?.();
3449
+ const subAgentArtifactComponents = subAgent2.getArtifactComponents();
3433
3450
  if (subAgentArtifactComponents) {
3434
3451
  for (const artifactComponent2 of subAgentArtifactComponents) {
3435
3452
  let artifactComponentId;
3436
3453
  let artifactComponentName;
3437
3454
  let artifactComponentDescription;
3438
3455
  let artifactComponentProps;
3439
- if (artifactComponent2.getId) {
3440
- artifactComponentId = artifactComponent2.getId();
3441
- artifactComponentName = artifactComponent2.getName();
3442
- artifactComponentDescription = artifactComponent2.getDescription() || "";
3443
- 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() || {};
3444
3462
  } else {
3445
3463
  artifactComponentId = artifactComponent2.id || (artifactComponent2.name ? artifactComponent2.name.toLowerCase().replace(/\s+/g, "-") : "");
3446
3464
  artifactComponentName = artifactComponent2.name || "";
@@ -3540,7 +3558,7 @@ var Project = class {
3540
3558
  models: this.models,
3541
3559
  stopWhen: this.stopWhen,
3542
3560
  sandboxConfig: this.sandboxConfig,
3543
- graphs: graphsObject,
3561
+ agents: agentsObject,
3544
3562
  tools: toolsObject,
3545
3563
  functions: Object.keys(functionsObject).length > 0 ? functionsObject : void 0,
3546
3564
  dataComponents: Object.keys(dataComponentsObject).length > 0 ? dataComponentsObject : void 0,
@@ -3553,8 +3571,8 @@ var Project = class {
3553
3571
  };
3554
3572
 
3555
3573
  // src/builderFunctions.ts
3556
- function agentGraph(config) {
3557
- return new AgentGraph(config);
3574
+ function agent(config) {
3575
+ return new Agent(config);
3558
3576
  }
3559
3577
  function project(config) {
3560
3578
  return new Project(config);
@@ -3726,7 +3744,7 @@ var ExternalAgent = class {
3726
3744
  throw error;
3727
3745
  }
3728
3746
  }
3729
- // Set context (tenantId and baseURL) from external source (graph, CLI, etc)
3747
+ // Set context (tenantId and baseURL) from external source (agent, CLI, etc)
3730
3748
  setContext(tenantId, baseURL) {
3731
3749
  this.tenantId = tenantId;
3732
3750
  if (baseURL) {
@@ -3867,58 +3885,58 @@ var MaxTurnsExceededError = class extends AgentError {
3867
3885
  var logger12 = agentsCore.getLogger("runner");
3868
3886
  var Runner = class _Runner {
3869
3887
  /**
3870
- * Run a graph until completion, handling transfers and tool calls
3888
+ * Run an agent until completion, handling transfers and tool calls
3871
3889
  * Similar to OpenAI's Runner.run() pattern
3872
- * NOTE: This now requires a graph instead of an agent
3890
+ * NOTE: This now requires an agent instead of an agent
3873
3891
  */
3874
- static async run(graph, messages, options) {
3892
+ static async run(agent2, messages, options) {
3875
3893
  const maxTurns = options?.maxTurns || 10;
3876
3894
  let turnCount = 0;
3877
3895
  const messageHistory = _Runner.normalizeToMessageHistory(messages);
3878
3896
  const allToolCalls = [];
3879
3897
  logger12.info(
3880
3898
  {
3881
- graphId: graph.getId(),
3882
- defaultSubAgent: graph.getdefaultSubAgent()?.getName(),
3899
+ agentId: agent2.getId(),
3900
+ defaultSubAgent: agent2.getDefaultSubAgent()?.getName(),
3883
3901
  maxTurns,
3884
3902
  initialMessageCount: messageHistory.length
3885
3903
  },
3886
- "Starting graph run"
3904
+ "Starting agent run"
3887
3905
  );
3888
3906
  while (turnCount < maxTurns) {
3889
3907
  logger12.debug(
3890
3908
  {
3891
- graphId: graph.getId(),
3909
+ agentId: agent2.getId(),
3892
3910
  turnCount,
3893
3911
  messageHistoryLength: messageHistory.length
3894
3912
  },
3895
3913
  "Starting turn"
3896
3914
  );
3897
- const response = await graph.generate(messageHistory, options);
3915
+ const response = await agent2.generate(messageHistory, options);
3898
3916
  turnCount++;
3899
3917
  logger12.info(
3900
3918
  {
3901
- graphId: graph.getId(),
3919
+ agentId: agent2.getId(),
3902
3920
  turnCount,
3903
3921
  responseLength: response.length
3904
3922
  },
3905
- "Graph generation completed"
3923
+ "Agent generation completed"
3906
3924
  );
3907
3925
  return {
3908
3926
  finalOutput: response,
3909
- agent: graph.getdefaultSubAgent() || {},
3927
+ agent: agent2.getDefaultSubAgent() || {},
3910
3928
  turnCount,
3911
3929
  usage: { inputTokens: 0, outputTokens: 0 },
3912
3930
  metadata: {
3913
3931
  toolCalls: allToolCalls,
3914
3932
  transfers: []
3915
- // Graph handles transfers internally
3933
+ // Agent handles transfers internally
3916
3934
  }
3917
3935
  };
3918
3936
  }
3919
3937
  logger12.error(
3920
3938
  {
3921
- graphId: graph.getId(),
3939
+ agentId: agent2.getId(),
3922
3940
  maxTurns,
3923
3941
  finalTurnCount: turnCount
3924
3942
  },
@@ -3927,43 +3945,43 @@ var Runner = class _Runner {
3927
3945
  throw new MaxTurnsExceededError(maxTurns);
3928
3946
  }
3929
3947
  /**
3930
- * Stream a graph's response
3948
+ * Stream an agent's response
3931
3949
  */
3932
- static async stream(graph, messages, options) {
3950
+ static async stream(agent2, messages, options) {
3933
3951
  logger12.info(
3934
3952
  {
3935
- graphId: graph.getId(),
3936
- defaultSubAgent: graph.getdefaultSubAgent()?.getName()
3953
+ agentId: agent2.getId(),
3954
+ defaultSubAgent: agent2.getDefaultSubAgent()?.getName()
3937
3955
  },
3938
- "Starting graph stream"
3956
+ "Starting agent stream"
3939
3957
  );
3940
- return graph.stream(messages, options);
3958
+ return agent2.stream(messages, options);
3941
3959
  }
3942
3960
  /**
3943
- * Execute multiple graphs in parallel and return the first successful result
3961
+ * Execute multiple agent in parallel and return the first successful result
3944
3962
  */
3945
- static async raceGraphs(graphs, messages, options) {
3946
- if (graphs.length === 0) {
3947
- 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");
3948
3966
  }
3949
3967
  logger12.info(
3950
3968
  {
3951
- graphCount: graphs.length,
3952
- graphIds: graphs.map((g) => g.getId())
3969
+ agentCount: agent2.length,
3970
+ agentIds: agent2.map((g) => g.getId())
3953
3971
  },
3954
- "Starting graph race"
3972
+ "Starting agent race"
3955
3973
  );
3956
- const promises = graphs.map(async (graph, index) => {
3974
+ const promises = agent2.map(async (agent3, index) => {
3957
3975
  try {
3958
- const result2 = await _Runner.run(graph, messages, options);
3976
+ const result2 = await _Runner.run(agent3, messages, options);
3959
3977
  return { ...result2, raceIndex: index };
3960
3978
  } catch (error) {
3961
3979
  logger12.error(
3962
3980
  {
3963
- graphId: graph.getId(),
3981
+ agentId: agent3.getId(),
3964
3982
  error: error instanceof Error ? error.message : "Unknown error"
3965
3983
  },
3966
- "Graph failed in race"
3984
+ "Agent failed in race"
3967
3985
  );
3968
3986
  throw error;
3969
3987
  }
@@ -3971,10 +3989,10 @@ var Runner = class _Runner {
3971
3989
  const result = await Promise.race(promises);
3972
3990
  logger12.info(
3973
3991
  {
3974
- winningGraphId: result.graphId || "unknown",
3992
+ winningAgentId: result.agentId || "unknown",
3975
3993
  raceIndex: result.raceIndex
3976
3994
  },
3977
- "Graph race completed"
3995
+ "Agent race completed"
3978
3996
  );
3979
3997
  return result;
3980
3998
  }
@@ -3991,14 +4009,14 @@ var Runner = class _Runner {
3991
4009
  return [messages];
3992
4010
  }
3993
4011
  /**
3994
- * Validate graph configuration before running
4012
+ * Validate agent configuration before running
3995
4013
  */
3996
- static validateGraph(graph) {
4014
+ static validateAgent(agent2) {
3997
4015
  const errors = [];
3998
- if (!graph.getId()) {
3999
- errors.push("Graph ID is required");
4016
+ if (!agent2.getId()) {
4017
+ errors.push("Agent ID is required");
4000
4018
  }
4001
- const defaultSubAgent = graph.getdefaultSubAgent();
4019
+ const defaultSubAgent = agent2.getDefaultSubAgent();
4002
4020
  if (!defaultSubAgent) {
4003
4021
  errors.push("Default agent is required");
4004
4022
  } else {
@@ -4009,12 +4027,12 @@ var Runner = class _Runner {
4009
4027
  errors.push("Default agent instructions are required");
4010
4028
  }
4011
4029
  }
4012
- const agents = graph.getSubAgents();
4013
- if (agents.length === 0) {
4014
- 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");
4015
4033
  }
4016
- for (const agent of agents) {
4017
- if (!agent.getName()) {
4034
+ for (const subAgent2 of subAgents) {
4035
+ if (!subAgent2.getName()) {
4018
4036
  errors.push(`Agent missing name`);
4019
4037
  }
4020
4038
  }
@@ -4024,35 +4042,46 @@ var Runner = class _Runner {
4024
4042
  };
4025
4043
  }
4026
4044
  /**
4027
- * Get execution statistics for a graph
4045
+ * Get execution statistics for an agent
4028
4046
  */
4029
- static async getExecutionStats(graph, messages, options) {
4030
- const agents = graph.getSubAgents();
4031
- const defaultSubAgent = graph.getdefaultSubAgent();
4047
+ static async getExecutionStats(agent2, messages, options) {
4048
+ const subAgents = agent2.getSubAgents();
4049
+ const defaultSubAgent = agent2.getDefaultSubAgent();
4032
4050
  const messageCount = Array.isArray(messages) ? messages.length : 1;
4033
4051
  return {
4034
4052
  estimatedTurns: Math.min(Math.max(messageCount, 1), options?.maxTurns || 10),
4035
4053
  estimatedTokens: messageCount * 100,
4036
4054
  // Rough estimate
4037
- agentCount: agents.length,
4055
+ subAgentCount: subAgents.length,
4038
4056
  defaultSubAgent: defaultSubAgent?.getName()
4039
4057
  };
4040
4058
  }
4041
4059
  };
4042
4060
  var run = Runner.run.bind(Runner);
4043
4061
  var stream = Runner.stream.bind(Runner);
4044
- var raceGraphs = Runner.raceGraphs.bind(Runner);
4062
+ var raceAgents = Runner.raceAgents.bind(Runner);
4045
4063
 
4046
- exports.Agent = SubAgent;
4064
+ Object.defineProperty(exports, "ANTHROPIC_MODELS", {
4065
+ enumerable: true,
4066
+ get: function () { return agentsCore.ANTHROPIC_MODELS; }
4067
+ });
4068
+ Object.defineProperty(exports, "GOOGLE_MODELS", {
4069
+ enumerable: true,
4070
+ get: function () { return agentsCore.GOOGLE_MODELS; }
4071
+ });
4072
+ Object.defineProperty(exports, "OPENAI_MODELS", {
4073
+ enumerable: true,
4074
+ get: function () { return agentsCore.OPENAI_MODELS; }
4075
+ });
4047
4076
  exports.ArtifactComponent = ArtifactComponent;
4048
4077
  exports.DataComponent = DataComponent;
4049
4078
  exports.ExternalAgent = ExternalAgent;
4050
4079
  exports.FunctionTool = FunctionTool;
4051
4080
  exports.Project = Project;
4052
4081
  exports.Runner = Runner;
4082
+ exports.SubAgent = SubAgent;
4053
4083
  exports.Tool = Tool;
4054
- exports.agent = subAgent;
4055
- exports.agentGraph = agentGraph;
4084
+ exports.agent = agent;
4056
4085
  exports.agentMcp = agentMcp;
4057
4086
  exports.artifactComponent = artifactComponent;
4058
4087
  exports.createEnvironmentSettings = createEnvironmentSettings;
@@ -4069,9 +4098,10 @@ exports.isCredentialReference = isCredentialReference;
4069
4098
  exports.mcpServer = mcpServer;
4070
4099
  exports.mcpTool = mcpTool;
4071
4100
  exports.project = project;
4072
- exports.raceGraphs = raceGraphs;
4101
+ exports.raceAgents = raceAgents;
4073
4102
  exports.registerEnvironmentSettings = registerEnvironmentSettings;
4074
4103
  exports.run = run;
4075
4104
  exports.stream = stream;
4105
+ exports.subAgent = subAgent;
4076
4106
  exports.transfer = transfer;
4077
4107
  exports.updateFullProjectViaAPI = updateFullProjectViaAPI;