@librechat/agents 2.4.322 → 3.0.0-rc2

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 (266) hide show
  1. package/dist/cjs/agents/AgentContext.cjs +218 -0
  2. package/dist/cjs/agents/AgentContext.cjs.map +1 -0
  3. package/dist/cjs/common/enum.cjs +14 -5
  4. package/dist/cjs/common/enum.cjs.map +1 -1
  5. package/dist/cjs/events.cjs +10 -6
  6. package/dist/cjs/events.cjs.map +1 -1
  7. package/dist/cjs/graphs/Graph.cjs +309 -212
  8. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  9. package/dist/cjs/graphs/MultiAgentGraph.cjs +422 -0
  10. package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -0
  11. package/dist/cjs/llm/anthropic/index.cjs +54 -9
  12. package/dist/cjs/llm/anthropic/index.cjs.map +1 -1
  13. package/dist/cjs/llm/anthropic/types.cjs.map +1 -1
  14. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +52 -6
  15. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -1
  16. package/dist/cjs/llm/anthropic/utils/message_outputs.cjs +22 -2
  17. package/dist/cjs/llm/anthropic/utils/message_outputs.cjs.map +1 -1
  18. package/dist/cjs/llm/anthropic/utils/tools.cjs +29 -0
  19. package/dist/cjs/llm/anthropic/utils/tools.cjs.map +1 -0
  20. package/dist/cjs/llm/google/index.cjs +144 -0
  21. package/dist/cjs/llm/google/index.cjs.map +1 -0
  22. package/dist/cjs/llm/google/utils/common.cjs +477 -0
  23. package/dist/cjs/llm/google/utils/common.cjs.map +1 -0
  24. package/dist/cjs/llm/ollama/index.cjs +67 -0
  25. package/dist/cjs/llm/ollama/index.cjs.map +1 -0
  26. package/dist/cjs/llm/ollama/utils.cjs +158 -0
  27. package/dist/cjs/llm/ollama/utils.cjs.map +1 -0
  28. package/dist/cjs/llm/openai/index.cjs +389 -3
  29. package/dist/cjs/llm/openai/index.cjs.map +1 -1
  30. package/dist/cjs/llm/openai/utils/index.cjs +672 -0
  31. package/dist/cjs/llm/openai/utils/index.cjs.map +1 -0
  32. package/dist/cjs/llm/providers.cjs +15 -15
  33. package/dist/cjs/llm/providers.cjs.map +1 -1
  34. package/dist/cjs/llm/text.cjs +14 -3
  35. package/dist/cjs/llm/text.cjs.map +1 -1
  36. package/dist/cjs/llm/vertexai/index.cjs +330 -0
  37. package/dist/cjs/llm/vertexai/index.cjs.map +1 -0
  38. package/dist/cjs/main.cjs +11 -0
  39. package/dist/cjs/main.cjs.map +1 -1
  40. package/dist/cjs/run.cjs +120 -81
  41. package/dist/cjs/run.cjs.map +1 -1
  42. package/dist/cjs/stream.cjs +85 -51
  43. package/dist/cjs/stream.cjs.map +1 -1
  44. package/dist/cjs/tools/ToolNode.cjs +10 -4
  45. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  46. package/dist/cjs/tools/handlers.cjs +119 -13
  47. package/dist/cjs/tools/handlers.cjs.map +1 -1
  48. package/dist/cjs/tools/search/anthropic.cjs +40 -0
  49. package/dist/cjs/tools/search/anthropic.cjs.map +1 -0
  50. package/dist/cjs/tools/search/firecrawl.cjs +55 -9
  51. package/dist/cjs/tools/search/firecrawl.cjs.map +1 -1
  52. package/dist/cjs/tools/search/format.cjs +6 -6
  53. package/dist/cjs/tools/search/format.cjs.map +1 -1
  54. package/dist/cjs/tools/search/rerankers.cjs +7 -29
  55. package/dist/cjs/tools/search/rerankers.cjs.map +1 -1
  56. package/dist/cjs/tools/search/search.cjs +86 -16
  57. package/dist/cjs/tools/search/search.cjs.map +1 -1
  58. package/dist/cjs/tools/search/tool.cjs +4 -2
  59. package/dist/cjs/tools/search/tool.cjs.map +1 -1
  60. package/dist/cjs/tools/search/utils.cjs +1 -1
  61. package/dist/cjs/tools/search/utils.cjs.map +1 -1
  62. package/dist/cjs/utils/events.cjs +31 -0
  63. package/dist/cjs/utils/events.cjs.map +1 -0
  64. package/dist/cjs/utils/title.cjs +57 -21
  65. package/dist/cjs/utils/title.cjs.map +1 -1
  66. package/dist/cjs/utils/tokens.cjs +54 -7
  67. package/dist/cjs/utils/tokens.cjs.map +1 -1
  68. package/dist/esm/agents/AgentContext.mjs +216 -0
  69. package/dist/esm/agents/AgentContext.mjs.map +1 -0
  70. package/dist/esm/common/enum.mjs +15 -6
  71. package/dist/esm/common/enum.mjs.map +1 -1
  72. package/dist/esm/events.mjs +10 -6
  73. package/dist/esm/events.mjs.map +1 -1
  74. package/dist/esm/graphs/Graph.mjs +311 -214
  75. package/dist/esm/graphs/Graph.mjs.map +1 -1
  76. package/dist/esm/graphs/MultiAgentGraph.mjs +420 -0
  77. package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -0
  78. package/dist/esm/llm/anthropic/index.mjs +54 -9
  79. package/dist/esm/llm/anthropic/index.mjs.map +1 -1
  80. package/dist/esm/llm/anthropic/types.mjs.map +1 -1
  81. package/dist/esm/llm/anthropic/utils/message_inputs.mjs +52 -6
  82. package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -1
  83. package/dist/esm/llm/anthropic/utils/message_outputs.mjs +22 -2
  84. package/dist/esm/llm/anthropic/utils/message_outputs.mjs.map +1 -1
  85. package/dist/esm/llm/anthropic/utils/tools.mjs +27 -0
  86. package/dist/esm/llm/anthropic/utils/tools.mjs.map +1 -0
  87. package/dist/esm/llm/google/index.mjs +142 -0
  88. package/dist/esm/llm/google/index.mjs.map +1 -0
  89. package/dist/esm/llm/google/utils/common.mjs +471 -0
  90. package/dist/esm/llm/google/utils/common.mjs.map +1 -0
  91. package/dist/esm/llm/ollama/index.mjs +65 -0
  92. package/dist/esm/llm/ollama/index.mjs.map +1 -0
  93. package/dist/esm/llm/ollama/utils.mjs +155 -0
  94. package/dist/esm/llm/ollama/utils.mjs.map +1 -0
  95. package/dist/esm/llm/openai/index.mjs +388 -4
  96. package/dist/esm/llm/openai/index.mjs.map +1 -1
  97. package/dist/esm/llm/openai/utils/index.mjs +666 -0
  98. package/dist/esm/llm/openai/utils/index.mjs.map +1 -0
  99. package/dist/esm/llm/providers.mjs +5 -5
  100. package/dist/esm/llm/providers.mjs.map +1 -1
  101. package/dist/esm/llm/text.mjs +14 -3
  102. package/dist/esm/llm/text.mjs.map +1 -1
  103. package/dist/esm/llm/vertexai/index.mjs +328 -0
  104. package/dist/esm/llm/vertexai/index.mjs.map +1 -0
  105. package/dist/esm/main.mjs +6 -5
  106. package/dist/esm/main.mjs.map +1 -1
  107. package/dist/esm/run.mjs +121 -83
  108. package/dist/esm/run.mjs.map +1 -1
  109. package/dist/esm/stream.mjs +87 -54
  110. package/dist/esm/stream.mjs.map +1 -1
  111. package/dist/esm/tools/ToolNode.mjs +10 -4
  112. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  113. package/dist/esm/tools/handlers.mjs +119 -15
  114. package/dist/esm/tools/handlers.mjs.map +1 -1
  115. package/dist/esm/tools/search/anthropic.mjs +37 -0
  116. package/dist/esm/tools/search/anthropic.mjs.map +1 -0
  117. package/dist/esm/tools/search/firecrawl.mjs +55 -9
  118. package/dist/esm/tools/search/firecrawl.mjs.map +1 -1
  119. package/dist/esm/tools/search/format.mjs +7 -7
  120. package/dist/esm/tools/search/format.mjs.map +1 -1
  121. package/dist/esm/tools/search/rerankers.mjs +7 -29
  122. package/dist/esm/tools/search/rerankers.mjs.map +1 -1
  123. package/dist/esm/tools/search/search.mjs +86 -16
  124. package/dist/esm/tools/search/search.mjs.map +1 -1
  125. package/dist/esm/tools/search/tool.mjs +4 -2
  126. package/dist/esm/tools/search/tool.mjs.map +1 -1
  127. package/dist/esm/tools/search/utils.mjs +1 -1
  128. package/dist/esm/tools/search/utils.mjs.map +1 -1
  129. package/dist/esm/utils/events.mjs +29 -0
  130. package/dist/esm/utils/events.mjs.map +1 -0
  131. package/dist/esm/utils/title.mjs +57 -22
  132. package/dist/esm/utils/title.mjs.map +1 -1
  133. package/dist/esm/utils/tokens.mjs +54 -8
  134. package/dist/esm/utils/tokens.mjs.map +1 -1
  135. package/dist/types/agents/AgentContext.d.ts +91 -0
  136. package/dist/types/common/enum.d.ts +15 -6
  137. package/dist/types/events.d.ts +5 -4
  138. package/dist/types/graphs/Graph.d.ts +64 -67
  139. package/dist/types/graphs/MultiAgentGraph.d.ts +37 -0
  140. package/dist/types/graphs/index.d.ts +1 -0
  141. package/dist/types/llm/anthropic/index.d.ts +11 -0
  142. package/dist/types/llm/anthropic/types.d.ts +9 -3
  143. package/dist/types/llm/anthropic/utils/message_inputs.d.ts +1 -1
  144. package/dist/types/llm/anthropic/utils/output_parsers.d.ts +4 -4
  145. package/dist/types/llm/anthropic/utils/tools.d.ts +3 -0
  146. package/dist/types/llm/google/index.d.ts +13 -0
  147. package/dist/types/llm/google/types.d.ts +32 -0
  148. package/dist/types/llm/google/utils/common.d.ts +19 -0
  149. package/dist/types/llm/google/utils/tools.d.ts +10 -0
  150. package/dist/types/llm/google/utils/zod_to_genai_parameters.d.ts +14 -0
  151. package/dist/types/llm/ollama/index.d.ts +7 -0
  152. package/dist/types/llm/ollama/utils.d.ts +7 -0
  153. package/dist/types/llm/openai/index.d.ts +72 -3
  154. package/dist/types/llm/openai/types.d.ts +10 -0
  155. package/dist/types/llm/openai/utils/index.d.ts +20 -0
  156. package/dist/types/llm/text.d.ts +1 -1
  157. package/dist/types/llm/vertexai/index.d.ts +293 -0
  158. package/dist/types/messages/reducer.d.ts +9 -0
  159. package/dist/types/run.d.ts +19 -12
  160. package/dist/types/scripts/ant_web_search.d.ts +1 -0
  161. package/dist/types/scripts/args.d.ts +2 -1
  162. package/dist/types/scripts/handoff-test.d.ts +1 -0
  163. package/dist/types/scripts/multi-agent-conditional.d.ts +1 -0
  164. package/dist/types/scripts/multi-agent-parallel.d.ts +1 -0
  165. package/dist/types/scripts/multi-agent-sequence.d.ts +1 -0
  166. package/dist/types/scripts/multi-agent-supervisor.d.ts +1 -0
  167. package/dist/types/scripts/multi-agent-test.d.ts +1 -0
  168. package/dist/types/scripts/test-custom-prompt-key.d.ts +2 -0
  169. package/dist/types/scripts/test-handoff-input.d.ts +2 -0
  170. package/dist/types/scripts/test-multi-agent-list-handoff.d.ts +2 -0
  171. package/dist/types/stream.d.ts +10 -3
  172. package/dist/types/tools/CodeExecutor.d.ts +2 -2
  173. package/dist/types/tools/ToolNode.d.ts +1 -1
  174. package/dist/types/tools/handlers.d.ts +17 -4
  175. package/dist/types/tools/search/anthropic.d.ts +16 -0
  176. package/dist/types/tools/search/firecrawl.d.ts +15 -0
  177. package/dist/types/tools/search/rerankers.d.ts +0 -1
  178. package/dist/types/tools/search/types.d.ts +30 -9
  179. package/dist/types/types/graph.d.ts +129 -15
  180. package/dist/types/types/llm.d.ts +24 -10
  181. package/dist/types/types/run.d.ts +46 -8
  182. package/dist/types/types/stream.d.ts +16 -2
  183. package/dist/types/types/tools.d.ts +1 -1
  184. package/dist/types/utils/events.d.ts +6 -0
  185. package/dist/types/utils/title.d.ts +2 -1
  186. package/dist/types/utils/tokens.d.ts +24 -0
  187. package/package.json +37 -17
  188. package/src/agents/AgentContext.ts +315 -0
  189. package/src/common/enum.ts +14 -5
  190. package/src/events.ts +24 -13
  191. package/src/graphs/Graph.ts +495 -312
  192. package/src/graphs/MultiAgentGraph.ts +498 -0
  193. package/src/graphs/index.ts +2 -1
  194. package/src/llm/anthropic/Jacob_Lee_Resume_2023.pdf +0 -0
  195. package/src/llm/anthropic/index.ts +78 -13
  196. package/src/llm/anthropic/llm.spec.ts +491 -115
  197. package/src/llm/anthropic/types.ts +39 -3
  198. package/src/llm/anthropic/utils/message_inputs.ts +67 -11
  199. package/src/llm/anthropic/utils/message_outputs.ts +21 -2
  200. package/src/llm/anthropic/utils/output_parsers.ts +25 -6
  201. package/src/llm/anthropic/utils/tools.ts +29 -0
  202. package/src/llm/google/index.ts +218 -0
  203. package/src/llm/google/types.ts +43 -0
  204. package/src/llm/google/utils/common.ts +646 -0
  205. package/src/llm/google/utils/tools.ts +160 -0
  206. package/src/llm/google/utils/zod_to_genai_parameters.ts +86 -0
  207. package/src/llm/ollama/index.ts +89 -0
  208. package/src/llm/ollama/utils.ts +193 -0
  209. package/src/llm/openai/index.ts +600 -14
  210. package/src/llm/openai/types.ts +24 -0
  211. package/src/llm/openai/utils/index.ts +912 -0
  212. package/src/llm/openai/utils/isReasoningModel.test.ts +90 -0
  213. package/src/llm/providers.ts +10 -9
  214. package/src/llm/text.ts +26 -7
  215. package/src/llm/vertexai/index.ts +360 -0
  216. package/src/messages/reducer.ts +80 -0
  217. package/src/run.ts +181 -112
  218. package/src/scripts/ant_web_search.ts +158 -0
  219. package/src/scripts/args.ts +12 -8
  220. package/src/scripts/cli4.ts +29 -21
  221. package/src/scripts/cli5.ts +29 -21
  222. package/src/scripts/code_exec.ts +54 -23
  223. package/src/scripts/code_exec_files.ts +48 -17
  224. package/src/scripts/code_exec_simple.ts +46 -27
  225. package/src/scripts/handoff-test.ts +135 -0
  226. package/src/scripts/image.ts +52 -20
  227. package/src/scripts/multi-agent-conditional.ts +220 -0
  228. package/src/scripts/multi-agent-example-output.md +110 -0
  229. package/src/scripts/multi-agent-parallel.ts +341 -0
  230. package/src/scripts/multi-agent-sequence.ts +212 -0
  231. package/src/scripts/multi-agent-supervisor.ts +361 -0
  232. package/src/scripts/multi-agent-test.ts +186 -0
  233. package/src/scripts/search.ts +1 -9
  234. package/src/scripts/simple.ts +25 -10
  235. package/src/scripts/test-custom-prompt-key.ts +145 -0
  236. package/src/scripts/test-handoff-input.ts +110 -0
  237. package/src/scripts/test-multi-agent-list-handoff.ts +258 -0
  238. package/src/scripts/tools.ts +48 -18
  239. package/src/specs/anthropic.simple.test.ts +150 -34
  240. package/src/specs/azure.simple.test.ts +325 -0
  241. package/src/specs/openai.simple.test.ts +140 -33
  242. package/src/specs/openrouter.simple.test.ts +107 -0
  243. package/src/specs/prune.test.ts +4 -9
  244. package/src/specs/reasoning.test.ts +80 -44
  245. package/src/specs/token-memoization.test.ts +39 -0
  246. package/src/stream.test.ts +94 -0
  247. package/src/stream.ts +139 -60
  248. package/src/tools/ToolNode.ts +21 -7
  249. package/src/tools/handlers.ts +192 -18
  250. package/src/tools/search/anthropic.ts +51 -0
  251. package/src/tools/search/firecrawl.ts +69 -20
  252. package/src/tools/search/format.ts +6 -8
  253. package/src/tools/search/rerankers.ts +7 -40
  254. package/src/tools/search/search.ts +97 -16
  255. package/src/tools/search/tool.ts +5 -2
  256. package/src/tools/search/types.ts +30 -10
  257. package/src/tools/search/utils.ts +1 -1
  258. package/src/types/graph.ts +315 -103
  259. package/src/types/llm.ts +25 -12
  260. package/src/types/run.ts +51 -13
  261. package/src/types/stream.ts +22 -1
  262. package/src/types/tools.ts +16 -10
  263. package/src/utils/events.ts +32 -0
  264. package/src/utils/llmConfig.ts +19 -7
  265. package/src/utils/title.ts +104 -30
  266. package/src/utils/tokens.ts +69 -10
