langchain 1.0.0-alpha.3 → 1.0.0-alpha.4

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 (70) 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/annotation.cjs +2 -2
  10. package/dist/agents/annotation.cjs.map +1 -1
  11. package/dist/agents/annotation.d.cts +3 -3
  12. package/dist/agents/annotation.d.cts.map +1 -1
  13. package/dist/agents/annotation.d.ts +3 -3
  14. package/dist/agents/annotation.d.ts.map +1 -1
  15. package/dist/agents/annotation.js +2 -2
  16. package/dist/agents/annotation.js.map +1 -1
  17. package/dist/agents/errors.cjs +1 -1
  18. package/dist/agents/errors.cjs.map +1 -1
  19. package/dist/agents/errors.js +1 -1
  20. package/dist/agents/errors.js.map +1 -1
  21. package/dist/agents/index.cjs +2 -2
  22. package/dist/agents/index.cjs.map +1 -1
  23. package/dist/agents/index.d.cts +15 -15
  24. package/dist/agents/index.d.cts.map +1 -1
  25. package/dist/agents/index.d.ts +15 -15
  26. package/dist/agents/index.d.ts.map +1 -1
  27. package/dist/agents/index.js +2 -2
  28. package/dist/agents/index.js.map +1 -1
  29. package/dist/agents/nodes/AgentNode.cjs.map +1 -1
  30. package/dist/agents/nodes/AgentNode.js.map +1 -1
  31. package/dist/agents/nodes/ToolNode.cjs +1 -1
  32. package/dist/agents/nodes/ToolNode.cjs.map +1 -1
  33. package/dist/agents/nodes/ToolNode.d.cts +1 -1
  34. package/dist/agents/nodes/ToolNode.d.cts.map +1 -1
  35. package/dist/agents/nodes/ToolNode.d.ts +1 -1
  36. package/dist/agents/nodes/ToolNode.d.ts.map +1 -1
  37. package/dist/agents/nodes/ToolNode.js +1 -1
  38. package/dist/agents/nodes/ToolNode.js.map +1 -1
  39. package/dist/agents/responses.cjs +1 -1
  40. package/dist/agents/responses.cjs.map +1 -1
  41. package/dist/agents/responses.d.cts +1 -1
  42. package/dist/agents/responses.d.cts.map +1 -1
  43. package/dist/agents/responses.d.ts +1 -1
  44. package/dist/agents/responses.d.ts.map +1 -1
  45. package/dist/agents/responses.js +1 -1
  46. package/dist/agents/responses.js.map +1 -1
  47. package/dist/agents/types.d.cts +8 -8
  48. package/dist/agents/types.d.cts.map +1 -1
  49. package/dist/agents/types.d.ts +8 -8
  50. package/dist/agents/types.d.ts.map +1 -1
  51. package/dist/agents/utils.cjs +1 -1
  52. package/dist/agents/utils.cjs.map +1 -1
  53. package/dist/agents/utils.js +1 -1
  54. package/dist/agents/utils.js.map +1 -1
  55. package/dist/agents/withAgentName.cjs +1 -1
  56. package/dist/agents/withAgentName.cjs.map +1 -1
  57. package/dist/agents/withAgentName.js +1 -1
  58. package/dist/agents/withAgentName.js.map +1 -1
  59. package/dist/evaluation/agents/trajectory.d.ts.map +1 -1
  60. package/dist/evaluation/comparison/pairwise.d.cts.map +1 -1
  61. package/dist/evaluation/comparison/pairwise.d.ts.map +1 -1
  62. package/dist/evaluation/criteria/criteria.d.cts.map +1 -1
  63. package/dist/evaluation/criteria/criteria.d.ts.map +1 -1
  64. package/dist/index.cjs +2 -2
  65. package/dist/index.cjs.map +1 -1
  66. package/dist/index.d.cts +2 -2
  67. package/dist/index.d.ts +2 -2
  68. package/dist/index.js +3 -3
  69. package/dist/index.js.map +1 -1
  70. package/package.json +5 -5
