@langchain/langgraph 1.0.12 → 1.0.14

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 (381) hide show
  1. package/dist/channels/any_value.cjs +46 -0
  2. package/dist/channels/any_value.cjs.map +1 -0
  3. package/dist/channels/any_value.d.cts +23 -0
  4. package/dist/channels/any_value.d.cts.map +1 -0
  5. package/dist/channels/any_value.d.ts +23 -0
  6. package/dist/channels/any_value.d.ts.map +1 -0
  7. package/dist/channels/any_value.js +46 -0
  8. package/dist/channels/any_value.js.map +1 -0
  9. package/dist/channels/base.cjs +101 -0
  10. package/dist/channels/base.cjs.map +1 -0
  11. package/dist/channels/base.d.cts +79 -0
  12. package/dist/channels/base.d.cts.map +1 -0
  13. package/dist/channels/base.d.ts +79 -0
  14. package/dist/channels/base.d.ts.map +1 -0
  15. package/dist/channels/base.js +97 -0
  16. package/dist/channels/base.js.map +1 -0
  17. package/dist/channels/binop.cjs +49 -0
  18. package/dist/channels/binop.cjs.map +1 -0
  19. package/dist/channels/binop.d.cts +22 -0
  20. package/dist/channels/binop.d.cts.map +1 -0
  21. package/dist/channels/binop.d.ts +22 -0
  22. package/dist/channels/binop.d.ts.map +1 -0
  23. package/dist/channels/binop.js +49 -0
  24. package/dist/channels/binop.js.map +1 -0
  25. package/dist/channels/dynamic_barrier_value.cjs +75 -0
  26. package/dist/channels/dynamic_barrier_value.cjs.map +1 -0
  27. package/dist/channels/dynamic_barrier_value.d.cts +40 -0
  28. package/dist/channels/dynamic_barrier_value.d.cts.map +1 -0
  29. package/dist/channels/dynamic_barrier_value.d.ts +40 -0
  30. package/dist/channels/dynamic_barrier_value.d.ts.map +1 -0
  31. package/dist/channels/dynamic_barrier_value.js +75 -0
  32. package/dist/channels/dynamic_barrier_value.js.map +1 -0
  33. package/dist/channels/ephemeral_value.cjs +46 -0
  34. package/dist/channels/ephemeral_value.cjs.map +1 -0
  35. package/dist/channels/ephemeral_value.d.cts +21 -0
  36. package/dist/channels/ephemeral_value.d.cts.map +1 -0
  37. package/dist/channels/ephemeral_value.d.ts +21 -0
  38. package/dist/channels/ephemeral_value.d.ts.map +1 -0
  39. package/dist/channels/ephemeral_value.js +46 -0
  40. package/dist/channels/ephemeral_value.js.map +1 -0
  41. package/dist/channels/index.cjs +21 -0
  42. package/dist/channels/index.d.cts +9 -0
  43. package/dist/channels/index.d.ts +9 -0
  44. package/dist/channels/index.js +10 -0
  45. package/dist/channels/last_value.cjs +98 -0
  46. package/dist/channels/last_value.cjs.map +1 -0
  47. package/dist/channels/last_value.d.cts +42 -0
  48. package/dist/channels/last_value.d.cts.map +1 -0
  49. package/dist/channels/last_value.d.ts +42 -0
  50. package/dist/channels/last_value.d.ts.map +1 -0
  51. package/dist/channels/last_value.js +97 -0
  52. package/dist/channels/last_value.js.map +1 -0
  53. package/dist/channels/named_barrier_value.cjs +116 -0
  54. package/dist/channels/named_barrier_value.cjs.map +1 -0
  55. package/dist/channels/named_barrier_value.d.cts +44 -0
  56. package/dist/channels/named_barrier_value.d.cts.map +1 -0
  57. package/dist/channels/named_barrier_value.d.ts +44 -0
  58. package/dist/channels/named_barrier_value.d.ts.map +1 -0
  59. package/dist/channels/named_barrier_value.js +114 -0
  60. package/dist/channels/named_barrier_value.js.map +1 -0
  61. package/dist/channels/topic.cjs +65 -0
  62. package/dist/channels/topic.cjs.map +1 -0
  63. package/dist/channels/topic.d.cts +32 -0
  64. package/dist/channels/topic.d.cts.map +1 -0
  65. package/dist/channels/topic.d.ts +32 -0
  66. package/dist/channels/topic.d.ts.map +1 -0
  67. package/dist/channels/topic.js +65 -0
  68. package/dist/channels/topic.js.map +1 -0
  69. package/dist/constants.cjs +406 -0
  70. package/dist/constants.cjs.map +1 -0
  71. package/dist/constants.d.cts +281 -0
  72. package/dist/constants.d.cts.map +1 -0
  73. package/dist/constants.d.ts +281 -0
  74. package/dist/constants.d.ts.map +1 -0
  75. package/dist/constants.js +362 -0
  76. package/dist/constants.js.map +1 -0
  77. package/dist/errors.cjs +163 -0
  78. package/dist/errors.cjs.map +1 -0
  79. package/dist/errors.d.cts +77 -0
  80. package/dist/errors.d.cts.map +1 -0
  81. package/dist/errors.d.ts +77 -0
  82. package/dist/errors.d.ts.map +1 -0
  83. package/dist/errors.js +146 -0
  84. package/dist/errors.js.map +1 -0
  85. package/dist/func/index.cjs +299 -0
  86. package/dist/func/index.cjs.map +1 -0
  87. package/dist/func/index.d.cts +288 -0
  88. package/dist/func/index.d.cts.map +1 -0
  89. package/dist/func/index.d.ts +288 -0
  90. package/dist/func/index.d.ts.map +1 -0
  91. package/dist/func/index.js +297 -0
  92. package/dist/func/index.js.map +1 -0
  93. package/dist/func/types.d.cts +62 -0
  94. package/dist/func/types.d.cts.map +1 -0
  95. package/dist/func/types.d.ts +62 -0
  96. package/dist/func/types.d.ts.map +1 -0
  97. package/dist/graph/annotation.cjs +101 -0
  98. package/dist/graph/annotation.cjs.map +1 -0
  99. package/dist/graph/annotation.d.cts +116 -0
  100. package/dist/graph/annotation.d.cts.map +1 -0
  101. package/dist/graph/annotation.d.ts +116 -0
  102. package/dist/graph/annotation.d.ts.map +1 -0
  103. package/dist/graph/annotation.js +99 -0
  104. package/dist/graph/annotation.js.map +1 -0
  105. package/dist/graph/graph.cjs +420 -0
  106. package/dist/graph/graph.cjs.map +1 -0
  107. package/dist/graph/graph.d.cts +108 -0
  108. package/dist/graph/graph.d.cts.map +1 -0
  109. package/dist/graph/graph.d.ts +108 -0
  110. package/dist/graph/graph.d.ts.map +1 -0
  111. package/dist/graph/graph.js +418 -0
  112. package/dist/graph/graph.js.map +1 -0
  113. package/dist/graph/index.cjs +5 -0
  114. package/dist/graph/index.js +7 -0
  115. package/dist/graph/message.cjs +97 -0
  116. package/dist/graph/message.cjs.map +1 -0
  117. package/dist/graph/message.d.cts +40 -0
  118. package/dist/graph/message.d.cts.map +1 -0
  119. package/dist/graph/message.d.ts +40 -0
  120. package/dist/graph/message.d.ts.map +1 -0
  121. package/dist/graph/message.js +94 -0
  122. package/dist/graph/message.js.map +1 -0
  123. package/dist/graph/messages_annotation.cjs +109 -0
  124. package/dist/graph/messages_annotation.cjs.map +1 -0
  125. package/dist/graph/messages_annotation.d.cts +112 -0
  126. package/dist/graph/messages_annotation.d.cts.map +1 -0
  127. package/dist/graph/messages_annotation.d.ts +112 -0
  128. package/dist/graph/messages_annotation.d.ts.map +1 -0
  129. package/dist/graph/messages_annotation.js +107 -0
  130. package/dist/graph/messages_annotation.js.map +1 -0
  131. package/dist/graph/state.cjs +494 -0
  132. package/dist/graph/state.cjs.map +1 -0
  133. package/dist/graph/state.d.cts +229 -0
  134. package/dist/graph/state.d.cts.map +1 -0
  135. package/dist/graph/state.d.ts +229 -0
  136. package/dist/graph/state.d.ts.map +1 -0
  137. package/dist/graph/state.js +493 -0
  138. package/dist/graph/state.js.map +1 -0
  139. package/dist/graph/zod/index.cjs +10 -0
  140. package/dist/graph/zod/index.d.cts +3 -0
  141. package/dist/graph/zod/index.d.ts +3 -0
  142. package/dist/graph/zod/index.js +5 -0
  143. package/dist/graph/zod/meta.cjs +144 -0
  144. package/dist/graph/zod/meta.cjs.map +1 -0
  145. package/dist/graph/zod/meta.d.cts +115 -0
  146. package/dist/graph/zod/meta.d.cts.map +1 -0
  147. package/dist/graph/zod/meta.d.ts +115 -0
  148. package/dist/graph/zod/meta.d.ts.map +1 -0
  149. package/dist/graph/zod/meta.js +141 -0
  150. package/dist/graph/zod/meta.js.map +1 -0
  151. package/dist/graph/zod/plugin.cjs +39 -0
  152. package/dist/graph/zod/plugin.cjs.map +1 -0
  153. package/dist/graph/zod/plugin.js +40 -0
  154. package/dist/graph/zod/plugin.js.map +1 -0
  155. package/dist/graph/zod/schema.cjs +98 -0
  156. package/dist/graph/zod/schema.cjs.map +1 -0
  157. package/dist/graph/zod/schema.d.cts +38 -0
  158. package/dist/graph/zod/schema.d.cts.map +1 -0
  159. package/dist/graph/zod/schema.d.ts +38 -0
  160. package/dist/graph/zod/schema.d.ts.map +1 -0
  161. package/dist/graph/zod/schema.js +94 -0
  162. package/dist/graph/zod/schema.js.map +1 -0
  163. package/dist/graph/zod/zod-registry.cjs +42 -0
  164. package/dist/graph/zod/zod-registry.cjs.map +1 -0
  165. package/dist/graph/zod/zod-registry.d.cts +49 -0
  166. package/dist/graph/zod/zod-registry.d.cts.map +1 -0
  167. package/dist/graph/zod/zod-registry.d.ts +49 -0
  168. package/dist/graph/zod/zod-registry.d.ts.map +1 -0
  169. package/dist/graph/zod/zod-registry.js +41 -0
  170. package/dist/graph/zod/zod-registry.js.map +1 -0
  171. package/dist/hash.cjs +265 -0
  172. package/dist/hash.cjs.map +1 -0
  173. package/dist/hash.js +263 -0
  174. package/dist/hash.js.map +1 -0
  175. package/dist/index.cjs +111 -0
  176. package/dist/index.cjs.map +1 -0
  177. package/dist/index.d.cts +26 -0
  178. package/dist/index.d.ts +26 -0
  179. package/dist/index.js +22 -0
  180. package/dist/index.js.map +1 -0
  181. package/dist/interrupt.cjs +79 -0
  182. package/dist/interrupt.cjs.map +1 -0
  183. package/dist/interrupt.d.cts +55 -0
  184. package/dist/interrupt.d.cts.map +1 -0
  185. package/dist/interrupt.d.ts +55 -0
  186. package/dist/interrupt.d.ts.map +1 -0
  187. package/dist/interrupt.js +79 -0
  188. package/dist/interrupt.js.map +1 -0
  189. package/dist/prebuilt/agentName.cjs +148 -0
  190. package/dist/prebuilt/agentName.cjs.map +1 -0
  191. package/dist/prebuilt/agentName.d.cts +42 -0
  192. package/dist/prebuilt/agentName.d.cts.map +1 -0
  193. package/dist/prebuilt/agentName.d.ts +42 -0
  194. package/dist/prebuilt/agentName.d.ts.map +1 -0
  195. package/dist/prebuilt/agentName.js +148 -0
  196. package/dist/prebuilt/agentName.js.map +1 -0
  197. package/dist/prebuilt/agent_executor.cjs +41 -0
  198. package/dist/prebuilt/agent_executor.cjs.map +1 -0
  199. package/dist/prebuilt/agent_executor.d.cts +58 -0
  200. package/dist/prebuilt/agent_executor.d.cts.map +1 -0
  201. package/dist/prebuilt/agent_executor.d.ts +58 -0
  202. package/dist/prebuilt/agent_executor.d.ts.map +1 -0
  203. package/dist/prebuilt/agent_executor.js +41 -0
  204. package/dist/prebuilt/agent_executor.js.map +1 -0
  205. package/dist/prebuilt/chat_agent_executor.cjs +62 -0
  206. package/dist/prebuilt/chat_agent_executor.cjs.map +1 -0
  207. package/dist/prebuilt/chat_agent_executor.d.cts +23 -0
  208. package/dist/prebuilt/chat_agent_executor.d.cts.map +1 -0
  209. package/dist/prebuilt/chat_agent_executor.d.ts +23 -0
  210. package/dist/prebuilt/chat_agent_executor.d.ts.map +1 -0
  211. package/dist/prebuilt/chat_agent_executor.js +62 -0
  212. package/dist/prebuilt/chat_agent_executor.js.map +1 -0
  213. package/dist/prebuilt/index.cjs +15 -0
  214. package/dist/prebuilt/index.d.cts +8 -0
  215. package/dist/prebuilt/index.d.ts +8 -0
  216. package/dist/prebuilt/index.js +8 -0
  217. package/dist/prebuilt/interrupt.d.cts +60 -0
  218. package/dist/prebuilt/interrupt.d.cts.map +1 -0
  219. package/dist/prebuilt/interrupt.d.ts +60 -0
  220. package/dist/prebuilt/interrupt.d.ts.map +1 -0
  221. package/dist/prebuilt/react_agent_executor.cjs +339 -0
  222. package/dist/prebuilt/react_agent_executor.cjs.map +1 -0
  223. package/dist/prebuilt/react_agent_executor.d.cts +211 -0
  224. package/dist/prebuilt/react_agent_executor.d.cts.map +1 -0
  225. package/dist/prebuilt/react_agent_executor.d.ts +211 -0
  226. package/dist/prebuilt/react_agent_executor.d.ts.map +1 -0
  227. package/dist/prebuilt/react_agent_executor.js +338 -0
  228. package/dist/prebuilt/react_agent_executor.js.map +1 -0
  229. package/dist/prebuilt/tool_executor.cjs +43 -0
  230. package/dist/prebuilt/tool_executor.cjs.map +1 -0
  231. package/dist/prebuilt/tool_executor.d.cts +40 -0
  232. package/dist/prebuilt/tool_executor.d.cts.map +1 -0
  233. package/dist/prebuilt/tool_executor.d.ts +40 -0
  234. package/dist/prebuilt/tool_executor.d.ts.map +1 -0
  235. package/dist/prebuilt/tool_executor.js +43 -0
  236. package/dist/prebuilt/tool_executor.js.map +1 -0
  237. package/dist/prebuilt/tool_node.cjs +247 -0
  238. package/dist/prebuilt/tool_node.cjs.map +1 -0
  239. package/dist/prebuilt/tool_node.d.cts +180 -0
  240. package/dist/prebuilt/tool_node.d.cts.map +1 -0
  241. package/dist/prebuilt/tool_node.d.ts +180 -0
  242. package/dist/prebuilt/tool_node.d.ts.map +1 -0
  243. package/dist/prebuilt/tool_node.js +246 -0
  244. package/dist/prebuilt/tool_node.js.map +1 -0
  245. package/dist/pregel/algo.cjs +565 -0
  246. package/dist/pregel/algo.cjs.map +1 -0
  247. package/dist/pregel/algo.d.cts +13 -0
  248. package/dist/pregel/algo.d.cts.map +1 -0
  249. package/dist/pregel/algo.d.ts +13 -0
  250. package/dist/pregel/algo.d.ts.map +1 -0
  251. package/dist/pregel/algo.js +560 -0
  252. package/dist/pregel/algo.js.map +1 -0
  253. package/dist/pregel/call.cjs +50 -0
  254. package/dist/pregel/call.cjs.map +1 -0
  255. package/dist/pregel/call.js +48 -0
  256. package/dist/pregel/call.js.map +1 -0
  257. package/dist/pregel/debug.cjs +172 -0
  258. package/dist/pregel/debug.cjs.map +1 -0
  259. package/dist/pregel/debug.js +166 -0
  260. package/dist/pregel/debug.js.map +1 -0
  261. package/dist/pregel/index.cjs +1163 -0
  262. package/dist/pregel/index.cjs.map +1 -0
  263. package/dist/pregel/index.d.cts +498 -0
  264. package/dist/pregel/index.d.cts.map +1 -0
  265. package/dist/pregel/index.d.ts +498 -0
  266. package/dist/pregel/index.d.ts.map +1 -0
  267. package/dist/pregel/index.js +1162 -0
  268. package/dist/pregel/index.js.map +1 -0
  269. package/dist/pregel/io.cjs +140 -0
  270. package/dist/pregel/io.cjs.map +1 -0
  271. package/dist/pregel/io.js +135 -0
  272. package/dist/pregel/io.js.map +1 -0
  273. package/dist/pregel/loop.cjs +545 -0
  274. package/dist/pregel/loop.cjs.map +1 -0
  275. package/dist/pregel/loop.js +545 -0
  276. package/dist/pregel/loop.js.map +1 -0
  277. package/dist/pregel/messages.cjs +107 -0
  278. package/dist/pregel/messages.cjs.map +1 -0
  279. package/dist/pregel/messages.js +107 -0
  280. package/dist/pregel/messages.js.map +1 -0
  281. package/dist/pregel/read.cjs +151 -0
  282. package/dist/pregel/read.cjs.map +1 -0
  283. package/dist/pregel/read.d.cts +45 -0
  284. package/dist/pregel/read.d.cts.map +1 -0
  285. package/dist/pregel/read.d.ts +45 -0
  286. package/dist/pregel/read.d.ts.map +1 -0
  287. package/dist/pregel/read.js +150 -0
  288. package/dist/pregel/read.js.map +1 -0
  289. package/dist/pregel/remote.cjs +341 -0
  290. package/dist/pregel/remote.cjs.map +1 -0
  291. package/dist/pregel/remote.d.cts +118 -0
  292. package/dist/pregel/remote.d.cts.map +1 -0
  293. package/dist/pregel/remote.d.ts +118 -0
  294. package/dist/pregel/remote.d.ts.map +1 -0
  295. package/dist/pregel/remote.js +341 -0
  296. package/dist/pregel/remote.js.map +1 -0
  297. package/dist/pregel/retry.cjs +91 -0
  298. package/dist/pregel/retry.cjs.map +1 -0
  299. package/dist/pregel/retry.js +91 -0
  300. package/dist/pregel/retry.js.map +1 -0
  301. package/dist/pregel/runnable_types.d.cts +43 -0
  302. package/dist/pregel/runnable_types.d.cts.map +1 -0
  303. package/dist/pregel/runnable_types.d.ts +43 -0
  304. package/dist/pregel/runnable_types.d.ts.map +1 -0
  305. package/dist/pregel/runner.cjs +228 -0
  306. package/dist/pregel/runner.cjs.map +1 -0
  307. package/dist/pregel/runner.js +228 -0
  308. package/dist/pregel/runner.js.map +1 -0
  309. package/dist/pregel/stream.cjs +197 -0
  310. package/dist/pregel/stream.cjs.map +1 -0
  311. package/dist/pregel/stream.js +195 -0
  312. package/dist/pregel/stream.js.map +1 -0
  313. package/dist/pregel/types.cjs +27 -0
  314. package/dist/pregel/types.cjs.map +1 -0
  315. package/dist/pregel/types.d.cts +440 -0
  316. package/dist/pregel/types.d.cts.map +1 -0
  317. package/dist/pregel/types.d.ts +440 -0
  318. package/dist/pregel/types.d.ts.map +1 -0
  319. package/dist/pregel/types.js +25 -0
  320. package/dist/pregel/types.js.map +1 -0
  321. package/dist/pregel/utils/config.cjs +121 -0
  322. package/dist/pregel/utils/config.cjs.map +1 -0
  323. package/dist/pregel/utils/config.d.cts +36 -0
  324. package/dist/pregel/utils/config.d.cts.map +1 -0
  325. package/dist/pregel/utils/config.d.ts +36 -0
  326. package/dist/pregel/utils/config.d.ts.map +1 -0
  327. package/dist/pregel/utils/config.js +115 -0
  328. package/dist/pregel/utils/config.js.map +1 -0
  329. package/dist/pregel/utils/index.cjs +102 -0
  330. package/dist/pregel/utils/index.cjs.map +1 -0
  331. package/dist/pregel/utils/index.d.cts +51 -0
  332. package/dist/pregel/utils/index.d.cts.map +1 -0
  333. package/dist/pregel/utils/index.d.ts +51 -0
  334. package/dist/pregel/utils/index.d.ts.map +1 -0
  335. package/dist/pregel/utils/index.js +96 -0
  336. package/dist/pregel/utils/index.js.map +1 -0
  337. package/dist/pregel/utils/subgraph.cjs +18 -0
  338. package/dist/pregel/utils/subgraph.cjs.map +1 -0
  339. package/dist/pregel/utils/subgraph.js +16 -0
  340. package/dist/pregel/utils/subgraph.js.map +1 -0
  341. package/dist/pregel/validate.cjs +45 -0
  342. package/dist/pregel/validate.cjs.map +1 -0
  343. package/dist/pregel/validate.js +44 -0
  344. package/dist/pregel/validate.js.map +1 -0
  345. package/dist/pregel/write.cjs +96 -0
  346. package/dist/pregel/write.cjs.map +1 -0
  347. package/dist/pregel/write.d.cts +31 -0
  348. package/dist/pregel/write.d.cts.map +1 -0
  349. package/dist/pregel/write.d.ts +31 -0
  350. package/dist/pregel/write.d.ts.map +1 -0
  351. package/dist/pregel/write.js +95 -0
  352. package/dist/pregel/write.js.map +1 -0
  353. package/dist/remote.cjs +3 -0
  354. package/dist/remote.d.cts +2 -0
  355. package/dist/remote.d.ts +2 -0
  356. package/dist/remote.js +3 -0
  357. package/dist/setup/async_local_storage.cjs +11 -0
  358. package/dist/setup/async_local_storage.cjs.map +1 -0
  359. package/dist/setup/async_local_storage.js +11 -0
  360. package/dist/setup/async_local_storage.js.map +1 -0
  361. package/dist/utils.cjs +86 -0
  362. package/dist/utils.cjs.map +1 -0
  363. package/dist/utils.d.cts +25 -0
  364. package/dist/utils.d.cts.map +1 -0
  365. package/dist/utils.d.ts +25 -0
  366. package/dist/utils.d.ts.map +1 -0
  367. package/dist/utils.js +80 -0
  368. package/dist/utils.js.map +1 -0
  369. package/dist/web.cjs +95 -0
  370. package/dist/web.d.cts +23 -0
  371. package/dist/web.d.ts +23 -0
  372. package/dist/web.js +15 -0
  373. package/dist/writer.cjs +14 -0
  374. package/dist/writer.cjs.map +1 -0
  375. package/dist/writer.d.cts +6 -0
  376. package/dist/writer.d.cts.map +1 -0
  377. package/dist/writer.d.ts +6 -0
  378. package/dist/writer.d.ts.map +1 -0
  379. package/dist/writer.js +14 -0
  380. package/dist/writer.js.map +1 -0
  381. package/package.json +25 -27
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent_executor.d.ts","names":["___web_js0","AgentAction","AgentFinish","BaseMessage","Runnable","Tool","ToolExecutor","BaseChannel","Step","AgentExecutorState","Array","createAgentExecutor","agentRunnable","tools","_langchain_core_messages0","MessageToolSet","MessageStructure","MessageType","StateDefinition","Partial","CompiledStateGraph"],"sources":["../../src/prebuilt/agent_executor.d.ts"],"sourcesContent":["import { AgentAction, AgentFinish } from \"@langchain/core/agents\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { Runnable } from \"@langchain/core/runnables\";\nimport { Tool } from \"@langchain/core/tools\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport type { BaseChannel } from \"../channels/base.js\";\ninterface Step {\n action: AgentAction | AgentFinish;\n observation: unknown;\n}\n/** @ignore */\nexport interface AgentExecutorState {\n agentOutcome?: AgentAction | AgentFinish;\n steps: Array<Step>;\n input: string;\n chatHistory?: BaseMessage[];\n}\n/** @ignore */\nexport declare function createAgentExecutor({ agentRunnable, tools }: {\n agentRunnable: Runnable;\n tools: Array<Tool> | ToolExecutor;\n}): import(\"../web.js\").CompiledStateGraph<{\n agentOutcome?: AgentAction | AgentFinish | undefined;\n steps: Step[];\n input: string;\n chatHistory?: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[] | undefined;\n}, {\n agentOutcome?: AgentAction | AgentFinish | undefined;\n steps?: Step[] | undefined;\n input?: string | undefined;\n chatHistory?: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[] | undefined;\n}, \"__start__\" | \"action\" | \"agent\", {\n agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;\n steps: BaseChannel<Step[], Step[], unknown>;\n input: BaseChannel<string, string, unknown>;\n chatHistory?: BaseChannel<BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[] | undefined, BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[] | undefined, unknown> | undefined;\n}, {\n agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;\n steps: BaseChannel<Step[], Step[], unknown>;\n input: BaseChannel<string, string, unknown>;\n chatHistory?: BaseChannel<BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[] | undefined, BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[] | undefined, unknown> | undefined;\n}, import(\"../web.js\").StateDefinition, {\n action: Partial<AgentExecutorState>;\n agent: {\n agentOutcome: any;\n };\n}, unknown, unknown>;\nexport {};\n"],"mappings":";;;;;;;;;;;UAMUQ,IAAAA;UACEP,cAAcC;;;;AADhBM,UAKOC,kBAAAA,CALH;EAAA,YAAA,CAAA,EAMKR,WANL,GAMmBC,WANnB;OACFD,EAMDS,KANCT,CAMKO,IANLP,CAAAA;OAAcC,EAAAA,MAAAA;EAAW,WAAA,CAAA,EAQnBC,WARmB,EAAA;AAIrC;;AACmBF,iBAMKU,mBAAAA,CANLV;EAAAA,aAAAA;EAAAA;CAAAA,EAAAA;eAAcC,EAOdE,QAPcF;OAChBM,EAONE,KAPMF,CAOAH,IAPAG,CAAAA,GAOQF,YAPRE;IA6BER,kBA7BRU,CAAAA;cAEOP,CAAAA,EAOCF,WAPDE,GAOeD,WAPfC,GAAAA,SAAAA;EAAW,KAAA,EAQlBK,IARkB,EAAA;EAGLG,KAAAA,EAAAA,MAAAA;EAAmB,WAAA,CAAA,EAOzBR,WAPyB,CAOwFW,yBAAAA,CAAlEE,gBAPtB,CAK5BF,yBAAAA,CAEsGC,cAAAA,CAP1E,EAOsCD,yBAAAA,CAAwFG,WAAAA,CAP9H,EAAA,GAAA,SAAA;;cAAkBJ,CAAAA,EAS1CZ,WAT0CY,GAS5BX,WAT4BW,GAAAA,SAAAA;OAC1CT,CAAAA,EASPI,IATOJ,EAAAA,GAAAA,SAAAA;OACFC,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;aAANK,CAAAA,EAUOP,WAVPO,CAUwHI,yBAAAA,CAAlEE,gBAVtDN,CAQKI,yBAAAA,CAEqGC,cAAAA,CAV1GL,EAUsEI,yBAAAA,CAAwFG,WAAAA,CAV9JP,EAAAA,GAAAA,SAAAA;cAAcJ,GAAAA,QAAAA,GAAAA,OAAAA,EAAAA;cAENL,CAAAA,EAUAM,WAVAN,CAUYA,WAVZA,GAU0BC,WAV1BD,GAAAA,SAAAA,EAUmDA,WAVnDA,GAUiEC,WAVjED,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;OAAcC,EAWtBK,WAXsBL,CAWVM,IAXUN,EAAAA,EAWFM,IAXEN,EAAAA,EAAAA,OAAAA,CAAAA;OACtBM,EAWAD,WAXAC,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA;aAAIM,CAAAA,EAYGP,WAZHO,CAYeX,WAVuFY,CAU0BD,yBAAAA,CAAlEE,gBAVwCD,CAS/FD,yBAAAA,CAC2GC,cAAAA,CAVZA,EAUxBD,yBAAAA,CAAwFG,WAAAA,CAVhEF,EAAAA,GAAAA,SAAAA,EAU4FZ,WAV5FY,CAU6MD,yBAAAA,CAAlEE,gBAV3ID,CAU5ED,yBAAAA,CAA2QC,cAAAA,CAV/LA,EAU2JD,yBAAAA,CAAwFG,WAAAA,CAVnPF,EAAAA,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;;cAApCD,CAAAA,EAY9DP,WAZ8DO,CAYlDb,WAZ0IgB,GAY5Hf,WAZ4He,GAAAA,SAAAA,EAYnGhB,WAZmGgB,GAYrFf,WAZqFe,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;OAAvJd,EAaPI,WAbOJ,CAaKK,IAbLL,EAAAA,EAaaK,IAbbL,EAAAA,EAAAA,OAAAA,CAAAA;OAECF,EAYRM,WAZQN,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA;aAAcC,CAAAA,EAafK,WAbeL,CAaHC,WAbGD,CAa8GY,yBAAAA,CAAlEE,gBAb5Cd,CAYXY,yBAAAA,CAC2GC,cAAAA,CAbhGb,EAa4DY,yBAAAA,CAAwFG,WAAAA,CAbpJf,EAAAA,GAAAA,SAAAA,EAagLC,WAbhLD,CAaiSY,yBAAAA,CAAlEE,gBAb/Nd,CAaQY,yBAAAA,CAA2QC,cAAAA,CAbnRb,EAa+OY,yBAAAA,CAAwFG,WAAAA,CAbvUf,EAAAA,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;GAaJF,eAAAA,EAZjBQ;QAAIM,EAcJK,OAdIL,CAcIL,kBAZiGM,CAAAA;OAAcD,EAAAA;IAAlDA,YAAAA,EAAAA,GAAAA;;UAElDb,EAAAA,OAAAA,CAAAA"}
@@ -0,0 +1,41 @@
1
+ import { END, START } from "../constants.js";
2
+ import { StateGraph } from "../graph/state.js";
3
+ import { ToolExecutor } from "./tool_executor.js";
4
+
5
+ //#region src/prebuilt/agent_executor.ts
6
+ /** @ignore */
7
+ function createAgentExecutor({ agentRunnable, tools }) {
8
+ let toolExecutor;
9
+ if (!Array.isArray(tools)) toolExecutor = tools;
10
+ else toolExecutor = new ToolExecutor({ tools });
11
+ const shouldContinue = (data) => {
12
+ if (data.agentOutcome && "returnValues" in data.agentOutcome) return "end";
13
+ return "continue";
14
+ };
15
+ const runAgent = async (data, config) => {
16
+ return { agentOutcome: await agentRunnable.invoke(data, config) };
17
+ };
18
+ const executeTools = async (data, config) => {
19
+ const agentAction = data.agentOutcome;
20
+ if (!agentAction || "returnValues" in agentAction) throw new Error("Agent has not been run yet");
21
+ return { steps: [{
22
+ action: agentAction,
23
+ observation: await toolExecutor.invoke(agentAction, config)
24
+ }] };
25
+ };
26
+ return new StateGraph({ channels: {
27
+ input: null,
28
+ agentOutcome: null,
29
+ steps: {
30
+ reducer: (x, y) => x.concat(y),
31
+ default: () => []
32
+ }
33
+ } }).addNode("agent", runAgent).addNode("action", executeTools).addEdge(START, "agent").addConditionalEdges("agent", shouldContinue, {
34
+ continue: "action",
35
+ end: END
36
+ }).addEdge("action", "agent").compile();
37
+ }
38
+
39
+ //#endregion
40
+ export { createAgentExecutor };
41
+ //# sourceMappingURL=agent_executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent_executor.js","names":[],"sources":["../../src/prebuilt/agent_executor.ts"],"sourcesContent":["import { AgentAction, AgentFinish } from \"@langchain/core/agents\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { Runnable, type RunnableConfig } from \"@langchain/core/runnables\";\nimport { Tool } from \"@langchain/core/tools\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport { StateGraph } from \"../graph/state.js\";\nimport { END, START } from \"../constants.js\";\nimport type { BaseChannel } from \"../channels/base.js\";\n\ninterface Step {\n action: AgentAction | AgentFinish;\n observation: unknown;\n}\n\n/** @ignore */\nexport interface AgentExecutorState {\n agentOutcome?: AgentAction | AgentFinish;\n steps: Array<Step>;\n input: string;\n chatHistory?: BaseMessage[];\n}\n\n/** @ignore */\nexport function createAgentExecutor({\n agentRunnable,\n tools,\n}: {\n agentRunnable: Runnable;\n tools: Array<Tool> | ToolExecutor;\n}) {\n let toolExecutor: ToolExecutor;\n if (!Array.isArray(tools)) {\n toolExecutor = tools;\n } else {\n toolExecutor = new ToolExecutor({\n tools,\n });\n }\n\n // Define logic that will be used to determine which conditional edge to go down\n const shouldContinue = (data: AgentExecutorState) => {\n if (data.agentOutcome && \"returnValues\" in data.agentOutcome) {\n return \"end\";\n }\n return \"continue\";\n };\n\n const runAgent = async (\n data: AgentExecutorState,\n config?: RunnableConfig\n ) => {\n const agentOutcome = await agentRunnable.invoke(data, config);\n return {\n agentOutcome,\n };\n };\n\n const executeTools = async (\n data: AgentExecutorState,\n config?: RunnableConfig\n ): Promise<Partial<AgentExecutorState>> => {\n const agentAction = data.agentOutcome;\n if (!agentAction || \"returnValues\" in agentAction) {\n throw new Error(\"Agent has not been run yet\");\n }\n const output = await toolExecutor.invoke(agentAction, config);\n return {\n steps: [{ action: agentAction, observation: output }],\n };\n };\n\n // Define a new graph\n const workflow = new StateGraph<{\n [K in keyof AgentExecutorState]: BaseChannel<\n AgentExecutorState[K],\n AgentExecutorState[K]\n >;\n }>({\n channels: {\n input: null,\n agentOutcome: null,\n steps: {\n reducer: (x: Step[], y: Step[]) => x.concat(y),\n default: () => [] as Step[],\n },\n },\n })\n // Define the two nodes we will cycle between\n .addNode(\"agent\", runAgent)\n .addNode(\"action\", executeTools)\n // Set the entrypoint as `agent`\n // This means that this node is the first one called\n .addEdge(START, \"agent\")\n // We now add a conditional edge\n .addConditionalEdges(\n // First, we define the start node. We use `agent`.\n // This means these are the edges taken after the `agent` node is called.\n \"agent\",\n // Next, we pass in the function that will determine which node is called next.\n shouldContinue,\n // Finally we pass in a mapping.\n // The keys are strings, and the values are other nodes.\n // END is a special node marking that the graph should finish.\n // What will happen is we will call `should_continue`, and then the output of that\n // will be matched against the keys in this mapping.\n // Based on which one it matches, that node will then be called.\n {\n // If `tools`, then we call the tool node.\n continue: \"action\",\n // Otherwise we finish.\n end: END,\n }\n )\n // We now add a normal edge from `tools` to `agent`.\n // This means that after `tools` is called, `agent` node is called next.\n .addEdge(\"action\", \"agent\");\n\n return workflow.compile();\n}\n"],"mappings":";;;;;;AAuBA,SAAgB,oBAAoB,EAClC,eACA,SAIC;CACD,IAAI;AACJ,KAAI,CAAC,MAAM,QAAQ,MAAM,CACvB,gBAAe;KAEf,gBAAe,IAAI,aAAa,EAC9B,OACD,CAAC;CAIJ,MAAM,kBAAkB,SAA6B;AACnD,MAAI,KAAK,gBAAgB,kBAAkB,KAAK,aAC9C,QAAO;AAET,SAAO;;CAGT,MAAM,WAAW,OACf,MACA,WACG;AAEH,SAAO,EACL,cAFmB,MAAM,cAAc,OAAO,MAAM,OAAO,EAG5D;;CAGH,MAAM,eAAe,OACnB,MACA,WACyC;EACzC,MAAM,cAAc,KAAK;AACzB,MAAI,CAAC,eAAe,kBAAkB,YACpC,OAAM,IAAI,MAAM,6BAA6B;AAG/C,SAAO,EACL,OAAO,CAAC;GAAE,QAAQ;GAAa,aAFlB,MAAM,aAAa,OAAO,aAAa,OAAO;GAEP,CAAC,EACtD;;AAiDH,QA7CiB,IAAI,WAKlB,EACD,UAAU;EACR,OAAO;EACP,cAAc;EACd,OAAO;GACL,UAAU,GAAW,MAAc,EAAE,OAAO,EAAE;GAC9C,eAAe,EAAE;GAClB;EACF,EACF,CAAC,CAEC,QAAQ,SAAS,SAAS,CAC1B,QAAQ,UAAU,aAAa,CAG/B,QAAQ,OAAO,QAAQ,CAEvB,oBAGC,SAEA,gBAOA;EAEE,UAAU;EAEV,KAAK;EACN,CACF,CAGA,QAAQ,UAAU,QAAQ,CAEb,SAAS"}
@@ -0,0 +1,62 @@
1
+ const require_constants = require('../constants.cjs');
2
+ const require_state = require('../graph/state.cjs');
3
+ const require_tool_executor = require('./tool_executor.cjs');
4
+ let _langchain_core_runnables = require("@langchain/core/runnables");
5
+ let _langchain_core_messages = require("@langchain/core/messages");
6
+ let _langchain_core_utils_function_calling = require("@langchain/core/utils/function_calling");
7
+
8
+ //#region src/prebuilt/chat_agent_executor.ts
9
+ /** @deprecated Use {@link createReactAgent} instead with tool calling. */
10
+ function createFunctionCallingExecutor({ model, tools }) {
11
+ let toolExecutor;
12
+ let toolClasses;
13
+ if (!Array.isArray(tools)) {
14
+ toolExecutor = tools;
15
+ toolClasses = tools.tools;
16
+ } else {
17
+ toolExecutor = new require_tool_executor.ToolExecutor({ tools });
18
+ toolClasses = tools;
19
+ }
20
+ if (!("bind" in model) || typeof model.bind !== "function") throw new Error("Model must be bindable");
21
+ const toolsAsOpenAIFunctions = toolClasses.map((tool) => (0, _langchain_core_utils_function_calling.convertToOpenAIFunction)(tool));
22
+ const newModel = model.bind({ functions: toolsAsOpenAIFunctions });
23
+ const shouldContinue = (state) => {
24
+ const { messages } = state;
25
+ const lastMessage = messages[messages.length - 1];
26
+ if (!("function_call" in lastMessage.additional_kwargs) || !lastMessage.additional_kwargs.function_call) return "end";
27
+ return "continue";
28
+ };
29
+ const callModel = async (state, config) => {
30
+ const { messages } = state;
31
+ return { messages: [await newModel.invoke(messages, config)] };
32
+ };
33
+ const _getAction = (state) => {
34
+ const { messages } = state;
35
+ const lastMessage = messages[messages.length - 1];
36
+ if (!lastMessage) throw new Error("No messages found.");
37
+ if (!lastMessage.additional_kwargs.function_call) throw new Error("No function call found in message.");
38
+ return {
39
+ tool: lastMessage.additional_kwargs.function_call.name,
40
+ toolInput: JSON.stringify(lastMessage.additional_kwargs.function_call.arguments),
41
+ log: ""
42
+ };
43
+ };
44
+ const callTool = async (state, config) => {
45
+ const action = _getAction(state);
46
+ return { messages: [new _langchain_core_messages.FunctionMessage({
47
+ content: await toolExecutor.invoke(action, config),
48
+ name: action.tool
49
+ })] };
50
+ };
51
+ return new require_state.StateGraph({ channels: { messages: {
52
+ value: (x, y) => x.concat(y),
53
+ default: () => []
54
+ } } }).addNode("agent", new _langchain_core_runnables.RunnableLambda({ func: callModel })).addNode("action", new _langchain_core_runnables.RunnableLambda({ func: callTool })).addEdge(require_constants.START, "agent").addConditionalEdges("agent", shouldContinue, {
55
+ continue: "action",
56
+ end: require_constants.END
57
+ }).addEdge("action", "agent").compile();
58
+ }
59
+
60
+ //#endregion
61
+ exports.createFunctionCallingExecutor = createFunctionCallingExecutor;
62
+ //# sourceMappingURL=chat_agent_executor.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat_agent_executor.cjs","names":["ToolExecutor","FunctionMessage","StateGraph","RunnableLambda","START","END"],"sources":["../../src/prebuilt/chat_agent_executor.ts"],"sourcesContent":["import { StructuredToolInterface } from \"@langchain/core/tools\";\nimport { convertToOpenAIFunction } from \"@langchain/core/utils/function_calling\";\nimport { AgentAction } from \"@langchain/core/agents\";\nimport { FunctionMessage, BaseMessage } from \"@langchain/core/messages\";\nimport {\n type RunnableConfig,\n RunnableLambda,\n RunnableToolLike,\n} from \"@langchain/core/runnables\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport {\n CompiledStateGraph,\n StateGraph,\n StateGraphArgs,\n} from \"../graph/state.js\";\nimport { END, START } from \"../constants.js\";\n\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport type FunctionCallingExecutorState = { messages: Array<BaseMessage> };\n\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport function createFunctionCallingExecutor<Model extends object>({\n model,\n tools,\n}: {\n model: Model;\n tools: Array<StructuredToolInterface | RunnableToolLike> | ToolExecutor;\n}): CompiledStateGraph<\n FunctionCallingExecutorState,\n Partial<FunctionCallingExecutorState>,\n typeof START | \"agent\" | \"action\"\n> {\n let toolExecutor: ToolExecutor;\n let toolClasses: Array<StructuredToolInterface | RunnableToolLike>;\n if (!Array.isArray(tools)) {\n toolExecutor = tools;\n toolClasses = tools.tools;\n } else {\n toolExecutor = new ToolExecutor({\n tools,\n });\n toolClasses = tools;\n }\n\n if (!(\"bind\" in model) || typeof model.bind !== \"function\") {\n throw new Error(\"Model must be bindable\");\n }\n const toolsAsOpenAIFunctions = toolClasses.map((tool) =>\n convertToOpenAIFunction(tool)\n );\n const newModel = model.bind({\n functions: toolsAsOpenAIFunctions,\n });\n\n // Define the function that determines whether to continue or not\n const shouldContinue = (state: FunctionCallingExecutorState) => {\n const { messages } = state;\n const lastMessage = messages[messages.length - 1];\n // If there is no function call, then we finish\n if (\n !(\"function_call\" in lastMessage.additional_kwargs) ||\n !lastMessage.additional_kwargs.function_call\n ) {\n return \"end\";\n }\n // Otherwise if there is, we continue\n return \"continue\";\n };\n\n // Define the function that calls the model\n const callModel = async (\n state: FunctionCallingExecutorState,\n config?: RunnableConfig\n ) => {\n const { messages } = state;\n const response = await newModel.invoke(messages, config);\n // We return a list, because this will get added to the existing list\n return {\n messages: [response],\n };\n };\n\n // Define the function to execute tools\n const _getAction = (state: FunctionCallingExecutorState): AgentAction => {\n const { messages } = state;\n // Based on the continue condition\n // we know the last message involves a function call\n const lastMessage = messages[messages.length - 1];\n if (!lastMessage) {\n throw new Error(\"No messages found.\");\n }\n if (!lastMessage.additional_kwargs.function_call) {\n throw new Error(\"No function call found in message.\");\n }\n // We construct an AgentAction from the function_call\n return {\n tool: lastMessage.additional_kwargs.function_call.name,\n toolInput: JSON.stringify(\n lastMessage.additional_kwargs.function_call.arguments\n ),\n log: \"\",\n };\n };\n\n const callTool = async (\n state: FunctionCallingExecutorState,\n config?: RunnableConfig\n ) => {\n const action = _getAction(state);\n // We call the tool_executor and get back a response\n const response = await toolExecutor.invoke(action, config);\n // We use the response to create a FunctionMessage\n const functionMessage = new FunctionMessage({\n content: response,\n name: action.tool,\n });\n // We return a list, because this will get added to the existing list\n return { messages: [functionMessage] };\n };\n\n // We create the AgentState that we will pass around\n // This simply involves a list of messages\n // We want steps to return messages to append to the list\n // So we annotate the messages attribute with operator.add\n const schema: StateGraphArgs<FunctionCallingExecutorState>[\"channels\"] = {\n messages: {\n value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),\n default: () => [],\n },\n };\n\n // Define a new graph\n const workflow = new StateGraph<FunctionCallingExecutorState>({\n channels: schema,\n })\n // Define the two nodes we will cycle between\n .addNode(\"agent\", new RunnableLambda({ func: callModel }))\n .addNode(\"action\", new RunnableLambda({ func: callTool }))\n // Set the entrypoint as `agent`\n // This means that this node is the first one called\n .addEdge(START, \"agent\")\n // We now add a conditional edge\n .addConditionalEdges(\n // First, we define the start node. We use `agent`.\n // This means these are the edges taken after the `agent` node is called.\n \"agent\",\n // Next, we pass in the function that will determine which node is called next.\n shouldContinue,\n // Finally we pass in a mapping.\n // The keys are strings, and the values are other nodes.\n // END is a special node marking that the graph should finish.\n // What will happen is we will call `should_continue`, and then the output of that\n // will be matched against the keys in this mapping.\n // Based on which one it matches, that node will then be called.\n {\n // If `tools`, then we call the tool node.\n continue: \"action\",\n // Otherwise we finish.\n end: END,\n }\n )\n // We now add a normal edge from `tools` to `agent`.\n // This means that after `tools` is called, `agent` node is called next.\n .addEdge(\"action\", \"agent\");\n\n // Finally, we compile it!\n // This compiles it into a LangChain Runnable,\n // meaning you can use it as you would any other runnable\n return workflow.compile();\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAgB,8BAAoD,EAClE,OACA,SAQA;CACA,IAAI;CACJ,IAAI;AACJ,KAAI,CAAC,MAAM,QAAQ,MAAM,EAAE;AACzB,iBAAe;AACf,gBAAc,MAAM;QACf;AACL,iBAAe,IAAIA,mCAAa,EAC9B,OACD,CAAC;AACF,gBAAc;;AAGhB,KAAI,EAAE,UAAU,UAAU,OAAO,MAAM,SAAS,WAC9C,OAAM,IAAI,MAAM,yBAAyB;CAE3C,MAAM,yBAAyB,YAAY,KAAK,6EACtB,KAAK,CAC9B;CACD,MAAM,WAAW,MAAM,KAAK,EAC1B,WAAW,wBACZ,CAAC;CAGF,MAAM,kBAAkB,UAAwC;EAC9D,MAAM,EAAE,aAAa;EACrB,MAAM,cAAc,SAAS,SAAS,SAAS;AAE/C,MACE,EAAE,mBAAmB,YAAY,sBACjC,CAAC,YAAY,kBAAkB,cAE/B,QAAO;AAGT,SAAO;;CAIT,MAAM,YAAY,OAChB,OACA,WACG;EACH,MAAM,EAAE,aAAa;AAGrB,SAAO,EACL,UAAU,CAHK,MAAM,SAAS,OAAO,UAAU,OAAO,CAGlC,EACrB;;CAIH,MAAM,cAAc,UAAqD;EACvE,MAAM,EAAE,aAAa;EAGrB,MAAM,cAAc,SAAS,SAAS,SAAS;AAC/C,MAAI,CAAC,YACH,OAAM,IAAI,MAAM,qBAAqB;AAEvC,MAAI,CAAC,YAAY,kBAAkB,cACjC,OAAM,IAAI,MAAM,qCAAqC;AAGvD,SAAO;GACL,MAAM,YAAY,kBAAkB,cAAc;GAClD,WAAW,KAAK,UACd,YAAY,kBAAkB,cAAc,UAC7C;GACD,KAAK;GACN;;CAGH,MAAM,WAAW,OACf,OACA,WACG;EACH,MAAM,SAAS,WAAW,MAAM;AAShC,SAAO,EAAE,UAAU,CALK,IAAIC,yCAAgB;GAC1C,SAHe,MAAM,aAAa,OAAO,QAAQ,OAAO;GAIxD,MAAM,OAAO;GACd,CAAC,CAEkC,EAAE;;AAmDxC,QApCiB,IAAIC,yBAAyC,EAC5D,UATuE,EACvE,UAAU;EACR,QAAQ,GAAkB,MAAqB,EAAE,OAAO,EAAE;EAC1D,eAAe,EAAE;EAClB,EACF,EAKA,CAAC,CAEC,QAAQ,SAAS,IAAIC,yCAAe,EAAE,MAAM,WAAW,CAAC,CAAC,CACzD,QAAQ,UAAU,IAAIA,yCAAe,EAAE,MAAM,UAAU,CAAC,CAAC,CAGzD,QAAQC,yBAAO,QAAQ,CAEvB,oBAGC,SAEA,gBAOA;EAEE,UAAU;EAEV,KAAKC;EACN,CACF,CAGA,QAAQ,UAAU,QAAQ,CAKb,SAAS"}
@@ -0,0 +1,23 @@
1
+ import { START } from "../constants.cjs";
2
+ import { CompiledStateGraph } from "../graph/state.cjs";
3
+ import { ToolExecutor } from "./tool_executor.cjs";
4
+ import { RunnableToolLike } from "@langchain/core/runnables";
5
+ import { BaseMessage } from "@langchain/core/messages";
6
+ import { StructuredToolInterface } from "@langchain/core/tools";
7
+
8
+ //#region src/prebuilt/chat_agent_executor.d.ts
9
+ /** @deprecated Use {@link createReactAgent} instead with tool calling. */
10
+ type FunctionCallingExecutorState = {
11
+ messages: Array<BaseMessage>;
12
+ };
13
+ /** @deprecated Use {@link createReactAgent} instead with tool calling. */
14
+ declare function createFunctionCallingExecutor<Model extends object>({
15
+ model,
16
+ tools
17
+ }: {
18
+ model: Model;
19
+ tools: Array<StructuredToolInterface | RunnableToolLike> | ToolExecutor;
20
+ }): CompiledStateGraph<FunctionCallingExecutorState, Partial<FunctionCallingExecutorState>, typeof START | "agent" | "action">;
21
+ //#endregion
22
+ export { FunctionCallingExecutorState, createFunctionCallingExecutor };
23
+ //# sourceMappingURL=chat_agent_executor.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat_agent_executor.d.cts","names":["StructuredToolInterface","BaseMessage","RunnableToolLike","ToolExecutor","CompiledStateGraph","START","FunctionCallingExecutorState","Array","createFunctionCallingExecutor","model","tools","Model","Partial"],"sources":["../../src/prebuilt/chat_agent_executor.d.ts"],"sourcesContent":["import { StructuredToolInterface } from \"@langchain/core/tools\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { RunnableToolLike } from \"@langchain/core/runnables\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport { CompiledStateGraph } from \"../graph/state.js\";\nimport { START } from \"../constants.js\";\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport type FunctionCallingExecutorState = {\n messages: Array<BaseMessage>;\n};\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport declare function createFunctionCallingExecutor<Model extends object>({ model, tools }: {\n model: Model;\n tools: Array<StructuredToolInterface | RunnableToolLike> | ToolExecutor;\n}): CompiledStateGraph<FunctionCallingExecutorState, Partial<FunctionCallingExecutorState>, typeof START | \"agent\" | \"action\">;\n"],"mappings":";;;;;;;;;KAOYM,4BAAAA;EAAAA,QAAAA,EACEC,KADFD,CACQL,WADRK,CAAAA;CAA4B;;AAC1BC,iBAGUC,6BAHVD,CAAAA,cAAAA,MAAAA,CAAAA,CAAAA;EAAAA,KAAAA;EAAAA;CAAAA,EAAAA;EAAK,KAAA,EAIRI,KAJQ;EAGKH,KAAAA,EAEbD,KAFaC,CAEPR,uBAFoC,GAEVE,gBAFU,CAAA,GAEUC,YAFV;CAAA,CAAA,EAGjDC,kBAHiD,CAG9BE,4BAH8B,EAGAM,OAHA,CAGQN,4BAHR,CAAA,EAAA,OAG8CD,KAH9C,GAAA,OAAA,GAAA,QAAA,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { START } from "../constants.js";
2
+ import { CompiledStateGraph } from "../graph/state.js";
3
+ import { ToolExecutor } from "./tool_executor.js";
4
+ import { RunnableToolLike } from "@langchain/core/runnables";
5
+ import { BaseMessage } from "@langchain/core/messages";
6
+ import { StructuredToolInterface } from "@langchain/core/tools";
7
+
8
+ //#region src/prebuilt/chat_agent_executor.d.ts
9
+ /** @deprecated Use {@link createReactAgent} instead with tool calling. */
10
+ type FunctionCallingExecutorState = {
11
+ messages: Array<BaseMessage>;
12
+ };
13
+ /** @deprecated Use {@link createReactAgent} instead with tool calling. */
14
+ declare function createFunctionCallingExecutor<Model extends object>({
15
+ model,
16
+ tools
17
+ }: {
18
+ model: Model;
19
+ tools: Array<StructuredToolInterface | RunnableToolLike> | ToolExecutor;
20
+ }): CompiledStateGraph<FunctionCallingExecutorState, Partial<FunctionCallingExecutorState>, typeof START | "agent" | "action">;
21
+ //#endregion
22
+ export { FunctionCallingExecutorState, createFunctionCallingExecutor };
23
+ //# sourceMappingURL=chat_agent_executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat_agent_executor.d.ts","names":["StructuredToolInterface","BaseMessage","RunnableToolLike","ToolExecutor","CompiledStateGraph","START","FunctionCallingExecutorState","Array","createFunctionCallingExecutor","model","tools","Model","Partial"],"sources":["../../src/prebuilt/chat_agent_executor.d.ts"],"sourcesContent":["import { StructuredToolInterface } from \"@langchain/core/tools\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { RunnableToolLike } from \"@langchain/core/runnables\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport { CompiledStateGraph } from \"../graph/state.js\";\nimport { START } from \"../constants.js\";\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport type FunctionCallingExecutorState = {\n messages: Array<BaseMessage>;\n};\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport declare function createFunctionCallingExecutor<Model extends object>({ model, tools }: {\n model: Model;\n tools: Array<StructuredToolInterface | RunnableToolLike> | ToolExecutor;\n}): CompiledStateGraph<FunctionCallingExecutorState, Partial<FunctionCallingExecutorState>, typeof START | \"agent\" | \"action\">;\n"],"mappings":";;;;;;;;;KAOYM,4BAAAA;EAAAA,QAAAA,EACEC,KADFD,CACQL,WADRK,CAAAA;CAA4B;;AAC1BC,iBAGUC,6BAHVD,CAAAA,cAAAA,MAAAA,CAAAA,CAAAA;EAAAA,KAAAA;EAAAA;CAAAA,EAAAA;EAAK,KAAA,EAIRI,KAJQ;EAGKH,KAAAA,EAEbD,KAFaC,CAEPR,uBAFoC,GAEVE,gBAFU,CAAA,GAEUC,YAFV;CAAA,CAAA,EAGjDC,kBAHiD,CAG9BE,4BAH8B,EAGAM,OAHA,CAGQN,4BAHR,CAAA,EAAA,OAG8CD,KAH9C,GAAA,OAAA,GAAA,QAAA,CAAA"}
@@ -0,0 +1,62 @@
1
+ import { END, START } from "../constants.js";
2
+ import { StateGraph } from "../graph/state.js";
3
+ import { ToolExecutor } from "./tool_executor.js";
4
+ import { RunnableLambda } from "@langchain/core/runnables";
5
+ import { FunctionMessage } from "@langchain/core/messages";
6
+ import { convertToOpenAIFunction } from "@langchain/core/utils/function_calling";
7
+
8
+ //#region src/prebuilt/chat_agent_executor.ts
9
+ /** @deprecated Use {@link createReactAgent} instead with tool calling. */
10
+ function createFunctionCallingExecutor({ model, tools }) {
11
+ let toolExecutor;
12
+ let toolClasses;
13
+ if (!Array.isArray(tools)) {
14
+ toolExecutor = tools;
15
+ toolClasses = tools.tools;
16
+ } else {
17
+ toolExecutor = new ToolExecutor({ tools });
18
+ toolClasses = tools;
19
+ }
20
+ if (!("bind" in model) || typeof model.bind !== "function") throw new Error("Model must be bindable");
21
+ const toolsAsOpenAIFunctions = toolClasses.map((tool) => convertToOpenAIFunction(tool));
22
+ const newModel = model.bind({ functions: toolsAsOpenAIFunctions });
23
+ const shouldContinue = (state) => {
24
+ const { messages } = state;
25
+ const lastMessage = messages[messages.length - 1];
26
+ if (!("function_call" in lastMessage.additional_kwargs) || !lastMessage.additional_kwargs.function_call) return "end";
27
+ return "continue";
28
+ };
29
+ const callModel = async (state, config) => {
30
+ const { messages } = state;
31
+ return { messages: [await newModel.invoke(messages, config)] };
32
+ };
33
+ const _getAction = (state) => {
34
+ const { messages } = state;
35
+ const lastMessage = messages[messages.length - 1];
36
+ if (!lastMessage) throw new Error("No messages found.");
37
+ if (!lastMessage.additional_kwargs.function_call) throw new Error("No function call found in message.");
38
+ return {
39
+ tool: lastMessage.additional_kwargs.function_call.name,
40
+ toolInput: JSON.stringify(lastMessage.additional_kwargs.function_call.arguments),
41
+ log: ""
42
+ };
43
+ };
44
+ const callTool = async (state, config) => {
45
+ const action = _getAction(state);
46
+ return { messages: [new FunctionMessage({
47
+ content: await toolExecutor.invoke(action, config),
48
+ name: action.tool
49
+ })] };
50
+ };
51
+ return new StateGraph({ channels: { messages: {
52
+ value: (x, y) => x.concat(y),
53
+ default: () => []
54
+ } } }).addNode("agent", new RunnableLambda({ func: callModel })).addNode("action", new RunnableLambda({ func: callTool })).addEdge(START, "agent").addConditionalEdges("agent", shouldContinue, {
55
+ continue: "action",
56
+ end: END
57
+ }).addEdge("action", "agent").compile();
58
+ }
59
+
60
+ //#endregion
61
+ export { createFunctionCallingExecutor };
62
+ //# sourceMappingURL=chat_agent_executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat_agent_executor.js","names":[],"sources":["../../src/prebuilt/chat_agent_executor.ts"],"sourcesContent":["import { StructuredToolInterface } from \"@langchain/core/tools\";\nimport { convertToOpenAIFunction } from \"@langchain/core/utils/function_calling\";\nimport { AgentAction } from \"@langchain/core/agents\";\nimport { FunctionMessage, BaseMessage } from \"@langchain/core/messages\";\nimport {\n type RunnableConfig,\n RunnableLambda,\n RunnableToolLike,\n} from \"@langchain/core/runnables\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport {\n CompiledStateGraph,\n StateGraph,\n StateGraphArgs,\n} from \"../graph/state.js\";\nimport { END, START } from \"../constants.js\";\n\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport type FunctionCallingExecutorState = { messages: Array<BaseMessage> };\n\n/** @deprecated Use {@link createReactAgent} instead with tool calling. */\nexport function createFunctionCallingExecutor<Model extends object>({\n model,\n tools,\n}: {\n model: Model;\n tools: Array<StructuredToolInterface | RunnableToolLike> | ToolExecutor;\n}): CompiledStateGraph<\n FunctionCallingExecutorState,\n Partial<FunctionCallingExecutorState>,\n typeof START | \"agent\" | \"action\"\n> {\n let toolExecutor: ToolExecutor;\n let toolClasses: Array<StructuredToolInterface | RunnableToolLike>;\n if (!Array.isArray(tools)) {\n toolExecutor = tools;\n toolClasses = tools.tools;\n } else {\n toolExecutor = new ToolExecutor({\n tools,\n });\n toolClasses = tools;\n }\n\n if (!(\"bind\" in model) || typeof model.bind !== \"function\") {\n throw new Error(\"Model must be bindable\");\n }\n const toolsAsOpenAIFunctions = toolClasses.map((tool) =>\n convertToOpenAIFunction(tool)\n );\n const newModel = model.bind({\n functions: toolsAsOpenAIFunctions,\n });\n\n // Define the function that determines whether to continue or not\n const shouldContinue = (state: FunctionCallingExecutorState) => {\n const { messages } = state;\n const lastMessage = messages[messages.length - 1];\n // If there is no function call, then we finish\n if (\n !(\"function_call\" in lastMessage.additional_kwargs) ||\n !lastMessage.additional_kwargs.function_call\n ) {\n return \"end\";\n }\n // Otherwise if there is, we continue\n return \"continue\";\n };\n\n // Define the function that calls the model\n const callModel = async (\n state: FunctionCallingExecutorState,\n config?: RunnableConfig\n ) => {\n const { messages } = state;\n const response = await newModel.invoke(messages, config);\n // We return a list, because this will get added to the existing list\n return {\n messages: [response],\n };\n };\n\n // Define the function to execute tools\n const _getAction = (state: FunctionCallingExecutorState): AgentAction => {\n const { messages } = state;\n // Based on the continue condition\n // we know the last message involves a function call\n const lastMessage = messages[messages.length - 1];\n if (!lastMessage) {\n throw new Error(\"No messages found.\");\n }\n if (!lastMessage.additional_kwargs.function_call) {\n throw new Error(\"No function call found in message.\");\n }\n // We construct an AgentAction from the function_call\n return {\n tool: lastMessage.additional_kwargs.function_call.name,\n toolInput: JSON.stringify(\n lastMessage.additional_kwargs.function_call.arguments\n ),\n log: \"\",\n };\n };\n\n const callTool = async (\n state: FunctionCallingExecutorState,\n config?: RunnableConfig\n ) => {\n const action = _getAction(state);\n // We call the tool_executor and get back a response\n const response = await toolExecutor.invoke(action, config);\n // We use the response to create a FunctionMessage\n const functionMessage = new FunctionMessage({\n content: response,\n name: action.tool,\n });\n // We return a list, because this will get added to the existing list\n return { messages: [functionMessage] };\n };\n\n // We create the AgentState that we will pass around\n // This simply involves a list of messages\n // We want steps to return messages to append to the list\n // So we annotate the messages attribute with operator.add\n const schema: StateGraphArgs<FunctionCallingExecutorState>[\"channels\"] = {\n messages: {\n value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),\n default: () => [],\n },\n };\n\n // Define a new graph\n const workflow = new StateGraph<FunctionCallingExecutorState>({\n channels: schema,\n })\n // Define the two nodes we will cycle between\n .addNode(\"agent\", new RunnableLambda({ func: callModel }))\n .addNode(\"action\", new RunnableLambda({ func: callTool }))\n // Set the entrypoint as `agent`\n // This means that this node is the first one called\n .addEdge(START, \"agent\")\n // We now add a conditional edge\n .addConditionalEdges(\n // First, we define the start node. We use `agent`.\n // This means these are the edges taken after the `agent` node is called.\n \"agent\",\n // Next, we pass in the function that will determine which node is called next.\n shouldContinue,\n // Finally we pass in a mapping.\n // The keys are strings, and the values are other nodes.\n // END is a special node marking that the graph should finish.\n // What will happen is we will call `should_continue`, and then the output of that\n // will be matched against the keys in this mapping.\n // Based on which one it matches, that node will then be called.\n {\n // If `tools`, then we call the tool node.\n continue: \"action\",\n // Otherwise we finish.\n end: END,\n }\n )\n // We now add a normal edge from `tools` to `agent`.\n // This means that after `tools` is called, `agent` node is called next.\n .addEdge(\"action\", \"agent\");\n\n // Finally, we compile it!\n // This compiles it into a LangChain Runnable,\n // meaning you can use it as you would any other runnable\n return workflow.compile();\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAgB,8BAAoD,EAClE,OACA,SAQA;CACA,IAAI;CACJ,IAAI;AACJ,KAAI,CAAC,MAAM,QAAQ,MAAM,EAAE;AACzB,iBAAe;AACf,gBAAc,MAAM;QACf;AACL,iBAAe,IAAI,aAAa,EAC9B,OACD,CAAC;AACF,gBAAc;;AAGhB,KAAI,EAAE,UAAU,UAAU,OAAO,MAAM,SAAS,WAC9C,OAAM,IAAI,MAAM,yBAAyB;CAE3C,MAAM,yBAAyB,YAAY,KAAK,SAC9C,wBAAwB,KAAK,CAC9B;CACD,MAAM,WAAW,MAAM,KAAK,EAC1B,WAAW,wBACZ,CAAC;CAGF,MAAM,kBAAkB,UAAwC;EAC9D,MAAM,EAAE,aAAa;EACrB,MAAM,cAAc,SAAS,SAAS,SAAS;AAE/C,MACE,EAAE,mBAAmB,YAAY,sBACjC,CAAC,YAAY,kBAAkB,cAE/B,QAAO;AAGT,SAAO;;CAIT,MAAM,YAAY,OAChB,OACA,WACG;EACH,MAAM,EAAE,aAAa;AAGrB,SAAO,EACL,UAAU,CAHK,MAAM,SAAS,OAAO,UAAU,OAAO,CAGlC,EACrB;;CAIH,MAAM,cAAc,UAAqD;EACvE,MAAM,EAAE,aAAa;EAGrB,MAAM,cAAc,SAAS,SAAS,SAAS;AAC/C,MAAI,CAAC,YACH,OAAM,IAAI,MAAM,qBAAqB;AAEvC,MAAI,CAAC,YAAY,kBAAkB,cACjC,OAAM,IAAI,MAAM,qCAAqC;AAGvD,SAAO;GACL,MAAM,YAAY,kBAAkB,cAAc;GAClD,WAAW,KAAK,UACd,YAAY,kBAAkB,cAAc,UAC7C;GACD,KAAK;GACN;;CAGH,MAAM,WAAW,OACf,OACA,WACG;EACH,MAAM,SAAS,WAAW,MAAM;AAShC,SAAO,EAAE,UAAU,CALK,IAAI,gBAAgB;GAC1C,SAHe,MAAM,aAAa,OAAO,QAAQ,OAAO;GAIxD,MAAM,OAAO;GACd,CAAC,CAEkC,EAAE;;AAmDxC,QApCiB,IAAI,WAAyC,EAC5D,UATuE,EACvE,UAAU;EACR,QAAQ,GAAkB,MAAqB,EAAE,OAAO,EAAE;EAC1D,eAAe,EAAE;EAClB,EACF,EAKA,CAAC,CAEC,QAAQ,SAAS,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC,CAAC,CACzD,QAAQ,UAAU,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC,CAAC,CAGzD,QAAQ,OAAO,QAAQ,CAEvB,oBAGC,SAEA,gBAOA;EAEE,UAAU;EAEV,KAAK;EACN,CACF,CAGA,QAAQ,UAAU,QAAQ,CAKb,SAAS"}
@@ -0,0 +1,15 @@
1
+ const require_tool_executor = require('./tool_executor.cjs');
2
+ const require_agent_executor = require('./agent_executor.cjs');
3
+ const require_chat_agent_executor = require('./chat_agent_executor.cjs');
4
+ const require_tool_node = require('./tool_node.cjs');
5
+ const require_agentName = require('./agentName.cjs');
6
+ const require_react_agent_executor = require('./react_agent_executor.cjs');
7
+
8
+ exports.ToolExecutor = require_tool_executor.ToolExecutor;
9
+ exports.ToolNode = require_tool_node.ToolNode;
10
+ exports.createAgentExecutor = require_agent_executor.createAgentExecutor;
11
+ exports.createFunctionCallingExecutor = require_chat_agent_executor.createFunctionCallingExecutor;
12
+ exports.createReactAgent = require_react_agent_executor.createReactAgent;
13
+ exports.createReactAgentAnnotation = require_react_agent_executor.createReactAgentAnnotation;
14
+ exports.toolsCondition = require_tool_node.toolsCondition;
15
+ exports.withAgentName = require_agentName.withAgentName;
@@ -0,0 +1,8 @@
1
+ import { ToolExecutor, ToolExecutorArgs, ToolInvocationInterface } from "./tool_executor.cjs";
2
+ import { AgentExecutorState, createAgentExecutor } from "./agent_executor.cjs";
3
+ import { FunctionCallingExecutorState, createFunctionCallingExecutor } from "./chat_agent_executor.cjs";
4
+ import { ToolNode, ToolNodeOptions, toolsCondition } from "./tool_node.cjs";
5
+ import { AgentState, CreateReactAgentParams, createReactAgent, createReactAgentAnnotation } from "./react_agent_executor.cjs";
6
+ import { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse } from "./interrupt.cjs";
7
+ import { AgentNameMode, withAgentName } from "./agentName.cjs";
8
+ export { type ActionRequest, type AgentExecutorState, type AgentNameMode, type AgentState, type CreateReactAgentParams, type FunctionCallingExecutorState, type HumanInterrupt, type HumanInterruptConfig, type HumanResponse, ToolExecutor, type ToolExecutorArgs, type ToolInvocationInterface, ToolNode, type ToolNodeOptions, createAgentExecutor, createFunctionCallingExecutor, createReactAgent, createReactAgentAnnotation, toolsCondition, withAgentName };
@@ -0,0 +1,8 @@
1
+ import { ToolExecutor, ToolExecutorArgs, ToolInvocationInterface } from "./tool_executor.js";
2
+ import { AgentExecutorState, createAgentExecutor } from "./agent_executor.js";
3
+ import { FunctionCallingExecutorState, createFunctionCallingExecutor } from "./chat_agent_executor.js";
4
+ import { ToolNode, ToolNodeOptions, toolsCondition } from "./tool_node.js";
5
+ import { AgentState, CreateReactAgentParams, createReactAgent, createReactAgentAnnotation } from "./react_agent_executor.js";
6
+ import { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse } from "./interrupt.js";
7
+ import { AgentNameMode, withAgentName } from "./agentName.js";
8
+ export { type ActionRequest, type AgentExecutorState, type AgentNameMode, type AgentState, type CreateReactAgentParams, type FunctionCallingExecutorState, type HumanInterrupt, type HumanInterruptConfig, type HumanResponse, ToolExecutor, type ToolExecutorArgs, type ToolInvocationInterface, ToolNode, type ToolNodeOptions, createAgentExecutor, createFunctionCallingExecutor, createReactAgent, createReactAgentAnnotation, toolsCondition, withAgentName };
@@ -0,0 +1,8 @@
1
+ import { ToolExecutor } from "./tool_executor.js";
2
+ import { createAgentExecutor } from "./agent_executor.js";
3
+ import { createFunctionCallingExecutor } from "./chat_agent_executor.js";
4
+ import { ToolNode, toolsCondition } from "./tool_node.js";
5
+ import { withAgentName } from "./agentName.js";
6
+ import { createReactAgent, createReactAgentAnnotation } from "./react_agent_executor.js";
7
+
8
+ export { ToolExecutor, ToolNode, createAgentExecutor, createFunctionCallingExecutor, createReactAgent, createReactAgentAnnotation, toolsCondition, withAgentName };
@@ -0,0 +1,60 @@
1
+ //#region src/prebuilt/interrupt.d.ts
2
+ /**
3
+ * Configuration interface that defines what actions are allowed for a human interrupt.
4
+ * This controls the available interaction options when the graph is paused for human input.
5
+ *
6
+ * @property {boolean} allow_ignore - Whether the human can choose to ignore/skip the current step
7
+ * @property {boolean} allow_respond - Whether the human can provide a text response/feedback
8
+ * @property {boolean} allow_edit - Whether the human can edit the provided content/state
9
+ * @property {boolean} allow_accept - Whether the human can accept/approve the current state
10
+ */
11
+ interface HumanInterruptConfig {
12
+ allow_ignore: boolean;
13
+ allow_respond: boolean;
14
+ allow_edit: boolean;
15
+ allow_accept: boolean;
16
+ }
17
+ /**
18
+ * Represents a request for human action within the graph execution.
19
+ * Contains the action type and any associated arguments needed for the action.
20
+ *
21
+ * @property {string} action - The type or name of action being requested (e.g., "Approve XYZ action")
22
+ * @property {Record<string, any>} args - Key-value pairs of arguments needed for the action
23
+ */
24
+ interface ActionRequest {
25
+ action: string;
26
+ args: Record<string, any>;
27
+ }
28
+ /**
29
+ * Represents an interrupt triggered by the graph that requires human intervention.
30
+ * This is passed to the `interrupt` function when execution is paused for human input.
31
+ *
32
+ * @property {ActionRequest} action_request - The specific action being requested from the human
33
+ * @property {HumanInterruptConfig} config - Configuration defining what actions are allowed
34
+ * @property {string} [description] - Optional detailed description of what input is needed
35
+ */
36
+ interface HumanInterrupt {
37
+ action_request: ActionRequest;
38
+ config: HumanInterruptConfig;
39
+ description?: string;
40
+ }
41
+ /**
42
+ * The response provided by a human to an interrupt, which is returned when graph execution resumes.
43
+ *
44
+ * @property {("accept"|"ignore"|"response"|"edit")} type - The type of response:
45
+ * - "accept": Approves the current state without changes
46
+ * - "ignore": Skips/ignores the current step
47
+ * - "response": Provides text feedback or instructions
48
+ * - "edit": Modifies the current state/content
49
+ * @property {null|string|ActionRequest} args - The response payload:
50
+ * - null: For ignore/accept actions
51
+ * - string: For text responses
52
+ * - ActionRequest: For edit actions with updated content
53
+ */
54
+ type HumanResponse = {
55
+ type: "accept" | "ignore" | "response" | "edit";
56
+ args: null | string | ActionRequest;
57
+ };
58
+ //#endregion
59
+ export { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse };
60
+ //# sourceMappingURL=interrupt.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interrupt.d.cts","names":["HumanInterruptConfig","ActionRequest","Record","HumanInterrupt","HumanResponse"],"sources":["../../src/prebuilt/interrupt.d.ts"],"sourcesContent":["/**\n * Configuration interface that defines what actions are allowed for a human interrupt.\n * This controls the available interaction options when the graph is paused for human input.\n *\n * @property {boolean} allow_ignore - Whether the human can choose to ignore/skip the current step\n * @property {boolean} allow_respond - Whether the human can provide a text response/feedback\n * @property {boolean} allow_edit - Whether the human can edit the provided content/state\n * @property {boolean} allow_accept - Whether the human can accept/approve the current state\n */\nexport interface HumanInterruptConfig {\n allow_ignore: boolean;\n allow_respond: boolean;\n allow_edit: boolean;\n allow_accept: boolean;\n}\n/**\n * Represents a request for human action within the graph execution.\n * Contains the action type and any associated arguments needed for the action.\n *\n * @property {string} action - The type or name of action being requested (e.g., \"Approve XYZ action\")\n * @property {Record<string, any>} args - Key-value pairs of arguments needed for the action\n */\nexport interface ActionRequest {\n action: string;\n args: Record<string, any>;\n}\n/**\n * Represents an interrupt triggered by the graph that requires human intervention.\n * This is passed to the `interrupt` function when execution is paused for human input.\n *\n * @property {ActionRequest} action_request - The specific action being requested from the human\n * @property {HumanInterruptConfig} config - Configuration defining what actions are allowed\n * @property {string} [description] - Optional detailed description of what input is needed\n */\nexport interface HumanInterrupt {\n action_request: ActionRequest;\n config: HumanInterruptConfig;\n description?: string;\n}\n/**\n * The response provided by a human to an interrupt, which is returned when graph execution resumes.\n *\n * @property {(\"accept\"|\"ignore\"|\"response\"|\"edit\")} type - The type of response:\n * - \"accept\": Approves the current state without changes\n * - \"ignore\": Skips/ignores the current step\n * - \"response\": Provides text feedback or instructions\n * - \"edit\": Modifies the current state/content\n * @property {null|string|ActionRequest} args - The response payload:\n * - null: For ignore/accept actions\n * - string: For text responses\n * - ActionRequest: For edit actions with updated content\n */\nexport type HumanResponse = {\n type: \"accept\" | \"ignore\" | \"response\" | \"edit\";\n args: null | string | ActionRequest;\n};\n"],"mappings":";;AASA;AAaA;AAYA;;;;;AAkBA;UA3CiBA,oBAAAA;;;;;;;;;;;;;UAaAC,aAAAA;;QAEPC;;;;;;;;;;UAUOC,cAAAA;kBACGF;UACRD;;;;;;;;;;;;;;;;KAgBAI,aAAAA;;wBAEcH"}
@@ -0,0 +1,60 @@
1
+ //#region src/prebuilt/interrupt.d.ts
2
+ /**
3
+ * Configuration interface that defines what actions are allowed for a human interrupt.
4
+ * This controls the available interaction options when the graph is paused for human input.
5
+ *
6
+ * @property {boolean} allow_ignore - Whether the human can choose to ignore/skip the current step
7
+ * @property {boolean} allow_respond - Whether the human can provide a text response/feedback
8
+ * @property {boolean} allow_edit - Whether the human can edit the provided content/state
9
+ * @property {boolean} allow_accept - Whether the human can accept/approve the current state
10
+ */
11
+ interface HumanInterruptConfig {
12
+ allow_ignore: boolean;
13
+ allow_respond: boolean;
14
+ allow_edit: boolean;
15
+ allow_accept: boolean;
16
+ }
17
+ /**
18
+ * Represents a request for human action within the graph execution.
19
+ * Contains the action type and any associated arguments needed for the action.
20
+ *
21
+ * @property {string} action - The type or name of action being requested (e.g., "Approve XYZ action")
22
+ * @property {Record<string, any>} args - Key-value pairs of arguments needed for the action
23
+ */
24
+ interface ActionRequest {
25
+ action: string;
26
+ args: Record<string, any>;
27
+ }
28
+ /**
29
+ * Represents an interrupt triggered by the graph that requires human intervention.
30
+ * This is passed to the `interrupt` function when execution is paused for human input.
31
+ *
32
+ * @property {ActionRequest} action_request - The specific action being requested from the human
33
+ * @property {HumanInterruptConfig} config - Configuration defining what actions are allowed
34
+ * @property {string} [description] - Optional detailed description of what input is needed
35
+ */
36
+ interface HumanInterrupt {
37
+ action_request: ActionRequest;
38
+ config: HumanInterruptConfig;
39
+ description?: string;
40
+ }
41
+ /**
42
+ * The response provided by a human to an interrupt, which is returned when graph execution resumes.
43
+ *
44
+ * @property {("accept"|"ignore"|"response"|"edit")} type - The type of response:
45
+ * - "accept": Approves the current state without changes
46
+ * - "ignore": Skips/ignores the current step
47
+ * - "response": Provides text feedback or instructions
48
+ * - "edit": Modifies the current state/content
49
+ * @property {null|string|ActionRequest} args - The response payload:
50
+ * - null: For ignore/accept actions
51
+ * - string: For text responses
52
+ * - ActionRequest: For edit actions with updated content
53
+ */
54
+ type HumanResponse = {
55
+ type: "accept" | "ignore" | "response" | "edit";
56
+ args: null | string | ActionRequest;
57
+ };
58
+ //#endregion
59
+ export { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse };
60
+ //# sourceMappingURL=interrupt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interrupt.d.ts","names":["HumanInterruptConfig","ActionRequest","Record","HumanInterrupt","HumanResponse"],"sources":["../../src/prebuilt/interrupt.d.ts"],"sourcesContent":["/**\n * Configuration interface that defines what actions are allowed for a human interrupt.\n * This controls the available interaction options when the graph is paused for human input.\n *\n * @property {boolean} allow_ignore - Whether the human can choose to ignore/skip the current step\n * @property {boolean} allow_respond - Whether the human can provide a text response/feedback\n * @property {boolean} allow_edit - Whether the human can edit the provided content/state\n * @property {boolean} allow_accept - Whether the human can accept/approve the current state\n */\nexport interface HumanInterruptConfig {\n allow_ignore: boolean;\n allow_respond: boolean;\n allow_edit: boolean;\n allow_accept: boolean;\n}\n/**\n * Represents a request for human action within the graph execution.\n * Contains the action type and any associated arguments needed for the action.\n *\n * @property {string} action - The type or name of action being requested (e.g., \"Approve XYZ action\")\n * @property {Record<string, any>} args - Key-value pairs of arguments needed for the action\n */\nexport interface ActionRequest {\n action: string;\n args: Record<string, any>;\n}\n/**\n * Represents an interrupt triggered by the graph that requires human intervention.\n * This is passed to the `interrupt` function when execution is paused for human input.\n *\n * @property {ActionRequest} action_request - The specific action being requested from the human\n * @property {HumanInterruptConfig} config - Configuration defining what actions are allowed\n * @property {string} [description] - Optional detailed description of what input is needed\n */\nexport interface HumanInterrupt {\n action_request: ActionRequest;\n config: HumanInterruptConfig;\n description?: string;\n}\n/**\n * The response provided by a human to an interrupt, which is returned when graph execution resumes.\n *\n * @property {(\"accept\"|\"ignore\"|\"response\"|\"edit\")} type - The type of response:\n * - \"accept\": Approves the current state without changes\n * - \"ignore\": Skips/ignores the current step\n * - \"response\": Provides text feedback or instructions\n * - \"edit\": Modifies the current state/content\n * @property {null|string|ActionRequest} args - The response payload:\n * - null: For ignore/accept actions\n * - string: For text responses\n * - ActionRequest: For edit actions with updated content\n */\nexport type HumanResponse = {\n type: \"accept\" | \"ignore\" | \"response\" | \"edit\";\n args: null | string | ActionRequest;\n};\n"],"mappings":";;AASA;AAaA;AAYA;;;;;AAkBA;UA3CiBA,oBAAAA;;;;;;;;;;;;;UAaAC,aAAAA;;QAEPC;;;;;;;;;;UAUOC,cAAAA;kBACGF;UACRD;;;;;;;;;;;;;;;;KAgBAI,aAAAA;;wBAEcH"}