langchain 1.0.0-alpha.8 → 1.0.0-alpha.9

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 (442) hide show
  1. package/LICENSE +6 -6
  2. package/dist/agents/ReactAgent.cjs +497 -104
  3. package/dist/agents/ReactAgent.cjs.map +1 -1
  4. package/dist/agents/ReactAgent.d.cts +140 -17
  5. package/dist/agents/ReactAgent.d.cts.map +1 -1
  6. package/dist/agents/ReactAgent.d.ts +140 -17
  7. package/dist/agents/ReactAgent.d.ts.map +1 -1
  8. package/dist/agents/ReactAgent.js +500 -107
  9. package/dist/agents/ReactAgent.js.map +1 -1
  10. package/dist/agents/annotation.cjs +32 -149
  11. package/dist/agents/annotation.cjs.map +1 -1
  12. package/dist/agents/annotation.js +34 -147
  13. package/dist/agents/annotation.js.map +1 -1
  14. package/dist/agents/constants.cjs.map +1 -1
  15. package/dist/agents/constants.d.cts +9 -0
  16. package/dist/agents/constants.d.cts.map +1 -0
  17. package/dist/agents/constants.d.ts +9 -0
  18. package/dist/agents/constants.d.ts.map +1 -0
  19. package/dist/agents/constants.js.map +1 -1
  20. package/dist/agents/errors.cjs +2 -1
  21. package/dist/agents/errors.cjs.map +1 -1
  22. package/dist/agents/errors.js +2 -1
  23. package/dist/agents/errors.js.map +1 -1
  24. package/dist/agents/index.cjs +5 -29
  25. package/dist/agents/index.cjs.map +1 -1
  26. package/dist/agents/index.d.cts +157 -128
  27. package/dist/agents/index.d.cts.map +1 -1
  28. package/dist/agents/index.d.ts +157 -128
  29. package/dist/agents/index.d.ts.map +1 -1
  30. package/dist/agents/index.js +5 -27
  31. package/dist/agents/index.js.map +1 -1
  32. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.cjs +2 -2
  33. package/dist/agents/middleware/callLimit.cjs.map +1 -0
  34. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.cts +3 -3
  35. package/dist/agents/middleware/callLimit.d.cts.map +1 -0
  36. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.ts +3 -3
  37. package/dist/agents/middleware/callLimit.d.ts.map +1 -0
  38. package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.js +1 -1
  39. package/dist/agents/middleware/callLimit.js.map +1 -0
  40. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.cjs +5 -5
  41. package/dist/agents/middleware/contextEditing.cjs.map +1 -0
  42. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.cts +2 -2
  43. package/dist/agents/middleware/contextEditing.d.cts.map +1 -0
  44. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.ts +2 -2
  45. package/dist/agents/middleware/contextEditing.d.ts.map +1 -0
  46. package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.js +4 -4
  47. package/dist/agents/middleware/contextEditing.js.map +1 -0
  48. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.cjs +6 -6
  49. package/dist/agents/middleware/dynamicSystemPrompt.cjs.map +1 -0
  50. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.cts +3 -2
  51. package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -0
  52. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.ts +3 -2
  53. package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -0
  54. package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.js +6 -6
  55. package/dist/agents/middleware/dynamicSystemPrompt.js.map +1 -0
  56. package/dist/agents/middleware/hitl.cjs +404 -0
  57. package/dist/agents/middleware/hitl.cjs.map +1 -0
  58. package/dist/agents/middleware/hitl.d.cts +611 -0
  59. package/dist/agents/middleware/hitl.d.cts.map +1 -0
  60. package/dist/agents/middleware/hitl.d.ts +611 -0
  61. package/dist/agents/middleware/hitl.d.ts.map +1 -0
  62. package/dist/agents/middleware/hitl.js +403 -0
  63. package/dist/agents/middleware/hitl.js.map +1 -0
  64. package/dist/agents/middleware/index.cjs +12 -0
  65. package/dist/agents/middleware/index.js +12 -0
  66. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.cjs +7 -7
  67. package/dist/agents/middleware/llmToolSelector.cjs.map +1 -0
  68. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.cts +2 -2
  69. package/dist/agents/middleware/llmToolSelector.d.cts.map +1 -0
  70. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.ts +2 -2
  71. package/dist/agents/middleware/llmToolSelector.d.ts.map +1 -0
  72. package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.js +6 -6
  73. package/dist/agents/middleware/llmToolSelector.js.map +1 -0
  74. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.cjs +28 -21
  75. package/dist/agents/middleware/modelFallback.cjs.map +1 -0
  76. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.cts +2 -2
  77. package/dist/agents/middleware/modelFallback.d.cts.map +1 -0
  78. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.ts +2 -2
  79. package/dist/agents/middleware/modelFallback.d.ts.map +1 -0
  80. package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.js +28 -21
  81. package/dist/agents/middleware/modelFallback.js.map +1 -0
  82. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.cjs +12 -12
  83. package/dist/agents/middleware/piiRedaction.cjs.map +1 -0
  84. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.cts +4 -4
  85. package/dist/agents/middleware/piiRedaction.d.cts.map +1 -0
  86. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.ts +4 -4
  87. package/dist/agents/middleware/piiRedaction.d.ts.map +1 -0
  88. package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.js +10 -10
  89. package/dist/agents/middleware/piiRedaction.js.map +1 -0
  90. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.cjs +27 -24
  91. package/dist/agents/middleware/promptCaching.cjs.map +1 -0
  92. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.cts +3 -3
  93. package/dist/agents/middleware/promptCaching.d.cts.map +1 -0
  94. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.ts +3 -3
  95. package/dist/agents/middleware/promptCaching.d.ts.map +1 -0
  96. package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.js +26 -23
  97. package/dist/agents/middleware/promptCaching.js.map +1 -0
  98. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.cjs +7 -12
  99. package/dist/agents/middleware/summarization.cjs.map +1 -0
  100. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.cts +3 -3
  101. package/dist/agents/middleware/summarization.d.cts.map +1 -0
  102. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.ts +3 -3
  103. package/dist/agents/middleware/summarization.d.ts.map +1 -0
  104. package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.js +4 -9
  105. package/dist/agents/middleware/summarization.js.map +1 -0
  106. package/dist/agents/middleware/todoListMiddleware.cjs +314 -0
  107. package/dist/agents/middleware/todoListMiddleware.cjs.map +1 -0
  108. package/dist/agents/middleware/todoListMiddleware.d.cts +75 -0
  109. package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -0
  110. package/dist/agents/middleware/todoListMiddleware.d.ts +75 -0
  111. package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -0
  112. package/dist/agents/middleware/todoListMiddleware.js +312 -0
  113. package/dist/agents/middleware/todoListMiddleware.js.map +1 -0
  114. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.cjs +2 -2
  115. package/dist/agents/middleware/toolCallLimit.cjs.map +1 -0
  116. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.cts +3 -3
  117. package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -0
  118. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.ts +3 -3
  119. package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -0
  120. package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.js +1 -1
  121. package/dist/agents/middleware/toolCallLimit.js.map +1 -0
  122. package/dist/agents/middleware/types.d.cts +208 -0
  123. package/dist/agents/middleware/types.d.cts.map +1 -0
  124. package/dist/agents/middleware/types.d.ts +208 -0
  125. package/dist/agents/middleware/types.d.ts.map +1 -0
  126. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.cjs +1 -1
  127. package/dist/agents/middleware/utils.cjs.map +1 -0
  128. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.cts +1 -1
  129. package/dist/agents/middleware/utils.d.cts.map +1 -0
  130. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.ts +1 -1
  131. package/dist/agents/middleware/utils.d.ts.map +1 -0
  132. package/dist/agents/{middlewareAgent/middleware → middleware}/utils.js +1 -1
  133. package/dist/agents/middleware/utils.js.map +1 -0
  134. package/dist/agents/{middlewareAgent/middleware.cjs → middleware.cjs} +11 -4
  135. package/dist/agents/middleware.cjs.map +1 -0
  136. package/dist/agents/middleware.d.cts +205 -0
  137. package/dist/agents/middleware.d.cts.map +1 -0
  138. package/dist/agents/middleware.d.ts +205 -0
  139. package/dist/agents/middleware.d.ts.map +1 -0
  140. package/dist/agents/{middlewareAgent/middleware.js → middleware.js} +11 -4
  141. package/dist/agents/middleware.js.map +1 -0
  142. package/dist/agents/nodes/AfterAgentNode.cjs +27 -0
  143. package/dist/agents/nodes/AfterAgentNode.cjs.map +1 -0
  144. package/dist/agents/nodes/AfterAgentNode.js +27 -0
  145. package/dist/agents/nodes/AfterAgentNode.js.map +1 -0
  146. package/dist/agents/{middlewareAgent/nodes/AfterModalNode.cjs → nodes/AfterModelNode.cjs} +3 -5
  147. package/dist/agents/nodes/AfterModelNode.cjs.map +1 -0
  148. package/dist/agents/{middlewareAgent/nodes/AfterModalNode.js → nodes/AfterModelNode.js} +3 -5
  149. package/dist/agents/nodes/AfterModelNode.js.map +1 -0
  150. package/dist/agents/nodes/AgentNode.cjs +202 -71
  151. package/dist/agents/nodes/AgentNode.cjs.map +1 -1
  152. package/dist/agents/nodes/AgentNode.js +204 -73
  153. package/dist/agents/nodes/AgentNode.js.map +1 -1
  154. package/dist/agents/nodes/BeforeAgentNode.cjs +27 -0
  155. package/dist/agents/nodes/BeforeAgentNode.cjs.map +1 -0
  156. package/dist/agents/nodes/BeforeAgentNode.js +27 -0
  157. package/dist/agents/nodes/BeforeAgentNode.js.map +1 -0
  158. package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.cjs → nodes/BeforeModelNode.cjs} +3 -3
  159. package/dist/agents/nodes/BeforeModelNode.cjs.map +1 -0
  160. package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.js → nodes/BeforeModelNode.js} +3 -3
  161. package/dist/agents/nodes/BeforeModelNode.js.map +1 -0
  162. package/dist/agents/nodes/ToolNode.cjs +157 -47
  163. package/dist/agents/nodes/ToolNode.cjs.map +1 -1
  164. package/dist/agents/nodes/ToolNode.js +158 -48
  165. package/dist/agents/nodes/ToolNode.js.map +1 -1
  166. package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.cjs +35 -10
  167. package/dist/agents/nodes/middleware.cjs.map +1 -0
  168. package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.js +34 -9
  169. package/dist/agents/nodes/middleware.js.map +1 -0
  170. package/dist/agents/nodes/types.d.cts +57 -0
  171. package/dist/agents/nodes/types.d.cts.map +1 -0
  172. package/dist/agents/nodes/types.d.ts +57 -0
  173. package/dist/agents/nodes/types.d.ts.map +1 -0
  174. package/dist/agents/nodes/utils.cjs +64 -0
  175. package/dist/agents/nodes/utils.cjs.map +1 -1
  176. package/dist/agents/nodes/utils.js +62 -1
  177. package/dist/agents/nodes/utils.js.map +1 -1
  178. package/dist/agents/responses.cjs +1 -1
  179. package/dist/agents/responses.cjs.map +1 -1
  180. package/dist/agents/responses.d.cts +9 -2
  181. package/dist/agents/responses.d.cts.map +1 -1
  182. package/dist/agents/responses.d.ts +8 -1
  183. package/dist/agents/responses.d.ts.map +1 -1
  184. package/dist/agents/responses.js +1 -1
  185. package/dist/agents/responses.js.map +1 -1
  186. package/dist/agents/runtime.d.cts +123 -0
  187. package/dist/agents/runtime.d.cts.map +1 -0
  188. package/dist/agents/runtime.d.ts +123 -0
  189. package/dist/agents/runtime.d.ts.map +1 -0
  190. package/dist/agents/tests/utils.cjs +13 -5
  191. package/dist/agents/tests/utils.cjs.map +1 -1
  192. package/dist/agents/tests/utils.d.cts +17 -8
  193. package/dist/agents/tests/utils.d.cts.map +1 -1
  194. package/dist/agents/tests/utils.d.ts +14 -5
  195. package/dist/agents/tests/utils.d.ts.map +1 -1
  196. package/dist/agents/tests/utils.js +13 -5
  197. package/dist/agents/tests/utils.js.map +1 -1
  198. package/dist/agents/tools.d.cts +9 -0
  199. package/dist/agents/tools.d.cts.map +1 -0
  200. package/dist/agents/tools.d.ts +9 -0
  201. package/dist/agents/tools.d.ts.map +1 -0
  202. package/dist/agents/types.d.cts +125 -126
  203. package/dist/agents/types.d.cts.map +1 -1
  204. package/dist/agents/types.d.ts +125 -126
  205. package/dist/agents/types.d.ts.map +1 -1
  206. package/dist/agents/utils.cjs +141 -38
  207. package/dist/agents/utils.cjs.map +1 -1
  208. package/dist/agents/utils.js +142 -40
  209. package/dist/agents/utils.js.map +1 -1
  210. package/dist/chat_models/universal.cjs +4 -0
  211. package/dist/chat_models/universal.cjs.map +1 -1
  212. package/dist/chat_models/universal.d.cts +6 -2
  213. package/dist/chat_models/universal.d.cts.map +1 -1
  214. package/dist/chat_models/universal.d.ts +4 -0
  215. package/dist/chat_models/universal.d.ts.map +1 -1
  216. package/dist/chat_models/universal.js +4 -0
  217. package/dist/chat_models/universal.js.map +1 -1
  218. package/dist/hub/base.cjs +4 -3
  219. package/dist/hub/base.cjs.map +1 -1
  220. package/dist/hub/base.d.cts +0 -4
  221. package/dist/hub/base.d.cts.map +1 -1
  222. package/dist/hub/base.d.ts +0 -4
  223. package/dist/hub/base.d.ts.map +1 -1
  224. package/dist/hub/base.js +4 -3
  225. package/dist/hub/base.js.map +1 -1
  226. package/dist/index.cjs +18 -38
  227. package/dist/index.cjs.map +1 -1
  228. package/dist/index.d.cts +21 -21
  229. package/dist/index.d.ts +21 -21
  230. package/dist/index.js +17 -26
  231. package/dist/index.js.map +1 -1
  232. package/dist/load/import_map.cjs +0 -2
  233. package/dist/load/import_map.cjs.map +1 -1
  234. package/dist/load/import_map.js +0 -2
  235. package/dist/load/import_map.js.map +1 -1
  236. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/client.cjs +74 -18
  237. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +1 -0
  238. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/client.js +75 -19
  239. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +1 -0
  240. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.cjs +1 -1
  241. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.cjs.map +1 -1
  242. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.js +1 -1
  243. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.js.map +1 -1
  244. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.cjs +1 -1
  245. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.cjs.map +1 -1
  246. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.js +1 -1
  247. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.js.map +1 -1
  248. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.cjs +1 -1
  249. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.cjs.map +1 -1
  250. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.js +1 -1
  251. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.js.map +1 -1
  252. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.cjs +2 -2
  253. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.cjs.map +1 -1
  254. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.js +2 -2
  255. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.js.map +1 -1
  256. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/run_trees.cjs +7 -5
  257. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +1 -0
  258. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/run_trees.js +7 -5
  259. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +1 -0
  260. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.cjs +1 -1
  261. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.cjs.map +1 -1
  262. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.js +1 -1
  263. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.js.map +1 -1
  264. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.cjs +1 -1
  265. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.cjs.map +1 -1
  266. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.js +1 -1
  267. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.js.map +1 -1
  268. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.cjs +1 -1
  269. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.cjs.map +1 -1
  270. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.js +1 -1
  271. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.js.map +1 -1
  272. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.cjs +1 -1
  273. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.cjs.map +1 -1
  274. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.js +1 -1
  275. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.js.map +1 -1
  276. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.cjs +1 -1
  277. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.cjs.map +1 -1
  278. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.js +1 -1
  279. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.js.map +1 -1
  280. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/env.cjs +19 -23
  281. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +1 -0
  282. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/env.js +19 -23
  283. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +1 -0
  284. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/error.cjs +16 -3
  285. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +1 -0
  286. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/error.js +16 -3
  287. package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +1 -0
  288. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs +1 -1
  289. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs.map +1 -1
  290. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js +1 -1
  291. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js.map +1 -1
  292. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.cjs +1 -1
  293. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.cjs.map +1 -1
  294. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.js +1 -1
  295. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.js.map +1 -1
  296. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.cjs +1 -1
  297. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.cjs.map +1 -1
  298. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.js +1 -1
  299. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.js.map +1 -1
  300. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.cjs +1 -1
  301. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.cjs.map +1 -1
  302. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.js +1 -1
  303. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.js.map +1 -1
  304. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.cjs +1 -1
  305. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.cjs.map +1 -1
  306. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.js +1 -1
  307. package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.js.map +1 -1
  308. package/package.json +4 -18
  309. package/dist/agents/RunnableCallable.d.cts +0 -41
  310. package/dist/agents/RunnableCallable.d.cts.map +0 -1
  311. package/dist/agents/RunnableCallable.d.ts +0 -41
  312. package/dist/agents/RunnableCallable.d.ts.map +0 -1
  313. package/dist/agents/annotation.d.cts +0 -52
  314. package/dist/agents/annotation.d.cts.map +0 -1
  315. package/dist/agents/annotation.d.ts +0 -52
  316. package/dist/agents/annotation.d.ts.map +0 -1
  317. package/dist/agents/createAgent.cjs +0 -10
  318. package/dist/agents/createAgent.cjs.map +0 -1
  319. package/dist/agents/createAgent.js +0 -10
  320. package/dist/agents/createAgent.js.map +0 -1
  321. package/dist/agents/interrupt.cjs +0 -2
  322. package/dist/agents/interrupt.d.cts +0 -81
  323. package/dist/agents/interrupt.d.cts.map +0 -1
  324. package/dist/agents/interrupt.d.ts +0 -81
  325. package/dist/agents/interrupt.d.ts.map +0 -1
  326. package/dist/agents/interrupt.js +0 -3
  327. package/dist/agents/middlewareAgent/ReactAgent.cjs +0 -579
  328. package/dist/agents/middlewareAgent/ReactAgent.cjs.map +0 -1
  329. package/dist/agents/middlewareAgent/ReactAgent.d.cts +0 -234
  330. package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +0 -1
  331. package/dist/agents/middlewareAgent/ReactAgent.d.ts +0 -234
  332. package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +0 -1
  333. package/dist/agents/middlewareAgent/ReactAgent.js +0 -578
  334. package/dist/agents/middlewareAgent/ReactAgent.js.map +0 -1
  335. package/dist/agents/middlewareAgent/annotation.cjs +0 -45
  336. package/dist/agents/middlewareAgent/annotation.cjs.map +0 -1
  337. package/dist/agents/middlewareAgent/annotation.js +0 -44
  338. package/dist/agents/middlewareAgent/annotation.js.map +0 -1
  339. package/dist/agents/middlewareAgent/constants.d.cts +0 -5
  340. package/dist/agents/middlewareAgent/constants.d.cts.map +0 -1
  341. package/dist/agents/middlewareAgent/constants.d.ts +0 -5
  342. package/dist/agents/middlewareAgent/constants.d.ts.map +0 -1
  343. package/dist/agents/middlewareAgent/index.cjs +0 -11
  344. package/dist/agents/middlewareAgent/index.cjs.map +0 -1
  345. package/dist/agents/middlewareAgent/index.js +0 -11
  346. package/dist/agents/middlewareAgent/index.js.map +0 -1
  347. package/dist/agents/middlewareAgent/middleware/callLimit.cjs.map +0 -1
  348. package/dist/agents/middlewareAgent/middleware/callLimit.d.cts.map +0 -1
  349. package/dist/agents/middlewareAgent/middleware/callLimit.d.ts.map +0 -1
  350. package/dist/agents/middlewareAgent/middleware/callLimit.js.map +0 -1
  351. package/dist/agents/middlewareAgent/middleware/contextEditing.cjs.map +0 -1
  352. package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts.map +0 -1
  353. package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts.map +0 -1
  354. package/dist/agents/middlewareAgent/middleware/contextEditing.js.map +0 -1
  355. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs.map +0 -1
  356. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts.map +0 -1
  357. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts.map +0 -1
  358. package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js.map +0 -1
  359. package/dist/agents/middlewareAgent/middleware/hitl.cjs +0 -341
  360. package/dist/agents/middlewareAgent/middleware/hitl.cjs.map +0 -1
  361. package/dist/agents/middlewareAgent/middleware/hitl.d.cts +0 -524
  362. package/dist/agents/middlewareAgent/middleware/hitl.d.cts.map +0 -1
  363. package/dist/agents/middlewareAgent/middleware/hitl.d.ts +0 -524
  364. package/dist/agents/middlewareAgent/middleware/hitl.d.ts.map +0 -1
  365. package/dist/agents/middlewareAgent/middleware/hitl.js +0 -340
  366. package/dist/agents/middlewareAgent/middleware/hitl.js.map +0 -1
  367. package/dist/agents/middlewareAgent/middleware/index.cjs +0 -52
  368. package/dist/agents/middlewareAgent/middleware/index.cjs.map +0 -1
  369. package/dist/agents/middlewareAgent/middleware/index.d.cts +0 -13
  370. package/dist/agents/middlewareAgent/middleware/index.d.ts +0 -13
  371. package/dist/agents/middlewareAgent/middleware/index.js +0 -34
  372. package/dist/agents/middlewareAgent/middleware/index.js.map +0 -1
  373. package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs.map +0 -1
  374. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts.map +0 -1
  375. package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts.map +0 -1
  376. package/dist/agents/middlewareAgent/middleware/llmToolSelector.js.map +0 -1
  377. package/dist/agents/middlewareAgent/middleware/modelFallback.cjs.map +0 -1
  378. package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts.map +0 -1
  379. package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts.map +0 -1
  380. package/dist/agents/middlewareAgent/middleware/modelFallback.js.map +0 -1
  381. package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs.map +0 -1
  382. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts.map +0 -1
  383. package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts.map +0 -1
  384. package/dist/agents/middlewareAgent/middleware/piiRedaction.js.map +0 -1
  385. package/dist/agents/middlewareAgent/middleware/promptCaching.cjs.map +0 -1
  386. package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts.map +0 -1
  387. package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts.map +0 -1
  388. package/dist/agents/middlewareAgent/middleware/promptCaching.js.map +0 -1
  389. package/dist/agents/middlewareAgent/middleware/summarization.cjs.map +0 -1
  390. package/dist/agents/middlewareAgent/middleware/summarization.d.cts.map +0 -1
  391. package/dist/agents/middlewareAgent/middleware/summarization.d.ts.map +0 -1
  392. package/dist/agents/middlewareAgent/middleware/summarization.js.map +0 -1
  393. package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs.map +0 -1
  394. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts.map +0 -1
  395. package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts.map +0 -1
  396. package/dist/agents/middlewareAgent/middleware/toolCallLimit.js.map +0 -1
  397. package/dist/agents/middlewareAgent/middleware/utils.cjs.map +0 -1
  398. package/dist/agents/middlewareAgent/middleware/utils.d.cts.map +0 -1
  399. package/dist/agents/middlewareAgent/middleware/utils.d.ts.map +0 -1
  400. package/dist/agents/middlewareAgent/middleware/utils.js.map +0 -1
  401. package/dist/agents/middlewareAgent/middleware.cjs.map +0 -1
  402. package/dist/agents/middlewareAgent/middleware.d.cts +0 -117
  403. package/dist/agents/middlewareAgent/middleware.d.cts.map +0 -1
  404. package/dist/agents/middlewareAgent/middleware.d.ts +0 -117
  405. package/dist/agents/middlewareAgent/middleware.d.ts.map +0 -1
  406. package/dist/agents/middlewareAgent/middleware.js.map +0 -1
  407. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +0 -1
  408. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +0 -1
  409. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +0 -468
  410. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +0 -1
  411. package/dist/agents/middlewareAgent/nodes/AgentNode.js +0 -467
  412. package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +0 -1
  413. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +0 -1
  414. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +0 -1
  415. package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +0 -1
  416. package/dist/agents/middlewareAgent/nodes/middleware.js.map +0 -1
  417. package/dist/agents/middlewareAgent/nodes/utils.cjs +0 -66
  418. package/dist/agents/middlewareAgent/nodes/utils.cjs.map +0 -1
  419. package/dist/agents/middlewareAgent/nodes/utils.js +0 -63
  420. package/dist/agents/middlewareAgent/nodes/utils.js.map +0 -1
  421. package/dist/agents/middlewareAgent/types.d.cts +0 -472
  422. package/dist/agents/middlewareAgent/types.d.cts.map +0 -1
  423. package/dist/agents/middlewareAgent/types.d.ts +0 -472
  424. package/dist/agents/middlewareAgent/types.d.ts.map +0 -1
  425. package/dist/agents/nodes/ToolNode.d.cts +0 -97
  426. package/dist/agents/nodes/ToolNode.d.cts.map +0 -1
  427. package/dist/agents/nodes/ToolNode.d.ts +0 -97
  428. package/dist/agents/nodes/ToolNode.d.ts.map +0 -1
  429. package/dist/agents/types.cjs +0 -7
  430. package/dist/agents/types.cjs.map +0 -1
  431. package/dist/agents/types.js +0 -6
  432. package/dist/agents/types.js.map +0 -1
  433. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +0 -1
  434. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +0 -1
  435. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +0 -1
  436. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +0 -1
  437. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +0 -1
  438. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +0 -1
  439. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +0 -1
  440. package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +0 -1
  441. /package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/index.cjs +0 -0
  442. /package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/index.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"annotation.js","names":["PreHookAnnotation: AnnotationRoot<{\n llmInputMessages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n messages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n}>","stateSchema: AnyAnnotationRoot | InteropZodObject","annotationFields: Record<string, any>","_: unknown","update: unknown","current: unknown[]","update: unknown[]","config: (typeof ZOD_TYPE_CONFIGS)[keyof typeof ZOD_TYPE_CONFIGS]","defaultValueFn: () => unknown","zodType: any","config"],"sources":["../../src/agents/annotation.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport {\n Annotation,\n Messages,\n AnnotationRoot,\n messagesStateReducer,\n type BinaryOperatorAggregate,\n type LastValue,\n} from \"@langchain/langgraph\";\nimport type { InteropZodToStateDefinition } from \"@langchain/langgraph/zod\";\nimport {\n isInteropZodSchema,\n getInteropZodObjectShape,\n getInteropZodDefaultGetter,\n type InteropZodObject,\n} from \"@langchain/core/utils/types\";\n\n/**\n * Special type to indicate that no response format is provided.\n * When this type is used, the structuredResponse property should not be present in the result.\n */\nexport type ResponseFormatUndefined = {\n __responseFormatUndefined: true;\n};\n\nexport const PreHookAnnotation: AnnotationRoot<{\n llmInputMessages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n messages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n}> = Annotation.Root({\n llmInputMessages: Annotation<BaseMessage[], Messages>({\n reducer: (_, update) => messagesStateReducer([], update),\n default: () => [],\n }),\n messages: Annotation<BaseMessage[], Messages>({\n reducer: messagesStateReducer,\n default: () => [],\n }),\n});\nexport type PreHookAnnotation = typeof PreHookAnnotation;\n\n// Base annotation without structuredResponse (for ResponseFormatUndefined)\nexport const createAgentBaseAnnotation = () =>\n Annotation.Root({\n messages: Annotation<BaseMessage[], Messages>({\n reducer: messagesStateReducer,\n default: () => [],\n }),\n });\n\n// Full annotation with structuredResponse (for regular cases)\nexport const createAgentAnnotation = <\n T extends Record<string, any> = Record<string, any>\n>(): AnnotationRoot<{\n structuredResponse: LastValue<T>;\n messages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n}> =>\n Annotation.Root({\n messages: Annotation<BaseMessage[], Messages>({\n reducer: messagesStateReducer,\n default: () => [],\n }),\n structuredResponse: Annotation<T>(),\n });\n\n// Create annotation conditionally - for ResponseFormatUndefined, don't include structuredResponse\nexport function createAgentAnnotationConditional<\n T extends Record<string, any> | ResponseFormatUndefined\n>(\n hasStructuredResponse = true\n): AnnotationRoot<{\n structuredResponse: LastValue<T extends ResponseFormatUndefined ? never : T>;\n messages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n}> {\n const baseAnnotation = {\n messages: Annotation<BaseMessage[], Messages>({\n reducer: messagesStateReducer,\n default: () => [],\n }),\n };\n\n if (!hasStructuredResponse) {\n return Annotation.Root(baseAnnotation) as AnnotationRoot<{\n structuredResponse: LastValue<\n T extends ResponseFormatUndefined ? never : T\n >;\n messages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n }>;\n }\n\n return Annotation.Root({\n ...baseAnnotation,\n structuredResponse:\n Annotation<T extends ResponseFormatUndefined ? never : T>(),\n });\n}\n\n// Helper type to select the right annotation based on the response format type\nexport type ReactAgentAnnotation<\n T extends Record<string, any> | ResponseFormatUndefined\n> = T extends ResponseFormatUndefined\n ? ReturnType<typeof createAgentBaseAnnotation>\n : T extends Record<string, any>\n ? ReturnType<typeof createAgentAnnotation<T>>\n : never;\n\nexport type ToAnnotationRoot<A extends AnyAnnotationRoot | InteropZodObject> =\n A extends AnyAnnotationRoot\n ? A\n : A extends InteropZodObject\n ? AnnotationRoot<InteropZodToStateDefinition<A>>\n : never;\n\nexport type AnyAnnotationRoot = AnnotationRoot<any>;\n\n/**\n * Enhances a state schema to ensure proper message handling.\n * If a Zod schema is provided, it creates an annotation that includes the messagesStateReducer\n * and infers appropriate reducers for all other fields.\n *\n * @param stateSchema - The state schema to enhance.\n * @returns The enhanced state schema.\n */\nexport function enhanceStateSchemaWithMessageReducer(\n stateSchema: AnyAnnotationRoot | InteropZodObject\n) {\n /**\n * If it's already an annotation, return as-is\n */\n if (typeof stateSchema === \"object\" && \"State\" in stateSchema) {\n return stateSchema;\n }\n\n /**\n * If it's a Zod schema, create annotations for all fields\n */\n if (isInteropZodSchema(stateSchema)) {\n const shape = getInteropZodObjectShape(stateSchema);\n const annotationFields: Record<string, any> = {};\n\n /**\n * Process each field in the Zod schema\n */\n for (const [key, zodType] of Object.entries(shape)) {\n annotationFields[key] =\n key === \"messages\"\n ? /**\n * Special handling for messages field - always use messagesStateReducer\n */\n Annotation<BaseMessage[]>({\n reducer: messagesStateReducer,\n default: () => [],\n })\n : /**\n * For other fields, create appropriate annotations based on type\n */\n createAnnotationForZodType(zodType);\n }\n\n /**\n * Ensure messages field exists even if not in the Zod schema\n */\n if (!annotationFields.messages) {\n annotationFields.messages = Annotation<BaseMessage[]>({\n reducer: messagesStateReducer,\n default: () => [],\n });\n }\n\n return Annotation.Root(annotationFields);\n }\n\n /**\n * Fallback: create a base annotation with message reducer only\n */\n return Annotation.Root({\n messages: Annotation<BaseMessage[]>({\n reducer: messagesStateReducer,\n default: () => [],\n }),\n });\n}\n\n/**\n * Type configuration for different Zod types\n */\nconst ZOD_TYPE_CONFIGS = {\n ZodString: {\n reducer: (_: unknown, update: unknown) => update,\n fallbackDefault: \"\",\n },\n ZodNumber: {\n reducer: (_: unknown, update: unknown) => update,\n fallbackDefault: 0,\n },\n ZodBoolean: {\n reducer: (_: unknown, update: unknown) => update,\n fallbackDefault: false,\n },\n ZodArray: {\n reducer: (_: unknown, update: unknown) => update,\n fallbackDefault: [] as unknown[],\n },\n ZodRecord: {\n reducer: (current: unknown[], update: unknown[]) => ({\n ...current,\n ...update,\n }),\n fallbackDefault: {} as Record<string, unknown>,\n },\n ZodObject: {\n reducer: (current: unknown[], update: unknown[]) => ({\n ...current,\n ...update,\n }),\n fallbackDefault: {} as Record<string, unknown>,\n },\n} as const;\n\n/**\n * Creates an annotation based on type configuration and default value\n */\nfunction createAnnotationFromConfig(\n config: (typeof ZOD_TYPE_CONFIGS)[keyof typeof ZOD_TYPE_CONFIGS],\n defaultValueFn: () => unknown\n) {\n return Annotation<any>({\n reducer: config.reducer,\n default: defaultValueFn,\n });\n}\n\n/**\n * Creates an appropriate annotation for a given Zod type.\n */\nfunction createAnnotationForZodType(zodType: any): any {\n const typeName = zodType._def?.typeName;\n const defaultGetter = getInteropZodDefaultGetter(zodType);\n const isOptional = typeName === \"ZodOptional\";\n\n /**\n * Handle Zod wrapper first\n */\n if (\n typeName === \"ZodDefault\" ||\n typeName === \"ZodOptional\" ||\n typeName === \"ZodNullable\"\n ) {\n const innerTypeName = zodType._def.innerType._def?.typeName;\n const config =\n ZOD_TYPE_CONFIGS[innerTypeName as keyof typeof ZOD_TYPE_CONFIGS];\n return config\n ? createAnnotationFromConfig(\n config,\n () =>\n defaultGetter?.() ||\n (isOptional ? undefined : config?.fallbackDefault)\n )\n : Annotation<unknown>({\n reducer: (_: unknown, update: unknown) => update,\n default: () => defaultGetter?.(),\n });\n }\n\n /**\n * Handle regular types\n */\n const config = ZOD_TYPE_CONFIGS[typeName as keyof typeof ZOD_TYPE_CONFIGS];\n if (config) {\n return createAnnotationFromConfig(\n config,\n () => defaultGetter?.() || config?.fallbackDefault\n );\n }\n\n /**\n * Fallback for unknown types\n */\n return Annotation<unknown>({\n reducer: (_: unknown, update: unknown) => update,\n default: () => defaultGetter?.(),\n });\n}\n"],"mappings":";;;;AA0BA,MAAaA,oBAGR,WAAW,KAAK;CACnB,kBAAkB,WAAoC;EACpD,SAAS,CAAC,GAAG,WAAW,qBAAqB,CAAE,GAAE,OAAO;EACxD,SAAS,MAAM,CAAE;CAClB,EAAC;CACF,UAAU,WAAoC;EAC5C,SAAS;EACT,SAAS,MAAM,CAAE;CAClB,EAAC;AACH,EAAC;AAIF,MAAa,4BAA4B,MACvC,WAAW,KAAK,EACd,UAAU,WAAoC;CAC5C,SAAS;CACT,SAAS,MAAM,CAAE;AAClB,EAAC,CACH,EAAC;AAGJ,MAAa,wBAAwB,MAMnC,WAAW,KAAK;CACd,UAAU,WAAoC;EAC5C,SAAS;EACT,SAAS,MAAM,CAAE;CAClB,EAAC;CACF,oBAAoB,YAAe;AACpC,EAAC;AAGJ,SAAgB,iCAGd,wBAAwB,MAIvB;CACD,MAAM,iBAAiB,EACrB,UAAU,WAAoC;EAC5C,SAAS;EACT,SAAS,MAAM,CAAE;CAClB,EAAC,CACH;AAED,KAAI,CAAC,sBACH,QAAO,WAAW,KAAK,eAAe;AAQxC,QAAO,WAAW,KAAK;EACrB,GAAG;EACH,oBACE,YAA2D;CAC9D,EAAC;AACH;;;;;;;;;AA4BD,SAAgB,qCACdC,aACA;;;;AAIA,KAAI,OAAO,gBAAgB,YAAY,WAAW,YAChD,QAAO;;;;AAMT,KAAI,mBAAmB,YAAY,EAAE;EACnC,MAAM,QAAQ,yBAAyB,YAAY;EACnD,MAAMC,mBAAwC,CAAE;;;;AAKhD,OAAK,MAAM,CAAC,KAAK,QAAQ,IAAI,OAAO,QAAQ,MAAM,EAChD,iBAAiB,OACf,QAAQ,aAIJ,WAA0B;GACxB,SAAS;GACT,SAAS,MAAM,CAAE;EAClB,EAAC,GAIF,2BAA2B,QAAQ;;;;AAM3C,MAAI,CAAC,iBAAiB,UACpB,iBAAiB,WAAW,WAA0B;GACpD,SAAS;GACT,SAAS,MAAM,CAAE;EAClB,EAAC;AAGJ,SAAO,WAAW,KAAK,iBAAiB;CACzC;;;;AAKD,QAAO,WAAW,KAAK,EACrB,UAAU,WAA0B;EAClC,SAAS;EACT,SAAS,MAAM,CAAE;CAClB,EAAC,CACH,EAAC;AACH;;;;AAKD,MAAM,mBAAmB;CACvB,WAAW;EACT,SAAS,CAACC,GAAYC,WAAoB;EAC1C,iBAAiB;CAClB;CACD,WAAW;EACT,SAAS,CAACD,GAAYC,WAAoB;EAC1C,iBAAiB;CAClB;CACD,YAAY;EACV,SAAS,CAACD,GAAYC,WAAoB;EAC1C,iBAAiB;CAClB;CACD,UAAU;EACR,SAAS,CAACD,GAAYC,WAAoB;EAC1C,iBAAiB,CAAE;CACpB;CACD,WAAW;EACT,SAAS,CAACC,SAAoBC,YAAuB;GACnD,GAAG;GACH,GAAG;EACJ;EACD,iBAAiB,CAAE;CACpB;CACD,WAAW;EACT,SAAS,CAACD,SAAoBC,YAAuB;GACnD,GAAG;GACH,GAAG;EACJ;EACD,iBAAiB,CAAE;CACpB;AACF;;;;AAKD,SAAS,2BACPC,QACAC,gBACA;AACA,QAAO,WAAgB;EACrB,SAAS,OAAO;EAChB,SAAS;CACV,EAAC;AACH;;;;AAKD,SAAS,2BAA2BC,SAAmB;CACrD,MAAM,WAAW,QAAQ,MAAM;CAC/B,MAAM,gBAAgB,2BAA2B,QAAQ;CACzD,MAAM,aAAa,aAAa;;;;AAKhC,KACE,aAAa,gBACb,aAAa,iBACb,aAAa,eACb;EACA,MAAM,gBAAgB,QAAQ,KAAK,UAAU,MAAM;EACnD,MAAMC,WACJ,iBAAiB;AACnB,SAAOA,WACH,2BACEA,UACA,MACE,iBAAiB,KAChB,aAAa,SAAYA,UAAQ,iBACrC,GACD,WAAoB;GAClB,SAAS,CAACP,GAAYC,WAAoB;GAC1C,SAAS,MAAM,iBAAiB;EACjC,EAAC;CACP;;;;CAKD,MAAM,SAAS,iBAAiB;AAChC,KAAI,OACF,QAAO,2BACL,QACA,MAAM,iBAAiB,IAAI,QAAQ,gBACpC;;;;AAMH,QAAO,WAAoB;EACzB,SAAS,CAACD,GAAYC,WAAoB;EAC1C,SAAS,MAAM,iBAAiB;CACjC,EAAC;AACH"}
