langchain 1.0.0-alpha.3 → 1.0.0-alpha.5

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 (201) hide show
  1. package/dist/agents/ReactAgent.cjs +1 -1
  2. package/dist/agents/ReactAgent.cjs.map +1 -1
  3. package/dist/agents/ReactAgent.d.cts +3 -3
  4. package/dist/agents/ReactAgent.d.cts.map +1 -1
  5. package/dist/agents/ReactAgent.d.ts +3 -3
  6. package/dist/agents/ReactAgent.d.ts.map +1 -1
  7. package/dist/agents/ReactAgent.js +2 -2
  8. package/dist/agents/ReactAgent.js.map +1 -1
  9. package/dist/agents/RunnableCallable.cjs +5 -0
  10. package/dist/agents/RunnableCallable.cjs.map +1 -1
  11. package/dist/agents/RunnableCallable.d.cts +2 -0
  12. package/dist/agents/RunnableCallable.d.cts.map +1 -1
  13. package/dist/agents/RunnableCallable.d.ts +2 -0
  14. package/dist/agents/RunnableCallable.d.ts.map +1 -1
  15. package/dist/agents/RunnableCallable.js +5 -0
  16. package/dist/agents/RunnableCallable.js.map +1 -1
  17. package/dist/agents/annotation.cjs +2 -2
  18. package/dist/agents/annotation.cjs.map +1 -1
  19. package/dist/agents/annotation.d.cts +4 -4
  20. package/dist/agents/annotation.d.cts.map +1 -1
  21. package/dist/agents/annotation.d.ts +3 -3
  22. package/dist/agents/annotation.d.ts.map +1 -1
  23. package/dist/agents/annotation.js +2 -2
  24. package/dist/agents/annotation.js.map +1 -1
  25. package/dist/agents/createAgent.cjs +10 -0
  26. package/dist/agents/createAgent.cjs.map +1 -0
  27. package/dist/agents/createAgent.js +10 -0
  28. package/dist/agents/createAgent.js.map +1 -0
  29. package/dist/agents/errors.cjs +1 -1
  30. package/dist/agents/errors.cjs.map +1 -1
  31. package/dist/agents/errors.js +1 -1
  32. package/dist/agents/errors.js.map +1 -1
  33. package/dist/agents/index.cjs +23 -4
  34. package/dist/agents/index.cjs.map +1 -1
  35. package/dist/agents/index.d.cts +96 -33
  36. package/dist/agents/index.d.cts.map +1 -1
  37. package/dist/agents/index.d.ts +96 -33
  38. package/dist/agents/index.d.ts.map +1 -1
  39. package/dist/agents/index.js +23 -4
  40. package/dist/agents/index.js.map +1 -1
  41. package/dist/agents/middlewareAgent/ReactAgent.cjs +255 -0
  42. package/dist/agents/middlewareAgent/ReactAgent.cjs.map +1 -0
  43. package/dist/agents/middlewareAgent/ReactAgent.d.cts +68 -0
  44. package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +1 -0
  45. package/dist/agents/middlewareAgent/ReactAgent.d.ts +68 -0
  46. package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +1 -0
  47. package/dist/agents/middlewareAgent/ReactAgent.js +254 -0
  48. package/dist/agents/middlewareAgent/ReactAgent.js.map +1 -0
  49. package/dist/agents/middlewareAgent/annotation.cjs +39 -0
  50. package/dist/agents/middlewareAgent/annotation.cjs.map +1 -0
  51. package/dist/agents/middlewareAgent/annotation.js +38 -0
  52. package/dist/agents/middlewareAgent/annotation.js.map +1 -0
  53. package/dist/agents/middlewareAgent/index.cjs +11 -0
  54. package/dist/agents/middlewareAgent/index.cjs.map +1 -0
  55. package/dist/agents/middlewareAgent/index.js +11 -0
  56. package/dist/agents/middlewareAgent/index.js.map +1 -0
  57. package/dist/agents/middlewareAgent/middleware.cjs +47 -0
  58. package/dist/agents/middlewareAgent/middleware.cjs.map +1 -0
  59. package/dist/agents/middlewareAgent/middleware.d.cts +46 -0
  60. package/dist/agents/middlewareAgent/middleware.d.cts.map +1 -0
  61. package/dist/agents/middlewareAgent/middleware.d.ts +46 -0
  62. package/dist/agents/middlewareAgent/middleware.d.ts.map +1 -0
  63. package/dist/agents/middlewareAgent/middleware.js +46 -0
  64. package/dist/agents/middlewareAgent/middleware.js.map +1 -0
  65. package/dist/agents/middlewareAgent/middlewares/hitl.cjs +235 -0
  66. package/dist/agents/middlewareAgent/middlewares/hitl.cjs.map +1 -0
  67. package/dist/agents/middlewareAgent/middlewares/hitl.d.cts +199 -0
  68. package/dist/agents/middlewareAgent/middlewares/hitl.d.cts.map +1 -0
  69. package/dist/agents/middlewareAgent/middlewares/hitl.d.ts +199 -0
  70. package/dist/agents/middlewareAgent/middlewares/hitl.d.ts.map +1 -0
  71. package/dist/agents/middlewareAgent/middlewares/hitl.js +234 -0
  72. package/dist/agents/middlewareAgent/middlewares/hitl.js.map +1 -0
  73. package/dist/agents/middlewareAgent/middlewares/index.cjs +8 -0
  74. package/dist/agents/middlewareAgent/middlewares/index.d.cts +4 -0
  75. package/dist/agents/middlewareAgent/middlewares/index.d.ts +4 -0
  76. package/dist/agents/middlewareAgent/middlewares/index.js +5 -0
  77. package/dist/agents/middlewareAgent/middlewares/promptCaching.cjs +153 -0
  78. package/dist/agents/middlewareAgent/middlewares/promptCaching.cjs.map +1 -0
  79. package/dist/agents/middlewareAgent/middlewares/promptCaching.d.cts +152 -0
  80. package/dist/agents/middlewareAgent/middlewares/promptCaching.d.cts.map +1 -0
  81. package/dist/agents/middlewareAgent/middlewares/promptCaching.d.ts +152 -0
  82. package/dist/agents/middlewareAgent/middlewares/promptCaching.d.ts.map +1 -0
  83. package/dist/agents/middlewareAgent/middlewares/promptCaching.js +152 -0
  84. package/dist/agents/middlewareAgent/middlewares/promptCaching.js.map +1 -0
  85. package/dist/agents/middlewareAgent/middlewares/summarization.cjs +262 -0
  86. package/dist/agents/middlewareAgent/middlewares/summarization.cjs.map +1 -0
  87. package/dist/agents/middlewareAgent/middlewares/summarization.d.cts +89 -0
  88. package/dist/agents/middlewareAgent/middlewares/summarization.d.cts.map +1 -0
  89. package/dist/agents/middlewareAgent/middlewares/summarization.d.ts +89 -0
  90. package/dist/agents/middlewareAgent/middlewares/summarization.d.ts.map +1 -0
  91. package/dist/agents/middlewareAgent/middlewares/summarization.js +260 -0
  92. package/dist/agents/middlewareAgent/middlewares/summarization.js.map +1 -0
  93. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs +29 -0
  94. package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +1 -0
  95. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js +29 -0
  96. package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +1 -0
  97. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +332 -0
  98. package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +1 -0
  99. package/dist/agents/middlewareAgent/nodes/AgentNode.js +331 -0
  100. package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +1 -0
  101. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs +27 -0
  102. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +1 -0
  103. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js +27 -0
  104. package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +1 -0
  105. package/dist/agents/middlewareAgent/nodes/middleware.cjs +73 -0
  106. package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +1 -0
  107. package/dist/agents/middlewareAgent/nodes/middleware.js +73 -0
  108. package/dist/agents/middlewareAgent/nodes/middleware.js.map +1 -0
  109. package/dist/agents/middlewareAgent/nodes/utils.cjs +74 -0
  110. package/dist/agents/middlewareAgent/nodes/utils.cjs.map +1 -0
  111. package/dist/agents/middlewareAgent/nodes/utils.js +70 -0
  112. package/dist/agents/middlewareAgent/nodes/utils.js.map +1 -0
  113. package/dist/agents/middlewareAgent/types.d.cts +393 -0
  114. package/dist/agents/middlewareAgent/types.d.cts.map +1 -0
  115. package/dist/agents/middlewareAgent/types.d.ts +393 -0
  116. package/dist/agents/middlewareAgent/types.d.ts.map +1 -0
  117. package/dist/agents/nodes/AgentNode.cjs.map +1 -1
  118. package/dist/agents/nodes/AgentNode.js.map +1 -1
  119. package/dist/agents/nodes/ToolNode.cjs +1 -1
  120. package/dist/agents/nodes/ToolNode.cjs.map +1 -1
  121. package/dist/agents/nodes/ToolNode.d.cts +4 -4
  122. package/dist/agents/nodes/ToolNode.d.cts.map +1 -1
  123. package/dist/agents/nodes/ToolNode.d.ts +1 -1
  124. package/dist/agents/nodes/ToolNode.d.ts.map +1 -1
  125. package/dist/agents/nodes/ToolNode.js +1 -1
  126. package/dist/agents/nodes/ToolNode.js.map +1 -1
  127. package/dist/agents/responses.cjs +1 -1
  128. package/dist/agents/responses.cjs.map +1 -1
  129. package/dist/agents/responses.d.cts +1 -1
  130. package/dist/agents/responses.d.cts.map +1 -1
  131. package/dist/agents/responses.d.ts +1 -1
  132. package/dist/agents/responses.d.ts.map +1 -1
  133. package/dist/agents/responses.js +1 -1
  134. package/dist/agents/responses.js.map +1 -1
  135. package/dist/agents/types.d.cts +12 -12
  136. package/dist/agents/types.d.cts.map +1 -1
  137. package/dist/agents/types.d.ts +8 -8
  138. package/dist/agents/types.d.ts.map +1 -1
  139. package/dist/agents/utils.cjs +1 -1
  140. package/dist/agents/utils.cjs.map +1 -1
  141. package/dist/agents/utils.js +1 -1
  142. package/dist/agents/utils.js.map +1 -1
  143. package/dist/agents/withAgentName.cjs +1 -1
  144. package/dist/agents/withAgentName.cjs.map +1 -1
  145. package/dist/agents/withAgentName.js +1 -1
  146. package/dist/agents/withAgentName.js.map +1 -1
  147. package/dist/chains/api/api_chain.d.cts +1 -1
  148. package/dist/chains/base.d.cts +1 -1
  149. package/dist/chains/combine_docs_chain.d.cts +1 -1
  150. package/dist/chains/combine_documents/stuff.d.cts +1 -1
  151. package/dist/chains/conversational_retrieval_chain.d.cts +1 -1
  152. package/dist/chains/graph_qa/cypher.d.cts +1 -1
  153. package/dist/chains/history_aware_retriever.d.cts +2 -2
  154. package/dist/chains/llm_chain.d.cts +3 -3
  155. package/dist/chains/openai_functions/base.d.cts +3 -3
  156. package/dist/chains/openai_functions/openapi.d.cts +1 -1
  157. package/dist/chains/openai_functions/structured_output.d.cts +3 -3
  158. package/dist/chains/openai_functions/tagging.d.cts +1 -1
  159. package/dist/chains/query_constructor/index.cjs +1 -1
  160. package/dist/chains/query_constructor/index.d.cts +2 -2
  161. package/dist/chains/query_constructor/index.d.ts +1 -1
  162. package/dist/chains/query_constructor/index.js +1 -1
  163. package/dist/chains/question_answering/load.d.ts +2 -2
  164. package/dist/chains/question_answering/load.d.ts.map +1 -1
  165. package/dist/chains/retrieval.d.cts +1 -1
  166. package/dist/chains/router/llm_router.d.cts +1 -1
  167. package/dist/chains/router/multi_prompt.cjs +1 -1
  168. package/dist/chains/router/multi_prompt.js +1 -1
  169. package/dist/chains/router/multi_retrieval_qa.cjs +1 -1
  170. package/dist/chains/router/multi_retrieval_qa.js +1 -1
  171. package/dist/chains/sql_db/sql_db_chain.d.cts +2 -2
  172. package/dist/chains/summarization/load.d.ts +2 -2
  173. package/dist/chains/summarization/load.d.ts.map +1 -1
  174. package/dist/chat_models/universal.d.cts +3 -3
  175. package/dist/evaluation/agents/trajectory.d.cts +3 -3
  176. package/dist/evaluation/agents/trajectory.d.ts.map +1 -1
  177. package/dist/evaluation/comparison/pairwise.d.cts +1 -1
  178. package/dist/evaluation/comparison/pairwise.d.ts.map +1 -1
  179. package/dist/evaluation/criteria/criteria.d.cts +1 -1
  180. package/dist/evaluation/qa/eval_chain.d.cts +1 -1
  181. package/dist/index.cjs +5 -2
  182. package/dist/index.cjs.map +1 -1
  183. package/dist/index.d.cts +6 -5
  184. package/dist/index.d.ts +4 -3
  185. package/dist/index.js +5 -3
  186. package/dist/index.js.map +1 -1
  187. package/dist/load/import_map.cjs +1 -1
  188. package/dist/load/import_map.js +1 -1
  189. package/dist/memory/summary.d.cts +1 -1
  190. package/dist/output_parsers/fix.d.cts +1 -1
  191. package/dist/output_parsers/http_response.d.cts +1 -1
  192. package/dist/output_parsers/structured.cjs +1 -1
  193. package/dist/output_parsers/structured.d.cts +2 -2
  194. package/dist/output_parsers/structured.d.ts +1 -1
  195. package/dist/output_parsers/structured.js +1 -1
  196. package/dist/tools/fs.d.cts +1 -1
  197. package/dist/tools/json.d.cts +1 -1
  198. package/dist/tools/retriever.d.cts +1 -1
  199. package/dist/tools/vectorstore.d.cts +1 -1
  200. package/dist/tools/webbrowser.d.cts +1 -1
  201. package/package.json +14 -3
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["InteropZodObject","InteropZodType","MessagesAnnotation","AnyAnnotationRoot","CreateReactAgentParams","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","ResponseFormatUndefined","JsonSchemaFormat","ReactAgent","createReactAgent","Record","StateSchema","T","ContextSchema","Omit","StructuredResponseFormat","ToolNode","toolStrategy","providerStrategy"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["import type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { MessagesAnnotation } from \"@langchain/langgraph\";\nimport { type AnyAnnotationRoot } from \"./annotation.js\";\nimport type { CreateReactAgentParams, ExtractZodArrayTypes } from \"./types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormat, ResponseFormatUndefined, JsonSchemaFormat } from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n/**\n * Creates a StateGraph agent that relies on a chat model utilizing tool calling.\n *\n * @example\n * ```ts\n * import { ChatOpenAI } from \"@langchain/openai\";\n * import { createReactAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const model = new ChatOpenAI({\n * model: \"gpt-4o\",\n * });\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 = createReactAgent({ llm: model, tools: [getWeather] });\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// Overload 1: With responseFormat as single InteropZodType\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport declare function createReactAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {\n responseFormat: T;\n}): ReactAgent<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema>;\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n}): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n}): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n}): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 7: With responseFormat as ProviderStrategy\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 8: Without responseFormat property at all\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateReactAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\">): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 9: With responseFormat explicitly undefined\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateReactAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n}): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 10: For other ResponseFormat values (failsafe)\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, StructuredResponseFormat, ContextSchema, ResponseFormat> & {\n responseFormat: ResponseFormat;\n}): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport * from \"./interrupt.js\";\nexport { ToolNode } from \"./nodes/ToolNode.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, } from \"./responses.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAgDA;;;;;;;;;;;;;;;;;;;;;;AAEc;AAEd;;;;;;;;;;;;;;AAA2VK,iBAJnUQ,gBAImUR,CAAAA,oBAJ9RF,iBAI8RE,GAJ1QL,gBAI0QK,GAAAA,OAJhPH,kBAIgPG,EAAAA,UAJlNS,MAIkNT,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAJ5LS,MAI4LT,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAJjJF,iBAIiJE,GAJ7HL,gBAI6HK,G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e,IAxBzM,CAwB8Md,sBAxB9M,CAwBqOW,WAxBrO,EAwBkPL,uBAxBlP,EAwB2QO,aAxB3Q,EAAA,KAAA,CAAA,EAAA,gBAAA,CAAA,GAAA;EAEUJ,cAAAA,CAAAA,EAAAA,SAAgB;CAAA,CAAA,EAwBpCD,UAxBoC,CAwBzBG,WAxByB,EAwBZL,uBAxBY,EAwBaO,aAxBb,CAAA;;AAAyCjB,iBA0BzDa,gBA1ByDb,CAAAA,oBA0BpBG,iBA1BoBH,GA0BAA,gBA1BAA,GAAAA,OA0B0BE,kBA1B1BF,EAAAA,iCA0B+Ec,MA1B/Ed,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GA0BqGc,MA1BrGd,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBA0BgJG,iBA1BhJH,GA0BoKA,gBA1BpKA,GA0BuLG,iBA1BvLH,CAAAA,CAAAA,MAAAA,EA0BkNI,sBA1BlNJ,CA0ByOe,WA1BzOf,EA0BsPmB,wBA1BtPnB,EA0BgRiB,aA1BhRjB,EA0B+RS,cA1B/RT,CAAAA,GAAAA;EAAgB,cAAUE,EA2BvFO,cA3BuFP;CAAkB,CAAA,EA4BzHU,UA5BiJT,CA4BtIY,WA5BsIZ,EA4BzHgB,wBA5ByHhB,EA4B/Fc,aA5B+Fd,CAAAA"}
1
+ {"version":3,"file":"index.d.cts","names":["InteropZodObject","InteropZodType","MessagesAnnotation","ReactAgent","ReactAgentV1","ReactAgentV2","AnyAnnotationRoot","CreateAgentParams","ExtractZodArrayTypes","CreateAgentParamsV2","AgentMiddleware","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormatUndefined","JsonSchemaFormat","ToolNode","toolStrategy","providerStrategy","ResponseFormat","createMiddleware","createAgent","Record","StateSchema","T","ContextSchema","Omit","StructuredResponseFormat","TMiddlewares"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["import type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { MessagesAnnotation } from \"@langchain/langgraph\";\nimport { ReactAgent as ReactAgentV1 } from \"./ReactAgent.js\";\nimport { ReactAgent as ReactAgentV2 } from \"./middlewareAgent/ReactAgent.js\";\nimport { type AnyAnnotationRoot } from \"./annotation.js\";\nimport type { CreateAgentParams, ExtractZodArrayTypes } from \"./types.js\";\nimport type { CreateAgentParams as CreateAgentParamsV2, AgentMiddleware } from \"./middlewareAgent/types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormatUndefined, JsonSchemaFormat } from \"./responses.js\";\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport * from \"./interrupt.js\";\nexport { ToolNode } from \"./nodes/ToolNode.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, } from \"./responses.js\";\nexport { createMiddleware } from \"./middlewareAgent/index.js\";\nexport type { AgentMiddleware } from \"./middlewareAgent/types.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\";\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// ===== V1 OVERLOADS (WITHOUT MIDDLEWARE) =====\n// These overloads come first to ensure proper type inference when middlewares is NOT provided\n// Overload 1: V1 - With responseFormat as single InteropZodType\nexport 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>> & {\n responseFormat: InteropZodType<T>;\n}): ReactAgentV1<StateSchema, T, ContextSchema>;\n// Overload 2: V1 - With responseFormat as array of InteropZodTypes\nexport 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> & {\n responseFormat: T;\n}): ReactAgentV1<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema>;\n// Overload 3: V1 - With responseFormat as JsonSchemaFormat\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n}): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 4: V1 - With responseFormat as array of JsonSchemaFormat\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n}): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 5: V1 - With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n}): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 6: V1 - With responseFormat as TypedToolStrategy\nexport 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>> & {\n responseFormat: TypedToolStrategy<T>;\n}): ReactAgentV1<StateSchema, T, ContextSchema>;\n// Overload 7: V1 - With responseFormat as single ToolStrategy\nexport 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>> & {\n responseFormat: ToolStrategy<T>;\n}): ReactAgentV1<StateSchema, T, ContextSchema>;\n// Overload 8: V1 - With responseFormat as ProviderStrategy\nexport 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>> & {\n responseFormat: ProviderStrategy<T>;\n}): ReactAgentV1<StateSchema, T, ContextSchema>;\n// Overload 9: V1 - Without responseFormat property at all\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\">): ReactAgentV1<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 10: V1 - With responseFormat explicitly undefined\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n}): ReactAgentV1<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 11: V1 - For other ResponseFormat values (failsafe)\nexport 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> & {\n responseFormat: any;\n}): ReactAgentV1<StateSchema, StructuredResponseFormat, ContextSchema>;\n// ===== V2 OVERLOADS (WITH MIDDLEWARE) =====\n// These overloads explicitly require the middlewares property\n// Overload 12: With responseFormat as single InteropZodType and middlewares\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middlewares: TMiddlewares;\n}): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n// Overload 13: With responseFormat as array of InteropZodTypes and middlewares\nexport declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {\n responseFormat: T;\n middlewares: TMiddlewares;\n}): ReactAgentV2<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddlewares>;\n// Overload 14: With responseFormat as JsonSchemaFormat and middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n middlewares: TMiddlewares;\n}): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n// Overload 15: With responseFormat as array of JsonSchemaFormat and middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n middlewares: TMiddlewares;\n}): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n// Overload 16: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[] and middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middlewares: TMiddlewares;\n}): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n// Overload 17: With responseFormat as TypedToolStrategy and middlewares\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middlewares: TMiddlewares;\n}): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n// Overload 18: With responseFormat as single ToolStrategy and middlewares\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middlewares: TMiddlewares;\n}): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n// Overload 19: With responseFormat as ProviderStrategy and middlewares\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middlewares: TMiddlewares;\n}): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n// Overload 20: Without responseFormat but with middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: Omit<CreateAgentParamsV2<ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n middlewares: TMiddlewares;\n}): ReactAgentV2<ResponseFormatUndefined, ContextSchema, TMiddlewares>;\n// Overload 21: With responseFormat explicitly undefined and middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: Omit<CreateAgentParamsV2<ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n middlewares: TMiddlewares;\n}): ReactAgentV2<ResponseFormatUndefined, ContextSchema, TMiddlewares>;\n// Overload 22: For other ResponseFormat values with middlewares (failsafe)\nexport declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<StructuredResponseFormat, ContextSchema, any> & {\n responseFormat: any;\n middlewares: TMiddlewares;\n}): ReactAgentV2<StructuredResponseFormat, ContextSchema, TMiddlewares>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;AAEoFQ,iBAN5Da,WAM4Db,CAAAA,oBAN5BF,iBAM4BE,GANRR,gBAMQQ,GAAAA,OANkBN,kBAMlBM,EAAAA,UANgDc,MAMhDd,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GANsEc,MAMtEd,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBANiHF,iBAMjHE,GANqIR,gBAMrIQ,GANwJF,iBAMxJE,CAAAA,CAAAA,MAAAA,EANmLD,iBAMnLC,CANqMe,WAMrMf,EANkNgB,CAMlNhB,EANqNiB,aAMrNjB,EANoOP,cAMpOO,CANmPgB,CAMnPhB,CAAAA,CAAAA,GAAAA;EAAoB,cAAMc,EAL1FrB,cAK0FqB,CAL3EE,CAK2E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AAqBnB,CAAAA,EAAAA,SAAAA;EAAiB,WAAGN,EAkE3D4B,YAlE2D5B;CAAgB,CAAA,EAmExFK,YAnEkGH,CAmErFY,uBAnEqFZ,EAmE5DuB,aAnE4DvB,EAmE7C0B,YAnE6C1B,CAAAA;;AAAoDoB,iBAqElID,WArEkIC,CAAAA,iCAqErFA,MArEqFA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAqE/DA,MArE+DA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAqEpBhB,iBArEoBgB,GAqEAtB,gBArEAsB,GAqEmBhB,iBArEnBgB,EAAAA,qBAAAA,SAqEoEZ,eArEpEY,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,GAAAA,SAqEgHZ,eArEhHY,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,CAAAA,CAAAA,MAAAA,EAqE0Jb,mBArE1Ja,CAqE8KK,wBArE9KL,EAqEwMG,aArExMH,EAAAA,GAAAA,CAAAA,GAAAA;EAAM,cAAqChB,EAAAA,GAAAA;EAAiB,WAAGN,EAuExM4B,YAvEwM5B;CAAgB,CAAA,EAwErOK,YAxEwOC,CAwE3NqB,wBAxE2NrB,EAwEjMmB,aAxEiMnB,EAwElLsB,YAxEkLtB,CAAAA"}
@@ -2,27 +2,28 @@ import { MultipleStructuredOutputsError, StructuredOutputParsingError } from "./
2
2
  import { JsonSchemaFormat, ProviderStrategy, ResponseFormat, ResponseFormatUndefined, ToolStrategy, TypedToolStrategy, providerStrategy, toolStrategy } from "./responses.js";
3
3
  import { AnyAnnotationRoot } from "./annotation.js";
4
4
  import { ToolNode } from "./nodes/ToolNode.js";
5
- import { AgentRuntime, AgentState, ClientTool, CreateReactAgentParams, ExtractZodArrayTypes, N, Prompt, ServerTool } from "./types.js";
5
+ import { AgentRuntime, AgentState, ClientTool, CreateAgentParams, ExtractZodArrayTypes, N, Prompt, ServerTool } from "./types.js";
6
+ import { AgentMiddleware, CreateAgentParams as CreateAgentParams$1 } from "./middlewareAgent/types.js";
6
7
  import { ReactAgent } from "./ReactAgent.js";
8
+ import { ReactAgent as ReactAgent$1 } from "./middlewareAgent/ReactAgent.js";
7
9
  import { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse } from "./interrupt.js";
10
+ import { createMiddleware } from "./middlewareAgent/middleware.js";
8
11
  import { MessagesAnnotation } from "@langchain/langgraph";
9
12
  import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
10
13
 
11
14
  //#region src/agents/index.d.ts
12
15
 
13
16
  /**
14
- * Creates a StateGraph agent that relies on a chat model utilizing tool calling.
17
+ * Agents combine language models with tools to create systems that can reason
18
+ * about tasks, decide which tools to use, and iteratively work towards solutions.
19
+ * {@link createAgent} provides a production-ready ReAct (Reasoning + Acting)
20
+ * agent implementation based on the paper {@link https://arxiv.org/abs/2210.03629|ReAct: Synergizing Reasoning and Acting in Language Models.}
15
21
  *
16
22
  * @example
17
23
  * ```ts
18
- * import { ChatOpenAI } from "@langchain/openai";
19
- * import { createReactAgent, tool } from "langchain";
24
+ * import { createAgent, tool } from "langchain";
20
25
  * import { z } from "zod";
21
26
  *
22
- * const model = new ChatOpenAI({
23
- * model: "gpt-4o",
24
- * });
25
- *
26
27
  * const getWeather = tool((input) => {
27
28
  * if (["sf", "san francisco"].includes(input.location.toLowerCase())) {
28
29
  * return "It's 60 degrees and foggy.";
@@ -37,7 +38,11 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
37
38
  * })
38
39
  * })
39
40
  *
40
- * const agent = createReactAgent({ llm: model, tools: [getWeather] });
41
+ * const agent = createAgent({
42
+ * // use chat model from "@langchain/openai"
43
+ * model: "openai:gpt-4o-mini",
44
+ * tools: [getWeather]
45
+ * });
41
46
  *
42
47
  * const inputs = {
43
48
  * messages: [{ role: "user", content: "what is the weather in SF?" }],
@@ -51,48 +56,106 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
51
56
  * // Returns the messages in the state at each step of execution
52
57
  * ```
53
58
  */
54
- // Overload 1: With responseFormat as single InteropZodType
55
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, InteropZodType<T>> & {
59
+ // ===== V1 OVERLOADS (WITHOUT MIDDLEWARE) =====
60
+ // These overloads come first to ensure proper type inference when middlewares is NOT provided
61
+ // Overload 1: V1 - With responseFormat as single InteropZodType
62
+ 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>> & {
56
63
  responseFormat: InteropZodType<T>;
57
64
  }): ReactAgent<StateSchema, T, ContextSchema>;
58
- // Overload 2: With responseFormat as array of InteropZodTypes (infers union type)
59
- declare function createReactAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {
65
+ // Overload 2: V1 - With responseFormat as array of InteropZodTypes
66
+ 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> & {
60
67
  responseFormat: T;
61
68
  }): ReactAgent<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema>;
62
- // Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)
63
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
69
+ // Overload 3: V1 - With responseFormat as JsonSchemaFormat
70
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
64
71
  responseFormat: JsonSchemaFormat;
65
72
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
66
- // Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)
67
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
73
+ // Overload 4: V1 - With responseFormat as array of JsonSchemaFormat
74
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
68
75
  responseFormat: JsonSchemaFormat[];
69
76
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
70
- // Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
71
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
77
+ // Overload 5: V1 - With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
78
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
72
79
  responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
73
80
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
74
- // Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)
75
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, TypedToolStrategy<T>> & {
81
+ // Overload 6: V1 - With responseFormat as TypedToolStrategy
82
+ 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>> & {
76
83
  responseFormat: TypedToolStrategy<T>;
77
84
  }): ReactAgent<StateSchema, T, ContextSchema>;
78
- // Overload 6: With responseFormat as single ToolStrategy instance
79
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, ToolStrategy<T>> & {
85
+ // Overload 7: V1 - With responseFormat as single ToolStrategy
86
+ 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>> & {
80
87
  responseFormat: ToolStrategy<T>;
81
88
  }): ReactAgent<StateSchema, T, ContextSchema>;
82
- // Overload 7: With responseFormat as ProviderStrategy
83
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, ProviderStrategy<T>> & {
89
+ // Overload 8: V1 - With responseFormat as ProviderStrategy
90
+ 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>> & {
84
91
  responseFormat: ProviderStrategy<T>;
85
92
  }): ReactAgent<StateSchema, T, ContextSchema>;
86
- // Overload 8: Without responseFormat property at all
87
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateReactAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, "responseFormat">): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;
88
- // Overload 9: With responseFormat explicitly undefined
89
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateReactAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
93
+ // Overload 9: V1 - Without responseFormat property at all
94
+ 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>;
95
+ // Overload 10: V1 - With responseFormat explicitly undefined
96
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
90
97
  responseFormat?: undefined;
91
98
  }): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;
