@inkeep/agents-sdk 0.0.0-dev-20250911192304 → 0.0.0-dev-20250911210702

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.js CHANGED
@@ -1,8 +1,9 @@
1
- import { __publicField, Tool } from './chunk-BCJFVUMJ.js';
2
- export { Tool } from './chunk-BCJFVUMJ.js';
3
1
  import { getLogger, generateIdFromName, MCPToolConfigSchema, CredentialReferenceApiInsertSchema, createDatabaseClient, getProject } from '@inkeep/agents-core';
4
2
  import { z } from 'zod';
5
3
 
4
+ var __defProp = Object.defineProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
7
  var logger = getLogger("artifactComponent");
7
8
  var ArtifactComponent = class {
8
9
  constructor(config) {
@@ -280,9 +281,147 @@ var DataComponent = class {
280
281
  );
281
282
  }
282
283
  };
284
+ var logger3 = getLogger("tool");
285
+ var Tool = class {
286
+ constructor(config) {
287
+ __publicField(this, "config");
288
+ __publicField(this, "baseURL");
289
+ __publicField(this, "tenantId");
290
+ __publicField(this, "initialized", false);
291
+ __publicField(this, "projectId");
292
+ this.config = config;
293
+ this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
294
+ this.tenantId = config.tenantId || "default";
295
+ this.projectId = config.projectId || "default";
296
+ logger3.info(
297
+ {
298
+ Id: this.getId(),
299
+ Name: config.name
300
+ },
301
+ "Tool constructor initialized"
302
+ );
303
+ }
304
+ // Compute ID from name using same slug transformation as agents
305
+ getId() {
306
+ return this.config.id;
307
+ }
308
+ getName() {
309
+ return this.config.name;
310
+ }
311
+ getDescription() {
312
+ return this.config.description || "";
313
+ }
314
+ getServerUrl() {
315
+ return this.config.serverUrl;
316
+ }
317
+ getActiveTools() {
318
+ return this.config.activeTools;
319
+ }
320
+ getCredentialReferenceId() {
321
+ return this.config.credential?.id;
322
+ }
323
+ // Public method to ensure tool exists in backend (with upsert behavior)
324
+ async init(options) {
325
+ if (this.initialized) return;
326
+ try {
327
+ if (!options?.skipDatabaseRegistration) {
328
+ await this.upsertTool();
329
+ }
330
+ logger3.info(
331
+ {
332
+ toolId: this.getId()
333
+ },
334
+ "Tool initialized successfully"
335
+ );
336
+ this.initialized = true;
337
+ } catch (error) {
338
+ logger3.error(
339
+ {
340
+ toolId: this.getId(),
341
+ error: error instanceof Error ? error.message : "Unknown error"
342
+ },
343
+ "Failed to initialize tool"
344
+ );
345
+ throw error;
346
+ }
347
+ }
348
+ // Private method to upsert tool (create or update)
349
+ async upsertTool() {
350
+ const toolDataForUpdate = {
351
+ id: this.getId(),
352
+ name: this.config.name,
353
+ credentialReferenceId: this.config.credential?.id ?? null,
354
+ headers: this.config.headers ?? null,
355
+ imageUrl: this.config.imageUrl,
356
+ config: {
357
+ type: "mcp",
358
+ mcp: {
359
+ server: {
360
+ url: this.config.serverUrl
361
+ },
362
+ transport: this.config.transport,
363
+ activeTools: this.config.activeTools
364
+ }
365
+ }
366
+ };
367
+ const toolDataForCreate = {
368
+ ...toolDataForUpdate
369
+ };
370
+ logger3.info({ toolDataForCreate }, "toolDataForCreate");
371
+ const updateResponse = await fetch(
372
+ `${this.baseURL}/tenants/${this.tenantId}/crud/projects/${this.projectId}/tools/${this.getId()}`,
373
+ {
374
+ method: "PUT",
375
+ headers: {
376
+ "Content-Type": "application/json"
377
+ },
378
+ body: JSON.stringify(toolDataForUpdate)
379
+ }
380
+ );
381
+ logger3.info({ updateResponse }, "tool updateResponse");
382
+ if (updateResponse.ok) {
383
+ logger3.info(
384
+ {
385
+ toolId: this.getId()
386
+ },
387
+ "Tool updated successfully"
388
+ );
389
+ return;
390
+ }
391
+ if (updateResponse.status === 404) {
392
+ logger3.info(
393
+ {
394
+ toolId: this.getId()
395
+ },
396
+ "Tool not found, creating new tool"
397
+ );
398
+ const createResponse = await fetch(
399
+ `${this.baseURL}/tenants/${this.tenantId}/crud/projects/${this.projectId}/tools`,
400
+ {
401
+ method: "POST",
402
+ headers: {
403
+ "Content-Type": "application/json"
404
+ },
405
+ body: JSON.stringify(toolDataForCreate)
406
+ }
407
+ );
408
+ if (!createResponse.ok) {
409
+ throw new Error(`Failed to create tool: ${createResponse.status}`);
410
+ }
411
+ logger3.info(
412
+ {
413
+ toolId: this.getId()
414
+ },
415
+ "Tool created successfully"
416
+ );
417
+ return;
418
+ }
419
+ throw new Error(`Failed to update tool: ${updateResponse.status}`);
420
+ }
421
+ };
283
422
 
284
423
  // src/agent.ts