@@ -2,7 +2,7 @@
2
2
  //#region src/agents/errors.ts
3
3
  var MultipleToolsBoundError = class extends Error {
4
4
  constructor() {
5
- super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createReactAgent. The agent will bind the tools provided in the 'tools' parameter.");
5
+ super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createAgent. The agent will bind the tools provided in the 'tools' parameter.");
6
6
  }
7
7
  };
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errors.cjs","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n constructor() {\n super(\n \"The provided LLM already has bound tools. \" +\n \"Please provide an LLM without bound tools to createReactAgent. \" +\n \"The agent will bind the tools provided in the 'tools' parameter.\"\n );\n }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n public readonly toolNames: string[];\n\n constructor(toolNames: string[]) {\n super(\n `The model has called multiple tools: ${toolNames.join(\n \", \"\n )} to return a structured output. ` +\n \"This is not supported. Please provide a single structured output.\"\n );\n this.toolNames = toolNames;\n }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n public readonly toolName: string;\n\n public readonly errors: string[];\n\n constructor(toolName: string, errors: string[]) {\n super(\n `Failed to parse structured output for tool '${toolName}':${errors\n .map((e) => `\\n - ${e}`)\n .join(\"\")}.`\n );\n this.toolName = toolName;\n this.errors = errors;\n }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n public readonly toolCall: ToolCall;\n\n public readonly toolError: Error;\n\n constructor(toolError: unknown, toolCall: ToolCall) {\n const error =\n toolError instanceof Error ? toolError : new Error(String(toolError));\n super(\n `Error invoking tool '${toolCall.name}' with kwargs ${JSON.stringify(\n toolCall.args\n )} ` +\n `with error:\\n ${error.stack}\\n Please fix the error and try again.`\n );\n\n this.toolCall = toolCall;\n this.toolError = error;\n }\n}\n"],"mappings":";;AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,4KAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,KAAK,UACzD,SAAS,KACV,CAAC,eAAC,EACgB,MAAM,MAAM,sCAAsC,CAAC,CACvE;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}
1
+ {"version":3,"file":"errors.cjs","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n constructor() {\n super(\n \"The provided LLM already has bound tools. \" +\n \"Please provide an LLM without bound tools to createAgent. \" +\n \"The agent will bind the tools provided in the 'tools' parameter.\"\n );\n }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n public readonly toolNames: string[];\n\n constructor(toolNames: string[]) {\n super(\n `The model has called multiple tools: ${toolNames.join(\n \", \"\n )} to return a structured output. ` +\n \"This is not supported. Please provide a single structured output.\"\n );\n this.toolNames = toolNames;\n }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n public readonly toolName: string;\n\n public readonly errors: string[];\n\n constructor(toolName: string, errors: string[]) {\n super(\n `Failed to parse structured output for tool '${toolName}':${errors\n .map((e) => `\\n - ${e}`)\n .join(\"\")}.`\n );\n this.toolName = toolName;\n this.errors = errors;\n }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n public readonly toolCall: ToolCall;\n\n public readonly toolError: Error;\n\n constructor(toolError: unknown, toolCall: ToolCall) {\n const error =\n toolError instanceof Error ? toolError : new Error(String(toolError));\n super(\n `Error invoking tool '${toolCall.name}' with kwargs ${JSON.stringify(\n toolCall.args\n )} ` +\n `with error:\\n ${error.stack}\\n Please fix the error and try again.`\n );\n\n this.toolCall = toolCall;\n this.toolError = error;\n }\n}\n"],"mappings":";;AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,uKAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,KAAK,UACzD,SAAS,KACV,CAAC,eAAC,EACgB,MAAM,MAAM,sCAAsC,CAAC,CACvE;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}
@@ -1,7 +1,7 @@
1
1
  //#region src/agents/errors.ts
2
2
  var MultipleToolsBoundError = class extends Error {
3
3
  constructor() {
4
- super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createReactAgent. The agent will bind the tools provided in the 'tools' parameter.");
4
+ super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createAgent. The agent will bind the tools provided in the 'tools' parameter.");
5
5
  }
6
6
  };
7
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n constructor() {\n super(\n \"The provided LLM already has bound tools. \" +\n \"Please provide an LLM without bound tools to createReactAgent. \" +\n \"The agent will bind the tools provided in the 'tools' parameter.\"\n );\n }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n public readonly toolNames: string[];\n\n constructor(toolNames: string[]) {\n super(\n `The model has called multiple tools: ${toolNames.join(\n \", \"\n )} to return a structured output. ` +\n \"This is not supported. Please provide a single structured output.\"\n );\n this.toolNames = toolNames;\n }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n public readonly toolName: string;\n\n public readonly errors: string[];\n\n constructor(toolName: string, errors: string[]) {\n super(\n `Failed to parse structured output for tool '${toolName}':${errors\n .map((e) => `\\n - ${e}`)\n .join(\"\")}.`\n );\n this.toolName = toolName;\n this.errors = errors;\n }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n public readonly toolCall: ToolCall;\n\n public readonly toolError: Error;\n\n constructor(toolError: unknown, toolCall: ToolCall) {\n const error =\n toolError instanceof Error ? toolError : new Error(String(toolError));\n super(\n `Error invoking tool '${toolCall.name}' with kwargs ${JSON.stringify(\n toolCall.args\n )} ` +\n `with error:\\n ${error.stack}\\n Please fix the error and try again.`\n );\n\n this.toolCall = toolCall;\n this.toolError = error;\n }\n}\n"],"mappings":";AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,4KAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,KAAK,UACzD,SAAS,KACV,CAAC,eAAC,EACgB,MAAM,MAAM,sCAAsC,CAAC,CACvE;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}
1
+ {"version":3,"file":"errors.js","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n constructor() {\n super(\n \"The provided LLM already has bound tools. \" +\n \"Please provide an LLM without bound tools to createAgent. \" +\n \"The agent will bind the tools provided in the 'tools' parameter.\"\n );\n }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n public readonly toolNames: string[];\n\n constructor(toolNames: string[]) {\n super(\n `The model has called multiple tools: ${toolNames.join(\n \", \"\n )} to return a structured output. ` +\n \"This is not supported. Please provide a single structured output.\"\n );\n this.toolNames = toolNames;\n }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n public readonly toolName: string;\n\n public readonly errors: string[];\n\n constructor(toolName: string, errors: string[]) {\n super(\n `Failed to parse structured output for tool '${toolName}':${errors\n .map((e) => `\\n - ${e}`)\n .join(\"\")}.`\n );\n this.toolName = toolName;\n this.errors = errors;\n }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n public readonly toolCall: ToolCall;\n\n public readonly toolError: Error;\n\n constructor(toolError: unknown, toolCall: ToolCall) {\n const error =\n toolError instanceof Error ? toolError : new Error(String(toolError));\n super(\n `Error invoking tool '${toolCall.name}' with kwargs ${JSON.stringify(\n toolCall.args\n )} ` +\n `with error:\\n ${error.stack}\\n Please fix the error and try again.`\n );\n\n this.toolCall = toolCall;\n this.toolError = error;\n }\n}\n"],"mappings":";AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,uKAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,KAAK,UACzD,SAAS,KACV,CAAC,eAAC,EACgB,MAAM,MAAM,sCAAsC,CAAC,CACvE;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}
@@ -7,10 +7,10 @@ require('./interrupt.cjs');
7
7
  const __langchain_langgraph = require_rolldown_runtime.__toESM(require("@langchain/langgraph"));
8
8
 
9
9
  //#region src/agents/index.ts
10
- function createReactAgent(params) {
10
+ function createAgent(params) {
11
11
  return new require_ReactAgent.ReactAgent(params);
12
12
  }
13
13
 
14
14
  //#endregion
15
- exports.createReactAgent = createReactAgent;
15
+ exports.createAgent = createAgent;
16
16
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["params: CreateReactAgentParams<\n StateSchema,\n StructuredResponseFormat,\n ContextSchema,\n any\n >","ReactAgent"],"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,IAAIC,8BAAW;AACvB"}
1
+ {"version":3,"file":"index.cjs","names":["params: CreateAgentParams<\n StateSchema,\n StructuredResponseFormat,\n ContextSchema,\n any\n >","ReactAgent"],"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 { CreateAgentParams, 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 { createAgent, 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 = createAgent({ 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 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): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\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): 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 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): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\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): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 4.5: 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): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from 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<\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 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): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 7: 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): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 8: 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): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n\n// Overload 9: 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): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n\n// Overload 10: 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 ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n }\n): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;\n\n// Implementation\nexport function createAgent<\n StateSchema extends AnyAnnotationRoot | InteropZodObject,\n StructuredResponseFormat extends Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject\n>(\n params: CreateAgentParams<\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":";;;;;;;;;AAqQA,SAAgB,YAKdA,QAMkE;AAClE,QAAO,IAAIC,8BAAW;AACvB"}
@@ -2,7 +2,7 @@ import { MultipleStructuredOutputsError, StructuredOutputParsingError } from "./
2
2
  import { JsonSchemaFormat, ProviderStrategy, ResponseFormat, ResponseFormatUndefined, ToolStrategy, TypedToolStrategy, providerStrategy, toolStrategy } from "./responses.cjs";
3
3
  import { AnyAnnotationRoot } from "./annotation.cjs";
4
4
  import { ToolNode } from "./nodes/ToolNode.cjs";
5
- import { AgentRuntime, AgentState, ClientTool, CreateReactAgentParams, ExtractZodArrayTypes, N, Prompt, ServerTool } from "./types.cjs";
5
+ import { AgentRuntime, AgentState, ClientTool, CreateAgentParams, ExtractZodArrayTypes, N, Prompt, ServerTool } from "./types.cjs";
6
6
  import { ReactAgent } from "./ReactAgent.cjs";
7
7
  import { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse } from "./interrupt.cjs";
8
8
  import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
@@ -16,7 +16,7 @@ import { MessagesAnnotation } from "@langchain/langgraph";
16
16
  * @example
17
17
  * ```ts
18
18
  * import { ChatOpenAI } from "@langchain/openai";
19
- * import { createReactAgent, tool } from "langchain";
19
+ * import { createAgent, tool } from "langchain";
20
20
  * import { z } from "zod";
21
21
  *
22
22
  * const model = new ChatOpenAI({
@@ -37,7 +37,7 @@ import { MessagesAnnotation } from "@langchain/langgraph";
37
37
  * })
38
38
  * })
39
39
  *
40
- * const agent = createReactAgent({ llm: model, tools: [getWeather] });
40
+ * const agent = createAgent({ llm: model, tools: [getWeather] });
41
41
  *
42
42
  * const inputs = {
43
43
  * messages: [{ role: "user", content: "what is the weather in SF?" }],
@@ -52,47 +52,47 @@ import { MessagesAnnotation } from "@langchain/langgraph";
52
52
  * ```
53
53
  */
54
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>> & {
55
+ 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
56
  responseFormat: InteropZodType<T>;
57
57
  }): ReactAgent<StateSchema, T, ContextSchema>;
58
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> & {
59
+ 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
60
  responseFormat: T;
61
61
  }): ReactAgent<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema>;