92
- // Overload 10: For other ResponseFormat values (failsafe)
93
- declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, StructuredResponseFormat, ContextSchema, ResponseFormat> & {
94
- responseFormat: ResponseFormat;
99
+ // Overload 11: V1 - For other ResponseFormat values (failsafe)
100
+ 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> & {
101
+ responseFormat: any;
95
102
  }): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;
103
+ // ===== V2 OVERLOADS (WITH MIDDLEWARE) =====
104
+ // These overloads explicitly require the middlewares property
105
+ // Overload 12: With responseFormat as single InteropZodType and middlewares
106
+ declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<T, ContextSchema, InteropZodType<T>> & {
107
+ responseFormat: InteropZodType<T>;
108
+ middlewares: TMiddlewares;
109
+ }): ReactAgent$1<T, ContextSchema, TMiddlewares>;
110
+ // Overload 13: With responseFormat as array of InteropZodTypes and middlewares
111
+ declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares 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> & {
112
+ responseFormat: T;
113
+ middlewares: TMiddlewares;
114
+ }): ReactAgent$1<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddlewares>;
115
+ // Overload 14: With responseFormat as JsonSchemaFormat and middlewares
116
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
117
+ responseFormat: JsonSchemaFormat;
118
+ middlewares: TMiddlewares;
119
+ }): ReactAgent$1<Record<string, unknown>, ContextSchema, TMiddlewares>;
120
+ // Overload 15: With responseFormat as array of JsonSchemaFormat and middlewares
121
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
122
+ responseFormat: JsonSchemaFormat[];
123
+ middlewares: TMiddlewares;
124
+ }): ReactAgent$1<Record<string, unknown>, ContextSchema, TMiddlewares>;
125
+ // Overload 16: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[] and middlewares
126
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
127
+ responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
128
+ middlewares: TMiddlewares;
129
+ }): ReactAgent$1<Record<string, unknown>, ContextSchema, TMiddlewares>;
130
+ // Overload 17: With responseFormat as TypedToolStrategy and middlewares
131
+ declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<T, ContextSchema, TypedToolStrategy<T>> & {
132
+ responseFormat: TypedToolStrategy<T>;
133
+ middlewares: TMiddlewares;
134
+ }): ReactAgent$1<T, ContextSchema, TMiddlewares>;
135
+ // Overload 18: With responseFormat as single ToolStrategy and middlewares
136
+ declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<T, ContextSchema, ToolStrategy<T>> & {
137
+ responseFormat: ToolStrategy<T>;
138
+ middlewares: TMiddlewares;
139
+ }): ReactAgent$1<T, ContextSchema, TMiddlewares>;
140
+ // Overload 19: With responseFormat as ProviderStrategy and middlewares
141
+ declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<T, ContextSchema, ProviderStrategy<T>> & {
142
+ responseFormat: ProviderStrategy<T>;
143
+ middlewares: TMiddlewares;
144
+ }): ReactAgent$1<T, ContextSchema, TMiddlewares>;
145
+ // Overload 20: Without responseFormat but with middlewares
146
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: Omit<CreateAgentParams$1<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
147
+ middlewares: TMiddlewares;
148
+ }): ReactAgent$1<ResponseFormatUndefined, ContextSchema, TMiddlewares>;
149
+ // Overload 21: With responseFormat explicitly undefined and middlewares
150
+ declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: Omit<CreateAgentParams$1<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
151
+ responseFormat?: undefined;
152
+ middlewares: TMiddlewares;
153
+ }): ReactAgent$1<ResponseFormatUndefined, ContextSchema, TMiddlewares>;
154
+ // Overload 22: For other ResponseFormat values with middlewares (failsafe)
155
+ declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParams$1<StructuredResponseFormat, ContextSchema, any> & {
156
+ responseFormat: any;
157
+ middlewares: TMiddlewares;
158
+ }): ReactAgent$1<StructuredResponseFormat, ContextSchema, TMiddlewares>;
96
159
  //#endregion