1
+ {"version":3,"file":"annotation.js","names":["middlewareList: TMiddleware","zodSchema: Record<string, any>","PreHookAnnotation: AnnotationRoot<{\n llmInputMessages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n messages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n}>","_x: Messages","update: Messages"],"sources":["../../src/agents/annotation.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { z } from \"zod/v3\";\nimport {\n Messages,\n AnnotationRoot,\n MessagesZodMeta,\n type BinaryOperatorAggregate,\n} from \"@langchain/langgraph\";\nimport { withLangGraph } from \"@langchain/langgraph/zod\";\n\nimport type { AgentMiddleware } from \"./middleware/types.js\";\n\nexport function createAgentAnnotationConditional<\n TMiddleware extends readonly AgentMiddleware<any, any, any>[] = []\n>(\n hasStructuredResponse = true,\n middlewareList: TMiddleware = [] as unknown as TMiddleware\n) {\n /**\n * Create Zod schema object to preserve jsonSchemaExtra\n * metadata for LangGraph Studio using v3-compatible withLangGraph\n */\n const zodSchema: Record<string, any> = {\n messages: withLangGraph(z.custom<BaseMessage[]>(), MessagesZodMeta),\n jumpTo: z\n .union([z.literal(\"model_request\"), z.literal(\"tools\"), z.undefined()])\n .optional(),\n };\n\n /**\n * Add middleware state properties to the Zod schema\n */\n for (const middleware of middlewareList) {\n if (middleware.stateSchema) {\n const { shape } = middleware.stateSchema;\n for (const [key, schema] of Object.entries(shape)) {\n /**\n * Skip private state properties\n */\n if (key.startsWith(\"_\")) {\n continue;\n }\n\n if (!(key in zodSchema)) {\n zodSchema[key] = schema;\n }\n }\n }\n }\n\n // Only include structuredResponse when responseFormat is defined\n if (hasStructuredResponse) {\n zodSchema.structuredResponse = z.any().optional();\n }\n\n return z.object(zodSchema);\n}\n\nexport const PreHookAnnotation: AnnotationRoot<{\n llmInputMessages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n messages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n}> = z.object({\n llmInputMessages: withLangGraph(z.custom<BaseMessage[]>(), {\n reducer: {\n fn: (_x: Messages, update: Messages) =>\n MessagesZodMeta.reducer!.fn([], update),\n },\n default: () => [],\n }),\n /**\n * Use MessagesZodMeta to preserve jsonSchemaExtra metadata\n * for LangGraph Studio UI to render proper messages input field\n */\n messages: withLangGraph(z.custom<BaseMessage[]>(), MessagesZodMeta),\n}) as unknown as AnnotationRoot<{\n llmInputMessages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n messages: BinaryOperatorAggregate<BaseMessage[], Messages>;\n}>;\nexport type PreHookAnnotation = typeof PreHookAnnotation;\n"],"mappings":";;;;;AAaA,SAAgB,iCAGd,wBAAwB,MACxBA,iBAA8B,CAAE,GAChC;;;;;CAKA,MAAMC,YAAiC;EACrC,UAAU,cAAc,EAAE,QAAuB,EAAE,gBAAgB;EACnE,QAAQ,EACL,MAAM;GAAC,EAAE,QAAQ,gBAAgB;GAAE,EAAE,QAAQ,QAAQ;GAAE,EAAE,WAAW;EAAC,EAAC,CACtE,UAAU;CACd;;;;AAKD,MAAK,MAAM,cAAc,eACvB,KAAI,WAAW,aAAa;EAC1B,MAAM,EAAE,OAAO,GAAG,WAAW;AAC7B,OAAK,MAAM,CAAC,KAAK,OAAO,IAAI,OAAO,QAAQ,MAAM,EAAE;;;;AAIjD,OAAI,IAAI,WAAW,IAAI,CACrB;AAGF,OAAI,EAAE,OAAO,YACX,UAAU,OAAO;EAEpB;CACF;AAIH,KAAI,uBACF,UAAU,qBAAqB,EAAE,KAAK,CAAC,UAAU;AAGnD,QAAO,EAAE,OAAO,UAAU;AAC3B;AAED,MAAaC,oBAGR,EAAE,OAAO;CACZ,kBAAkB,cAAc,EAAE,QAAuB,EAAE;EACzD,SAAS,EACP,IAAI,CAACC,IAAcC,WACjB,gBAAgB,QAAS,GAAG,CAAE,GAAE,OAAO,CAC1C;EACD,SAAS,MAAM,CAAE;CAClB,EAAC;CAKF,UAAU,cAAc,EAAE,QAAuB,EAAE,gBAAgB;AACpE,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","names":[],"sources":["../../src/agents/constants.ts"],"sourcesContent":["export const PROMPT_RUNNABLE_NAME = \"prompt\";\n"],"mappings":";;AAAA,MAAa,uBAAuB"}
1
+ {"version":3,"file":"constants.cjs","names":[],"sources":["../../src/agents/constants.ts"],"sourcesContent":["/**\n * jump targets (user facing)\n */\nexport const JUMP_TO_TARGETS = [\"model\", \"tools\", \"end\"] as const;\nexport type JumpToTarget = (typeof JUMP_TO_TARGETS)[number];\n\nexport const PROMPT_RUNNABLE_NAME = \"prompt\";\n"],"mappings":";;AAMA,MAAa,uBAAuB"}
@@ -0,0 +1,9 @@
1
+ //#region src/agents/constants.d.ts
2
+ /**
3
+ * jump targets (user facing)
4
+ */
5
+ declare const JUMP_TO_TARGETS: readonly ["model", "tools", "end"];
6
+ type JumpToTarget = (typeof JUMP_TO_TARGETS)[number];
7
+ //#endregion
8
+ export { JumpToTarget };
9
+ //# sourceMappingURL=constants.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.cts","names":["JUMP_TO_TARGETS","JumpToTarget","PROMPT_RUNNABLE_NAME"],"sources":["../../src/agents/constants.d.ts"],"sourcesContent":["/**\n * jump targets (user facing)\n */\nexport declare const JUMP_TO_TARGETS: readonly [\"model\", \"tools\", \"end\"];\nexport type JumpToTarget = (typeof JUMP_TO_TARGETS)[number];\nexport declare const PROMPT_RUNNABLE_NAME = \"prompt\";\n"],"mappings":";;AAGA;AACA;cADqBA;KACTC,YAAAA,WAAuBD"}
@@ -0,0 +1,9 @@
1
+ //#region src/agents/constants.d.ts
2
+ /**
3
+ * jump targets (user facing)
4
+ */
5
+ declare const JUMP_TO_TARGETS: readonly ["model", "tools", "end"];
6
+ type JumpToTarget = (typeof JUMP_TO_TARGETS)[number];
7
+ //#endregion
8
+ export { JumpToTarget };
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","names":["JUMP_TO_TARGETS","JumpToTarget","PROMPT_RUNNABLE_NAME"],"sources":["../../src/agents/constants.d.ts"],"sourcesContent":["/**\n * jump targets (user facing)\n */\nexport declare const JUMP_TO_TARGETS: readonly [\"model\", \"tools\", \"end\"];\nexport type JumpToTarget = (typeof JUMP_TO_TARGETS)[number];\nexport declare const PROMPT_RUNNABLE_NAME = \"prompt\";\n"],"mappings":";;AAGA;AACA;cADqBA;KACTC,YAAAA,WAAuBD"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../src/agents/constants.ts"],"sourcesContent":["export const PROMPT_RUNNABLE_NAME = \"prompt\";\n"],"mappings":";AAAA,MAAa,uBAAuB"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../src/agents/constants.ts"],"sourcesContent":["/**\n * jump targets (user facing)\n */\nexport const JUMP_TO_TARGETS = [\"model\", \"tools\", \"end\"] as const;\nexport type JumpToTarget = (typeof JUMP_TO_TARGETS)[number];\n\nexport const PROMPT_RUNNABLE_NAME = \"prompt\";\n"],"mappings":";AAMA,MAAa,uBAAuB"}
@@ -35,7 +35,8 @@ var ToolInvocationError = class extends Error {
35
35
  toolError;
36
36
  constructor(toolError, toolCall) {
37
37
  const error = toolError instanceof Error ? toolError : new Error(String(toolError));
38
- super(`Error invoking tool '${toolCall.name}' with kwargs ${JSON.stringify(toolCall.args)} with error:\n ${error.stack}\n Please fix the error and try again.`);
38
+ const toolArgs = JSON.stringify(toolCall.args);
39
+ super(`Error invoking tool '${toolCall.name}' with kwargs ${toolArgs} with error: ${error.stack}\n Please fix the error and try again.`);
39
40
  this.toolCall = toolCall;
40
41
  this.toolError = error;
41
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.cjs","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n constructor() {\n super(\n \"The provided LLM already has bound tools. \" +\n \"Please provide an LLM without bound tools to createAgent. \" +\n \"The agent will bind the tools provided in the 'tools' parameter.\"\n );\n }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n public readonly toolNames: string[];\n\n constructor(toolNames: string[]) {\n super(\n `The model has called multiple tools: ${toolNames.join(\n \", \"\n )} to return a structured output. ` +\n \"This is not supported. Please provide a single structured output.\"\n );\n this.toolNames = toolNames;\n }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n public readonly toolName: string;\n\n public readonly errors: string[];\n\n constructor(toolName: string, errors: string[]) {\n super(\n `Failed to parse structured output for tool '${toolName}':${errors\n .map((e) => `\\n - ${e}`)\n .join(\"\")}.`\n );\n this.toolName = toolName;\n this.errors = errors;\n }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n public readonly toolCall: ToolCall;\n\n public readonly toolError: Error;\n\n constructor(toolError: unknown, toolCall: ToolCall) {\n const error =\n toolError instanceof Error ? toolError : new Error(String(toolError));\n super(\n `Error invoking tool '${toolCall.name}' with kwargs ${JSON.stringify(\n toolCall.args\n )} ` +\n `with error:\\n ${error.stack}\\n Please fix the error and try again.`\n );\n\n this.toolCall = toolCall;\n this.toolError = error;\n }\n}\n"],"mappings":";;AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,uKAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,KAAK,UACzD,SAAS,KACV,CAAC,eAAC,EACgB,MAAM,MAAM,sCAAsC,CAAC,CACvE;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}
1
+ {"version":3,"file":"errors.cjs","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n constructor() {\n super(\n \"The provided LLM already has bound tools. \" +\n \"Please provide an LLM without bound tools to createAgent. \" +\n \"The agent will bind the tools provided in the 'tools' parameter.\"\n );\n }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n public readonly toolNames: string[];\n\n constructor(toolNames: string[]) {\n super(\n `The model has called multiple tools: ${toolNames.join(\n \", \"\n )} to return a structured output. ` +\n \"This is not supported. Please provide a single structured output.\"\n );\n this.toolNames = toolNames;\n }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n public readonly toolName: string;\n\n public readonly errors: string[];\n\n constructor(toolName: string, errors: string[]) {\n super(\n `Failed to parse structured output for tool '${toolName}':${errors\n .map((e) => `\\n - ${e}`)\n .join(\"\")}.`\n );\n this.toolName = toolName;\n this.errors = errors;\n }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n public readonly toolCall: ToolCall;\n\n public readonly toolError: Error;\n\n constructor(toolError: unknown, toolCall: ToolCall) {\n const error =\n toolError instanceof Error ? toolError : new Error(String(toolError));\n const toolArgs = JSON.stringify(toolCall.args);\n super(\n `Error invoking tool '${toolCall.name}' with kwargs ${toolArgs} with error: ${error.stack}\\n Please fix the error and try again.`\n );\n\n this.toolCall = toolCall;\n this.toolError = error;\n }\n}\n"],"mappings":";;AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,uKAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MAAM,WAAW,KAAK,UAAU,SAAS,KAAK;EAC9C,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,SAAS,aAAa,EAAE,MAAM,MAAM,sCAAsC,CAAC,CAClI;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}
@@ -34,7 +34,8 @@ var ToolInvocationError = class extends Error {
34
34
  toolError;
35
35
  constructor(toolError, toolCall) {
36
36
  const error = toolError instanceof Error ? toolError : new Error(String(toolError));
37
- super(`Error invoking tool '${toolCall.name}' with kwargs ${JSON.stringify(toolCall.args)} with error:\n ${error.stack}\n Please fix the error and try again.`);
37
+ const toolArgs = JSON.stringify(toolCall.args);
38
+ super(`Error invoking tool '${toolCall.name}' with kwargs ${toolArgs} with error: ${error.stack}\n Please fix the error and try again.`);
38
39
  this.toolCall = toolCall;
39
40
  this.toolError = error;
40
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n constructor() {\n super(\n \"The provided LLM already has bound tools. \" +\n \"Please provide an LLM without bound tools to createAgent. \" +\n \"The agent will bind the tools provided in the 'tools' parameter.\"\n );\n }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n public readonly toolNames: string[];\n\n constructor(toolNames: string[]) {\n super(\n `The model has called multiple tools: ${toolNames.join(\n \", \"\n )} to return a structured output. ` +\n \"This is not supported. Please provide a single structured output.\"\n );\n this.toolNames = toolNames;\n }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n public readonly toolName: string;\n\n public readonly errors: string[];\n\n constructor(toolName: string, errors: string[]) {\n super(\n `Failed to parse structured output for tool '${toolName}':${errors\n .map((e) => `\\n - ${e}`)\n .join(\"\")}.`\n );\n this.toolName = toolName;\n this.errors = errors;\n }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n public readonly toolCall: ToolCall;\n\n public readonly toolError: Error;\n\n constructor(toolError: unknown, toolCall: ToolCall) {\n const error =\n toolError instanceof Error ? toolError : new Error(String(toolError));\n super(\n `Error invoking tool '${toolCall.name}' with kwargs ${JSON.stringify(\n toolCall.args\n )} ` +\n `with error:\\n ${error.stack}\\n Please fix the error and try again.`\n );\n\n this.toolCall = toolCall;\n this.toolError = error;\n }\n}\n"],"mappings":";AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,uKAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,KAAK,UACzD,SAAS,KACV,CAAC,eAAC,EACgB,MAAM,MAAM,sCAAsC,CAAC,CACvE;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}
1
+ {"version":3,"file":"errors.js","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n constructor() {\n super(\n \"The provided LLM already has bound tools. \" +\n \"Please provide an LLM without bound tools to createAgent. \" +\n \"The agent will bind the tools provided in the 'tools' parameter.\"\n );\n }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n public readonly toolNames: string[];\n\n constructor(toolNames: string[]) {\n super(\n `The model has called multiple tools: ${toolNames.join(\n \", \"\n )} to return a structured output. ` +\n \"This is not supported. Please provide a single structured output.\"\n );\n this.toolNames = toolNames;\n }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n public readonly toolName: string;\n\n public readonly errors: string[];\n\n constructor(toolName: string, errors: string[]) {\n super(\n `Failed to parse structured output for tool '${toolName}':${errors\n .map((e) => `\\n - ${e}`)\n .join(\"\")}.`\n );\n this.toolName = toolName;\n this.errors = errors;\n }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n public readonly toolCall: ToolCall;\n\n public readonly toolError: Error;\n\n constructor(toolError: unknown, toolCall: ToolCall) {\n const error =\n toolError instanceof Error ? toolError : new Error(String(toolError));\n const toolArgs = JSON.stringify(toolCall.args);\n super(\n `Error invoking tool '${toolCall.name}' with kwargs ${toolArgs} with error: ${error.stack}\\n Please fix the error and try again.`\n );\n\n this.toolCall = toolCall;\n this.toolError = error;\n }\n}\n"],"mappings":";AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,uKAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MAAM,WAAW,KAAK,UAAU,SAAS,KAAK;EAC9C,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,SAAS,aAAa,EAAE,MAAM,MAAM,sCAAsC,CAAC,CAClI;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}
@@ -1,38 +1,14 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_annotation = require('./annotation.cjs');
3
1
  const require_errors = require('./errors.cjs');
4
2
  const require_responses = require('./responses.cjs');
5
- const require_ToolNode = require('./nodes/ToolNode.cjs');
6
- const require_createAgent = require('./createAgent.cjs');
7
- const require_middleware = require('./middlewareAgent/middleware.cjs');
8
- const require_index = require('./middlewareAgent/index.cjs');
9
- const require_types = require('./types.cjs');
10
- require('./interrupt.cjs');
3
+ const require_ReactAgent = require('./ReactAgent.cjs');
4
+ const require_middleware = require('./middleware.cjs');
11
5
  const require_utils = require('./tests/utils.cjs');
12
- const __langchain_langgraph = require_rolldown_runtime.__toESM(require("@langchain/langgraph"));
13
6
 
14
7
  //#region src/agents/index.ts
15
- function createAgent$2(params) {
16
- /**
17
- * Check if middleware property is present
18
- */
19
- if ("middleware" in params && params.middleware !== void 0) {
20
- /**
21
- * The user wants to use the middleware version of the agent.
22
- * Let's verify that `preModelHook` and `postModelHook` are not provided
23
- */
24
- if ("preModelHook" in params || "postModelHook" in params) throw new Error("The `preModelHook` and `postModelHook` parameters are not supported in the middleware version of the agent.");
25
- /**
26
- * Use v2 (middleware version)
27
- */
28
- return require_index.createAgent(params);
29
- } else
30
- /**
31
- * Use v1 (original version)
32
- */
33
- return require_createAgent.createAgent(params);
8
+ function createAgent(params) {
9
+ return new require_ReactAgent.ReactAgent(params);
34
10
  }
35
11
 
36
12
  //#endregion
37
- exports.createAgent = createAgent$2;
13
+ exports.createAgent = createAgent;
38
14
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["createAgent","params: any","createAgentV2","createAgentV1"],"sources":["../../src/agents/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\nimport { MessagesAnnotation } from \"@langchain/langgraph\";\n\n// Import v1 (without middleware)\nimport { createAgent as createAgentV1 } from \"./createAgent.js\";\nimport { ReactAgent as ReactAgentV1 } from \"./ReactAgent.js\";\n\n// Import v2 (with middleware)\nimport { createAgent as createAgentV2 } from \"./middlewareAgent/index.js\";\nimport { ReactAgent as ReactAgentV2 } from \"./middlewareAgent/ReactAgent.js\";\n\nimport type {\n AnyAnnotationRoot,\n ResponseFormatUndefined,\n} from \"./annotation.js\";\nimport type { CreateAgentParams, ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n CreateAgentParams as CreateAgentParamsV2,\n AgentMiddleware,\n} from \"./middlewareAgent/types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n JsonSchemaFormat,\n} from \"./responses.js\";\n\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport * from \"./interrupt.js\";\nexport * from \"./annotation.js\";\nexport { ToolNode } from \"./nodes/ToolNode.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n} from \"./responses.js\";\nexport { createMiddleware } from \"./middlewareAgent/index.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { AgentMiddleware } from \"./middlewareAgent/types.js\";\nexport type { ReactAgent } from \"./middlewareAgent/ReactAgent.js\";\n/**\n * Agents combine language models with tools to create systems that can reason\n * about tasks, decide which tools to use, and iteratively work towards solutions.\n * {@link createAgent} provides a production-ready ReAct (Reasoning + Acting)\n * agent implementation based on the paper {@link https://arxiv.org/abs/2210.03629|ReAct: Synergizing Reasoning and Acting in Language Models.}\n *\n * @example\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod/v3\";\n *\n * const getWeather = tool((input) => {\n * if ([\"sf\", \"san francisco\"].includes(input.location.toLowerCase())) {\n * return \"It's 60 degrees and foggy.\";\n * } else {\n * return \"It's 90 degrees and sunny.\";\n * }\n * }, {\n * name: \"get_weather\",\n * description: \"Call to get the current weather.\",\n * schema: z.object({\n * location: z.string().describe(\"Location to get the weather for.\"),\n * })\n * })\n *\n * const agent = createAgent({\n * // use chat model from \"@langchain/openai\"\n * model: \"openai:gpt-4o-mini\",\n * tools: [getWeather]\n * });\n *\n * const inputs = {\n * messages: [{ role: \"user\", content: \"what is the weather in SF?\" }],\n * };\n *\n * const stream = await agent.stream(inputs, { streamMode: \"values\" });\n *\n * for await (const { messages } of stream) {\n * console.log(messages);\n * }\n * // Returns the messages in the state at each step of execution\n * ```\n */\n\n// ===== V1 OVERLOADS (WITHOUT MIDDLEWARE) =====\n// These overloads come first to ensure proper type inference when middleware is NOT provided\n\n// Overload 1: V1 - With responseFormat as single InteropZodType\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<\n StateSchema,\n T,\n ContextSchema,\n InteropZodType<T>\n > & {\n responseFormat: InteropZodType<T>;\n }\n): ReactAgentV1<StateSchema, T, ContextSchema>;\n\n// Overload 2: V1 - With responseFormat as array of InteropZodTypes\nexport function createAgent<\n T extends readonly InteropZodType<any>[],\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<\n StateSchema,\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema,\n T\n > & {\n responseFormat: T;\n }\n): ReactAgentV1<\n StateSchema,\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema\n>;\n\n// Overload 3: V1 - With responseFormat as JsonSchemaFormat\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<\n StateSchema,\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n }\n): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 4: V1 - With responseFormat as array of JsonSchemaFormat\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<\n StateSchema,\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n }\n): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 5: V1 - With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<\n StateSchema,\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n }\n): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 6: V1 - With responseFormat as TypedToolStrategy\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<\n StateSchema,\n T,\n ContextSchema,\n TypedToolStrategy<T>\n > & {\n responseFormat: TypedToolStrategy<T>;\n }\n): ReactAgentV1<StateSchema, T, ContextSchema>;\n\n// Overload 7: V1 - With responseFormat as single ToolStrategy\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<StateSchema, T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n }\n): ReactAgentV1<StateSchema, T, ContextSchema>;\n\n// Overload 8: V1 - With responseFormat as ProviderStrategy\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<\n StateSchema,\n T,\n ContextSchema,\n ProviderStrategy<T>\n > & {\n responseFormat: ProviderStrategy<T>;\n }\n): ReactAgentV1<StateSchema, T, ContextSchema>;\n\n// Overload 9: V1 - Without responseFormat property at all\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: Omit<\n CreateAgentParams<\n StateSchema,\n ResponseFormatUndefined,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n >\n): ReactAgentV1<StateSchema, ResponseFormatUndefined, ContextSchema>;\n\n// Overload 10: V1 - With responseFormat explicitly undefined\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: Omit<\n CreateAgentParams<\n StateSchema,\n ResponseFormatUndefined,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n }\n): ReactAgentV1<StateSchema, ResponseFormatUndefined, ContextSchema>;\n\n// Overload 11: V1 - For other ResponseFormat values (failsafe)\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateAgentParams<\n StateSchema,\n StructuredResponseFormat,\n ContextSchema,\n any\n > & {\n responseFormat: any;\n }\n): ReactAgentV1<StateSchema, StructuredResponseFormat, ContextSchema>;\n\n// ===== V2 OVERLOADS (WITH MIDDLEWARE) =====\n// These overloads explicitly require the middleware property\n\n// Overload 12: With responseFormat as single InteropZodType and middleware\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware: TMiddleware;\n }\n): ReactAgentV2<T, ContextSchema, TMiddleware>;\n\n// Overload 13: With responseFormat as array of InteropZodTypes and middleware\nexport function createAgent<\n T extends readonly InteropZodType<any>[],\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema,\n T\n > & {\n responseFormat: T;\n middleware: TMiddleware;\n }\n): ReactAgentV2<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema,\n TMiddleware\n>;\n\n// Overload 14: With responseFormat as JsonSchemaFormat and middleware\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n middleware: TMiddleware;\n }\n): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 15: With responseFormat as array of JsonSchemaFormat and middleware\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n middleware: TMiddleware;\n }\n): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 16: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[] and middleware\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware: TMiddleware;\n }\n): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 17: With responseFormat as TypedToolStrategy and middleware\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware: TMiddleware;\n }\n): ReactAgentV2<T, ContextSchema, TMiddleware>;\n\n// Overload 18: With responseFormat as single ToolStrategy and middleware\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware: TMiddleware;\n }\n): ReactAgentV2<T, ContextSchema, TMiddleware>;\n\n// Overload 19: With responseFormat as ProviderStrategy and middleware\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware: TMiddleware;\n }\n): ReactAgentV2<T, ContextSchema, TMiddleware>;\n\n// Overload 20: Without responseFormat but with middleware\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: Omit<\n CreateAgentParamsV2<ResponseFormatUndefined, ContextSchema, never>,\n \"responseFormat\"\n > & { middleware: TMiddleware }\n): ReactAgentV2<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n\n// Overload 21: With responseFormat explicitly undefined and middleware\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: Omit<\n CreateAgentParamsV2<ResponseFormatUndefined, ContextSchema, never>,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n middleware: TMiddleware;\n }\n): ReactAgentV2<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n\n// Overload 22: For other ResponseFormat values with middleware (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware<\n any,\n any,\n any\n >[] = readonly AgentMiddleware<any, any, any>[]\n>(\n params: CreateAgentParamsV2<StructuredResponseFormat, ContextSchema, any> & {\n responseFormat: any;\n middleware: TMiddleware;\n }\n): ReactAgentV2<StructuredResponseFormat, ContextSchema, TMiddleware>;\n\nexport function createAgent(params: any): any {\n /**\n * Check if middleware property is present\n */\n if (\"middleware\" in params && params.middleware !== undefined) {\n /**\n * The user wants to use the middleware version of the agent.\n * Let's verify that `preModelHook` and `postModelHook` are not provided\n */\n if (\"preModelHook\" in params || \"postModelHook\" in params) {\n throw new Error(\n \"The `preModelHook` and `postModelHook` parameters are not supported in the middleware version of the agent.\"\n );\n }\n\n /**\n * Use v2 (middleware version)\n */\n return createAgentV2(params);\n } else {\n /**\n * Use v1 (original version)\n */\n return createAgentV1(params);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAsgBA,SAAgBA,cAAYC,QAAkB;;;;AAI5C,KAAI,gBAAgB,UAAU,OAAO,eAAe,QAAW;;;;;AAK7D,MAAI,kBAAkB,UAAU,mBAAmB,OACjD,OAAM,IAAI,MACR;;;;AAOJ,SAAOC,0BAAc,OAAO;CAC7B;;;;AAIC,QAAOC,gCAAc,OAAO;AAE/B"}
1
+ {"version":3,"file":"index.cjs","names":["params: CreateAgentParams<StructuredResponseFormat, ContextSchema, any>","ReactAgent"],"sources":["../../src/agents/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\n\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n ResponseFormat,\n JsonSchemaFormat,\n} from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, ContextSchema, TMiddleware>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport function createAgent<\n T extends readonly InteropZodType<any>[],\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema,\n T\n > & {\n responseFormat: T;\n middleware?: TMiddleware;\n }\n): ReactAgent<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema,\n TMiddleware\n>;\n\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, ContextSchema, TMiddleware>;\n\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, ContextSchema, TMiddleware>;\n\n// Overload 7: With responseFormat as ProviderStrategy\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, ContextSchema, TMiddleware>;\n\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: Omit<\n CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>,\n \"responseFormat\"\n > & { middleware?: TMiddleware }\n): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n\n// Overload 9: With responseFormat explicitly undefined\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: Omit<\n CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n }\n): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n\n// Overload 10: For other ResponseFormat values (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n ContextSchema,\n ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n }\n): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware>;\n\n// Implementation\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject,\n TMiddleware extends readonly AgentMiddleware[] = []\n>(\n params: CreateAgentParams<StructuredResponseFormat, ContextSchema, any>\n): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware> {\n return new ReactAgent(params);\n}\n\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n type ResponseFormatUndefined,\n} from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type {\n ToolCallRequest,\n ToolCallHandler,\n ToolCallWrapper,\n} from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;AA+TA,SAAgB,YAKdA,QACkE;AAClE,QAAO,IAAIC,8BAAW;AACvB"}
@@ -1,162 +1,191 @@
1
- import { AnyAnnotationRoot, PreHookAnnotation, ReactAgentAnnotation, ResponseFormatUndefined, ToAnnotationRoot, createAgentAnnotation, createAgentAnnotationConditional, createAgentBaseAnnotation, enhanceStateSchemaWithMessageReducer } from "./annotation.cjs";
2
1
  import { MultipleStructuredOutputsError, MultipleToolsBoundError, StructuredOutputParsingError, ToolInvocationError } from "./errors.cjs";
3
- import { JsonSchemaFormat, ProviderStrategy, ResponseFormat, ToolStrategy, TypedToolStrategy, providerStrategy, toolStrategy } from "./responses.cjs";
4
- import { ToolNode } from "./nodes/ToolNode.cjs";
5
- import { AgentRuntime, AgentState, ClientTool, CreateAgentParams, ExecutedToolCall, ExtractZodArrayTypes, ExtractZodType, InferResponseFormatType, InternalAgentState, META_EXTRAS_DESCRIPTION_PREFIX, N, Prompt, ReducedZodChannel, ServerTool, WithStateGraphNodes } from "./types.cjs";
6
- import { AgentMiddleware, CreateAgentParams as CreateAgentParams$1 } from "./middlewareAgent/types.cjs";
7
- import { createMiddleware } from "./middlewareAgent/middleware.cjs";
2
+ import { JsonSchemaFormat, ProviderStrategy, ResponseFormat, ResponseFormatUndefined, ToolStrategy, TypedToolStrategy, providerStrategy, toolStrategy } from "./responses.cjs";
3
+ import { JumpToTarget } from "./constants.cjs";
4
+ import { Runtime } from "./runtime.cjs";
5
+ import { AgentMiddleware, AnyAnnotationRoot, ToolCallHandler, ToolCallRequest, ToolCallWrapper } from "./middleware/types.cjs";
6
+ import { BuiltInState, CreateAgentParams, ExecutedToolCall, ExtractZodArrayTypes, Interrupt, JumpTo, N, ToolCall, ToolResult, UserInput, WithStateGraphNodes } from "./types.cjs";
8
7
  import { ReactAgent } from "./ReactAgent.cjs";
9
- import { ReactAgent as ReactAgent$1 } from "./middlewareAgent/ReactAgent.cjs";
10
- import { HumanInterrupt, HumanInterruptConfig, HumanResponse, Interrupt, interrupt } from "./interrupt.cjs";
8
+ import { createMiddleware } from "./middleware.cjs";
11
9
  import { FakeToolCallingModel } from "./tests/utils.cjs";
12
10
  import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
13
- import { MessagesAnnotation } from "@langchain/langgraph";
14
11
 
15
12
  //#region src/agents/index.d.ts
16
13
 
17
14
  /**
18
- * Agents combine language models with tools to create systems that can reason
19
- * about tasks, decide which tools to use, and iteratively work towards solutions.
20
- * {@link createAgent} provides a production-ready ReAct (Reasoning + Acting)
21
- * agent implementation based on the paper {@link https://arxiv.org/abs/2210.03629|ReAct: Synergizing Reasoning and Acting in Language Models.}
15
+ * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools
16
+ * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively
17
+ * work towards solutions.
22
18
  *
23
- * @example
19
+ * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively
20
+ * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state
21
+ * across interactions, and provide auditable decision processes.
22
+ *
23
+ * ## Core Components
24
+ *
25
+ * ### Model
26
+ * The reasoning engine can be specified as:
27
+ * - **String identifier**: `"openai:gpt-4o"` for simple setup
28
+ * - **Model instance**: Configured model object for full control
29
+ * - **Dynamic function**: Select models at runtime based on state
30
+ *
31
+ * ### Tools
32
+ * Tools give agents the ability to take actions:
33
+ * - Pass an array of tools created with the `tool` function
34
+ * - Or provide a configured `ToolNode` for custom error handling
35
+ *
36
+ * ### Prompt
37
+ * Shape how your agent approaches tasks:
38
+ * - String for simple instructions
39
+ * - SystemMessage for structured prompts
40
+ * - Function for dynamic prompts based on state
41
+ *
42
+ * ### Middleware
43
+ * Middleware allows you to extend the agent's behavior:
44
+ * - Add pre/post-model processing for context injection or validation
45
+ * - Add dynamic control flows, e.g. terminate invocation or retries
46
+ * - Add human-in-the-loop capabilities
47
+ * - Add tool calls to the agent
48
+ * - Add tool results to the agent
49
+ *
50
+ * ## Advanced Features
51
+ *
52
+ * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses
53
+ * - **Memory**: Extend the state schema to remember information across interactions
54
+ * - **Streaming**: Get real-time updates as the agent processes
55
+ *
56
+ * @param options - Configuration options for the agent
57
+ * @param options.llm - The language model as an instance of a chat model
58
+ * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.
59
+ * @param options.tools - Array of tools or configured ToolNode
60
+ * @param options.prompt - System instructions (string, SystemMessage, or function)
61
+ * @param options.responseFormat - Zod schema for structured output
62
+ * @param options.stateSchema - Custom state schema for memory
63
+ * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.
64
+ *
65
+ * @returns A ReactAgent instance with `invoke` and `stream` methods
66
+ *
67
+ * @example Basic agent with tools
24
68
  * ```ts
25
69
  * import { createAgent, tool } from "langchain";
26
- * import { z } from "zod/v3";
70
+ * import { z } from "zod";
27
71
  *
28
- * const getWeather = tool((input) => {
29
- * if (["sf", "san francisco"].includes(input.location.toLowerCase())) {
30
- * return "It's 60 degrees and foggy.";
31
- * } else {
32
- * return "It's 90 degrees and sunny.";
72
+ * const search = tool(
73
+ * ({ query }) => `Results for: ${query}`,
74
+ * {
75
+ * name: "search",
76
+ * description: "Search for information",
77
+ * schema: z.object({
78
+ * query: z.string().describe("The search query"),
79
+ * })
33
80
  * }
34
- * }, {
35
- * name: "get_weather",
36
- * description: "Call to get the current weather.",
37
- * schema: z.object({
38
- * location: z.string().describe("Location to get the weather for."),
39
- * })
40
- * })
81
+ * );
82
+ *
83
+ * const agent = createAgent({
84
+ * llm: "openai:gpt-4o",
85
+ * tools: [search],
86
+ * });
87
+ *
88
+ * const result = await agent.invoke({
89
+ * messages: [{ role: "user", content: "Search for ReAct agents" }],
90
+ * });
91
+ * ```
92
+ *
93
+ * @example Structured output
94
+ * ```ts
95
+ * import { createAgent } from "langchain";
96
+ * import { z } from "zod";
97
+ *
98
+ * const ContactInfo = z.object({
99
+ * name: z.string(),
100
+ * email: z.string(),
101
+ * phone: z.string(),
102
+ * });
41
103
  *
42
104
  * const agent = createAgent({
43
- * // use chat model from "@langchain/openai"
44
- * model: "openai:gpt-4o-mini",
45
- * tools: [getWeather]
105
+ * llm: "openai:gpt-4o",
106
+ * tools: [],
107
+ * responseFormat: ContactInfo,
46
108
  * });
47
109
  *
48
- * const inputs = {
49
- * messages: [{ role: "user", content: "what is the weather in SF?" }],
50
- * };
110
+ * const result = await agent.invoke({
111
+ * messages: [{
112
+ * role: "user",
113
+ * content: "Extract: John Doe, john@example.com, (555) 123-4567"
114
+ * }],
115
+ * });
51
116
  *
52
- * const stream = await agent.stream(inputs, { streamMode: "values" });
117
+ * console.log(result.structuredResponse);
118
+ * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }
119
+ * ```
53
120
  *
54
- * for await (const { messages } of stream) {
55
- * console.log(messages);
121
+ * @example Streaming responses
122
+ * ```ts
123
+ * const stream = await agent.stream(
124
+ * { messages: [{ role: "user", content: "What's the weather?" }] },
125
+ * { streamMode: "values" }
126
+ * );
127
+ *
128
+ * for await (const chunk of stream) {
129
+ * // ...
56
130
  * }
57
- * // Returns the messages in the state at each step of execution
58
131
  * ```
59
132
  */
60
- // ===== V1 OVERLOADS (WITHOUT MIDDLEWARE) =====
61
- // These overloads come first to ensure proper type inference when middleware is NOT provided
62
- // Overload 1: V1 - With responseFormat as single InteropZodType
63
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, T, ContextSchema, InteropZodType<T>> & {
133
+ // Overload 1: With responseFormat as single InteropZodType
134
+ declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, InteropZodType<T>> & {
64
135
  responseFormat: InteropZodType<T>;
65
- }): ReactAgent<StateSchema, T, ContextSchema>;
66
- // Overload 2: V1 - With responseFormat as array of InteropZodTypes
67
- declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {
136
+ middleware?: TMiddleware;
137
+ }): ReactAgent<T, ContextSchema, TMiddleware>;
138
+ // Overload 2: With responseFormat as array of InteropZodTypes (infers union type)
139
+ declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {
68
140
  responseFormat: T;
69
- }): ReactAgent<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema>;
70
- // Overload 3: V1 - With responseFormat as JsonSchemaFormat
71
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
141
+ middleware?: TMiddleware;
142
+ }): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddleware>;
143
+ // Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)
144
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
72
145
  responseFormat: JsonSchemaFormat;
73
- }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
74
- // Overload 4: V1 - With responseFormat as array of JsonSchemaFormat
75
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
146
+ middleware?: TMiddleware;
147
+ }): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
148
+ // Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)
149
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
76
150
  responseFormat: JsonSchemaFormat[];
77
- }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
78
- // Overload 5: V1 - With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
79
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
151
+ middleware?: TMiddleware;
152
+ }): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
153
+ // Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
154
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
80
155
  responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