@@ -1,25 +1,93 @@
1
- import type { StateGraphArgs, StateGraph, CompiledStateGraph } from '@langchain/langgraph';
2
- import type { BaseMessage, AIMessageChunk } from '@langchain/core/messages';
1
+ import type { START, StateType, UpdateType, StateGraph, StateGraphArgs, StateDefinition, CompiledStateGraph, BinaryOperatorAggregate } from '@langchain/langgraph';
2
+ import type { BindToolsInput } from '@langchain/core/language_models/chat_models';
3
+ import type { BaseMessage, AIMessageChunk, SystemMessage } from '@langchain/core/messages';
4
+ import type { RunnableConfig, Runnable } from '@langchain/core/runnables';
3
5
  import type { ChatGenerationChunk } from '@langchain/core/outputs';
4
- import type { RunnableConfig } from '@langchain/core/runnables';
5
- import type { ToolMap, GenericTool } from '@/types/tools';
6
+ import type { GoogleAIToolType } from '@langchain/google-common';
7
+ import type { ToolMap, ToolEndEvent, GenericTool } from '@/types/tools';
8
+ import type { Providers, Callback, GraphNodeKeys } from '@/common';
9
+ import type { StandardGraph, MultiAgentGraph } from '@/graphs';
6
10
  import type { ClientOptions } from '@/types/llm';