97
- export { createReactAgent };
160
+ export { createAgent };
98
161
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["InteropZodObject","InteropZodType","MessagesAnnotation","AnyAnnotationRoot","CreateReactAgentParams","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","ResponseFormatUndefined","JsonSchemaFormat","ReactAgent","createReactAgent","Record","StateSchema","T","ContextSchema","Omit","StructuredResponseFormat","ToolNode","toolStrategy","providerStrategy"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["import type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { MessagesAnnotation } from \"@langchain/langgraph\";\nimport { type AnyAnnotationRoot } from \"./annotation.js\";\nimport type { CreateReactAgentParams, ExtractZodArrayTypes } from \"./types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormat, ResponseFormatUndefined, JsonSchemaFormat } from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n/**\n * Creates a StateGraph agent that relies on a chat model utilizing tool calling.\n *\n * @example\n * ```ts\n * import { ChatOpenAI } from \"@langchain/openai\";\n * import { createReactAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const model = new ChatOpenAI({\n * model: \"gpt-4o\",\n * });\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 = createReactAgent({ llm: model, tools: [getWeather] });\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// Overload 1: With responseFormat as single InteropZodType\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport declare function createReactAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {\n responseFormat: T;\n}): ReactAgent<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema>;\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n}): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n}): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n}): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 7: With responseFormat as ProviderStrategy\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 8: Without responseFormat property at all\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateReactAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\">): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 9: With responseFormat explicitly undefined\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateReactAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n}): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 10: For other ResponseFormat values (failsafe)\nexport declare function createReactAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<StateSchema, StructuredResponseFormat, ContextSchema, ResponseFormat> & {\n responseFormat: ResponseFormat;\n}): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport * from \"./interrupt.js\";\nexport { ToolNode } from \"./nodes/ToolNode.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, } from \"./responses.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAgDA;;;;;;;;;;;;;;;;;;;;;;AAEc;AAEd;;;;;;;;;;;;;;AAA2VK,iBAJnUQ,gBAImUR,CAAAA,oBAJ9RF,iBAI8RE,GAJ1QL,gBAI0QK,GAAAA,OAJhPH,kBAIgPG,EAAAA,UAJlNS,MAIkNT,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAJ5LS,MAI4LT,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAJjJF,iBAIiJE,GAJ7HL,gBAI6HK,GAJ1GF,iBAI0GE,CAAAA,CAAAA,MAAAA,EAJ/ED,sBAI+EC,CAJxDU,WAIwDV,EAJ3CW,CAI2CX,EAJxCY,aAIwCZ,EAJzBJ,cAIyBI,CAJVW,CAIUX,CAAAA,CAAAA,GAAAA;EAAoB,cAAMS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EAwBpCD,UAxBoC,CAwBzBG,WAxByB,EAwBZL,uBAxBY,EAwBaO,aAxBb,CAAA;;AAAyCjB,iBA0BzDa,gBA1ByDb,CAAAA,oBA0BpBG,iBA1BoBH,GA0BAA,gBA1BAA,GAAAA,OA0B0BE,kBA1B1BF,EAAAA,iCA0B+Ec,MA1B/Ed,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GA0BqGc,MA1BrGd,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBA0BgJG,iBA1BhJH,GA0BoKA,gBA1BpKA,GA0BuLG,iBA1BvLH,CAAAA,CAAAA,MAAAA,EA0BkNI,sBA1BlNJ,CA0ByOe,WA1BzOf,EA0BsPmB,wBA1BtPnB,EA0BgRiB,aA1BhRjB,EA0B+RS,cA1B/RT,CAAAA,GAAAA;EAAgB,cAAUE,EA2BvFO,cA3BuFP;CAAkB,CAAA,EA4BzHU,UA5BiJT,CA4BtIY,WA5BsIZ,EA4BzHgB,wBA5ByHhB,EA4B/Fc,aA5B+Fd,CAAAA"}
1
+ {"version":3,"file":"index.d.ts","names":["InteropZodObject","InteropZodType","MessagesAnnotation","ReactAgent","ReactAgentV1","ReactAgentV2","AnyAnnotationRoot","CreateAgentParams","ExtractZodArrayTypes","CreateAgentParamsV2","AgentMiddleware","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormatUndefined","JsonSchemaFormat","ToolNode","toolStrategy","providerStrategy","ResponseFormat","createMiddleware","createAgent","Record","StateSchema","T","ContextSchema","Omit","StructuredResponseFormat","TMiddlewares"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["import type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { MessagesAnnotation } from \"@langchain/langgraph\";\nimport { ReactAgent as ReactAgentV1 } from \"./ReactAgent.js\";\nimport { ReactAgent as ReactAgentV2 } from \"./middlewareAgent/ReactAgent.js\";\nimport { type AnyAnnotationRoot } from \"./annotation.js\";\nimport type { CreateAgentParams, ExtractZodArrayTypes } from \"./types.js\";\nimport type { CreateAgentParams as CreateAgentParamsV2, AgentMiddleware } from \"./middlewareAgent/types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormatUndefined, JsonSchemaFormat } from \"./responses.js\";\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport * from \"./interrupt.js\";\nexport { ToolNode } from \"./nodes/ToolNode.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, } from \"./responses.js\";\nexport { createMiddleware } from \"./middlewareAgent/index.js\";\nexport type { AgentMiddleware } from \"./middlewareAgent/types.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\";\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// ===== V1 OVERLOADS (WITHOUT MIDDLEWARE) =====\n// These overloads come first to ensure proper type inference when middlewares is NOT provided\n// Overload 1: V1 - With responseFormat as single InteropZodType\nexport 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>> & {\n responseFormat: InteropZodType<T>;\n}): ReactAgentV1<StateSchema, T, ContextSchema>;\n// Overload 2: V1 - With responseFormat as array of InteropZodTypes\nexport 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> & {\n responseFormat: T;\n}): ReactAgentV1<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema>;\n// Overload 3: V1 - With responseFormat as JsonSchemaFormat\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n}): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 4: V1 - With responseFormat as array of JsonSchemaFormat\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n}): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 5: V1 - With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n}): ReactAgentV1<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 6: V1 - With responseFormat as TypedToolStrategy\nexport 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>> & {\n responseFormat: TypedToolStrategy<T>;\n}): ReactAgentV1<StateSchema, T, ContextSchema>;\n// Overload 7: V1 - With responseFormat as single ToolStrategy\nexport 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>> & {\n responseFormat: ToolStrategy<T>;\n}): ReactAgentV1<StateSchema, T, ContextSchema>;\n// Overload 8: V1 - With responseFormat as ProviderStrategy\nexport 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>> & {\n responseFormat: ProviderStrategy<T>;\n}): ReactAgentV1<StateSchema, T, ContextSchema>;\n// Overload 9: V1 - Without responseFormat property at all\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\">): ReactAgentV1<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 10: V1 - With responseFormat explicitly undefined\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n}): ReactAgentV1<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 11: V1 - For other ResponseFormat values (failsafe)\nexport 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> & {\n responseFormat: any;\n}): ReactAgentV1<StateSchema, StructuredResponseFormat, ContextSchema>;\n// ===== V2 OVERLOADS (WITH MIDDLEWARE) =====\n// These overloads explicitly require the middlewares property\n// Overload 12: With responseFormat as single InteropZodType and middlewares\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middlewares: TMiddlewares;\n}): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n// Overload 13: With responseFormat as array of InteropZodTypes and middlewares\nexport declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {\n responseFormat: T;\n middlewares: TMiddlewares;\n}): ReactAgentV2<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddlewares>;\n// Overload 14: With responseFormat as JsonSchemaFormat and middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n middlewares: TMiddlewares;\n}): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n// Overload 15: With responseFormat as array of JsonSchemaFormat and middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n middlewares: TMiddlewares;\n}): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n// Overload 16: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[] and middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middlewares: TMiddlewares;\n}): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n// Overload 17: With responseFormat as TypedToolStrategy and middlewares\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middlewares: TMiddlewares;\n}): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n// Overload 18: With responseFormat as single ToolStrategy and middlewares\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middlewares: TMiddlewares;\n}): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n// Overload 19: With responseFormat as ProviderStrategy and middlewares\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middlewares: TMiddlewares;\n}): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n// Overload 20: Without responseFormat but with middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: Omit<CreateAgentParamsV2<ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n middlewares: TMiddlewares;\n}): ReactAgentV2<ResponseFormatUndefined, ContextSchema, TMiddlewares>;\n// Overload 21: With responseFormat explicitly undefined and middlewares\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: Omit<CreateAgentParamsV2<ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n middlewares: TMiddlewares;\n}): ReactAgentV2<ResponseFormatUndefined, ContextSchema, TMiddlewares>;\n// Overload 22: For other ResponseFormat values with middlewares (failsafe)\nexport declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddlewares extends readonly AgentMiddleware<any, any, any>[] = readonly AgentMiddleware<any, any, any>[]>(params: CreateAgentParamsV2<StructuredResponseFormat, ContextSchema, any> & {\n responseFormat: any;\n middlewares: TMiddlewares;\n}): ReactAgentV2<StructuredResponseFormat, ContextSchema, TMiddlewares>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;AAEoFQ,iBAN5Da,WAM4Db,CAAAA,oBAN5BF,iBAM4BE,GANRR,gBAMQQ,GAAAA,OANkBN,kBAMlBM,EAAAA,UANgDc,MAMhDd,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GANsEc,MAMtEd,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBANiHF,iBAMjHE,GANqIR,gBAMrIQ,GANwJF,iBAMxJE,CAAAA,CAAAA,MAAAA,EANmLD,iBAMnLC,CANqMe,WAMrMf,EANkNgB,CAMlNhB,EANqNiB,aAMrNjB,EANoOP,cAMpOO,CANmPgB,CAMnPhB,CAAAA,CAAAA,GAAAA;EAAoB,cAAMc,EAL1FrB,cAK0FqB,CAL3EE,CAK2EF,CAAAA;CAAM,CAAA,EAJhHlB,UAI+HqB,CAJlHF,WAIkHE,EAJrGD,CAIqGC,EAJlGA,aAIkGA,CAAAA;;AAAnH,iBAFQJ,WAER,CAAA,UAAA,SAFuCpB,cAEvC,CAAA,GAAA,CAAA,EAAA,EAAA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iBAqElID,WArEkIC,CAAAA,iCAqErFA,MArEqFA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAqE/DA,MArE+DA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAqEpBhB,iBArEoBgB,GAqEAtB,gBArEAsB,GAqEmBhB,iBArEnBgB,EAAAA,qBAAAA,SAqEoEZ,eArEpEY,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,GAAAA,SAqEgHZ,eArEhHY,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,CAAAA,CAAAA,MAAAA,EAqE0Jb,mBArE1Ja,CAqE8KK,wBArE9KL,EAqEwMG,aArExMH,EAAAA,GAAAA,CAAAA,GAAAA;EAAM,cAAqChB,EAAAA,GAAAA;EAAiB,WAAGN,EAuExM4B,YAvEwM5B;CAAgB,CAAA,EAwErOK,YAxEwOC,CAwE3NqB,wBAxE2NrB,EAwEjMmB,aAxEiMnB,EAwElLsB,YAxEkLtB,CAAAA"}
@@ -1,14 +1,33 @@
1
1
  import { MultipleStructuredOutputsError, MultipleToolsBoundError, StructuredOutputParsingError, ToolInvocationError } from "./errors.js";
2
2
  import { ProviderStrategy, ToolStrategy, providerStrategy, toolStrategy } from "./responses.js";
3
3
  import { ToolNode } from "./nodes/ToolNode.js";
4
- import { ReactAgent } from "./ReactAgent.js";
4
+ import { createAgent } from "./createAgent.js";
5
+ import { createMiddleware } from "./middlewareAgent/middleware.js";
6
+ import { createAgent as createAgent$1 } from "./middlewareAgent/index.js";
5
7
  import "./interrupt.js";
6
8
 
7
9
  //#region src/agents/index.ts
8
- function createReactAgent(params) {
9
- return new ReactAgent(params);
10
+ function createAgent$2(params) {
11
+ /**
12
+ * Check if middlewares property is present
13
+ */
14
+ if ("middlewares" in params && params.middlewares !== void 0) {
15
+ /**
16
+ * The user wants to use the middleware version of the agent.
17
+ * Let's verify that `preModelHook` and `postModelHook` are not provided
18
+ */
19
+ 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.");
20
+ /**
21
+ * Use v2 (middleware version)
22
+ */
23
+ return createAgent$1(params);
24
+ } else
25
+ /**
26
+ * Use v1 (original version)
27
+ */
28
+ return createAgent(params);
10
29
  }
11
30
 
12
31
  //#endregion
13
- export { createReactAgent };
32
+ export { createAgent$2 as createAgent };
14
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["params: CreateReactAgentParams<\n StateSchema,\n StructuredResponseFormat,\n ContextSchema,\n any\n >"],"sources":["../../src/agents/index.ts"],"sourcesContent":["import type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\n\nimport { MessagesAnnotation } from \"@langchain/langgraph\";\n\nimport { type AnyAnnotationRoot } from \"./annotation.js\";\nimport type { CreateReactAgentParams, ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n ResponseFormat,\n ResponseFormatUndefined,\n JsonSchemaFormat,\n} from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n\n/**\n * Creates a StateGraph agent that relies on a chat model utilizing tool calling.\n *\n * @example\n * ```ts\n * import { ChatOpenAI } from \"@langchain/openai\";\n * import { createReactAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const model = new ChatOpenAI({\n * model: \"gpt-4o\",\n * });\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 = createReactAgent({ llm: model, tools: [getWeather] });\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// Overload 1: With responseFormat as single InteropZodType\nexport function createReactAgent<\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: CreateReactAgentParams<\n StateSchema,\n T,\n ContextSchema,\n InteropZodType<T>\n > & {\n responseFormat: InteropZodType<T>;\n }\n): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport function createReactAgent<\n T extends readonly InteropZodType<any>[],\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateReactAgentParams<\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): ReactAgent<\n StateSchema,\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema\n>;\n\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport function createReactAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateReactAgentParams<\n StateSchema,\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n }\n): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport function createReactAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateReactAgentParams<\n StateSchema,\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n }\n): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createReactAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: CreateReactAgentParams<\n StateSchema,\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n }\n): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport function createReactAgent<\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: CreateReactAgentParams<\n StateSchema,\n T,\n ContextSchema,\n TypedToolStrategy<T>\n > & {\n responseFormat: TypedToolStrategy<T>;\n }\n): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport function createReactAgent<\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: CreateReactAgentParams<\n StateSchema,\n T,\n ContextSchema,\n ToolStrategy<T>\n > & {\n responseFormat: ToolStrategy<T>;\n }\n): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 7: With responseFormat as ProviderStrategy\nexport function createReactAgent<\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: CreateReactAgentParams<\n StateSchema,\n T,\n ContextSchema,\n ProviderStrategy<T>\n > & {\n responseFormat: ProviderStrategy<T>;\n }\n): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 8: Without responseFormat property at all\nexport function createReactAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: Omit<\n CreateReactAgentParams<\n StateSchema,\n ResponseFormatUndefined,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n >\n): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n\n// Overload 9: With responseFormat explicitly undefined\nexport function createReactAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = typeof MessagesAnnotation,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot\n>(\n params: Omit<\n CreateReactAgentParams<\n StateSchema,\n ResponseFormatUndefined,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n }\n): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n\n// Overload 10: For other ResponseFormat values (failsafe)\nexport function createReactAgent<\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: CreateReactAgentParams<\n StateSchema,\n StructuredResponseFormat,\n ContextSchema,\n ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n }\n): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;\n\n// Implementation\nexport function createReactAgent<\n StateSchema extends AnyAnnotationRoot | InteropZodObject,\n StructuredResponseFormat extends Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject\n>(\n params: CreateReactAgentParams<\n StateSchema,\n StructuredResponseFormat,\n ContextSchema,\n any\n >\n): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema> {\n return new ReactAgent(params);\n}\n\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport * from \"./interrupt.js\";\nexport { ToolNode } from \"./nodes/ToolNode.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n} from \"./responses.js\";\n"],"mappings":";;;;;;;AA0QA,SAAgB,iBAKdA,QAMkE;AAClE,QAAO,IAAI,WAAW;AACvB"}
1
+ {"version":3,"file":"index.js","names":["createAgent","params: any","createAgentV2","createAgentV1"],"sources":["../../src/agents/index.ts"],"sourcesContent":["import 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 AnyAnnotationRoot } 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 ResponseFormatUndefined,\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 { 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 type { AgentMiddleware } from \"./middlewareAgent/types.js\";\n\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\";\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 middlewares 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 middlewares property\n\n// Overload 12: With responseFormat as single InteropZodType and middlewares\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n\n// Overload 13: With responseFormat as array of InteropZodTypes and middlewares\nexport function createAgent<\n T extends readonly InteropZodType<any>[],\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema,\n TMiddlewares\n>;\n\n// Overload 14: With responseFormat as JsonSchemaFormat and middlewares\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n\n// Overload 15: With responseFormat as array of JsonSchemaFormat and middlewares\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n\n// Overload 16: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[] and middlewares\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<Record<string, unknown>, ContextSchema, TMiddlewares>;\n\n// Overload 17: With responseFormat as TypedToolStrategy and middlewares\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n\n// Overload 18: With responseFormat as single ToolStrategy and middlewares\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n\n// Overload 19: With responseFormat as ProviderStrategy and middlewares\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<T, ContextSchema, TMiddlewares>;\n\n// Overload 20: Without responseFormat but with middlewares\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 > & { middlewares: TMiddlewares }\n): ReactAgentV2<ResponseFormatUndefined, ContextSchema, TMiddlewares>;\n\n// Overload 21: With responseFormat explicitly undefined and middlewares\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<ResponseFormatUndefined, ContextSchema, TMiddlewares>;\n\n// Overload 22: For other ResponseFormat values with middlewares (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddlewares 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 middlewares: TMiddlewares;\n }\n): ReactAgentV2<StructuredResponseFormat, ContextSchema, TMiddlewares>;\n\nexport function createAgent(params: any): any {\n /**\n * Check if middlewares property is present\n */\n if (\"middlewares\" in params && params.middlewares !== 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":";;;;;;;;;AAigBA,SAAgBA,cAAYC,QAAkB;;;;AAI5C,KAAI,iBAAiB,UAAU,OAAO,gBAAgB,QAAW;;;;;AAK/D,MAAI,kBAAkB,UAAU,mBAAmB,OACjD,OAAM,IAAI,MACR;;;;AAOJ,SAAOC,cAAc,OAAO;CAC7B;;;;AAIC,QAAOC,YAAc,OAAO;AAE/B"}