62
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> & {
63
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
64
64
  responseFormat: JsonSchemaFormat;
65
65
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
66
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[]> & {
67
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
68
68
  responseFormat: JsonSchemaFormat[];
69
69
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
70
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[]> & {
71
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
72
72
  responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
73
73
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
74
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>> & {
75
+ 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
76
  responseFormat: TypedToolStrategy<T>;
77
77
  }): ReactAgent<StateSchema, T, ContextSchema>;
78
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>> & {
79
+ 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
80
  responseFormat: ToolStrategy<T>;
81
81
  }): ReactAgent<StateSchema, T, ContextSchema>;
82
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>> & {
83
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, T, ContextSchema, ProviderStrategy<T>> & {
84
84
  responseFormat: ProviderStrategy<T>;
85
85
  }): ReactAgent<StateSchema, T, ContextSchema>;
86
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>;
87
+ 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>;
88
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"> & {
89
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
90
90
  responseFormat?: undefined;
91
91
  }): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;
92
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> & {
93
+ 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, ResponseFormat> & {
94
94
  responseFormat: ResponseFormat;
95
95
  }): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;
96
96
  //#endregion
97
- export { createReactAgent };
97
+ export { createAgent };
98
98
  //# sourceMappingURL=index.d.cts.map
@@ -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,GAJ1GF,iBAI0GE,CAAAA,CAAAA,MAAAA,EAJ/ED,sBAI+EC,CAJxDU,WAIwDV,EAJ3CW,CAI2CX,EAJxCY,aAIwCZ,EAJzBJ,cAIyBI,CAJVW,CAIUX,CAAAA,CAAAA,GAAAA;EAAoB,cAAMS,EAHjWb,cAGiWa,CAHlVE,CAGkVF,CAAAA;CAAM,CAAA,EAFvXF,UAEsYK,CAF3XF,WAE2XE,EAF9WD,CAE8WC,EAF3WA,aAE2WA,CAAAA;;AAAzIb,iBAAzOS,gBAAyOT,CAAAA,UAAAA,SAArMH,cAAqMG,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,oBAA1JD,iBAA0JC,GAAtIJ,gBAAsII,GAAAA,OAA5GF,kBAA4GE,EAAAA,sBAAlED,iBAAkEC,GAA9CJ,gBAA8CI,GAA3BD,iBAA2BC,CAAAA,CAAAA,MAAAA,EAAAA,sBAAAA,CAAuBW,WAAvBX,EAAoCC,oBAApCD,CAAyDY,CAAzDZ,CAAAA,SAAoEU,MAApEV,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAA0FC,oBAA1FD,CAA+GY,CAA/GZ,CAAAA,GAAoHU,MAApHV,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AA,EA4BzHU,UA5BiJT,CA4BtIY,WA5BsIZ,EA4BzHgB,wBA5ByHhB,EA4B/Fc,aA5B+Fd,CAAAA"}
1
+ {"version":3,"file":"index.d.cts","names":["InteropZodObject","InteropZodType","MessagesAnnotation","AnyAnnotationRoot","CreateAgentParams","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","ResponseFormatUndefined","JsonSchemaFormat","ReactAgent","createAgent","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 { CreateAgentParams, 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 { createAgent, 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 = createAgent({ 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 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}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\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}): 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 createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<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 createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<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 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}): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from 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, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 6: With responseFormat as single ToolStrategy instance\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}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 7: 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}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 8: 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\">): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 9: 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}): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 10: 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, 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;;;;;;;;;;;;;;AAAiVK,iBAJzTQ,WAIyTR,CAAAA,oBAJzRF,iBAIyRE,GAJrQL,gBAIqQK,GAAAA,OAJ3OH,kBAI2OG,EAAAA,UAJ7MS,MAI6MT,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAJvLS,MAIuLT,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAJ5IF,iBAI4IE,GAJxHL,gBAIwHK,GAJrGF,iBAIqGE,CAAAA,CAAAA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AwBwOL,uBAxBxO,EAwBiQO,aAxBjQ,EAAA,KAAA,CAAA,EAAA,gBAAA,CAAA,GAAA;EAEUJ,cAAW,CAAA,EAAA,SAAA;CAAA,CAAA,EAwB/BD,UAxB+B,CAwBpBG,WAxBoB,EAwBPL,uBAxBO,EAwBkBO,aAxBlB,CAAA;;AAAyCjB,iBA0BpDa,WA1BoDb,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,iBA1BlNJ,CA0BoOe,WA1BpOf,EA0BiPmB,wBA1BjPnB,EA0B2QiB,aA1B3QjB,EA0B0RS,cA1B1RT,CAAAA,GAAAA;EAAgB,cAAUE,EA2BlFO,cA3BkFP;CAAkB,CAAA,EA4BpHU,UA5B4IT,CA4BjIY,WA5BiIZ,EA4BpHgB,wBA5BoHhB,EA4B1Fc,aA5B0Fd,CAAAA"}
@@ -2,7 +2,7 @@ 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
6
  import { ReactAgent } from "./ReactAgent.js";
7
7
  import { ActionRequest, HumanInterrupt, HumanInterruptConfig, HumanResponse } from "./interrupt.js";
8
8
  import { MessagesAnnotation } from "@langchain/langgraph";
@@ -16,7 +16,7 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
16
16
  * @example
17
17
  * ```ts
18
18
  * import { ChatOpenAI } from "@langchain/openai";
19
- * import { createReactAgent, tool } from "langchain";
19
+ * import { createAgent, tool } from "langchain";
20
20
  * import { z } from "zod";
21
21
  *
22
22
  * const model = new ChatOpenAI({
@@ -37,7 +37,7 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
37
37
  * })
38
38
  * })
39
39
  *
40
- * const agent = createReactAgent({ llm: model, tools: [getWeather] });
40
+ * const agent = createAgent({ llm: model, tools: [getWeather] });
41
41
  *
42
42
  * const inputs = {
43
43
  * messages: [{ role: "user", content: "what is the weather in SF?" }],
@@ -52,47 +52,47 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
52
52
  * ```
53
53
  */
54
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>> & {
55
+ 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
56
  responseFormat: InteropZodType<T>;
57
57
  }): ReactAgent<StateSchema, T, ContextSchema>;