7
- import type { Providers } from '@/common';
8
- import type { Graph } from '@/graphs';
11
+ import type { RunStep, RunStepDeltaEvent, MessageDeltaEvent, ReasoningDeltaEvent } from '@/types/stream';
12
+ import type { TokenCounter } from '@/types/run';
13
+ /** Interface for bound model with stream and invoke methods */
14
+ export interface ChatModel {
15
+ stream?: (messages: BaseMessage[], config?: RunnableConfig) => Promise<AsyncIterable<AIMessageChunk>>;
16
+ invoke: (messages: BaseMessage[], config?: RunnableConfig) => Promise<AIMessageChunk>;
17
+ }
18
+ export type GraphNode = GraphNodeKeys | typeof START;
19
+ export type ClientCallback<T extends unknown[]> = (graph: StandardGraph, ...args: T) => void;
20
+ export type ClientCallbacks = {
21
+ [Callback.TOOL_ERROR]?: ClientCallback<[Error, string]>;
22
+ [Callback.TOOL_START]?: ClientCallback<unknown[]>;
23
+ [Callback.TOOL_END]?: ClientCallback<unknown[]>;
24
+ };
25
+ export type SystemCallbacks = {
26
+ [K in keyof ClientCallbacks]: ClientCallbacks[K] extends ClientCallback<infer Args> ? (...args: Args) => void : never;
27
+ };
9
28
  export type BaseGraphState = {
10
29
  messages: BaseMessage[];
11
30
  };
