@copilotkit/runtime 1.5.20 → 1.6.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 (43) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/__snapshots__/schema/schema.graphql +1 -0
  3. package/dist/{chunk-BLOO7P5D.mjs → chunk-A4P5YLJQ.mjs} +2 -2
  4. package/dist/{chunk-YAEZPJTK.mjs → chunk-AMKPW7KT.mjs} +32 -14
  5. package/dist/chunk-AMKPW7KT.mjs.map +1 -0
  6. package/dist/{chunk-U4EZU7AQ.mjs → chunk-EYEJ5L3X.mjs} +2 -2
  7. package/dist/{chunk-HEILVP57.mjs → chunk-RGSZK24X.mjs} +2 -2
  8. package/dist/{copilot-runtime-084fb9c7.d.ts → copilot-runtime-67033bfa.d.ts} +1 -1
  9. package/dist/{groq-adapter-3b894689.d.ts → groq-adapter-9d15c927.d.ts} +1 -1
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +26 -8
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +9 -9
  14. package/dist/{langserve-3a591089.d.ts → langserve-7cc5be48.d.ts} +1 -0
  15. package/dist/lib/index.d.ts +3 -3
  16. package/dist/lib/index.js +26 -8
  17. package/dist/lib/index.js.map +1 -1
  18. package/dist/lib/index.mjs +5 -5
  19. package/dist/lib/integrations/index.d.ts +3 -3
  20. package/dist/lib/integrations/index.js +8 -1
  21. package/dist/lib/integrations/index.js.map +1 -1
  22. package/dist/lib/integrations/index.mjs +5 -5
  23. package/dist/lib/integrations/nest/index.d.ts +2 -2
  24. package/dist/lib/integrations/nest/index.js +8 -1
  25. package/dist/lib/integrations/nest/index.js.map +1 -1
  26. package/dist/lib/integrations/nest/index.mjs +3 -3
  27. package/dist/lib/integrations/node-express/index.d.ts +2 -2
  28. package/dist/lib/integrations/node-express/index.js +8 -1
  29. package/dist/lib/integrations/node-express/index.js.map +1 -1
  30. package/dist/lib/integrations/node-express/index.mjs +3 -3
  31. package/dist/lib/integrations/node-http/index.d.ts +2 -2
  32. package/dist/lib/integrations/node-http/index.js +8 -1
  33. package/dist/lib/integrations/node-http/index.js.map +1 -1
  34. package/dist/lib/integrations/node-http/index.mjs +2 -2
  35. package/dist/service-adapters/index.d.ts +3 -3
  36. package/package.json +2 -2
  37. package/src/graphql/inputs/agent-state.input.ts +3 -0
  38. package/src/lib/runtime/remote-action-constructors.ts +10 -4
  39. package/src/lib/runtime/remote-lg-action.ts +5 -0
  40. package/dist/chunk-YAEZPJTK.mjs.map +0 -1
  41. /package/dist/{chunk-BLOO7P5D.mjs.map → chunk-A4P5YLJQ.mjs.map} +0 -0
  42. /package/dist/{chunk-U4EZU7AQ.mjs.map → chunk-EYEJ5L3X.mjs.map} +0 -0
  43. /package/dist/{chunk-HEILVP57.mjs.map → chunk-RGSZK24X.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @copilotkit/runtime
2
2
 
3
+ ## 1.6.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7d061d9: - feat(configurable): execute langgraph with user config
8
+
9
+ ### Patch Changes
10
+
11
+ - @copilotkit/shared@1.6.0-next.0
12
+
3
13
  ## 1.5.20
4
14
 
5
15
  ### Patch Changes
@@ -48,6 +48,7 @@ input AgentSessionInput {
48
48
 
49
49
  input AgentStateInput {
50
50
  agentName: String!
51
+ configurable: String
51
52
  state: String!
52
53
  }
53
54
 
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-YAEZPJTK.mjs";
5
+ } from "./chunk-AMKPW7KT.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
22
22
  export {
23
23
  copilotRuntimeNodeExpressEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-BLOO7P5D.mjs.map
25
+ //# sourceMappingURL=chunk-A4P5YLJQ.mjs.map
@@ -1,8 +1,3 @@
1
- import {
2
- EmptyAdapter,
3
- RemoteChain,
4
- streamLangChainResponse
5
- } from "./chunk-OS5YD32G.mjs";
6
1
  import {
7
2
  GuardrailsValidationFailureResponse,
8
3
  MessageStreamInterruptedResponse,
@@ -10,6 +5,11 @@ import {
10
5
  SuccessResponseStatus,
11
6
  UnknownErrorResponse
12
7
  } from "./chunk-5BIEM2UU.mjs";
8
+ import {
9
+ EmptyAdapter,
10
+ RemoteChain,
11
+ streamLangChainResponse
12
+ } from "./chunk-OS5YD32G.mjs";
13
13
  import {
14
14
  ActionExecutionMessage,
15
15
  AgentStateMessage,
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  publishConfig: {
40
40
  access: "public"
41
41
  },
42
- version: "1.5.20",
42
+ version: "1.6.0-next.0",
43
43
  sideEffects: false,
44
44
  main: "./dist/index.js",
45
45
  module: "./dist/index.mjs",
@@ -667,6 +667,7 @@ __name(_ts_metadata8, "_ts_metadata");
667
667
  var AgentStateInput = class {
668
668
  agentName;
669
669
  state;
670
+ configurable;
670
671
  };
671
672
  __name(AgentStateInput, "AgentStateInput");
672
673
  _ts_decorate8([
@@ -677,6 +678,12 @@ _ts_decorate8([
677
678
  Field8(() => String),
678
679
  _ts_metadata8("design:type", String)
679
680
  ], AgentStateInput.prototype, "state", void 0);
681
+ _ts_decorate8([
682
+ Field8(() => String, {
683
+ nullable: true
684
+ }),
685
+ _ts_metadata8("design:type", String)
686
+ ], AgentStateInput.prototype, "configurable", void 0);
680
687
  AgentStateInput = _ts_decorate8([
681
688
  InputType8()
682
689
  ], AgentStateInput);
@@ -1685,7 +1692,7 @@ async function execute(args) {
1685
1692
  __name(execute, "execute");
1686
1693
  async function streamEvents(controller, args) {
1687
1694
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1688
- const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2, properties, metaEvents } = args;
1695
+ const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, configurable, messages, actions, logger: logger2, properties, metaEvents } = args;
1689
1696
  let nodeName = initialNodeName;
1690
1697
  let state = initialState;
1691
1698
  const { name, assistantId: initialAssistantId } = agent;
@@ -1785,6 +1792,13 @@ async function streamEvents(controller, args) {
1785
1792
  throw new Error("No agent id found");
1786
1793
  }
1787
1794
  const assistantId = retrievedAssistant.assistant_id;
1795
+ if (configurable) {
1796
+ await client.assistants.update(assistantId, {
1797
+ config: {
1798
+ configurable
1799
+ }
1800
+ });
1801
+ }
1788
1802
  const graphInfo = await client.assistants.getGraph(assistantId);
1789
1803
  let streamingStateExtractor = new StreamingStateExtractor([]);
1790
1804
  let prevNodeName = null;
@@ -2200,7 +2214,6 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
2200
2214
  handler: async (_args) => {
2201
2215
  },
2202
2216
  langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
2203
- var _a;
2204
2217
  logger2.debug({
2205
2218
  actionName: agent.name
2206
2219
  }, "Executing LangGraph Platform agent");
@@ -2211,10 +2224,12 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
2211
2224
  hashedLgcKey: createHash2("sha256").update(endpoint.langsmithApiKey).digest("hex")
2212
2225
  });
2213
2226
  let state = {};
2227
+ let configurable = {};
2214
2228
  if (agentStates) {
2215
- const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
2229
+ const jsonState = agentStates.find((state2) => state2.agentName === name);
2216
2230
  if (jsonState) {
2217
- state = JSON.parse(jsonState);
2231
+ state = JSON.parse(jsonState.state);
2232
+ configurable = JSON.parse(jsonState.configurable);
2218
2233
  }
2219
2234
  }
2220
2235
  try {
@@ -2232,6 +2247,7 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
2232
2247
  ...additionalMessages
2233
2248
  ],
2234
2249
  state,
2250
+ configurable,
2235
2251
  properties: graphqlContext.properties,
2236
2252
  actions: actionInputsWithoutAgents.map((action) => ({
2237
2253
  name: action.name,
@@ -2328,7 +2344,6 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
2328
2344
  handler: async (_args) => {
2329
2345
  },
2330
2346
  langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
2331
- var _a;
2332
2347
  logger2.debug({
2333
2348
  actionName: agent.name
2334
2349
  }, "Executing remote agent");
@@ -2339,10 +2354,12 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
2339
2354
  agentsAmount: json["agents"].length
2340
2355
  });
2341
2356
  let state = {};
2357
+ let configurable = {};
2342
2358
  if (agentStates) {
2343
- const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
2359
+ const jsonState = agentStates.find((state2) => state2.agentName === name);
2344
2360
  if (jsonState) {
2345
- state = JSON.parse(jsonState);
2361
+ state = JSON.parse(jsonState.state);
2362
+ configurable = JSON.parse(jsonState.configurable);
2346
2363
  }
2347
2364
  }
2348
2365
  const fetchUrl = `${url}/agents/execute`;
@@ -2359,6 +2376,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
2359
2376
  ...additionalMessages
2360
2377
  ],
2361
2378
  state,
2379
+ configurable,
2362
2380
  properties: graphqlContext.properties,
2363
2381
  actions: actionInputsWithoutAgents.map((action) => ({
2364
2382
  name: action.name,
@@ -4244,4 +4262,4 @@ export {
4244
4262
  getCommonConfig,
4245
4263
  copilotRuntimeNodeHttpEndpoint
4246
4264
  };
4247
- //# sourceMappingURL=chunk-YAEZPJTK.mjs.map
4265
+ //# sourceMappingURL=chunk-AMKPW7KT.mjs.map