58
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> & {
59
+ 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
60
  responseFormat: T;
61
61
  }): ReactAgent<StateSchema, ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema>;
62
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> & {
63
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
64
64
  responseFormat: JsonSchemaFormat;
65
65
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
66
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[]> & {
67
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
68
68
  responseFormat: JsonSchemaFormat[];
69
69
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
70
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[]> & {
71
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
72
72
  responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
73
73
  }): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;
74
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>> & {
75
+ 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
76
  responseFormat: TypedToolStrategy<T>;
77
77
  }): ReactAgent<StateSchema, T, ContextSchema>;
78
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>> & {
79
+ 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
80
  responseFormat: ToolStrategy<T>;
81
81
  }): ReactAgent<StateSchema, T, ContextSchema>;
82
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>> & {
83
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<StateSchema, T, ContextSchema, ProviderStrategy<T>> & {
84
84
  responseFormat: ProviderStrategy<T>;
85
85
  }): ReactAgent<StateSchema, T, ContextSchema>;
86
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>;
87
+ 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>;
88
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"> & {
89
+ declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: Omit<CreateAgentParams<StateSchema, ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
90
90
  responseFormat?: undefined;
91
91
  }): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;
92
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> & {
93
+ 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, ResponseFormat> & {
94
94
  responseFormat: ResponseFormat;
95
95
  }): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;