81
- }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
82
- // Overload 6: V1 - With responseFormat as TypedToolStrategy
83
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, T, ContextSchema, TypedToolStrategy<T>> & {
156
+ middleware?: TMiddleware;
157
+ }): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
158
+ // Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)
159
+ declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, TypedToolStrategy<T>> & {
84
160
  responseFormat: TypedToolStrategy<T>;
85
- }): ReactAgent<StateSchema, T, ContextSchema>;
86
- // Overload 7: V1 - With responseFormat as single ToolStrategy
87
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, T, ContextSchema, ToolStrategy<T>> & {
161
+ middleware?: TMiddleware;
162
+ }): ReactAgent<T, ContextSchema, TMiddleware>;
163
+ // Overload 6: With responseFormat as single ToolStrategy instance
164
+ declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ToolStrategy<T>> & {
88
165
  responseFormat: ToolStrategy<T>;
89
- }): ReactAgent<StateSchema, T, ContextSchema>;
90
- // Overload 8: V1 - With responseFormat as ProviderStrategy
91
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, T, ContextSchema, ProviderStrategy<T>> & {
166
+ middleware?: TMiddleware;
167
+ }): ReactAgent<T, ContextSchema, TMiddleware>;
168
+ // Overload 7: With responseFormat as ProviderStrategy
169
+ declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ProviderStrategy<T>> & {
92
170
  responseFormat: ProviderStrategy<T>;
93
- }): ReactAgent<StateSchema, T, ContextSchema>;
94
- // Overload 9: V1 - Without responseFormat property at all
95
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, "responseFormat">): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;
96
- // Overload 10: V1 - With responseFormat explicitly undefined
97
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
171
+ middleware?: TMiddleware;
172
+ }): ReactAgent<T, ContextSchema, TMiddleware>;
173
+ // Overload 8: Without responseFormat property at all - with proper middleware state typing
174
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
175
+ middleware?: TMiddleware;
176
+ }): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;
177
+ // Overload 9: With responseFormat explicitly undefined
178
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
98
179
  responseFormat?: undefined;
