@copilotkit/runtime 1.6.0-next.9 → 1.7.0-next.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/{chunk-5ZBUMQE2.mjs → chunk-2BN7NZNC.mjs} +2 -2
  3. package/dist/{chunk-L7OTGCAG.mjs → chunk-34Y5DNNJ.mjs} +104 -74
  4. package/dist/chunk-34Y5DNNJ.mjs.map +1 -0
  5. package/dist/{chunk-7BCFHZLY.mjs → chunk-PH24IU7T.mjs} +2 -2
  6. package/dist/{chunk-4HQ5OZXN.mjs → chunk-ZYFN76KV.mjs} +2 -2
  7. package/dist/index.js +103 -73
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +103 -73
  11. package/dist/lib/index.js.map +1 -1
  12. package/dist/lib/index.mjs +4 -4
  13. package/dist/lib/integrations/index.js +6 -3
  14. package/dist/lib/integrations/index.js.map +1 -1
  15. package/dist/lib/integrations/index.mjs +4 -4
  16. package/dist/lib/integrations/nest/index.js +6 -3
  17. package/dist/lib/integrations/nest/index.js.map +1 -1
  18. package/dist/lib/integrations/nest/index.mjs +2 -2
  19. package/dist/lib/integrations/node-express/index.js +6 -3
  20. package/dist/lib/integrations/node-express/index.js.map +1 -1
  21. package/dist/lib/integrations/node-express/index.mjs +2 -2
  22. package/dist/lib/integrations/node-http/index.js +6 -3
  23. package/dist/lib/integrations/node-http/index.js.map +1 -1
  24. package/dist/lib/integrations/node-http/index.mjs +1 -1
  25. package/package.json +2 -2
  26. package/src/agents/langgraph/event-source.ts +11 -4
  27. package/src/graphql/resolvers/copilot.resolver.ts +4 -0
  28. package/src/lib/runtime/__tests__/remote-action-constructors.test.ts +45 -35
  29. package/src/lib/runtime/copilot-runtime.ts +23 -17
  30. package/src/lib/runtime/remote-action-constructors.ts +28 -68
  31. package/src/lib/runtime/remote-actions.ts +5 -5
  32. package/src/lib/streaming.ts +59 -0
  33. package/src/lib/telemetry-client.ts +3 -1
  34. package/src/service-adapters/events.ts +3 -3
  35. package/dist/chunk-L7OTGCAG.mjs.map +0 -1
  36. /package/dist/{chunk-5ZBUMQE2.mjs.map → chunk-2BN7NZNC.mjs.map} +0 -0
  37. /package/dist/{chunk-7BCFHZLY.mjs.map → chunk-PH24IU7T.mjs.map} +0 -0
  38. /package/dist/{chunk-4HQ5OZXN.mjs.map → chunk-ZYFN76KV.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,64 @@
1
1
  # @copilotkit/runtime
2
2
 
3
+ ## 1.7.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 082db7a: - CrewAI support
8
+
9
+ ### Patch Changes
10
+
11
+ - 082db7a: - Added RemoteAgentAdapter and implemented CopilotKit (protocol & events).
12
+ - Integrated CrewAI (with a prototype, HITL, event system, and chat/demo tweaks).
13
+ - Updated docs and cleaned up code (fixing stdout issues, restricting Python version, and streamlining demos).
14
+ - @copilotkit/shared@1.7.0-next.0
15
+
16
+ ## 1.6.0
17
+
18
+ ### Minor Changes
19
+
20
+ - fea916f: - feat: support input and output schema of langgraph
21
+ - docs: add input output schema docs
22
+ - 7d061d9: - feat(configurable): execute langgraph with user config
23
+
24
+ ### Patch Changes
25
+
26
+ - 543f703: - fix: refrain from processing same tool end several times
27
+ - fix: do not register runtime set action when there are remote endpoints
28
+ - 090203d: - fix: use tryMap method to filter out possibly invalid items
29
+ - 1bb9ca2: - fix(coagents): don't fail when LangSmith API key is missing
30
+ - fix(coagents): don't check for langsmithApiKey in resolveEndpointType
31
+ - 4ddb6d2: - fix: add class validator to dependencies
32
+ - d07f49c: - fix(runtime): fix execution of runtime set backend action handlers
33
+ - 45a3e10: - feat: support latest openai api
34
+ - chore: update all openai dependencies to use latest
35
+ - feat: update adapters using openai API
36
+ - 68f7b65: - handle parsing in fail-safe fashion
37
+ - Updated dependencies [090203d]
38
+ - @copilotkit/shared@1.6.0
39
+
40
+ ## 1.6.0-next.12
41
+
42
+ ### Patch Changes
43
+
44
+ - 1bb9ca2: - fix(coagents): don't fail when LangSmith API key is missing
45
+ - fix(coagents): don't check for langsmithApiKey in resolveEndpointType
46
+ - @copilotkit/shared@1.6.0-next.12
47
+
48
+ ## 1.6.0-next.11
49
+
50
+ ### Patch Changes
51
+
52
+ - @copilotkit/shared@1.6.0-next.11
53
+
54
+ ## 1.6.0-next.10
55
+
56
+ ### Patch Changes
57
+
58
+ - 543f703: - fix: refrain from processing same tool end several times
59
+ - fix: do not register runtime set action when there are remote endpoints
60
+ - @copilotkit/shared@1.6.0-next.10
61
+
3
62
  ## 1.6.0-next.9
4
63
 
5
64
  ### Patch Changes
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-L7OTGCAG.mjs";
5
+ } from "./chunk-34Y5DNNJ.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
22
22
  export {
23
23
  copilotRuntimeNestEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-5ZBUMQE2.mjs.map
25
+ //# sourceMappingURL=chunk-2BN7NZNC.mjs.map
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  publishConfig: {
40
40
  access: "public"
41
41
  },
42
- version: "1.6.0-next.9",
42
+ version: "1.7.0-next.0",
43
43
  sideEffects: false,
44
44
  main: "./dist/index.js",
45
45
  module: "./dist/index.mjs",
@@ -1503,10 +1503,11 @@ var RemoteLangGraphEventSource = class {
1503
1503
  let isToolCallEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "tool_calls";
1504
1504
  acc.isToolCallStart = toolCallChunks.some((chunk) => chunk.name && chunk.id);
1505
1505
  acc.isMessageStart = prevMessageId !== acc.lastMessageId && !acc.isToolCallStart;
1506
- if (acc.isToolCall && !toolCallCheck) {
1506
+ let previousRoundHadToolCall = acc.isToolCall;
1507
+ acc.isToolCall = toolCallCheck;
1508
+ if (previousRoundHadToolCall && !toolCallCheck) {
1507
1509
  isToolCallEnd = true;
1508
1510
  }
1509
- acc.isToolCall = toolCallCheck;
1510
1511
  acc.isToolCallEnd = isToolCallEnd;
1511
1512
  acc.isMessageEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "stop";
1512
1513
  ({ name: acc.lastToolCallName, id: acc.lastToolCallId } = toolCallChunks.find((chunk) => chunk.name && chunk.id) ?? {
@@ -1527,7 +1528,8 @@ var RemoteLangGraphEventSource = class {
1527
1528
  lastMessageId: null,
1528
1529
  lastToolCallId: null,
1529
1530
  lastToolCallName: null,
1530
- currentContent: null
1531
+ currentContent: null,
1532
+ processedToolCallIds: /* @__PURE__ */ new Set()
1531
1533
  }), mergeMap((acc) => {
1532
1534
  const events = [];
1533
1535
  let shouldEmitMessages = true;
@@ -1555,7 +1557,8 @@ var RemoteLangGraphEventSource = class {
1555
1557
  });
1556
1558
  }
1557
1559
  const responseMetadata = this.getResponseMetadata(acc.event);
1558
- if (acc.isToolCallEnd && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName)) {
1560
+ if (acc.isToolCallEnd && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName) && acc.lastToolCallId && !acc.processedToolCallIds.has(acc.lastToolCallId)) {
1561
+ acc.processedToolCallIds.add(acc.lastToolCallId);
1559
1562
  events.push({
1560
1563
  type: RuntimeEventTypes.ActionExecutionEnd,
1561
1564
  actionExecutionId: acc.lastToolCallId
@@ -1622,6 +1625,7 @@ var RemoteLangGraphEventSource = class {
1622
1625
  parentMessageId: acc.lastMessageId
1623
1626
  });
1624
1627
  } else if (acc.isMessageStart && shouldEmitMessages) {
1628
+ acc.processedToolCallIds.clear();
1625
1629
  events.push({
1626
1630
  type: RuntimeEventTypes.TextMessageStart,
1627
1631
  messageId: acc.lastMessageId
@@ -1811,7 +1815,7 @@ async function streamEvents(controller, args) {
1811
1815
  let emitIntermediateStateUntilEnd = null;
1812
1816
  let shouldExit = false;
1813
1817
  let externalRunId = null;
1814
- const streamResponse2 = client.runs.stream(threadId, assistantId, payload);
1818
+ const streamResponse = client.runs.stream(threadId, assistantId, payload);
1815
1819
  const emit = /* @__PURE__ */ __name((message) => controller.enqueue(new TextEncoder().encode(message)), "emit");
1816
1820
  let latestStateValues = {};
1817
1821
  let updatedState = state;
@@ -1821,7 +1825,7 @@ async function streamEvents(controller, args) {
1821
1825
  telemetry_client_default.capture("oss.runtime.agent_execution_stream_started", {
1822
1826
  hashedLgcKey: streamInfo.hashedLgcKey
1823
1827
  });
1824
- for await (const chunk of streamResponse2) {
1828
+ for await (const chunk of streamResponse) {
1825
1829
  if (![
1826
1830
  "events",
1827
1831
  "values",
@@ -2236,6 +2240,54 @@ __name(getSchemaKeys, "getSchemaKeys");
2236
2240
 
2237
2241
  // src/lib/runtime/remote-action-constructors.ts
2238
2242
  import { CopilotKitError, CopilotKitLowLevelError } from "@copilotkit/shared";
2243
+
2244
+ // src/lib/streaming.ts
2245
+ async function writeJsonLineResponseToEventStream(response, eventStream$) {
2246
+ const reader = response.getReader();
2247
+ const decoder = new TextDecoder();
2248
+ let buffer = [];
2249
+ function flushBuffer() {
2250
+ const currentBuffer = buffer.join("");
2251
+ if (currentBuffer.trim().length === 0) {
2252
+ return;
2253
+ }
2254
+ const parts = currentBuffer.split("\n");
2255
+ if (parts.length === 0) {
2256
+ return;
2257
+ }
2258
+ const lastPartIsComplete = currentBuffer.endsWith("\n");
2259
+ buffer = [];
2260
+ if (!lastPartIsComplete) {
2261
+ buffer.push(parts.pop());
2262
+ }
2263
+ parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
2264
+ eventStream$.next(JSON.parse(part));
2265
+ });
2266
+ }
2267
+ __name(flushBuffer, "flushBuffer");
2268
+ try {
2269
+ while (true) {
2270
+ const { done, value } = await reader.read();
2271
+ if (!done) {
2272
+ buffer.push(decoder.decode(value, {
2273
+ stream: true
2274
+ }));
2275
+ }
2276
+ flushBuffer();
2277
+ if (done) {
2278
+ break;
2279
+ }
2280
+ }
2281
+ } catch (error) {
2282
+ console.error("Error in stream", error);
2283
+ eventStream$.error(error);
2284
+ return;
2285
+ }
2286
+ eventStream$.complete();
2287
+ }
2288
+ __name(writeJsonLineResponseToEventStream, "writeJsonLineResponseToEventStream");
2289
+
2290
+ // src/lib/runtime/remote-action-constructors.ts
2239
2291
  import { CopilotKitApiDiscoveryError, ResolvedCopilotKitError } from "@copilotkit/shared";
2240
2292
  import { parseJson as parseJson2, tryMap } from "@copilotkit/shared";
2241
2293
  function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, messages, agentStates }) {
@@ -2245,7 +2297,7 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
2245
2297
  parameters: [],
2246
2298
  handler: async (_args) => {
2247
2299
  },
2248
- langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
2300
+ remoteAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
2249
2301
  logger2.debug({
2250
2302
  actionName: agent.name
2251
2303
  }, "Executing LangGraph Platform agent");
@@ -2289,7 +2341,7 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
2289
2341
  metaEvents
2290
2342
  });
2291
2343
  const eventSource = new RemoteLangGraphEventSource();
2292
- streamResponse(response, eventSource.eventStream$);
2344
+ writeJsonLineResponseToEventStream(response, eventSource.eventStream$);
2293
2345
  return eventSource.processLangGraphEvents();
2294
2346
  } catch (error) {
2295
2347
  logger2.error({
@@ -2306,6 +2358,11 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
2306
2358
  ];
2307
2359
  }
2308
2360
  __name(constructLGCRemoteAction, "constructLGCRemoteAction");
2361
+ var RemoteAgentType;
2362
+ (function(RemoteAgentType2) {
2363
+ RemoteAgentType2["LangGraph"] = "langgraph";
2364
+ RemoteAgentType2["CrewAI"] = "crewai";
2365
+ })(RemoteAgentType || (RemoteAgentType = {}));
2309
2366
  function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
2310
2367
  const totalAgents = Array.isArray(json["agents"]) ? json["agents"].length : 0;
2311
2368
  const actions = json["actions"].map((action) => ({
@@ -2375,7 +2432,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
2375
2432
  parameters: [],
2376
2433
  handler: async (_args) => {
2377
2434
  },
2378
- langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
2435
+ remoteAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
2379
2436
  logger2.debug({
2380
2437
  actionName: agent.name
2381
2438
  }, "Executing remote agent");
@@ -2435,9 +2492,17 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
2435
2492
  isRemoteEndpoint: true
2436
2493
  });
2437
2494
  }
2438
- const eventSource = new RemoteLangGraphEventSource();
2439
- streamResponse(response.body, eventSource.eventStream$);
2440
- return eventSource.processLangGraphEvents();
2495
+ if (agent.type === "langgraph") {
2496
+ const eventSource = new RemoteLangGraphEventSource();
2497
+ writeJsonLineResponseToEventStream(response.body, eventSource.eventStream$);
2498
+ return eventSource.processLangGraphEvents();
2499
+ } else if (agent.type === "crewai") {
2500
+ const eventStream$ = new RuntimeEventSubject();
2501
+ writeJsonLineResponseToEventStream(response.body, eventStream$);
2502
+ return eventStream$;
2503
+ } else {
2504
+ throw new Error("Unsupported agent type");
2505
+ }
2441
2506
  } catch (error) {
2442
2507
  if (error instanceof CopilotKitError) {
2443
2508
  throw error;
@@ -2455,50 +2520,6 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
2455
2520
  ];
2456
2521
  }
2457
2522
  __name(constructRemoteActions, "constructRemoteActions");
2458
- async function streamResponse(response, eventStream$) {
2459
- const reader = response.getReader();
2460
- const decoder = new TextDecoder();
2461
- let buffer = [];
2462
- function flushBuffer() {
2463
- const currentBuffer = buffer.join("");
2464
- if (currentBuffer.trim().length === 0) {
2465
- return;
2466
- }
2467
- const parts = currentBuffer.split("\n");
2468
- if (parts.length === 0) {
2469
- return;
2470
- }
2471
- const lastPartIsComplete = currentBuffer.endsWith("\n");
2472
- buffer = [];
2473
- if (!lastPartIsComplete) {
2474
- buffer.push(parts.pop());
2475
- }
2476
- parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
2477
- eventStream$.next(JSON.parse(part));
2478
- });
2479
- }
2480
- __name(flushBuffer, "flushBuffer");
2481
- try {
2482
- while (true) {
2483
- const { done, value } = await reader.read();
2484
- if (!done) {
2485
- buffer.push(decoder.decode(value, {
2486
- stream: true
2487
- }));
2488
- }
2489
- flushBuffer();
2490
- if (done) {
2491
- break;
2492
- }
2493
- }
2494
- } catch (error) {
2495
- console.error("Error in stream", error);
2496
- eventStream$.error(error);
2497
- return;
2498
- }
2499
- eventStream$.complete();
2500
- }
2501
- __name(streamResponse, "streamResponse");
2502
2523
  function createHeaders(onBeforeRequest, graphqlContext) {
2503
2524
  const headers = {
2504
2525
  "Content-Type": "application/json"
@@ -2522,13 +2543,13 @@ var EndpointType;
2522
2543
  EndpointType2["CopilotKit"] = "copilotKit";
2523
2544
  EndpointType2["LangGraphPlatform"] = "langgraph-platform";
2524
2545
  })(EndpointType || (EndpointType = {}));
2525
- function isLangGraphAgentAction(action) {
2546
+ function isRemoteAgentAction(action) {
2526
2547
  if (!action) {
2527
2548
  return false;
2528
2549
  }
2529
- return typeof action.langGraphAgentHandler === "function";
2550
+ return typeof action.remoteAgentHandler === "function";
2530
2551
  }
2531
- __name(isLangGraphAgentAction, "isLangGraphAgentAction");
2552
+ __name(isRemoteAgentAction, "isRemoteAgentAction");
2532
2553
  async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2, frontendUrl }) {
2533
2554
  logger2.debug({
2534
2555
  url
@@ -2693,7 +2714,12 @@ var CopilotRuntime = class {
2693
2714
  delegateAgentProcessingToServiceAdapter;
2694
2715
  constructor(params) {
2695
2716
  var _a, _b;
2696
- this.actions = (params == null ? void 0 : params.actions) || [];
2717
+ if ((params == null ? void 0 : params.actions) && (params == null ? void 0 : params.remoteEndpoints)) {
2718
+ console.warn("Actions set in runtime instance will be ignored when remote endpoints are set");
2719
+ this.actions = [];
2720
+ } else {
2721
+ this.actions = (params == null ? void 0 : params.actions) || [];
2722
+ }
2697
2723
  for (const chain of (params == null ? void 0 : params.langserve) || []) {
2698
2724
  const remoteChain = new RemoteChain(chain);
2699
2725
  this.langserve.push(remoteChain.toAction());
@@ -2785,7 +2811,6 @@ please use an LLM adapter instead.`
2785
2811
  }
2786
2812
  }
2787
2813
  async discoverAgentsFromEndpoints(graphqlContext) {
2788
- const headers = createHeaders(null, graphqlContext);
2789
2814
  const agents = this.remoteEndpointDefinitions.reduce(async (acc, endpoint) => {
2790
2815
  const agents2 = await acc;
2791
2816
  if (endpoint.type === EndpointType.LangGraphPlatform) {
@@ -2811,11 +2836,12 @@ please use an LLM adapter instead.`
2811
2836
  ...endpointAgents
2812
2837
  ];
2813
2838
  }
2839
+ const cpkEndpoint = endpoint;
2814
2840
  const fetchUrl = `${endpoint.url}/info`;
2815
2841
  try {
2816
2842
  const response = await fetch(fetchUrl, {
2817
2843
  method: "POST",
2818
- headers,
2844
+ headers: createHeaders(cpkEndpoint.onBeforeRequest, graphqlContext),
2819
2845
  body: JSON.stringify({
2820
2846
  properties: graphqlContext.properties
2821
2847
  })
@@ -2896,11 +2922,12 @@ please use an LLM adapter instead.`
2896
2922
  };
2897
2923
  }
2898
2924
  } else if (agentWithEndpoint.endpoint.type === EndpointType.CopilotKit || !("type" in agentWithEndpoint.endpoint)) {
2899
- const fetchUrl = `${agentWithEndpoint.endpoint.url}/agents/state`;
2925
+ const cpkEndpoint = agentWithEndpoint.endpoint;
2926
+ const fetchUrl = `${cpkEndpoint.url}/agents/state`;
2900
2927
  try {
2901
2928
  const response = await fetch(fetchUrl, {
2902
2929
  method: "POST",
2903
- headers,
2930
+ headers: createHeaders(cpkEndpoint.onBeforeRequest, graphqlContext),
2904
2931
  body: JSON.stringify({
2905
2932
  properties: graphqlContext.properties,
2906
2933
  threadId,
@@ -2945,7 +2972,7 @@ please use an LLM adapter instead.`
2945
2972
  const threadId = threadIdFromRequest ?? agentSession.threadId;
2946
2973
  const serverSideActions = await this.getServerSideActions(request);
2947
2974
  const messages = convertGqlInputToMessages(rawMessages);
2948
- const currentAgent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
2975
+ const currentAgent = serverSideActions.find((action) => action.name === agentName && isRemoteAgentAction(action));
2949
2976
  if (!currentAgent) {
2950
2977
  throw new CopilotKitAgentDiscoveryError({
2951
2978
  agentName
@@ -2953,8 +2980,8 @@ please use an LLM adapter instead.`
2953
2980
  }
2954
2981
  const availableActionsForCurrentAgent = serverSideActions.filter((action) => (
2955
2982
  // Case 1: Keep all regular (non-agent) actions
2956
- !isLangGraphAgentAction(action) || // Case 2: For agent actions, keep all except self (prevent infinite loops)
2957
- isLangGraphAgentAction(action) && action.name !== agentName
2983
+ !isRemoteAgentAction(action) || // Case 2: For agent actions, keep all except self (prevent infinite loops)
2984
+ isRemoteAgentAction(action) && action.name !== agentName
2958
2985
  )).map((action) => ({
2959
2986
  name: action.name,
2960
2987
  description: action.description,
@@ -2972,7 +2999,7 @@ please use an LLM adapter instead.`
2972
2999
  }));
2973
3000
  try {
2974
3001
  const eventSource = new RuntimeEventSource();
2975
- const stream = await currentAgent.langGraphAgentHandler({
3002
+ const stream = await currentAgent.remoteAgentHandler({
2976
3003
  name: agentName,
2977
3004
  threadId,
2978
3005
  nodeName,
@@ -3076,7 +3103,7 @@ function langGraphPlatformEndpoint(config) {
3076
3103
  __name(langGraphPlatformEndpoint, "langGraphPlatformEndpoint");
3077
3104
  function resolveEndpointType(endpoint) {
3078
3105
  if (!endpoint.type) {
3079
- if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
3106
+ if ("deploymentUrl" in endpoint && "agents" in endpoint) {
3080
3107
  return EndpointType.LangGraphPlatform;
3081
3108
  } else {
3082
3109
  return EndpointType.CopilotKit;
@@ -3112,7 +3139,7 @@ function getRuntimeInstanceTelemetryInfo(runtime) {
3112
3139
  info = {
3113
3140
  ...info,
3114
3141
  agentsAmount: ep.agents.length,
3115
- hashedKey: createHash3("sha256").update(ep.langsmithApiKey).digest("hex")
3142
+ hashedKey: ep.langsmithApiKey ? createHash3("sha256").update(ep.langsmithApiKey).digest("hex") : null
3116
3143
  };
3117
3144
  }
3118
3145
  return info;
@@ -3343,7 +3370,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
3343
3370
  return;
3344
3371
  }
3345
3372
  }
3346
- if (isLangGraphAgentAction(action)) {
3373
+ if (isRemoteAgentAction(action)) {
3347
3374
  const result = `${action.name} agent started`;
3348
3375
  const agentExecution = plainToInstance2(ActionExecutionMessage, {
3349
3376
  id: actionExecutionId,
@@ -3364,7 +3391,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
3364
3391
  actionName: action.name,
3365
3392
  result
3366
3393
  });
3367
- const stream = await action.langGraphAgentHandler({
3394
+ const stream = await action.remoteAgentHandler({
3368
3395
  name: action.name,
3369
3396
  threadId,
3370
3397
  actionInputsWithoutAgents,
@@ -3602,6 +3629,9 @@ var CopilotResolver = class {
3602
3629
  resolveOutputMessagesPromise = resolve;
3603
3630
  rejectOutputMessagesPromise = reject;
3604
3631
  });
3632
+ if (copilotCloudPublicApiKey) {
3633
+ ctx.properties["copilotCloudPublicApiKey"] = copilotCloudPublicApiKey;
3634
+ }
3605
3635
  logger2.debug("Processing");
3606
3636
  const { eventSource, threadId = randomId4(), runId, serverSideActions, actionInputsWithoutAgents, extensions } = await copilotRuntime.processRuntimeRequest({
3607
3637
  serviceAdapter,
@@ -4296,4 +4326,4 @@ export {
4296
4326
  getCommonConfig,
4297
4327
  copilotRuntimeNodeHttpEndpoint
4298
4328
  };
4299
- //# sourceMappingURL=chunk-L7OTGCAG.mjs.map
4329
+ //# sourceMappingURL=chunk-34Y5DNNJ.mjs.map