96
96
  //#endregion
97
- export { createReactAgent };
97
+ export { createAgent };
98
98
  //# 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,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,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.ts","names":["InteropZodObject","InteropZodType","MessagesAnnotation","AnyAnnotationRoot","CreateAgentParams","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","ResponseFormatUndefined","JsonSchemaFormat","ReactAgent","createAgent","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 { CreateAgentParams, 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 { createAgent, 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 = createAgent({ 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 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}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\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}): 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 createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<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 createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateAgentParams<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 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}): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from 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, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 6: With responseFormat as single ToolStrategy instance\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}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 7: 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}): ReactAgent<StateSchema, T, ContextSchema>;\n// Overload 8: 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\">): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 9: 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}): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n// Overload 10: 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, 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;;;;;;;;;;;;;;AAAiVK,iBAJzTQ,WAIyTR,CAAAA,oBAJzRF,iBAIyRE,GAJrQL,gBAIqQK,GAAAA,OAJ3OH,kBAI2OG,EAAAA,UAJ7MS,MAI6MT,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAJvLS,MAIuLT,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAJ5IF,iBAI4IE,GAJxHL,gBAIwHK,GAJrGF,iBAIqGE,CAAAA,CAAAA,MAAAA,EAJ1ED,iBAI0EC,CAJxDU,WAIwDV,EAJ3CW,CAI2CX,EAJxCY,aAIwCZ,EAJzBJ,cAIyBI,CAJVW,CAIUX,CAAAA,CAAAA,GAAAA;EAAoB,cAAMS,EAHvVb,cAGuVa,CAHxUE,CAGwUF,CAAAA;CAAM,CAAA,EAF7WF,UAE4XK,CAFjXF,WAEiXE,EAFpWD,CAEoWC,EAFjWA,aAEiWA,CAAAA;;AAApIb,iBAApOS,WAAoOT,CAAAA,UAAAA,SAArMH,cAAqMG,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,oBAA1JD,iBAA0JC,GAAtIJ,gBAAsII,GAAAA,OAA5GF,kBAA4GE,EAAAA,sBAAlED,iBAAkEC,GAA9CJ,gBAA8CI,GAA3BD,iBAA2BC,CAAAA,CAAAA,MAAAA,EAAAA,iBAAAA,CAAkBW,WAAlBX,EAA+BC,oBAA/BD,CAAoDY,CAApDZ,CAAAA,SAA+DU,MAA/DV,CAAAA,MAAAA,EAAAA,GAAAA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AAAA;EAAgB,cAAUE,EA2BlFO,cA3BkFP;CAAkB,CAAA,EA4BpHU,UA5B4IT,CA4BjIY,WA5BiIZ,EA4BpHgB,wBA5BoHhB,EA4B1Fc,aA5B0Fd,CAAAA"}