99
- }): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;
100
- // Overload 11: V1 - For other ResponseFormat values (failsafe)
101
- declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, StructuredResponseFormat, ContextSchema, any> & {
102
- responseFormat: any;
103
- }): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;
104
- // ===== V2 OVERLOADS (WITH MIDDLEWARE) =====
105
- // These overloads explicitly require the middleware property
106
- // Overload 12: With responseFormat as single InteropZodType and middleware
107
- declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<T, ContextSchema, InteropZodType<T>> & {
108
- responseFormat: InteropZodType<T>;
109
- middleware: TMiddleware;
110
- }): ReactAgent$1<T, ContextSchema, TMiddleware>;
111
- // Overload 13: With responseFormat as array of InteropZodTypes and middleware
112
- declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {
113
- responseFormat: T;
114
- middleware: TMiddleware;
115
- }): ReactAgent$1<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddleware>;
116
- // Overload 14: With responseFormat as JsonSchemaFormat and middleware
117
- declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
118
- responseFormat: JsonSchemaFormat;
119
- middleware: TMiddleware;
120
- }): ReactAgent$1<Record<string, unknown>, ContextSchema, TMiddleware>;
121
- // Overload 15: With responseFormat as array of JsonSchemaFormat and middleware
122
- declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
123
- responseFormat: JsonSchemaFormat[];
124
- middleware: TMiddleware;
125
- }): ReactAgent$1<Record<string, unknown>, ContextSchema, TMiddleware>;
126
- // Overload 16: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[] and middleware
127
- declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
128
- responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
129
- middleware: TMiddleware;
130
- }): ReactAgent$1<Record<string, unknown>, ContextSchema, TMiddleware>;
131
- // Overload 17: With responseFormat as TypedToolStrategy and middleware
132
- declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<T, ContextSchema, TypedToolStrategy<T>> & {
133
- responseFormat: TypedToolStrategy<T>;
134
- middleware: TMiddleware;
135
- }): ReactAgent$1<T, ContextSchema, TMiddleware>;
136
- // Overload 18: With responseFormat as single ToolStrategy and middleware
137
- declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<T, ContextSchema, ToolStrategy<T>> & {
138
- responseFormat: ToolStrategy<T>;
139
- middleware: TMiddleware;
140
- }): ReactAgent$1<T, ContextSchema, TMiddleware>;
141
- // Overload 19: With responseFormat as ProviderStrategy and middleware
142
- declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<T, ContextSchema, ProviderStrategy<T>> & {
143
- responseFormat: ProviderStrategy<T>;
144
- middleware: TMiddleware;
145
- }): ReactAgent$1<T, ContextSchema, TMiddleware>;
146
- // Overload 20: Without responseFormat but with middleware
147
- declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: Omit<CreateAgentParams$1<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
148
- middleware: TMiddleware;
149
- }): ReactAgent$1<ResponseFormatUndefined, ContextSchema, TMiddleware>;
150
- // Overload 21: With responseFormat explicitly undefined and middleware
151
- declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: Omit<CreateAgentParams$1<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
152
- responseFormat?: undefined;
153
- middleware: TMiddleware;
154
- }): ReactAgent$1<ResponseFormatUndefined, ContextSchema, TMiddleware>;
155
- // Overload 22: For other ResponseFormat values with middleware (failsafe)
156
- declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<StructuredResponseFormat, ContextSchema, any> & {
157
- responseFormat: any;
158
- middleware: TMiddleware;
159
- }): ReactAgent$1<StructuredResponseFormat, ContextSchema, TMiddleware>;
180
+ middleware?: TMiddleware;
181
+ }): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;
182
+ // Overload 10: For other ResponseFormat values (failsafe)
183
+ declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, ContextSchema, ResponseFormat> & {
184
+ responseFormat: ResponseFormat;
185
+ middleware?: TMiddleware;
186
+ }): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware>;
187
+ // Re-export types and utilities
188
+
160
189
  //#endregion
161
190
  export { createAgent };
162
191
  //# sourceMappingURL=index.d.cts.map