31
+ export type MultiAgentGraphState = BaseGraphState & {
32
+ agentMessages?: BaseMessage[];
33
+ };
12
34
  export type IState = BaseGraphState;
13
35
  export interface EventHandler {
14
- handle(event: string, data: StreamEventData | ModelEndData, metadata?: Record<string, unknown>, graph?: Graph): void;
36
+ handle(event: string, data: StreamEventData | ModelEndData | RunStep | RunStepDeltaEvent | MessageDeltaEvent | ReasoningDeltaEvent | {
37
+ result: ToolEndEvent;
38
+ }, metadata?: Record<string, unknown>, graph?: StandardGraph | MultiAgentGraph): void | Promise<void>;
15
39
  }
16
40
  export type GraphStateChannels<T extends BaseGraphState> = StateGraphArgs<T>['channels'];
17
41
  export type Workflow<T extends BaseGraphState = BaseGraphState, U extends Partial<T> = Partial<T>, N extends string = string> = StateGraph<T, U, N>;
18
42
  export type CompiledWorkflow<T extends BaseGraphState = BaseGraphState, U extends Partial<T> = Partial<T>, N extends string = string> = CompiledStateGraph<T, U, N>;
43
+ export type CompiledStateWorkflow = CompiledStateGraph<StateType<{
44
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
45
+ }>, UpdateType<{
46
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
47
+ }>, string, {
48
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
49
+ }, {
50
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
51
+ }, StateDefinition>;
52
+ export type CompiledMultiAgentWorkflow = CompiledStateGraph<StateType<{
53
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
54
+ agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
55
+ }>, UpdateType<{
56
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
57
+ agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
58
+ }>, string, {
59
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
60
+ agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
61
+ }, {
62
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
63
+ agentMessages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
64
+ }, StateDefinition>;
65
+ export type CompiledAgentWorfklow = CompiledStateGraph<{
66
+ messages: BaseMessage[];
67
+ }, {
68
+ messages?: BaseMessage[] | undefined;
69
+ }, '__start__' | `agent=${string}` | `tools=${string}`, {
70
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
71
+ }, {
72
+ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
73
+ }, StateDefinition, {
74
+ [x: `agent=${string}`]: Partial<BaseGraphState>;
75
+ [x: `tools=${string}`]: any;
76
+ }>;
77
+ export type SystemRunnable = Runnable<BaseMessage[], (BaseMessage | SystemMessage)[], RunnableConfig<Record<string, unknown>>> | undefined;
78
+ /**
79
+ * Optional compile options passed to workflow.compile().
80
+ * These are intentionally untyped to avoid coupling to library internals.
81
+ */
82
+ export type CompileOptions = {
83
+ checkpointer?: any;
84
+ interruptBefore?: string[];
85
+ interruptAfter?: string[];
86
+ };
19
87
  export type EventStreamCallbackHandlerInput = Parameters<CompiledWorkflow['streamEvents']>[2] extends Omit<infer T, 'autoClose'> ? T : never;
20
- export type StreamChunk = ChatGenerationChunk & {
88
+ export type StreamChunk = (ChatGenerationChunk & {
21
89
  message: AIMessageChunk;
22
- } | AIMessageChunk;
90
+ }) | AIMessageChunk;
23
91
  /**
24
92
  * Data associated with a StreamEvent.
25
93
  */
@@ -55,6 +123,10 @@ export type StreamEventData = {
55
123
  * Custom result from the runnable that generated the event.
56
124
  */
57
125
  result?: unknown;
126
+ /**
127
+ * Custom field to indicate the event was manually emitted, and may have been handled already
128
+ */
129
+ emitted?: boolean;
58
130
  };