285
- var logger3 = getLogger("agent");
424
+ var logger4 = getLogger("agent");
286
425
  function resolveGetter(value) {
287
426
  if (typeof value === "function") {
288
427
  return value();
@@ -301,7 +440,7 @@ var Agent = class {
301
440
  this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
302
441
  this.tenantId = config.tenantId || "default";
303
442
  this.projectId = config.projectId || "default";
304
- logger3.info(
443
+ logger4.info(
305
444
  {
306
445
  tenantId: this.tenantId,
307
446
  agentId: this.config.id,
@@ -321,8 +460,9 @@ var Agent = class {
321
460
  getInstructions() {
322
461
  return this.config.prompt;
323
462
  }
463
+ // adjust
324
464
  getTools() {
325
- const tools = resolveGetter(this.config.tools);
465
+ const tools = resolveGetter(this.config.canUse);
326
466
  if (!tools) {
327
467
  return {};
328
468
  }
@@ -332,9 +472,19 @@ var Agent = class {
332
472
  const toolRecord = {};
333
473
  for (const tool of tools) {
334
474
  if (tool && typeof tool === "object") {
335
- const id = tool.id || tool.getId?.() || tool.name;
475
+ let id;
476
+ let toolInstance;
477
+ if ("server" in tool && "selectedTools" in tool) {
478
+ const agentMcpConfig = tool;
479
+ id = agentMcpConfig.server.getId();
480
+ toolInstance = agentMcpConfig.server;
481
+ toolInstance.selectedTools = agentMcpConfig.selectedTools;
482
+ } else {
483
+ id = tool.id || tool.getId?.() || tool.name;
484
+ toolInstance = tool;
485
+ }
336
486
  if (id) {
337
- toolRecord[id] = tool;
487
+ toolRecord[id] = toolInstance;
338
488
  }
339
489
  }
340
490
  }
@@ -358,9 +508,10 @@ var Agent = class {
358
508
  getArtifactComponents() {
359
509
  return resolveGetter(this.config.artifactComponents) || [];
360
510
  }
511
+ // adjust
361
512
  addTool(_name, tool) {
362
- const existingTools = this.config.tools ? this.config.tools() : [];
363
- this.config.tools = () => [...existingTools, tool];
513
+ const existingTools = this.config.canUse ? this.config.canUse() : [];
514
+ this.config.canUse = () => [...existingTools, tool];
364
515
  }
365
516
  addTransfer(...agents) {
366
517
  if (typeof this.config.canTransferTo === "function") {
@@ -388,7 +539,7 @@ var Agent = class {
388
539
  await this.saveToolsAndRelations();
389
540
  await this.saveDataComponents();
390
541
  await this.saveArtifactComponents();
391
- logger3.info(
542
+ logger4.info(
392
543
  {
393
544
  agentId: this.getId()
394
545
  },
@@ -396,7 +547,7 @@ var Agent = class {
396
547
  );
397
548
  this.initialized = true;
398
549
  } catch (error) {
399
- logger3.error(
550
+ logger4.error(
400
551
  {
401
552
  agentId: this.getId(),
402
553
  error: error instanceof Error ? error.message : "Unknown error"
@@ -428,7 +579,7 @@ var Agent = class {
428
579
  }
429
580
  );
430
581
  if (updateResponse.ok) {
431
- logger3.info(
582
+ logger4.info(
432
583
  {
433
584
  agentId: this.getId()
434
585
  },
@@ -437,7 +588,7 @@ var Agent = class {
437
588
  return;
438
589
  }
439
590
  if (updateResponse.status === 404) {
440
- logger3.info(
591
+ logger4.info(
441
592
  {
442
593
  agentId: this.getId()
443
594
  },
@@ -459,7 +610,7 @@ var Agent = class {
459
610
  `Failed to create agent: ${createResponse.status} ${createResponse.statusText} - ${errorText2}`
460
611
  );
461
612
  }
462
- logger3.info(
613
+ logger4.info(
463
614
  {
464
615
  agentId: this.getId()
465
616
  },
@@ -473,23 +624,37 @@ var Agent = class {
473
624
  );
474
625
  }
475
626
  async saveToolsAndRelations() {
476
- logger3.info(
477
- {
478
- transfers: this.getTransfers(),
479
- delegates: this.getDelegates(),
480
- tools: this.config.tools
481
- },
482
- "transfers, delegates, and tools"
483
- );
484
- if (this.config.tools) {
485
- logger3.info({ tools: this.config.tools }, "tools and config");
486
- for (const [toolId, toolConfig] of Object.entries(this.config.tools)) {
487
- await this.createTool(toolId, toolConfig);
627
+ if (this.config.canUse) {
628
+ const tools = resolveGetter(this.config.canUse);
629
+ if (tools && Array.isArray(tools)) {
630
+ for (let i = 0; i < tools.length; i++) {
631
+ const toolConfig = tools[i];
632
+ let toolId;
633
+ if (toolConfig instanceof Tool) {
634
+ toolId = toolConfig.getId();
635
+ } else if (toolConfig && typeof toolConfig === "object" && "server" in toolConfig) {
636
+ toolId = toolConfig.server.getId();
637
+ } else {
638
+ toolId = `tool-${i}`;
639
+ }
640
+ try {
641
+ await this.createTool(toolId, toolConfig);
642
+ } catch (error) {
643
+ logger4.error(
644
+ {
645
+ toolId,
646
+ error: error instanceof Error ? error.message : "Unknown error"
647
+ },
648
+ "Tool creation failed"
649
+ );
650
+ throw error;
651
+ }
652
+ }
488
653
  }
489
654
  }
490
655
  }
491
656
  async saveDataComponents() {
492
- logger3.info(
657
+ logger4.info(
493
658
  { dataComponents: this.config.dataComponents },
494
659
  "dataComponents and config"
495
660
  );
@@ -501,7 +666,7 @@ var Agent = class {
501
666
  }
502
667
  }
503
668
  async saveArtifactComponents() {
504
- logger3.info(
669
+ logger4.info(
505
670
  { artifactComponents: this.config.artifactComponents },
506
671
  "artifactComponents and config"
507
672
  );
@@ -537,7 +702,7 @@ var Agent = class {
537
702
  return acc;
538
703
  }, []);
539
704
  this.config.dataComponents = uniqueComponents;
540
- logger3.info(
705
+ logger4.info(
541
706
  {
542
707
  agentId: this.getId(),
543
708
  dbComponentCount: dbDataComponents.length,
@@ -547,7 +712,7 @@ var Agent = class {
547
712
  "Loaded and merged data components"
548
713
  );
549
714
  } catch (error) {
550
- logger3.error(
715
+ logger4.error(
551
716
  {
552
717
  agentId: this.getId(),
553
718
  error: error instanceof Error ? error.message : "Unknown error"
@@ -582,7 +747,7 @@ var Agent = class {
582
747
  return acc;
583
748
  }, []);
584
749
  this.config.artifactComponents = uniqueComponents;
585
- logger3.info(
750
+ logger4.info(
586
751
  {
587
752
  agentId: this.getId(),
588
753
  dbComponentCount: dbArtifactComponents.length,
@@ -592,7 +757,7 @@ var Agent = class {
592
757
  "Loaded and merged artifact components"
593
758
  );
594
759
  } catch (error) {
595
- logger3.error(
760
+ logger4.error(
596
761
  {
597
762
  agentId: this.getId(),
598
763
  error: error instanceof Error ? error.message : "Unknown error"
@@ -604,39 +769,27 @@ var Agent = class {
604
769
  async createTool(toolId, toolConfig) {
605
770
  try {
606
771
  if (toolConfig.type === "function") {
607
- logger3.info(
772
+ logger4.info(
608
773
  {
609
774
  agentId: this.getId(),
610
- toolId,
611
- toolType: "function"
775
+ toolId
612
776
  },
613
777
  "Skipping function tool creation - will be handled at runtime"
614
778
  );
615
779
  return;
616
780
  }
617
- const { Tool: Tool2 } = await import('./tool-6K5MVNKA.js');
618
781
  let tool;
619
- if (toolConfig instanceof Tool2) {
620
- logger3.info(
621
- {
622
- agentId: this.getId(),
623
- toolId,
624
- toolType: "Tool"
625
- },
626
- "Initializing Tool instance"
627
- );
782
+ let selectedTools;
783
+ if (toolConfig && typeof toolConfig === "object" && "server" in toolConfig && "selectedTools" in toolConfig) {
784
+ const mcpConfig = toolConfig;
785
+ tool = mcpConfig.server;
786
+ selectedTools = mcpConfig.selectedTools;
787
+ await tool.init();
788
+ } else if (toolConfig instanceof Tool) {
628
789
  tool = toolConfig;
629
790
  await tool.init();
630
791
  } else {
631
- logger3.info(
632
- {
633
- agentId: this.getId(),
634
- toolId,
635
- toolType: "legacy-config"
636
- },
637
- "Creating Tool from config"
638
- );
639
- tool = new Tool2({
792
+ tool = new Tool({
640
793
  id: toolId,
641
794
  tenantId: this.tenantId,
642
795
  name: toolConfig.name || toolId,
@@ -647,8 +800,8 @@ var Agent = class {
647
800
  });
648
801
  await tool.init();
649
802
  }
650
- await this.createAgentToolRelation(tool.getId());
651
- logger3.info(
803
+ await this.createAgentToolRelation(tool.getId(), selectedTools);
804
+ logger4.info(
652
805
  {
653
806
  agentId: this.getId(),
654
807
  toolId: tool.getId()
@@ -656,7 +809,7 @@ var Agent = class {
656
809
  "Tool created and linked to agent"
657
810
  );
658
811
  } catch (error) {
659
- logger3.error(
812
+ logger4.error(
660
813
  {
661
814
  agentId: this.getId(),
662
815
  toolId,
@@ -664,6 +817,7 @@ var Agent = class {
664
817
  },
665
818
  "Failed to create tool"
666
819
  );
820
+ throw error;
667
821
  }
668
822
  }
669
823
  async createDataComponent(dataComponent2) {
@@ -677,7 +831,7 @@ var Agent = class {
677
831
  });
678
832
  await dc.init();
679
833
  await this.createAgentDataComponentRelation(dc.getId());
680
- logger3.info(
834
+ logger4.info(
681
835
  {
682
836
  agentId: this.getId(),
683
837
  dataComponentId: dc.getId()
@@ -685,7 +839,7 @@ var Agent = class {
685
839
  "DataComponent created and linked to agent"
686
840
  );
687
841
  } catch (error) {
688
- logger3.error(
842
+ logger4.error(
689
843
  {
690
844
  agentId: this.getId(),
691
845
  dataComponentName: dataComponent2.name,
@@ -708,7 +862,7 @@ var Agent = class {
708
862
  });
709
863
  await ac.init();
710
864
  await this.createAgentArtifactComponentRelation(ac.getId());
711
- logger3.info(
865
+ logger4.info(
712
866
  {
713
867
  agentId: this.getId(),
714
868
  artifactComponentId: ac.getId()
@@ -716,7 +870,7 @@ var Agent = class {
716
870
  "ArtifactComponent created and linked to agent"
717
871
  );
718
872
  } catch (error) {
719
- logger3.error(
873
+ logger4.error(
720
874
  {
721
875
  agentId: this.getId(),
722
876
  artifactComponentName: artifactComponent2.name,
@@ -748,7 +902,7 @@ var Agent = class {
748
902
  `Failed to create agent-dataComponent relation: ${relationResponse.status} ${relationResponse.statusText}`
749
903
  );
750
904
  }
751
- logger3.info(
905
+ logger4.info(
752
906
  {
753
907
  agentId: this.getId(),
754
908
  dataComponentId
@@ -777,7 +931,7 @@ var Agent = class {
777
931
  `Failed to create agent-artifactComponent relation: ${relationResponse.status} ${relationResponse.statusText}`
778
932
  );
779
933
  }
780
- logger3.info(
934
+ logger4.info(
781
935
  {
782
936
  agentId: this.getId(),
783
937
  artifactComponentId
@@ -785,20 +939,25 @@ var Agent = class {
785
939
  "Created agent-artifactComponent relation"
786
940
  );
787
941
  }
788
- async createAgentToolRelation(toolId) {
942
+ async createAgentToolRelation(toolId, selectedTools) {
943
+ const relationData = {
944
+ id: `${this.getId()}-tool-${toolId}`,
945
+ tenantId: this.tenantId,
946
+ projectId: this.projectId,
947
+ agentId: this.getId(),
948
+ toolId
949
+ };
950
+ if (selectedTools !== void 0) {
951
+ relationData.selectedTools = selectedTools;
952
+ }
789
953
  const relationResponse = await fetch(
790
- `${this.baseURL}/tenants/${this.tenantId}/crud/agent-tool-relations`,
954
+ `${this.baseURL}/tenants/${this.tenantId}/crud/projects/${this.projectId}/agent-tool-relations`,
791
955
  {
792
956
  method: "POST",
793
957
  headers: {
794
958
  "Content-Type": "application/json"
795
959
  },
796
- body: JSON.stringify({
797
- id: `${this.getId()}-tool-${toolId}`,
798
- tenantId: this.tenantId,
799
- agentId: this.getId(),
800
- toolId
801
- })
960
+ body: JSON.stringify(relationData)
802
961
  }
803
962
  );
804
963
  if (!relationResponse.ok) {
@@ -813,9 +972,6 @@ var TransferConfigSchema = z.object({
813
972
  agent: z.instanceof(Agent),
814
973
  description: z.string().optional()
815
974
  });
816
- function generateIdFromName3(name) {
817
- return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
818
- }
819
975
  function validateFunction(value, name) {
820
976
  if (typeof value !== "function") {
821
977
  throw new Error(`${name} must be a function`);
@@ -829,24 +985,6 @@ function agent(config) {
829
985
  }
830
986
  return new Agent(config);
831
987
  }
832
- function mcpServer(config) {
833
- if (!config.serverUrl) {
834
- throw new Error("MCP server requires a serverUrl");
835
- }
836
- const id = config.id || generateIdFromName3(config.name);
837
- return new Tool({
838
- id,
839
- name: config.name,
840
- description: config.description,
841
- serverUrl: config.serverUrl,
842
- tenantId: config.tenantId,
843
- credential: config.credential,
844
- activeTools: config.activeTools,
845
- headers: config.headers,
846
- imageUrl: config.imageUrl,
847
- transport: config.transport ? { type: config.transport } : void 0
848
- });
849
- }
850
988
  function mcpTool(config) {
851
989
  const validatedConfig = MCPToolConfigSchema.parse(config);
852
990
  return new Tool(validatedConfig);
@@ -908,7 +1046,7 @@ function createEnvironmentSettings(environments) {
908
1046
  function registerEnvironmentSettings(config) {
909
1047
  return config;
910
1048
  }
911
- var logger4 = getLogger("external-agent-builder");
1049
+ var logger5 = getLogger("external-agent-builder");
912
1050
  var ExternalAgent = class {
913
1051
  constructor(config) {
914
1052
  __publicField(this, "config");
@@ -919,7 +1057,7 @@ var ExternalAgent = class {
919
1057
  this.config = { ...config, type: "external" };
920
1058
  this.tenantId = config.tenantId || "default";
921
1059
  this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
922
- logger4.debug(
1060
+ logger5.debug(
923
1061
  {
924
1062
  externalAgentName: this.config.name,
925
1063
  baseUrl: this.config.baseUrl,
@@ -935,7 +1073,7 @@ var ExternalAgent = class {
935
1073
  if (this.initialized) return;
936
1074
  try {
937
1075
  await this.upsertExternalAgent();
938
- logger4.info(
1076
+ logger5.info(
939
1077
  {
940
1078
  externalAgentId: this.getId()
941
1079
  },
@@ -943,7 +1081,7 @@ var ExternalAgent = class {
943
1081
  );
944
1082
  this.initialized = true;
945
1083
  } catch (error) {
946
- logger4.error(
1084
+ logger5.error(
947
1085
  {
948
1086
  externalAgentId: this.getId(),
949
1087
  error: error instanceof Error ? error.message : "Unknown error"
@@ -978,7 +1116,7 @@ var ExternalAgent = class {
978
1116
  }
979
1117
  );
980
1118
  if (updateResponse.ok) {
981
- logger4.info(
1119
+ logger5.info(
982
1120
  {
983
1121
  externalAgentId: this.getId()
984
1122
  },
@@ -987,7 +1125,7 @@ var ExternalAgent = class {
987
1125
  return;
988
1126
  }
989
1127
  if (updateResponse.status === 404) {
990
- logger4.info(
1128
+ logger5.info(
991
1129
  {
992
1130
  externalAgentId: this.getId()
993
1131
  },
@@ -1009,7 +1147,7 @@ var ExternalAgent = class {
1009
1147
  `Failed to create external agent: ${createResponse.status} ${createResponse.statusText} - ${errorText2}`
1010
1148
  );
1011
1149
  }
1012
- logger4.info(
1150
+ logger5.info(
1013
1151
  {
1014
1152
  externalAgentId: this.getId()
1015
1153
  },
@@ -1066,9 +1204,9 @@ function externalAgents(configs) {
1066
1204
  }
1067
1205
  return builders;
1068
1206
  }
1069
- var logger5 = getLogger("graphFullClient");
1207
+ var logger6 = getLogger("graphFullClient");
1070
1208
  async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graphData) {
1071
- logger5.info(
1209
+ logger6.info(
1072
1210
  {
1073
1211
  tenantId,
1074
1212
  projectId,
@@ -1098,7 +1236,7 @@ async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graph
1098
1236
  errorMessage = errorText;
1099
1237
  }
1100
1238
  }
1101
- logger5.error(
1239
+ logger6.error(
1102
1240
  {
1103
1241
  status: response.status,
1104
1242
  error: errorMessage
@@ -1108,7 +1246,7 @@ async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graph
1108
1246
  throw new Error(errorMessage);
1109
1247
  }
1110
1248
  const result = await response.json();
1111
- logger5.info(
1249
+ logger6.info(
1112
1250
  {
1113
1251
  graphId
1114
1252
  },
@@ -1118,7 +1256,7 @@ async function updateFullGraphViaAPI(tenantId, projectId, apiUrl, graphId, graph
1118
1256
  }
1119
1257
 
1120
1258
  // src/graph.ts
1121
- var logger6 = getLogger("graph");
1259
+ var logger7 = getLogger("graph");
1122
1260
  function resolveGetter2(value) {
1123
1261
  if (typeof value === "function") {
1124
1262
  return value();
@@ -1173,7 +1311,7 @@ var AgentGraph = class {
1173
1311
  if (this.models) {
1174
1312
  this.propagateImmediateModelSettings();
1175
1313
  }
1176
- logger6.info(
1314
+ logger7.info(
1177
1315
  {
1178
1316
  graphId: this.graphId,
1179
1317
  tenantId: this.tenantId,
@@ -1216,7 +1354,7 @@ var AgentGraph = class {
1216
1354
  if (this.contextConfig && !this.contextConfig.tenantId) {
1217
1355
  this.contextConfig.tenantId = tenantId;
1218
1356
  }
1219
- logger6.info(
1357
+ logger7.info(
1220
1358
  {
1221
1359
  graphId: this.graphId,
1222
1360
  tenantId: this.tenantId,
@@ -1237,10 +1375,20 @@ var AgentGraph = class {
1237
1375
  const transfers = internalAgent.getTransfers();
1238
1376
  const delegates = internalAgent.getDelegates();
1239
1377
  const tools = [];
1378
+ const selectedToolsMapping = {};
1240
1379
  const agentTools = internalAgent.getTools();
1241
1380
  for (const [toolName, toolInstance] of Object.entries(agentTools)) {
1242
1381
  if (toolInstance && typeof toolInstance === "object") {
1243
- const toolId = toolInstance.getId?.() || toolInstance.id || toolName;
1382
+ let toolId;
1383
+ if ("server" in toolInstance && "selectedTools" in toolInstance) {
1384
+ const mcpConfig = toolInstance;
1385
+ toolId = mcpConfig.server.getId();
1386
+ if (mcpConfig.selectedTools !== void 0) {
1387
+ selectedToolsMapping[toolId] = mcpConfig.selectedTools;
1388
+ }
1389
+ } else {
1390
+ toolId = toolInstance.getId?.() || toolInstance.id || toolName;
1391
+ }
1244
1392
  tools.push(toolId);
1245
1393
  }
1246
1394
  }
@@ -1269,6 +1417,7 @@ var AgentGraph = class {
1269
1417
  canTransferTo: transfers.map((h) => h.getId()),
1270
1418
  canDelegateTo: delegates.map((d) => d.getId()),
1271
1419
  tools,
1420
+ selectedTools: Object.keys(selectedToolsMapping).length > 0 ? selectedToolsMapping : void 0,
1272
1421
  dataComponents: dataComponents.length > 0 ? dataComponents : void 0,
1273
1422
  artifactComponents: artifactComponents.length > 0 ? artifactComponents : void 0,
1274
1423
  type: "internal"
@@ -1297,55 +1446,64 @@ var AgentGraph = class {
1297
1446
  const agentTools = internalAgent.getTools();
1298
1447
  for (const [toolName, toolInstance] of Object.entries(agentTools)) {
1299
1448
  if (toolInstance && typeof toolInstance === "object") {
1300
- const toolId = toolInstance.getId?.() || toolInstance.id || toolName;
1449
+ let actualTool;
1450
+ let toolId;
1451
+ if ("server" in toolInstance && "selectedTools" in toolInstance) {
1452
+ const mcpConfig = toolInstance;
1453
+ actualTool = mcpConfig.server;
1454
+ toolId = actualTool.getId();
1455
+ } else {
1456
+ actualTool = toolInstance;
1457
+ toolId = actualTool.getId?.() || actualTool.id || toolName;
1458
+ }
1301
1459
  if (!toolsObject[toolId]) {
1302
1460
  let toolConfig;
1303
- if (toolInstance.config?.serverUrl) {
1461
+ if (actualTool.config?.serverUrl) {
1304
1462
  toolConfig = {
1305
1463
  type: "mcp",
1306
1464
  mcp: {
1307
1465
  server: {
1308
- url: toolInstance.config.serverUrl
1466
+ url: actualTool.config.serverUrl
1309
1467
  }
1310
1468
  }
1311
1469
  };
1312
- } else if (toolInstance.config?.type === "mcp") {
1313
- toolConfig = toolInstance.config;
1470
+ } else if (actualTool.config?.type === "mcp") {
1471
+ toolConfig = actualTool.config;
1314
1472
  } else {
1315
1473
  toolConfig = {
1316
1474
  type: "function",
1317
- parameters: toolInstance.parameters || {}
1475
+ parameters: actualTool.parameters || {}
1318
1476
  };
1319
1477
  }
1320
1478
  const toolData = {
1321
1479
  id: toolId,
1322
- name: toolInstance.config?.name || toolInstance.name || toolName,
1480
+ name: actualTool.config?.name || actualTool.name || toolName,
1323
1481
  config: toolConfig,
1324
- status: toolInstance.getStatus?.() || toolInstance.status || "unknown"
1482
+ status: actualTool.getStatus?.() || actualTool.status || "unknown"
1325
1483
  };
1326
- if (toolInstance.config?.imageUrl) {
1327
- toolData.imageUrl = toolInstance.config.imageUrl;
1484
+ if (actualTool.config?.imageUrl) {
1485
+ toolData.imageUrl = actualTool.config.imageUrl;
1328
1486
  }
1329
- if (toolInstance.config?.headers) {
1330
- toolData.headers = toolInstance.config.headers;
1487
+ if (actualTool.config?.headers) {
1488
+ toolData.headers = actualTool.config.headers;
1331
1489
  }
1332
- if (toolInstance.capabilities) {
1333
- toolData.capabilities = toolInstance.capabilities;
1490
+ if (actualTool.capabilities) {
1491
+ toolData.capabilities = actualTool.capabilities;
1334
1492
  }
1335
- if (toolInstance.lastHealthCheck) {
1336
- toolData.lastHealthCheck = toolInstance.lastHealthCheck;
1493
+ if (actualTool.lastHealthCheck) {
1494
+ toolData.lastHealthCheck = actualTool.lastHealthCheck;
1337
1495
  }
1338
- if (toolInstance.availableTools) {
1339
- toolData.availableTools = toolInstance.availableTools;
1496
+ if (actualTool.availableTools) {
1497
+ toolData.availableTools = actualTool.availableTools;
1340
1498
  }
1341
- if (toolInstance.lastError) {
1342
- toolData.lastError = toolInstance.lastError;
1499
+ if (actualTool.lastError) {
1500
+ toolData.lastError = actualTool.lastError;
1343
1501
  }
1344
- if (toolInstance.lastToolsSync) {
1345
- toolData.lastToolsSync = toolInstance.lastToolsSync;
1502
+ if (actualTool.lastToolsSync) {
1503
+ toolData.lastToolsSync = actualTool.lastToolsSync;
1346
1504
  }
1347
- if (toolInstance.getCredentialReferenceId?.()) {
1348
- toolData.credentialReferenceId = toolInstance.getCredentialReferenceId();
1505
+ if (actualTool.getCredentialReferenceId?.()) {
1506
+ toolData.credentialReferenceId = actualTool.getCredentialReferenceId();
1349
1507
  }
1350
1508
  toolsObject[toolId] = toolData;
1351
1509
  }
@@ -1422,7 +1580,7 @@ var AgentGraph = class {
1422
1580
  * Initialize all tools in all agents (especially IPCTools that need MCP server URLs)
1423
1581
  */
1424
1582
  async initializeAllTools() {
1425
- logger6.info({ graphId: this.graphId }, "Initializing all tools in graph");
1583
+ logger7.info({ graphId: this.graphId }, "Initializing all tools in graph");
1426
1584
  const toolInitPromises = [];
1427
1585
  for (const agent2 of this.agents) {
1428
1586
  if (!agent2.getTools) {
@@ -1446,7 +1604,7 @@ var AgentGraph = class {
1446
1604
  await toolInstance.init();
1447
1605
  }
1448
1606
  }
1449
- logger6.debug(
1607
+ logger7.debug(
1450
1608
  {
1451
1609
  agentId: agent2.getId(),
1452
1610
  toolName,
@@ -1456,7 +1614,7 @@ var AgentGraph = class {
1456
1614
  "Tool initialized successfully"
1457
1615
  );
1458
1616
  } catch (error) {
1459
- logger6.error(
1617
+ logger7.error(
1460
1618
  {
1461
1619
  agentId: agent2.getId(),
1462
1620
  toolName,
@@ -1473,7 +1631,7 @@ var AgentGraph = class {
1473
1631
  }
1474
1632
  }
1475
1633
  await Promise.all(toolInitPromises);
1476
- logger6.info(
1634
+ logger7.info(
1477
1635
  { graphId: this.graphId, toolCount: toolInitPromises.length },
1478
1636
  "All tools initialized successfully"
1479
1637
  );
@@ -1483,10 +1641,10 @@ var AgentGraph = class {
1483
1641
  */
1484
1642
  async init() {
1485
1643
  if (this.initialized) {
1486
- logger6.info({ graphId: this.graphId }, "Graph already initialized");
1644
+ logger7.info({ graphId: this.graphId }, "Graph already initialized");
1487
1645
  return;
1488
1646
  }
1489
- logger6.info(
1647
+ logger7.info(
1490
1648
  {
1491
1649
  graphId: this.graphId,
1492
1650
  agentCount: this.agents.length
@@ -1497,7 +1655,7 @@ var AgentGraph = class {
1497
1655
  await this.initializeAllTools();
1498
1656
  await this.applyModelInheritance();
1499
1657
  const graphDefinition = await this.toFullGraphDefinition();
1500
- logger6.info(
1658
+ logger7.info(
1501
1659
  {
1502
1660
  graphId: this.graphId,
1503
1661
  mode: "api-client",
@@ -1512,7 +1670,7 @@ var AgentGraph = class {
1512
1670
  this.graphId,
1513
1671
  graphDefinition
1514
1672
  );
1515
- logger6.info(
1673
+ logger7.info(
1516
1674
  {
1517
1675
  graphId: this.graphId,
1518
1676
  agentCount: Object.keys(createdGraph.agents || {}).length
@@ -1521,7 +1679,7 @@ var AgentGraph = class {
1521
1679
  );
1522
1680
  this.initialized = true;
1523
1681
  } catch (error) {
1524
- logger6.error(
1682
+ logger7.error(
1525
1683
  {
1526
1684
  graphId: this.graphId,
1527
1685
  error: error instanceof Error ? error.message : "Unknown error"
@@ -1537,10 +1695,10 @@ var AgentGraph = class {
1537
1695
  */
1538
1696
  async initLegacy() {
1539
1697
  if (this.initialized) {
1540
- logger6.info({ graphId: this.graphId }, "Graph already initialized");
1698
+ logger7.info({ graphId: this.graphId }, "Graph already initialized");
1541
1699
  return;
1542
1700
  }
1543
- logger6.info(
1701
+ logger7.info(
1544
1702
  {
1545
1703
  graphId: this.graphId,
1546
1704
  agentCount: this.agents.length
@@ -1550,7 +1708,7 @@ var AgentGraph = class {
1550
1708
  try {
1551
1709
  if (this.contextConfig) {
1552
1710
  await this.contextConfig.init();
1553
- logger6.info(
1711
+ logger7.info(
1554
1712
  {
1555
1713
  graphId: this.graphId,
1556
1714
  contextConfigId: this.contextConfig.getId()
@@ -1562,7 +1720,7 @@ var AgentGraph = class {
1562
1720
  try {
1563
1721
  agent2.config.graphId = this.graphId;
1564
1722
  await agent2.init();
1565
- logger6.debug(
1723
+ logger7.debug(
1566
1724
  {
1567
1725
  agentId: agent2.getId(),
1568
1726
  graphId: this.graphId
@@ -1570,7 +1728,7 @@ var AgentGraph = class {
1570
1728
  "Agent initialized in graph"
1571
1729
  );
1572
1730
  } catch (error) {
1573
- logger6.error(
1731
+ logger7.error(
1574
1732
  {
1575
1733
  agentId: agent2.getId(),
1576
1734
  graphId: this.graphId,
@@ -1587,7 +1745,7 @@ var AgentGraph = class {
1587
1745
  await this.createAgentRelations();
1588
1746
  await this.saveRelations();
1589
1747
  this.initialized = true;
1590
- logger6.info(
1748
+ logger7.info(
1591
1749
  {
1592
1750
  graphId: this.graphId,
1593
1751
  agentCount: this.agents.length
@@ -1595,7 +1753,7 @@ var AgentGraph = class {
1595
1753
  "Agent graph initialized successfully"
1596
1754
  );
1597
1755
  } catch (error) {
1598
- logger6.error(
1756
+ logger7.error(
1599
1757
  {
1600
1758
  graphId: this.graphId,
1601
1759
  error: error instanceof Error ? error.message : "Unknown error"
@@ -1613,7 +1771,7 @@ var AgentGraph = class {
1613
1771
  if (!this.defaultAgent) {
1614
1772
  throw new Error("No default agent configured for this graph");
1615
1773
  }
1616
- logger6.info(
1774
+ logger7.info(
1617
1775
  {
1618
1776
  graphId: this.graphId,
1619
1777
  defaultAgent: this.defaultAgent.getName(),
@@ -1632,7 +1790,7 @@ var AgentGraph = class {
1632
1790
  if (!this.defaultAgent) {
1633
1791
  throw new Error("No default agent configured for this graph");
1634
1792
  }
1635
- logger6.info(
1793
+ logger7.info(
1636
1794
  {
1637
1795
  graphId: this.graphId,
1638
1796
  defaultAgent: this.defaultAgent.getName(),
@@ -1671,7 +1829,7 @@ var AgentGraph = class {
1671
1829
  `Agent '${agentId}' is an external agent and cannot be run directly. External agents are only accessible via delegation.`
1672
1830
  );
1673
1831
  }
1674
- logger6.info(
1832
+ logger7.info(
1675
1833
  {
1676
1834
  graphId: this.graphId,
1677
1835
  agentId,
@@ -1706,7 +1864,7 @@ var AgentGraph = class {
1706
1864
  if (this.models && this.isInternalAgent(agent2)) {
1707
1865
  this.propagateModelSettingsToAgent(agent2);
1708
1866
  }
1709
- logger6.info(
1867
+ logger7.info(
1710
1868
  {
1711
1869
  graphId: this.graphId,
1712
1870
  agentId: agent2.getId(),
@@ -1725,7 +1883,7 @@ var AgentGraph = class {
1725
1883
  this.agents = this.agents.filter(
1726
1884
  (agent2) => agent2.getId() !== agentToRemove.getId()
1727
1885
  );
1728
- logger6.info(
1886
+ logger7.info(
1729
1887
  {
1730
1888
  graphId: this.graphId,
1731
1889
  agentId: agentToRemove.getId()
@@ -1754,7 +1912,7 @@ var AgentGraph = class {
1754
1912
  setDefaultAgent(agent2) {
1755
1913
  this.defaultAgent = agent2;
1756
1914
  this.addAgent(agent2);
1757
- logger6.info(
1915
+ logger7.info(
1758
1916
  {
1759
1917
  graphId: this.graphId,
1760
1918
  defaultAgent: agent2.getId()
@@ -1896,7 +2054,7 @@ var AgentGraph = class {
1896
2054
  });
1897
2055
  return project?.models;
1898
2056
  } catch (error) {
1899
- logger6.warn(
2057
+ logger7.warn(
1900
2058
  {
1901
2059
  tenantId: this.tenantId,
1902
2060
  projectId: this.projectId,
@@ -1917,7 +2075,7 @@ var AgentGraph = class {
1917
2075
  });
1918
2076
  return project?.stopWhen;
1919
2077
  } catch (error) {
1920
- logger6.warn(
2078
+ logger7.warn(
1921
2079
  {
1922
2080
  tenantId: this.tenantId,
1923
2081
  projectId: this.projectId,
@@ -1981,7 +2139,7 @@ var AgentGraph = class {
1981
2139
  }
1982
2140
  }
1983
2141
  }
1984
- logger6.debug(
2142
+ logger7.debug(
1985
2143
  {
1986
2144
  graphId: this.graphId,
1987
2145
  graphStopWhen: this.stopWhen,
@@ -2031,7 +2189,7 @@ var AgentGraph = class {
2031
2189
  async executeWithBackend(input, options) {
2032
2190
  const normalizedMessages = this.normalizeMessages(input);
2033
2191
  const url = `${this.baseURL}/tenants/${this.tenantId}/graphs/${this.graphId}/v1/chat/completions`;
2034
- logger6.info({ url }, "Executing with backend");
2192
+ logger7.info({ url }, "Executing with backend");
2035
2193
  const requestBody = {
2036
2194
  model: "gpt-4o-mini",
2037
2195
  messages: normalizedMessages.map((msg) => ({
@@ -2119,7 +2277,7 @@ var AgentGraph = class {
2119
2277
  }
2120
2278
  });
2121
2279
  if (getResponse.ok) {
2122
- logger6.info(
2280
+ logger7.info(
2123
2281
  { graphId: this.graphId },
2124
2282
  "Graph already exists in backend"
2125
2283
  );
@@ -2135,7 +2293,7 @@ var AgentGraph = class {
2135
2293
  throw error;
2136
2294
  }
2137
2295
  }
2138
- logger6.info({ graphId: this.graphId }, "Creating graph in backend");
2296
+ logger7.info({ graphId: this.graphId }, "Creating graph in backend");
2139
2297
  const createUrl = `${this.baseURL}/tenants/${this.tenantId}/crud/agent-graphs`;
2140
2298
  const createResponse = await fetch(createUrl, {
2141
2299
  method: "POST",
@@ -2157,7 +2315,7 @@ var AgentGraph = class {
2157
2315
  }
2158
2316
  const createData = await createResponse.json();
2159
2317
  this.graphId = createData.data.id;
2160
- logger6.info({ graph: createData.data }, "Graph created in backend");
2318
+ logger7.info({ graph: createData.data }, "Graph created in backend");
2161
2319
  } catch (error) {
2162
2320
  throw new Error(
2163
2321
  `Failed to save graph to database: ${error instanceof Error ? error.message : "Unknown error"}`
@@ -2184,7 +2342,7 @@ var AgentGraph = class {
2184
2342
  `HTTP ${updateResponse.status}: ${updateResponse.statusText}`
2185
2343
  );
2186
2344
  }
2187
- logger6.debug(
2345
+ logger7.debug(
2188
2346
  {
2189
2347
  graphId: this.graphId,
2190
2348
  defaultAgent: this.defaultAgent.getName()
@@ -2192,7 +2350,7 @@ var AgentGraph = class {
2192
2350
  "Graph relationships configured"
2193
2351
  );
2194
2352
  } catch (error) {
2195
- logger6.error(
2353
+ logger7.error(
2196
2354
  {
2197
2355
  graphId: this.graphId,
2198
2356
  error: error instanceof Error ? error.message : "Unknown error"
@@ -2239,7 +2397,7 @@ var AgentGraph = class {
2239
2397
  successCount++;
2240
2398
  } else {
2241
2399
  errors.push(result.reason);
2242
- logger6.error(
2400
+ logger7.error(
2243
2401
  {
2244
2402
  error: result.reason instanceof Error ? result.reason.message : "Unknown error",
2245
2403
  graphId: this.graphId
@@ -2248,7 +2406,7 @@ var AgentGraph = class {
2248
2406
  );
2249
2407
  }
2250
2408
  }
2251
- logger6.info(
2409
+ logger7.info(
2252
2410
  {
2253
2411
  graphId: this.graphId,
2254
2412
  totalRelations: allRelationPromises.length,
@@ -2281,7 +2439,7 @@ var AgentGraph = class {
2281
2439
  if (!response.ok) {
2282
2440
  const errorText = await response.text().catch(() => "Unknown error");
2283
2441
  if (response.status === 422 && errorText.includes("already exists")) {
2284
- logger6.info(
2442
+ logger7.info(
2285
2443
  {
2286
2444
  sourceAgentId: sourceAgent.getId(),
2287
2445
  targetAgentId: targetAgent.getId(),
@@ -2296,7 +2454,7 @@ var AgentGraph = class {
2296
2454
  `Failed to create agent relation: ${response.status} - ${errorText}`
2297
2455
  );
2298
2456
  }
2299
- logger6.info(
2457
+ logger7.info(
2300
2458
  {
2301
2459
  sourceAgentId: sourceAgent.getId(),
2302
2460
  targetAgentId: targetAgent.getId(),
@@ -2306,7 +2464,7 @@ var AgentGraph = class {
2306
2464
  `${relationType} relation created successfully`
2307
2465
  );
2308
2466
  } catch (error) {
2309
- logger6.error(
2467
+ logger7.error(
2310
2468
  {
2311
2469
  sourceAgentId: sourceAgent.getId(),
2312
2470
  targetAgentId: targetAgent.getId(),
@@ -2340,7 +2498,7 @@ var AgentGraph = class {
2340
2498
  if (!response.ok) {
2341
2499
  const errorText = await response.text().catch(() => "Unknown error");
2342
2500
  if (response.status === 422 && errorText.includes("already exists")) {
2343
- logger6.info(
2501
+ logger7.info(
2344
2502
  {
2345
2503
  sourceAgentId: sourceAgent.getId(),
2346
2504
  externalAgentId: externalAgent2.getId(),
@@ -2355,7 +2513,7 @@ var AgentGraph = class {
2355
2513
  `Failed to create external agent relation: ${response.status} - ${errorText}`
2356
2514
  );
2357
2515
  }
2358
- logger6.info(
2516
+ logger7.info(
2359
2517
  {
2360
2518
  sourceAgentId: sourceAgent.getId(),
2361
2519
  externalAgentId: externalAgent2.getId(),
@@ -2365,7 +2523,7 @@ var AgentGraph = class {
2365
2523
  `${relationType} relation created successfully`
2366
2524
  );
2367
2525
  } catch (error) {
2368
- logger6.error(
2526
+ logger7.error(
2369
2527
  {
2370
2528
  sourceAgentId: sourceAgent.getId(),
2371
2529
  externalAgentId: externalAgent2.getId(),
@@ -2385,7 +2543,7 @@ var AgentGraph = class {
2385
2543
  const externalAgents2 = this.agents.filter(
2386
2544
  (agent2) => this.isExternalAgent(agent2)
2387
2545
  );
2388
- logger6.info(
2546
+ logger7.info(
2389
2547
  {
2390
2548
  graphId: this.graphId,
2391
2549
  externalAgentCount: externalAgents2.length
@@ -2395,7 +2553,7 @@ var AgentGraph = class {
2395
2553
  const initPromises = externalAgents2.map(async (externalAgent2) => {
2396
2554
  try {
2397
2555
  await externalAgent2.init();
2398
- logger6.debug(
2556
+ logger7.debug(
2399
2557
  {
2400
2558
  externalAgentId: externalAgent2.getId(),
2401
2559
  graphId: this.graphId
@@ -2403,7 +2561,7 @@ var AgentGraph = class {
2403
2561
  "External agent created in database"
2404
2562
  );
2405
2563
  } catch (error) {
2406
- logger6.error(
2564
+ logger7.error(
2407
2565
  {
2408
2566
  externalAgentId: externalAgent2.getId(),
2409
2567
  graphId: this.graphId,
@@ -2416,7 +2574,7 @@ var AgentGraph = class {
2416
2574
  });
2417
2575
  try {
2418
2576
  await Promise.all(initPromises);
2419
- logger6.info(
2577
+ logger7.info(
2420
2578
  {
2421
2579
  graphId: this.graphId,
2422
2580
  externalAgentCount: externalAgents2.length
@@ -2424,7 +2582,7 @@ var AgentGraph = class {
2424
2582
  "All external agents created successfully"
2425
2583
  );
2426
2584
  } catch (error) {
2427
- logger6.error(
2585
+ logger7.error(
2428
2586
  {
2429
2587
  graphId: this.graphId,
2430
2588
  error: error instanceof Error ? error.message : "Unknown error"
@@ -2439,13 +2597,13 @@ function agentGraph(config) {
2439
2597
  return new AgentGraph(config);
2440
2598
  }
2441
2599
  async function generateGraph(configPath) {
2442
- logger6.info({ configPath }, "Loading graph configuration");
2600
+ logger7.info({ configPath }, "Loading graph configuration");
2443
2601
  try {
2444
2602
  const config = await import(configPath);
2445
2603
  const graphConfig = config.default || config;
2446
2604
  const graph = agentGraph(graphConfig);
2447
2605
  await graph.init();
2448
- logger6.info(
2606
+ logger7.info(
2449
2607
  {
2450
2608
  configPath,
2451
2609
  graphId: graph.getStats().graphId,
@@ -2455,7 +2613,7 @@ async function generateGraph(configPath) {
2455
2613
  );
2456
2614
  return graph;
2457
2615
  } catch (error) {
2458
- logger6.error(
2616
+ logger7.error(
2459
2617
  {
2460
2618
  configPath,
2461
2619
  error: error instanceof Error ? error.message : "Unknown error"
@@ -2485,7 +2643,7 @@ var MaxTurnsExceededError = class extends AgentError {
2485
2643
  };
2486
2644
 
2487
2645
  // src/runner.ts
2488
- var logger7 = getLogger("runner");
2646
+ var logger8 = getLogger("runner");
2489
2647
  var Runner = class _Runner {
2490
2648
  /**
2491
2649
  * Run a graph until completion, handling transfers and tool calls
@@ -2497,7 +2655,7 @@ var Runner = class _Runner {
2497
2655
  let turnCount = 0;
2498
2656
  const messageHistory = _Runner.normalizeToMessageHistory(messages);
2499
2657
  const allToolCalls = [];
2500
- logger7.info(
2658
+ logger8.info(
2501
2659
  {
2502
2660
  graphId: graph.getId(),
2503
2661
  defaultAgent: graph.getDefaultAgent()?.getName(),
@@ -2507,7 +2665,7 @@ var Runner = class _Runner {
2507
2665
  "Starting graph run"
2508
2666
  );
2509
2667
  while (turnCount < maxTurns) {
2510
- logger7.debug(
2668
+ logger8.debug(
2511
2669
  {
2512
2670
  graphId: graph.getId(),
2513
2671
  turnCount,
@@ -2517,7 +2675,7 @@ var Runner = class _Runner {
2517
2675
  );
2518
2676
  const response = await graph.generate(messageHistory, options);
2519
2677
  turnCount++;
2520
- logger7.info(
2678
+ logger8.info(
2521
2679
  {
2522
2680
  graphId: graph.getId(),
2523
2681
  turnCount,
@@ -2537,7 +2695,7 @@ var Runner = class _Runner {
2537
2695
  }
2538
2696
  };
2539
2697
  }
2540
- logger7.error(
2698
+ logger8.error(
2541
2699
  {
2542
2700
  graphId: graph.getId(),
2543
2701
  maxTurns,
@@ -2551,7 +2709,7 @@ var Runner = class _Runner {
2551
2709
  * Stream a graph's response
2552
2710
  */
2553
2711
  static async stream(graph, messages, options) {
2554
- logger7.info(
2712
+ logger8.info(
2555
2713
  {
2556
2714
  graphId: graph.getId(),
2557
2715
  defaultAgent: graph.getDefaultAgent()?.getName()
@@ -2567,7 +2725,7 @@ var Runner = class _Runner {
2567
2725
  if (graphs.length === 0) {
2568
2726
  throw new Error("No graphs provided for race");
2569
2727
  }
2570
- logger7.info(
2728
+ logger8.info(
2571
2729
  {
2572
2730
  graphCount: graphs.length,
2573
2731
  graphIds: graphs.map((g) => g.getId())
@@ -2579,7 +2737,7 @@ var Runner = class _Runner {
2579
2737
  const result2 = await _Runner.run(graph, messages, options);
2580
2738
  return { ...result2, raceIndex: index };
2581
2739
  } catch (error) {
2582
- logger7.error(
2740
+ logger8.error(
2583
2741
  {
2584
2742
  graphId: graph.getId(),
2585
2743
  error: error instanceof Error ? error.message : "Unknown error"
@@ -2590,7 +2748,7 @@ var Runner = class _Runner {
2590
2748
  }
2591
2749
  });
2592
2750
  const result = await Promise.race(promises);
2593
- logger7.info(
2751
+ logger8.info(
2594
2752
  {
2595
2753
  winningGraphId: result.graphId || "unknown",
2596
2754
  raceIndex: result.raceIndex
@@ -2667,4 +2825,4 @@ var run = Runner.run.bind(Runner);
2667
2825
  var stream = Runner.stream.bind(Runner);
2668
2826
  var raceGraphs = Runner.raceGraphs.bind(Runner);
2669
2827
 
2670
- export { Agent, AgentGraph, ArtifactComponent, DataComponent, ExternalAgent, Runner, agent, agentGraph, artifactComponent, createEnvironmentSettings, credential, dataComponent, externalAgent, externalAgents, generateGraph, mcpServer, mcpTool, raceGraphs, registerEnvironmentSettings, run, stream, transfer };
2828
+ export { Agent, AgentGraph, ArtifactComponent, DataComponent, ExternalAgent, Runner, Tool, agent, agentGraph, artifactComponent, createEnvironmentSettings, credential, dataComponent, externalAgent, externalAgents, generateGraph, mcpTool, raceGraphs, registerEnvironmentSettings, run, stream, transfer };