@@ -5,10 +5,10 @@ import { ReactAgent } from "./ReactAgent.js";
5
5
  import "./interrupt.js";
6
6
 
7
7
  //#region src/agents/index.ts
8
- function createReactAgent(params) {
8
+ function createAgent(params) {
9
9
  return new ReactAgent(params);
10
10
  }
11
11
 
12
12
  //#endregion
13
- export { createReactAgent };
13
+ export { createAgent };
14
14
  //# 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":["params: CreateAgentParams<\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 { CreateAgentParams, 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 { createAgent, 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 = createAgent({ 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 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): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\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): 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 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): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\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): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 4.5: 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): ReactAgent<StateSchema, Record<string, unknown>, ContextSchema>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from 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<\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 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): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 7: 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): ReactAgent<StateSchema, T, ContextSchema>;\n\n// Overload 8: 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): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n\n// Overload 9: 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): ReactAgent<StateSchema, ResponseFormatUndefined, ContextSchema>;\n\n// Overload 10: 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 ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n }\n): ReactAgent<StateSchema, StructuredResponseFormat, ContextSchema>;\n\n// Implementation\nexport function createAgent<\n StateSchema extends AnyAnnotationRoot | InteropZodObject,\n StructuredResponseFormat extends Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject\n>(\n params: CreateAgentParams<\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":";;;;;;;AAqQA,SAAgB,YAKdA,QAMkE;AAClE,QAAO,IAAI,WAAW;AACvB"}