59
131
  /**
60
132
  * A streaming event.
@@ -117,19 +189,61 @@ export type PartMetadata = {
117
189
  action?: boolean;
118
190
  output?: string;
119
191
  };
120
- export type ModelEndData = StreamEventData & {
192
+ export type ModelEndData = (StreamEventData & {
121
193
  output: AIMessageChunk | undefined;
122
- } | undefined;
194
+ }) | undefined;
195
+ export type GraphTools = GenericTool[] | BindToolsInput[] | GoogleAIToolType[];
123
196
  export type StandardGraphInput = {
124
197
  runId?: string;
198
+ signal?: AbortSignal;
199
+ agents: AgentInputs[];
200
+ tokenCounter?: TokenCounter;
201
+ indexTokenCountMap?: Record<string, number>;
202
+ };
203
+ export type GraphEdge = {
204
+ /** Agent ID, use a list for multiple sources */
205
+ from: string | string[];
206
+ /** Agent ID, use a list for multiple destinations */
207
+ to: string | string[];
208
+ description?: string;
209
+ /** Can return boolean or specific destination(s) */
210
+ condition?: (state: BaseGraphState) => boolean | string | string[];
211
+ /** 'handoff' creates tools for dynamic routing, 'direct' creates direct edges, which also allow parallel execution */
212
+ edgeType?: 'handoff' | 'direct';
213
+ /**
214
+ * For direct edges: Optional prompt to add when transitioning through this edge.
215
+ * String prompts can include variables like {results} which will be replaced with
216
+ * messages from startIndex onwards. When {results} is used, excludeResults defaults to true.
217
+ *
218
+ * For handoff edges: Description for the input parameter that the handoff tool accepts,
219
+ * allowing the supervisor to pass specific instructions/context to the transferred agent.
220
+ */
221
+ prompt?: string | ((messages: BaseMessage[], runStartIndex: number) => string | undefined);
222
+ /**
223
+ * When true, excludes messages from startIndex when adding prompt.
224
+ * Automatically set to true when {results} variable is used in prompt.
225
+ */
226
+ excludeResults?: boolean;
227
+ /**
228
+ * For handoff edges: Customizes the parameter name for the handoff input.
229
+ * Defaults to "instructions" if not specified.
230
+ * Only applies when prompt is provided for handoff edges.
231
+ */
232
+ promptKey?: string;
233
+ };
234
+ export type MultiAgentGraphInput = StandardGraphInput & {
235
+ edges: GraphEdge[];
236
+ };
237
+ export interface AgentInputs {
238
+ agentId: string;
125
239
  toolEnd?: boolean;
126
240
  toolMap?: ToolMap;
241
+ tools?: GraphTools;
127
242
  provider: Providers;
128
- signal?: AbortSignal;
129
243
  instructions?: string;
130
244
  streamBuffer?: number;
131
- tools?: GenericTool[];
132
- clientOptions: ClientOptions;
245
+ maxContextTokens?: number;
246
+ clientOptions?: ClientOptions;
133
247
  additional_instructions?: string;
134
248
  reasoningKey?: 'reasoning_content' | 'reasoning';
135
- };
249
+ }
@@ -1,27 +1,29 @@
1
1
  import { ChatOllama } from '@langchain/ollama';
2
- import { ChatAnthropic } from '@langchain/anthropic';
3
2
  import { ChatMistralAI } from '@langchain/mistralai';
4
3
  import { ChatBedrockConverse } from '@langchain/aws';
5
- import { ChatVertexAI } from '@langchain/google-vertexai';
6
- import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
7
4
  import { BedrockChat } from '@langchain/community/chat_models/bedrock/web';
8
5
  import type { BindToolsInput, BaseChatModelParams } from '@langchain/core/language_models/chat_models';
9
6
  import type { OpenAIChatInput, ChatOpenAIFields, AzureOpenAIInput, ClientOptions as OAIClientOptions } from '@langchain/openai';
10
7
  import type { BedrockChatFields } from '@langchain/community/chat_models/bedrock/web';
11
8
  import type { GoogleGenerativeAIChatInput } from '@langchain/google-genai';
9
+ import type { GeminiGenerationConfig } from '@langchain/google-common';
12
10
  import type { ChatVertexAIInput } from '@langchain/google-vertexai';
13
11
  import type { ChatDeepSeekCallOptions } from '@langchain/deepseek';
14
12
  import type { ChatOpenRouterCallOptions } from '@/llm/openrouter';
15
13
  import type { ChatBedrockConverseInput } from '@langchain/aws';
16
14
  import type { ChatMistralAIInput } from '@langchain/mistralai';
15
+ import type { RequestOptions } from '@google/generative-ai';
17
16
  import type { StructuredTool } from '@langchain/core/tools';
18
17
  import type { AnthropicInput } from '@langchain/anthropic';
19
18
  import type { Runnable } from '@langchain/core/runnables';
20
19
  import type { ChatOllamaInput } from '@langchain/ollama';
21
20
  import type { OpenAI as OpenAIClient } from 'openai';
22
21
  import type { ChatXAIInput } from '@langchain/xai';
23
- import { ChatXAI, ChatOpenAI, ChatDeepSeek, AzureChatOpenAI } from '@/llm/openai';
22
+ import { AzureChatOpenAI, ChatDeepSeek, ChatOpenAI, ChatXAI } from '@/llm/openai';
23
+ import { CustomChatGoogleGenerativeAI } from '@/llm/google';
24
+ import { CustomAnthropic } from '@/llm/anthropic';
24
25
  import { ChatOpenRouter } from '@/llm/openrouter';
26
+ import { ChatVertexAI } from '@/llm/vertexai';
25
27
  import { Providers } from '@/common';
26
28
  export type AzureClientOptions = Partial<OpenAIChatInput> & Partial<AzureOpenAIInput> & {
27
29
  openAIApiKey?: string;
@@ -42,19 +44,31 @@ export type OpenAIClientOptions = ChatOpenAIFields;
42
44
  export type OllamaClientOptions = ChatOllamaInput;
43
45
  export type AnthropicClientOptions = AnthropicInput;
44
46
  export type MistralAIClientOptions = ChatMistralAIInput;
45
- export type VertexAIClientOptions = ChatVertexAIInput;
47
+ export type VertexAIClientOptions = ChatVertexAIInput & {
48
+ includeThoughts?: boolean;
49
+ };
46
50
  export type BedrockClientOptions = BedrockChatFields;
47
51
  export type BedrockAnthropicInput = ChatBedrockConverseInput & {
48
52
  additionalModelRequestFields?: ChatBedrockConverseInput['additionalModelRequestFields'] & AnthropicReasoning;
49
53
  };
50
54
  export type BedrockConverseClientOptions = ChatBedrockConverseInput;
51
- export type GoogleClientOptions = GoogleGenerativeAIChatInput;
55
+ export type GoogleClientOptions = GoogleGenerativeAIChatInput & {
56
+ customHeaders?: RequestOptions['customHeaders'];
57
+ thinkingConfig?: GeminiGenerationConfig['thinkingConfig'];
58
+ };
52
59
  export type DeepSeekClientOptions = ChatDeepSeekCallOptions;
53
60
  export type XAIClientOptions = ChatXAIInput;
54
61
  export type ClientOptions = OpenAIClientOptions | AzureClientOptions | OllamaClientOptions | AnthropicClientOptions | MistralAIClientOptions | VertexAIClientOptions | BedrockClientOptions | BedrockConverseClientOptions | GoogleClientOptions | DeepSeekClientOptions | XAIClientOptions;
55
- export type LLMConfig = {
62
+ export type SharedLLMConfig = {
56
63
  provider: Providers;
57
- } & ClientOptions;
64
+ };
65
+ export type LLMConfig = SharedLLMConfig & ClientOptions & {
66
+ /** Optional provider fallbacks in order of attempt */
67
+ fallbacks?: Array<{
68
+ provider: Providers;
69
+ clientOptions?: ClientOptions;
70
+ }>;
71
+ };
58
72
  export type ProviderOptionsMap = {
59
73
  [Providers.AZURE]: AzureClientOptions;
60
74
  [Providers.OPENAI]: OpenAIClientOptions;
@@ -77,13 +91,13 @@ export type ChatModelMap = {
77
91
  [Providers.AZURE]: AzureChatOpenAI;
78
92
  [Providers.DEEPSEEK]: ChatDeepSeek;
79
93
  [Providers.VERTEXAI]: ChatVertexAI;
80
- [Providers.ANTHROPIC]: ChatAnthropic;
94
+ [Providers.ANTHROPIC]: CustomAnthropic;
81
95
  [Providers.MISTRALAI]: ChatMistralAI;
82
96
  [Providers.MISTRAL]: ChatMistralAI;
83
97
  [Providers.OPENROUTER]: ChatOpenRouter;
84
98
  [Providers.BEDROCK_LEGACY]: BedrockChat;
85
99
  [Providers.BEDROCK]: ChatBedrockConverse;
86
- [Providers.GOOGLE]: ChatGoogleGenerativeAI;
100
+ [Providers.GOOGLE]: CustomChatGoogleGenerativeAI;
87
101
  };
88
102
  export type ChatModelConstructorMap = {
89
103
  [P in Providers]: new (config: ProviderOptionsMap[P]) => ChatModelMap[P];
@@ -3,26 +3,59 @@ import type { BaseMessage } from '@langchain/core/messages';
3
3
  import type { StructuredTool } from '@langchain/core/tools';
4
4
  import type { RunnableConfig } from '@langchain/core/runnables';
5
5
  import type { BaseCallbackHandler, CallbackHandlerMethods } from '@langchain/core/callbacks/base';
6
- import type * as graph from '@/graphs/Graph';
7
6
  import type * as s from '@/types/stream';
8
7
  import type * as e from '@/common/enum';
9
8
  import type * as g from '@/types/graph';
10
9
  import type * as l from '@/types/llm';
11
10
  export type ZodObjectAny = z.ZodObject<any, any, any, any>;
12
11
  export type BaseGraphConfig = {
13
- type?: 'standard';
14
12
  llmConfig: l.LLMConfig;
15
13
  provider?: e.Providers;
16
14
  clientOptions?: l.ClientOptions;
15
+ /** Optional compile options for workflow.compile() */
16
+ compileOptions?: g.CompileOptions;
17
17
  };
18
- export type StandardGraphConfig = BaseGraphConfig & Omit<g.StandardGraphInput, 'provider' | 'clientOptions'>;
18
+ export type LegacyGraphConfig = BaseGraphConfig & {
19
+ type?: 'standard';
20
+ } & Omit<g.StandardGraphInput, 'provider' | 'clientOptions' | 'agents'> & Omit<g.AgentInputs, 'provider' | 'clientOptions' | 'agentId'>;
21
+ export type SupervisedGraphConfig = BaseGraphConfig & {
22
+ type: 'supervised';
23
+ /** Enable supervised router; when false, fall back to standard loop */
24
+ routerEnabled?: boolean;
25
+ /** Table-driven routing policy per stage */
26
+ routingPolicies?: Array<{
27
+ stage: string;
28
+ agents?: string[];
29
+ model?: e.Providers;
30
+ parallel?: boolean;
31
+ /** Optional simple condition on content/tools */
32
+ when?: 'always' | 'has_tools' | 'no_tools' | {
33
+ includes?: string[];
34
+ excludes?: string[];
35
+ };
36
+ }>;
37
+ /** Opt-in feature flags */
38
+ featureFlags?: {
39
+ multi_model_routing?: boolean;
40
+ fan_out?: boolean;
41
+ fan_out_retries?: number;
42
+ fan_out_backoff_ms?: number;
43
+ fan_out_concurrency?: number;
44
+ };
45
+ /** Optional per-stage model configs */
46
+ models?: Record<string, l.LLMConfig>;
47
+ } & Omit<g.StandardGraphInput, 'provider' | 'clientOptions'>;
19
48
  export type RunTitleOptions = {
20
49
  inputText: string;
50
+ provider: e.Providers;
21
51
  contentParts: (s.MessageContentComplex | undefined)[];
22
52
  titlePrompt?: string;
23
53
  skipLanguage?: boolean;
24
54
  clientOptions?: l.ClientOptions;
25
55
  chainOptions?: Partial<RunnableConfig> | undefined;
56
+ omitOptions?: Set<string>;
57
+ titleMethod?: e.TitleMethod;
58
+ titlePromptTemplate?: string;
26
59
  };
27
60
  export interface AgentStateChannels {
28
61
  messages: BaseMessage[];
@@ -53,18 +86,23 @@ export type TaskManagerGraphConfig = {
53
86
  llmConfig: l.LLMConfig;
54
87
  };
55
88
  };
89
+ export type MultiAgentGraphConfig = {
90
+ type: 'multi-agent';
91
+ compileOptions?: g.CompileOptions;
92
+ agents: g.AgentInputs[];
93
+ edges: g.GraphEdge[];
94
+ };
56
95
  export type RunConfig = {
57
96
  runId: string;
58
- graphConfig: StandardGraphConfig | CollaborativeGraphConfig | TaskManagerGraphConfig;
97
+ graphConfig: LegacyGraphConfig | MultiAgentGraphConfig;
59
98
  customHandlers?: Record<string, g.EventHandler>;
60
99
  returnContent?: boolean;
100
+ tokenCounter?: TokenCounter;
101
+ indexTokenCountMap?: Record<string, number>;
61
102
  };
62
103
  export type ProvidedCallbacks = (BaseCallbackHandler | CallbackHandlerMethods)[] | undefined;
63
104
  export type TokenCounter = (message: BaseMessage) => number;
64
105
  export type EventStreamOptions = {
65
- callbacks?: graph.ClientCallbacks;
106
+ callbacks?: g.ClientCallbacks;
66
107
  keepContent?: boolean;
67
- maxContextTokens?: number;
68
- tokenCounter?: TokenCounter;
69
- indexTokenCountMap?: Record<string, number>;
70
108
  };
@@ -2,6 +2,8 @@ import type OpenAITypes from 'openai';
2
2
  import type { MessageContentImageUrl, MessageContentText, ToolMessage, BaseMessage } from '@langchain/core/messages';
3
3
  import type { ToolCall, ToolCallChunk } from '@langchain/core/messages/tool';
4
4
  import type { LLMResult, Generation } from '@langchain/core/outputs';
5
+ import type { AnthropicContentBlock } from '@/llm/anthropic/types';
6
+ import type { Command } from '@langchain/langgraph';
5
7
  import type { ToolEndEvent } from '@/types/tools';
6
8
  import { StepTypes, ContentTypes, GraphEvents } from '@/common/enum';
7
9
  export type HandleLLMEnd = (output: LLMResult, runId: string, parentRunId?: string, tags?: string[]) => void;
@@ -64,7 +66,7 @@ export type MessageCreationDetails = {
64
66
  };
65
67
  export type ToolEndData = {
66
68
  input: string | Record<string, unknown>;
67
- output?: ToolMessage;
69
+ output?: ToolMessage | Command;
68
70
  };
69
71
  export type ToolErrorData = {
70
72
  id: string;
@@ -191,6 +193,11 @@ export type ReasoningContentText = {
191
193
  type: ContentTypes.THINK;
192
194
  think: string;
193
195
  };
196
+ /** Vertex AI / Google Common - Reasoning Content Block Format */
197
+ export type GoogleReasoningContentText = {
198
+ type: ContentTypes.REASONING;
199
+ reasoning: string;
200
+ };
194
201
  /** Anthropic's Reasoning Content Block Format */
195
202
  export type ThinkingContentText = {
196
203
  type: ContentTypes.THINKING;
@@ -230,7 +237,14 @@ export type ToolCallContent = {
230
237
  type: ContentTypes.TOOL_CALL;
231
238
  tool_call?: ToolCallPart;
232
239
  };
233
- export type MessageContentComplex = (ThinkingContentText | AgentUpdate | ToolCallContent | ReasoningContentText | MessageContentText | MessageContentImageUrl | (Record<string, any> & {
240
+ export type ToolResultContent = {
241
+ content: string | Record<string, unknown> | Array<string | Record<string, unknown>> | AnthropicContentBlock[];
242
+ type: 'tool_result' | 'web_search_result' | 'web_search_tool_result';
243
+ tool_use_id?: string;
244
+ input?: string | Record<string, unknown>;
245
+ index?: number;
246
+ };
247
+ export type MessageContentComplex = (ToolResultContent | ThinkingContentText | AgentUpdate | ToolCallContent | ReasoningContentText | MessageContentText | MessageContentImageUrl | (Record<string, any> & {
234
248
  type?: 'text' | 'image_url' | 'think' | 'thinking' | string;
235
249
  }) | (Record<string, any> & {
236
250
  type?: never;
@@ -1,5 +1,5 @@
1
- import type { RunnableToolLike } from '@langchain/core/runnables';
2
1
  import type { StructuredToolInterface } from '@langchain/core/tools';
2
+ import type { RunnableToolLike } from '@langchain/core/runnables';
3
3
  import type { ToolCall } from '@langchain/core/messages/tool';
4
4
  import type { ToolErrorData } from './stream';
5
5
  import { EnvVar } from '@/common';
@@ -0,0 +1,6 @@
1
+ import type { RunnableConfig } from '@langchain/core/runnables';
2
+ /**
3
+ * Safely dispatches a custom event and properly awaits it to avoid
4
+ * race conditions where events are dispatched after run cleanup.
5
+ */
6
+ export declare function safeDispatchCustomEvent(event: string, payload: unknown, config?: RunnableConfig): Promise<void>;
@@ -1,3 +1,4 @@
1
1
  import type { Runnable } from '@langchain/core/runnables';
2
- import * as t from '@/types';
2
+ import type * as t from '@/types';
3
3
  export declare const createTitleRunnable: (model: t.ChatModelInstance, _titlePrompt?: string) => Promise<Runnable>;
4
+ export declare const createCompletionTitleRunnable: (model: t.ChatModelInstance, titlePrompt?: string) => Promise<Runnable>;
@@ -1,3 +1,27 @@
1
1
  import type { BaseMessage } from '@langchain/core/messages';
2
2
  export declare function getTokenCountForMessage(message: BaseMessage, getTokenCount: (text: string) => number): number;
3
+ /**
4
+ * Creates a singleton token counter function that reuses the same encoder instance.
5
+ * This avoids creating multiple function closures and prevents potential memory issues.
6
+ */
3
7
  export declare const createTokenCounter: () => Promise<(message: BaseMessage) => number>;
8
+ /**
9
+ * Utility to manage the token encoder lifecycle explicitly.
10
+ * Useful for applications that need fine-grained control over resource management.
11
+ */
12
+ export declare const TokenEncoderManager: {
13
+ /**
14
+ * Pre-initializes the encoder. This can be called during app startup
15
+ * to avoid lazy loading delays later.
16
+ */
17
+ initialize(): Promise<void>;
18
+ /**
19
+ * Clears the cached encoder and token counter.
20
+ * Useful for testing or when you need to force a fresh reload.
21
+ */
22
+ reset(): void;
23
+ /**
24
+ * Checks if the encoder has been initialized.
25
+ */
26
+ isInitialized(): boolean;
27
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@librechat/agents",
3
- "version": "2.4.322",
3
+ "version": "3.0.00-rc2",
4
4
  "main": "./dist/cjs/main.cjs",
5
5
  "module": "./dist/esm/main.mjs",
6
6
  "types": "./dist/types/index.d.ts",
@@ -47,14 +47,23 @@
47
47
  "image": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/image.ts --provider 'google' --name 'Jo' --location 'New York, NY'",
48
48
  "code_exec_files": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec_files.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
49
49
  "code_exec_simple": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/code_exec_simple.ts --provider 'google' --name 'Jo' --location 'New York, NY'",
50
- "simple": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/simple.ts --provider 'xai' --name 'Jo' --location 'New York, NY'",
50
+ "simple": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/simple.ts --provider 'anthropic' --name 'Jo' --location 'New York, NY'",
51
51
  "caching": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/caching.ts --name 'Jo' --location 'New York, NY'",
52
52
  "thinking": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/thinking.ts --name 'Jo' --location 'New York, NY'",
53
53
  "memory": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/memory.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
54
- "tool-test": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/tools.ts --provider 'alibaba' --name 'Jo' --location 'New York, NY'",
54
+ "tool-test": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/tools.ts --provider 'bedrock' --name 'Jo' --location 'New York, NY'",
55
55
  "search": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/search.ts --provider 'anthropic' --name 'Jo' --location 'New York, NY'",
56
+ "ant_web_search": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/ant_web_search.ts --name 'Jo' --location 'New York, NY'",
56
57
  "abort": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/abort.ts --provider 'openAI' --name 'Jo' --location 'New York, NY'",
57
58
  "start:cli2": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/cli2.ts --provider 'anthropic' --name 'Jo' --location 'New York, NY'",
59
+ "multi-agent-test": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/multi-agent-test.ts",
60
+ "multi-agent-parallel": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/multi-agent-parallel.ts",
61
+ "multi-agent-sequence": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/multi-agent-sequence.ts",
62
+ "multi-agent-conditional": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/multi-agent-conditional.ts",
63
+ "multi-agent-supervisor": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/multi-agent-supervisor.ts",
64
+ "multi-agent-list-handoff": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/test-multi-agent-list-handoff.ts",
65
+ "test-handoff-input": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/test-handoff-input.ts",
66
+ "test-custom-prompt-key": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/test-custom-prompt-key.ts",
58
67
  "script2": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/proto/example_test.ts",
59
68
  "script3": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/proto/example_test_anthropic.ts",
60
69
  "script4": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/cli4.ts --name 'Jo' --location 'New York, NY'",
@@ -65,35 +74,46 @@
65
74
  "start:collab": "node --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/main.ts",
66
75
  "start:collab5": "node --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/collab_design_v5.ts",
67
76
  "start:dev": "node --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/main.ts",
77
+ "supervised": "node -r dotenv/config --loader ./tsconfig-paths-bootstrap.mjs --experimental-specifier-resolution=node ./src/scripts/supervised.ts --provider anthropic --name Jo --location \"New York, NY\"",
68
78
  "test": "jest",
79
+ "test:memory": "NODE_OPTIONS='--expose-gc' npx jest src/specs/title.memory-leak.test.ts",
80
+ "test:all": "npm test -- --testPathIgnorePatterns=title.memory-leak.test.ts && npm run test:memory",
69
81
  "reinstall": "npm run clean && npm ci && rm -rf ./dist && npm run build",
70
82
  "re": "bun run clean && bun install && rm -rf ./dist && turbo build",
71
83
  "lint": "eslint \"{,!(node_modules|venv)/**/}*.{js,jsx,ts,tsx}\" --fix",
72
84
  "format": "prettier --write ."
73
85
  },
86
+ "overrides": {
87
+ "@langchain/openai": "0.5.18",
88
+ "@browserbasehq/stagehand": {
89
+ "openai": "$openai"
90
+ }
91
+ },
74
92
  "dependencies": {
75
- "@langchain/anthropic": "^0.3.20",
76
- "@langchain/aws": "0.1.8",
77
- "@langchain/community": "^0.3.42",
78
- "@langchain/core": "^0.3.55",
79
- "@langchain/deepseek": "^0.0.1",
80
- "@langchain/google-genai": "^0.2.8",
81
- "@langchain/google-vertexai": "^0.2.8",
82
- "@langchain/langgraph": "^0.2.72",
83
- "@langchain/mistralai": "^0.2.0",
84
- "@langchain/ollama": "^0.2.0",
85
- "@langchain/openai": "^0.5.10",
86
- "@langchain/xai": "^0.0.2",
93
+ "@langchain/anthropic": "^0.3.26",
94
+ "@langchain/aws": "^0.1.12",
95
+ "@langchain/community": "^0.3.47",
96
+ "@langchain/core": "^0.3.72",
97
+ "@langchain/deepseek": "^0.0.2",
98
+ "@langchain/google-genai": "^0.2.13",
99
+ "@langchain/google-vertexai": "^0.2.13",
100
+ "@langchain/langgraph": "^0.4.9",
101
+ "@langchain/mistralai": "^0.2.1",
102
+ "@langchain/ollama": "^0.2.3",
103
+ "@langchain/openai": "0.5.18",
104
+ "@langchain/xai": "^0.0.3",
87
105
  "cheerio": "^1.0.0",
88
106
  "dotenv": "^16.4.7",
89
107
  "https-proxy-agent": "^7.0.6",
90
- "nanoid": "^3.3.7"
108
+ "nanoid": "^3.3.7",
109
+ "openai": "^5.10.1"
91
110
  },
92
111
  "imports": {
93
112
  "@/*": "./src/*",
94
113
  "~/*": "./*"
95
114
  },
96
115
  "devDependencies": {
116
+ "@anthropic-ai/vertex-sdk": "^0.12.0",
97
117
  "@eslint/compat": "^1.2.7",
98
118
  "@rollup/plugin-alias": "^5.1.0",
99
119
  "@rollup/plugin-commonjs": "^28.0.3",
@@ -107,7 +127,7 @@
107
127
  "@types/yargs-parser": "^21.0.3",
108
128
  "@typescript-eslint/eslint-plugin": "^8.24.0",
109
129
  "@typescript-eslint/parser": "^8.24.0",
110
- "eslint": "^9.22.0",
130
+ "eslint": "^9.31.0",
111
131
  "eslint-import-resolver-typescript": "^3.7.0",
112
132
  "eslint-plugin-import": "^2.31.0",
113
133
  "husky": "^9.1.7",