langchain 1.2.18 → 1.2.19
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.
- package/CHANGELOG.md +9 -0
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/middleware/llmToolSelector.d.ts +4 -4
- package/dist/agents/middleware/llmToolSelector.d.ts.map +1 -1
- package/dist/agents/middleware/summarization.d.ts +8 -8
- package/dist/agents/middleware/summarization.d.ts.map +1 -1
- package/dist/agents/nodes/AgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AgentNode.js.map +1 -1
- package/dist/agents/responses.cjs.map +1 -1
- package/dist/agents/responses.d.cts +9 -0
- package/dist/agents/responses.d.cts.map +1 -1
- package/dist/agents/responses.d.ts +9 -0
- package/dist/agents/responses.d.ts.map +1 -1
- package/dist/agents/responses.js.map +1 -1
- package/dist/agents/utils.cjs.map +1 -1
- package/dist/agents/utils.js.map +1 -1
- package/dist/chat_models/universal.cjs.map +1 -1
- package/dist/chat_models/universal.js.map +1 -1
- package/dist/hub/base.cjs +6 -3
- package/dist/hub/base.cjs.map +1 -1
- package/dist/hub/base.d.cts +2 -0
- package/dist/hub/base.d.cts.map +1 -1
- package/dist/hub/base.d.ts +2 -0
- package/dist/hub/base.d.ts.map +1 -1
- package/dist/hub/base.js +6 -3
- package/dist/hub/base.js.map +1 -1
- package/dist/hub/index.cjs +2 -0
- package/dist/hub/index.cjs.map +1 -1
- package/dist/hub/index.d.cts +5 -0
- package/dist/hub/index.d.cts.map +1 -1
- package/dist/hub/index.d.ts +5 -0
- package/dist/hub/index.d.ts.map +1 -1
- package/dist/hub/index.js +2 -0
- package/dist/hub/index.js.map +1 -1
- package/dist/hub/node.cjs +2 -0
- package/dist/hub/node.cjs.map +1 -1
- package/dist/hub/node.d.cts +5 -0
- package/dist/hub/node.d.cts.map +1 -1
- package/dist/hub/node.d.ts +5 -0
- package/dist/hub/node.d.ts.map +1 -1
- package/dist/hub/node.js +2 -0
- package/dist/hub/node.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# langchain
|
|
2
2
|
|
|
3
|
+
## 1.2.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#9957](https://github.com/langchain-ai/langchainjs/pull/9957) [`71c3cba`](https://github.com/langchain-ai/langchainjs/commit/71c3cba843ab16d877299d158a1de0c7d22f3fb9) Thanks [@jacoblee93](https://github.com/jacoblee93)! - feat(langchain,core): Update prompt pulling params, LangSmith version
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`71c3cba`](https://github.com/langchain-ai/langchainjs/commit/71c3cba843ab16d877299d158a1de0c7d22f3fb9)]:
|
|
10
|
+
- @langchain/core@1.1.20
|
|
11
|
+
|
|
3
12
|
## 1.2.18
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n any\n >","ReactAgent"],"sources":["../../src/agents/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\nimport type { ClientTool, ServerTool } from \"@langchain/core/tools\";\nimport type { StateDefinitionInit } from \"@langchain/langgraph\";\n\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type {\n CreateAgentParams,\n AgentTypeConfig,\n CombineTools,\n} from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n ResponseFormat,\n JsonSchemaFormat,\n} from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n *\n * @example With StateSchema\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { StateSchema, ReducedValue } from \"@langchain/langgraph\";\n * import { z } from \"zod\";\n *\n * const AgentState = new StateSchema({\n * userId: z.string(),\n * count: z.number().default(0),\n * history: new ReducedValue(\n * z.array(z.string()).default(() => []),\n * { inputSchema: z.string(), reducer: (c, n) => [...c, n] }\n * ),\n * });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * tools: [searchTool],\n * stateSchema: AgentState,\n * });\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n InteropZodType<StructuredResponseFormat>\n > & {\n responseFormat: InteropZodType<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport function createAgent<\n StructuredResponseFormat extends readonly InteropZodType<any>[],\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n ExtractZodArrayTypes<StructuredResponseFormat> extends Record<string, any>\n ? ExtractZodArrayTypes<StructuredResponseFormat>\n : Record<string, any>,\n TStateSchema,\n ContextSchema,\n StructuredResponseFormat\n > & {\n responseFormat: StructuredResponseFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n ExtractZodArrayTypes<StructuredResponseFormat> extends Record<string, any>\n ? ExtractZodArrayTypes<StructuredResponseFormat>\n : Record<string, any>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TypedToolStrategy<StructuredResponseFormat>\n > & {\n responseFormat: TypedToolStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ToolStrategy<StructuredResponseFormat>\n > & {\n responseFormat: ToolStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 7: With responseFormat as ProviderStrategy\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ProviderStrategy<StructuredResponseFormat>\n > & {\n responseFormat: ProviderStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & { middleware?: TMiddleware; tools?: TTools }\n): ReactAgent<\n AgentTypeConfig<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 9: With responseFormat explicitly undefined\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 10: For other ResponseFormat values (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Implementation\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any>,\n TStateSchema extends StateDefinitionInit,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[],\n TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n any\n >\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n> {\n return new ReactAgent(params);\n}\n\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n type ResponseFormatUndefined,\n} from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport { MIDDLEWARE_BRAND } from \"./middleware/types.js\";\nexport type * from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;;AA8hBA,SAAgB,YAUdA,QAcA;AACA,QAAO,IAAIC,8BAAW;AACvB"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n any\n >","ReactAgent"],"sources":["../../src/agents/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\nimport type { ClientTool, ServerTool } from \"@langchain/core/tools\";\nimport type { StateDefinitionInit } from \"@langchain/langgraph\";\n\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type {\n CreateAgentParams,\n AgentTypeConfig,\n CombineTools,\n} from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n ResponseFormat,\n JsonSchemaFormat,\n} from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n *\n * @example With StateSchema\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { StateSchema, ReducedValue } from \"@langchain/langgraph\";\n * import { z } from \"zod\";\n *\n * const AgentState = new StateSchema({\n * userId: z.string(),\n * count: z.number().default(0),\n * history: new ReducedValue(\n * z.array(z.string()).default(() => []),\n * { inputSchema: z.string(), reducer: (c, n) => [...c, n] }\n * ),\n * });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * tools: [searchTool],\n * stateSchema: AgentState,\n * });\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n InteropZodType<StructuredResponseFormat>\n > & {\n responseFormat: InteropZodType<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport function createAgent<\n StructuredResponseFormat extends readonly InteropZodType<any>[],\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n ExtractZodArrayTypes<StructuredResponseFormat> extends Record<string, any>\n ? ExtractZodArrayTypes<StructuredResponseFormat>\n : Record<string, any>,\n TStateSchema,\n ContextSchema,\n StructuredResponseFormat\n > & {\n responseFormat: StructuredResponseFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n ExtractZodArrayTypes<StructuredResponseFormat> extends Record<string, any>\n ? ExtractZodArrayTypes<StructuredResponseFormat>\n : Record<string, any>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TypedToolStrategy<StructuredResponseFormat>\n > & {\n responseFormat: TypedToolStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ToolStrategy<StructuredResponseFormat>\n > & {\n responseFormat: ToolStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 7: With responseFormat as ProviderStrategy\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ProviderStrategy<StructuredResponseFormat>\n > & {\n responseFormat: ProviderStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & { middleware?: TMiddleware; tools?: TTools }\n): ReactAgent<\n AgentTypeConfig<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 9: With responseFormat explicitly undefined\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 10: For other ResponseFormat values (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Implementation\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any>,\n TStateSchema extends StateDefinitionInit,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[],\n TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n any\n >\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n> {\n return new ReactAgent(params);\n}\n\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n type ResponseFormatUndefined,\n} from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport { MIDDLEWARE_BRAND } from \"./middleware/types.js\";\nexport type * from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;;AAmhBA,SAAgB,YAUdA,QAcA;AACA,QAAO,IAAIC,8BAAW;AACvB"}
|
package/dist/agents/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n any\n >"],"sources":["../../src/agents/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\nimport type { ClientTool, ServerTool } from \"@langchain/core/tools\";\nimport type { StateDefinitionInit } from \"@langchain/langgraph\";\n\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type {\n CreateAgentParams,\n AgentTypeConfig,\n CombineTools,\n} from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n ResponseFormat,\n JsonSchemaFormat,\n} from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n *\n * @example With StateSchema\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { StateSchema, ReducedValue } from \"@langchain/langgraph\";\n * import { z } from \"zod\";\n *\n * const AgentState = new StateSchema({\n * userId: z.string(),\n * count: z.number().default(0),\n * history: new ReducedValue(\n * z.array(z.string()).default(() => []),\n * { inputSchema: z.string(), reducer: (c, n) => [...c, n] }\n * ),\n * });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * tools: [searchTool],\n * stateSchema: AgentState,\n * });\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n InteropZodType<StructuredResponseFormat>\n > & {\n responseFormat: InteropZodType<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport function createAgent<\n StructuredResponseFormat extends readonly InteropZodType<any>[],\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n ExtractZodArrayTypes<StructuredResponseFormat> extends Record<string, any>\n ? ExtractZodArrayTypes<StructuredResponseFormat>\n : Record<string, any>,\n TStateSchema,\n ContextSchema,\n StructuredResponseFormat\n > & {\n responseFormat: StructuredResponseFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n ExtractZodArrayTypes<StructuredResponseFormat> extends Record<string, any>\n ? ExtractZodArrayTypes<StructuredResponseFormat>\n : Record<string, any>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TypedToolStrategy<StructuredResponseFormat>\n > & {\n responseFormat: TypedToolStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ToolStrategy<StructuredResponseFormat>\n > & {\n responseFormat: ToolStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 7: With responseFormat as ProviderStrategy\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ProviderStrategy<StructuredResponseFormat>\n > & {\n responseFormat: ProviderStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & { middleware?: TMiddleware; tools?: TTools }\n): ReactAgent<\n AgentTypeConfig<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 9: With responseFormat explicitly undefined\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 10: For other ResponseFormat values (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends\n readonly AgentMiddleware[] = readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Implementation\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any>,\n TStateSchema extends StateDefinitionInit,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[],\n TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n any\n >\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n> {\n return new ReactAgent(params);\n}\n\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n type ResponseFormatUndefined,\n} from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport { MIDDLEWARE_BRAND } from \"./middleware/types.js\";\nexport type * from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;;AA8hBA,SAAgB,YAUdA,QAcA;AACA,QAAO,IAAI,WAAW;AACvB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n any\n >"],"sources":["../../src/agents/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\nimport type { ClientTool, ServerTool } from \"@langchain/core/tools\";\nimport type { StateDefinitionInit } from \"@langchain/langgraph\";\n\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type {\n CreateAgentParams,\n AgentTypeConfig,\n CombineTools,\n} from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n ResponseFormat,\n JsonSchemaFormat,\n} from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n *\n * @example With StateSchema\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { StateSchema, ReducedValue } from \"@langchain/langgraph\";\n * import { z } from \"zod\";\n *\n * const AgentState = new StateSchema({\n * userId: z.string(),\n * count: z.number().default(0),\n * history: new ReducedValue(\n * z.array(z.string()).default(() => []),\n * { inputSchema: z.string(), reducer: (c, n) => [...c, n] }\n * ),\n * });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * tools: [searchTool],\n * stateSchema: AgentState,\n * });\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n InteropZodType<StructuredResponseFormat>\n > & {\n responseFormat: InteropZodType<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport function createAgent<\n StructuredResponseFormat extends readonly InteropZodType<any>[],\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n ExtractZodArrayTypes<StructuredResponseFormat> extends Record<string, any>\n ? ExtractZodArrayTypes<StructuredResponseFormat>\n : Record<string, any>,\n TStateSchema,\n ContextSchema,\n StructuredResponseFormat\n > & {\n responseFormat: StructuredResponseFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n ExtractZodArrayTypes<StructuredResponseFormat> extends Record<string, any>\n ? ExtractZodArrayTypes<StructuredResponseFormat>\n : Record<string, any>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n Record<string, unknown>,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TypedToolStrategy<StructuredResponseFormat>\n > & {\n responseFormat: TypedToolStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ToolStrategy<StructuredResponseFormat>\n > & {\n responseFormat: ToolStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 7: With responseFormat as ProviderStrategy\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ProviderStrategy<StructuredResponseFormat>\n > & {\n responseFormat: ProviderStrategy<StructuredResponseFormat>;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & { middleware?: TMiddleware; tools?: TTools }\n): ReactAgent<\n AgentTypeConfig<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 9: With responseFormat explicitly undefined\nexport function createAgent<\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n ResponseFormatUndefined,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Overload 10: For other ResponseFormat values (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n TStateSchema extends StateDefinitionInit | undefined = undefined,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject =\n AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] =\n readonly AgentMiddleware[],\n const TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n tools?: TTools;\n }\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n>;\n\n// Implementation\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any>,\n TStateSchema extends StateDefinitionInit,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[],\n TTools extends readonly (ClientTool | ServerTool)[] = readonly (\n | ClientTool\n | ServerTool\n )[],\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n any\n >\n): ReactAgent<\n AgentTypeConfig<\n StructuredResponseFormat,\n TStateSchema,\n ContextSchema,\n TMiddleware,\n CombineTools<TTools, TMiddleware>\n >\n> {\n return new ReactAgent(params);\n}\n\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n type ResponseFormatUndefined,\n} from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport { MIDDLEWARE_BRAND } from \"./middleware/types.js\";\nexport type * from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;;AAmhBA,SAAgB,YAUdA,QAcA;AACA,QAAO,IAAI,WAAW;AACvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMiddleware } from "../middleware.js";
|
|
2
2
|
import { InferInteropZodInput } from "@langchain/core/utils/types";
|
|
3
3
|
import { z } from "zod/v3";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _langchain_core_language_models_base0 from "@langchain/core/language_models/base";
|
|
5
5
|
import { BaseLanguageModel } from "@langchain/core/language_models/base";
|
|
6
6
|
|
|
7
7
|
//#region src/agents/middleware/llmToolSelector.d.ts
|
|
@@ -12,7 +12,7 @@ declare const LLMToolSelectorOptionsSchema: z.ZodObject<{
|
|
|
12
12
|
/**
|
|
13
13
|
* The language model to use for tool selection (default: the provided model from the agent options).
|
|
14
14
|
*/
|
|
15
|
-
model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<BaseLanguageModel<unknown,
|
|
15
|
+
model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<BaseLanguageModel<unknown, _langchain_core_language_models_base0.BaseLanguageModelCallOptions>, z.ZodTypeDef, BaseLanguageModel<unknown, _langchain_core_language_models_base0.BaseLanguageModelCallOptions>>]>>;
|
|
16
16
|
/**
|
|
17
17
|
* System prompt for the tool selection model.
|
|
18
18
|
*/
|
|
@@ -28,12 +28,12 @@ declare const LLMToolSelectorOptionsSchema: z.ZodObject<{
|
|
|
28
28
|
*/
|
|
29
29
|
alwaysInclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
model?: string | BaseLanguageModel<unknown,
|
|
31
|
+
model?: string | BaseLanguageModel<unknown, _langchain_core_language_models_base0.BaseLanguageModelCallOptions> | undefined;
|
|
32
32
|
systemPrompt?: string | undefined;
|
|
33
33
|
maxTools?: number | undefined;
|
|
34
34
|
alwaysInclude?: string[] | undefined;
|
|
35
35
|
}, {
|
|
36
|
-
model?: string | BaseLanguageModel<unknown,
|
|
36
|
+
model?: string | BaseLanguageModel<unknown, _langchain_core_language_models_base0.BaseLanguageModelCallOptions> | undefined;
|
|
37
37
|
systemPrompt?: string | undefined;
|
|
38
38
|
maxTools?: number | undefined;
|
|
39
39
|
alwaysInclude?: string[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llmToolSelector.d.ts","names":["z","BaseLanguageModel","InferInteropZodInput","createMiddleware","LLMToolSelectorOptionsSchema","ZodString","
|
|
1
|
+
{"version":3,"file":"llmToolSelector.d.ts","names":["z","BaseLanguageModel","InferInteropZodInput","createMiddleware","LLMToolSelectorOptionsSchema","ZodString","_langchain_core_language_models_base0","BaseLanguageModelCallOptions","ZodTypeDef","ZodType","ZodUnion","ZodOptional","ZodNumber","ZodArray","ZodTypeAny","ZodObject","LLMToolSelectorConfig","llmToolSelectorMiddleware","ReturnType"],"sources":["../../../src/agents/middleware/llmToolSelector.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport type { InferInteropZodInput } from \"@langchain/core/utils/types\";\nimport { createMiddleware } from \"../middleware.js\";\n/**\n * Options for configuring the LLM Tool Selector middleware.\n */\nexport declare const LLMToolSelectorOptionsSchema: z.ZodObject<{\n /**\n * The language model to use for tool selection (default: the provided model from the agent options).\n */\n model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<BaseLanguageModel<unknown, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>, z.ZodTypeDef, BaseLanguageModel<unknown, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>>]>>;\n /**\n * System prompt for the tool selection model.\n */\n systemPrompt: z.ZodOptional<z.ZodString>;\n /**\n * Maximum number of tools to select. If the model selects more,\n * only the first maxTools will be used. No limit if not specified.\n */\n maxTools: z.ZodOptional<z.ZodNumber>;\n /**\n * Tool names to always include regardless of selection.\n * These do not count against the maxTools limit.\n */\n alwaysInclude: z.ZodOptional<z.ZodArray<z.ZodString, \"many\">>;\n}, \"strip\", z.ZodTypeAny, {\n model?: string | BaseLanguageModel<unknown, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions> | undefined;\n systemPrompt?: string | undefined;\n maxTools?: number | undefined;\n alwaysInclude?: string[] | undefined;\n}, {\n model?: string | BaseLanguageModel<unknown, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions> | undefined;\n systemPrompt?: string | undefined;\n maxTools?: number | undefined;\n alwaysInclude?: string[] | undefined;\n}>;\nexport type LLMToolSelectorConfig = InferInteropZodInput<typeof LLMToolSelectorOptionsSchema>;\n/**\n * Middleware for selecting tools using an LLM-based strategy.\n *\n * When an agent has many tools available, this middleware filters them down\n * to only the most relevant ones for the user's query. This reduces token usage\n * and helps the main model focus on the right tools.\n *\n * @param options - Configuration options for the middleware\n * @param options.model - The language model to use for tool selection (default: the provided model from the agent options).\n * @param options.systemPrompt - Instructions for the selection model.\n * @param options.maxTools - Maximum number of tools to select. If the model selects more,\n * only the first maxTools will be used. No limit if not specified.\n * @param options.alwaysInclude - Tool names to always include regardless of selection.\n * These do not count against the maxTools limit.\n *\n * @example\n * Limit to 3 tools:\n * ```ts\n * import { llmToolSelectorMiddleware } from \"langchain/agents/middleware\";\n *\n * const middleware = llmToolSelectorMiddleware({ maxTools: 3 });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4o\",\n * tools: [tool1, tool2, tool3, tool4, tool5],\n * middleware: [middleware],\n * });\n * ```\n *\n * @example\n * Use a smaller model for selection:\n * ```ts\n * const middleware = llmToolSelectorMiddleware({\n * model: \"openai:gpt-4o-mini\",\n * maxTools: 2\n * });\n * ```\n */\nexport declare function llmToolSelectorMiddleware(options: LLMToolSelectorConfig): ReturnType<typeof createMiddleware>;\n//# sourceMappingURL=llmToolSelector.d.ts.map"],"mappings":";;;;;;;;;;AAOqBI,cAAAA,4BA6BnB,EA7BiDJ,CAAAA,CAAEe,SA6BnD,CAAA;EAzBqCV;;;EAAgIG,KAAAA,EAA5JR,CAAAA,CAAEW,WAA0JH,CAA9IR,CAAAA,CAAEU,QAA4IF,CAAAA,CAAlIR,CAAAA,CAAEK,SAAgIG,EAArHR,CAAAA,CAAES,OAAmHD,CAA3GP,iBAA2GO,CAAAA,OAAAA,EAAvHF,qCAAAA,CAAsFC,4BAAAA,CAAiCC,EAAFR,CAAAA,CAAEQ,UAAAA,EAAYP,iBAAZO,CAAAA,OAAAA,EAAUF,qCAAAA,CAA4EC,4BAAAA,CAAtFC,CAAAA,CAAAA,CAAAA,CAAAA;EAAUF;;;EAAtJI,YAAAA,EAITV,CAAAA,CAAEW,WAJOD,CAIKV,CAAAA,CAAEK,SAJPK,CAAAA;EAAdC;;;;EASGA,QAAAA,EAAFX,CAAAA,CAAEW,WAAAA,CAAYX,CAAAA,CAAEY,SAAdD,CAAAA;EAK8BN;;;;EACtBC,aAAAA,EADLN,CAAAA,CAAEW,WACGL,CADSN,CAAAA,CAAEa,QAE4DN,CAFnDP,CAAAA,CAAEK,SAEiDE,EAAAA,MAAAA,CAAAA,CAAAA;CAA1EN,EAAAA,OAAAA,EADTD,CAAAA,CAAEc,UACOb,EAAAA;EAAiBK,KAAAA,CAAAA,EAAAA,MAAAA,GAAjBL,iBAAiBK,CAKyDC,OAAAA,EANvED,qCAAAA,CACuEC,4BAAAA,CAKAA,GAAAA,SAAAA;EAA1EN,YAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAzBgCc,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAS,aAAA,CAAA,EAAA,MAAA,EAAA,GAAA,SAAA;AA8B9D,CAAA,EAAA;EAuCwBE,KAAAA,CAAAA,EAAAA,MAAAA,GA5CHhB,iBA4C4B,CAAA,OAAA,EAjDXK,qCAAAA,CAKyDC,4BAAAA,CA4C9C,GAAA,SAAA;EAAUS,YAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAA0Cb,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAlBe,aAAAA,CAAAA,EAAAA,MAAAA,EAAAA,GAAAA,SAAAA;AAAU,CAAA,CAAA;KAvCjFF,qBAAAA,GAAwBd,4BAA4BE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuCxCa,yBAAAA,UAAmCD,wBAAwBE,kBAAkBf"}
|
|
@@ -4,7 +4,7 @@ import { BaseMessage } from "@langchain/core/messages";
|
|
|
4
4
|
import * as _langchain_core_tools1 from "@langchain/core/tools";
|
|
5
5
|
import { InferInteropZodInput } from "@langchain/core/utils/types";
|
|
6
6
|
import { z } from "zod/v3";
|
|
7
|
-
import * as
|
|
7
|
+
import * as _langchain_core_language_models_base3 from "@langchain/core/language_models/base";
|
|
8
8
|
import { BaseLanguageModel } from "@langchain/core/language_models/base";
|
|
9
9
|
|
|
10
10
|
//#region src/agents/middleware/summarization.d.ts
|
|
@@ -72,7 +72,7 @@ declare const contextSchema: z.ZodObject<{
|
|
|
72
72
|
/**
|
|
73
73
|
* Model to use for summarization
|
|
74
74
|
*/
|
|
75
|
-
model: z.ZodType<string | BaseLanguageModel<any,
|
|
75
|
+
model: z.ZodType<string | BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions>, z.ZodTypeDef, string | BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions>>;
|
|
76
76
|
/**
|
|
77
77
|
* Trigger conditions for summarization.
|
|
78
78
|
* Can be a single condition object (all properties must be met) or an array of conditions (any condition must be met).
|
|
@@ -204,7 +204,7 @@ declare const contextSchema: z.ZodObject<{
|
|
|
204
204
|
*/
|
|
205
205
|
messagesToKeep: z.ZodOptional<z.ZodNumber>;
|
|
206
206
|
}, "strip", z.ZodTypeAny, {
|
|
207
|
-
model: string | BaseLanguageModel<any,
|
|
207
|
+
model: string | BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions>;
|
|
208
208
|
trigger?: {
|
|
209
209
|
fraction?: number | undefined;
|
|
210
210
|
tokens?: number | undefined;
|
|
@@ -226,7 +226,7 @@ declare const contextSchema: z.ZodObject<{
|
|
|
226
226
|
maxTokensBeforeSummary?: number | undefined;
|
|
227
227
|
messagesToKeep?: number | undefined;
|
|
228
228
|
}, {
|
|
229
|
-
model: string | BaseLanguageModel<any,
|
|
229
|
+
model: string | BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions>;
|
|
230
230
|
trigger?: {
|
|
231
231
|
fraction?: number | undefined;
|
|
232
232
|
tokens?: number | undefined;
|
|
@@ -389,7 +389,7 @@ declare function summarizationMiddleware(options: SummarizationMiddlewareConfig)
|
|
|
389
389
|
maxTokensBeforeSummary: z.ZodOptional<z.ZodNumber>;
|
|
390
390
|
messagesToKeep: z.ZodOptional<z.ZodNumber>;
|
|
391
391
|
} & {
|
|
392
|
-
model: z.ZodOptional<z.ZodType<BaseLanguageModel<any,
|
|
392
|
+
model: z.ZodOptional<z.ZodType<BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions>, z.ZodTypeDef, BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions>>>;
|
|
393
393
|
}, "strip", z.ZodTypeAny, {
|
|
394
394
|
trigger?: {
|
|
395
395
|
fraction?: number | undefined;
|
|
@@ -411,7 +411,7 @@ declare function summarizationMiddleware(options: SummarizationMiddlewareConfig)
|
|
|
411
411
|
summaryPrefix?: string | undefined;
|
|
412
412
|
maxTokensBeforeSummary?: number | undefined;
|
|
413
413
|
messagesToKeep?: number | undefined;
|
|
414
|
-
model?: BaseLanguageModel<any,
|
|
414
|
+
model?: BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions> | undefined;
|
|
415
415
|
}, {
|
|
416
416
|
trigger?: {
|
|
417
417
|
fraction?: number | undefined;
|
|
@@ -433,7 +433,7 @@ declare function summarizationMiddleware(options: SummarizationMiddlewareConfig)
|
|
|
433
433
|
summaryPrefix?: string | undefined;
|
|
434
434
|
maxTokensBeforeSummary?: number | undefined;
|
|
435
435
|
messagesToKeep?: number | undefined;
|
|
436
|
-
model?: BaseLanguageModel<any,
|
|
436
|
+
model?: BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions> | undefined;
|
|
437
437
|
}>, {
|
|
438
438
|
trigger?: {
|
|
439
439
|
fraction?: number | undefined;
|
|
@@ -455,7 +455,7 @@ declare function summarizationMiddleware(options: SummarizationMiddlewareConfig)
|
|
|
455
455
|
summaryPrefix?: string | undefined;
|
|
456
456
|
maxTokensBeforeSummary?: number | undefined;
|
|
457
457
|
messagesToKeep?: number | undefined;
|
|
458
|
-
model?: BaseLanguageModel<any,
|
|
458
|
+
model?: BaseLanguageModel<any, _langchain_core_language_models_base3.BaseLanguageModelCallOptions> | undefined;
|
|
459
459
|
}, readonly (_langchain_core_tools1.ServerTool | _langchain_core_tools1.ClientTool)[]>;
|
|
460
460
|
//#endregion
|
|
461
461
|
export { ContextSize, KeepSize, SummarizationMiddlewareConfig, TokenCounter, summarizationMiddleware };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarization.d.ts","names":["_langchain_core_messages0","_langchain_core_tools1","__types_js8","z","BaseMessage","BaseLanguageModel","InferInteropZodInput","DEFAULT_SUMMARY_PROMPT","TokenCounter","Promise","contextSizeSchema","ZodNumber","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","ContextSize","infer","keepSchema","KeepSize","contextSchema","_langchain_core_language_models_base0","BaseLanguageModelCallOptions","ZodTypeDef","ZodType","ZodArray","ZodUnion","MessageToolSet","MessageStructure","MessageType","ZodUnknown","ZodTuple","ZodPromise","ZodFunction","ZodString","ZodDefault","SummarizationMiddlewareConfig","getProfileLimits","summarizationMiddleware","ServerTool","ClientTool","AgentMiddleware"],"sources":["../../../src/agents/middleware/summarization.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { InferInteropZodInput } from \"@langchain/core/utils/types\";\nexport declare const DEFAULT_SUMMARY_PROMPT = \"<role>\\nContext Extraction Assistant\\n</role>\\n\\n<primary_objective>\\nYour sole objective in this task is to extract the highest quality/most relevant context from the conversation history below.\\n</primary_objective>\\n\\n<objective_information>\\nYou're nearing the total number of input tokens you can accept, so you must extract the highest quality/most relevant pieces of information from your conversation history.\\nThis context will then overwrite the conversation history presented below. Because of this, ensure the context you extract is only the most important information to your overall goal.\\n</objective_information>\\n\\n<instructions>\\nThe conversation history below will be replaced with the context you extract in this step. Because of this, you must do your very best to extract and record all of the most important context from the conversation history.\\nYou want to ensure that you don't repeat any actions you've already completed, so the context you extract from the conversation history should be focused on the most important information to your overall goal.\\n</instructions>\\n\\nThe user will message you with the full message history you'll be extracting context from, to then replace. Carefully read over it all, and think deeply about what information is most important to your overall goal that should be saved:\\n\\nWith all of this in mind, please carefully read over the entire conversation history, and extract the most important and relevant context to replace it so that you can free up space in the conversation history.\\nRespond ONLY with the extracted context. Do not include any additional information, or text before or after the extracted context.\\n\\n<messages>\\nMessages to summarize:\\n{messages}\\n</messages>\";\nexport type TokenCounter = (messages: BaseMessage[]) => number | Promise<number>;\nexport declare const contextSizeSchema: z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n}, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}>;\nexport type ContextSize = z.infer<typeof contextSizeSchema>;\nexport declare const keepSchema: z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to keep\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to keep\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n messages: z.ZodOptional<z.ZodNumber>;\n}, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}>;\nexport type KeepSize = z.infer<typeof keepSchema>;\ndeclare const contextSchema: z.ZodObject<{\n /**\n * Model to use for summarization\n */\n model: z.ZodType<string | BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>, z.ZodTypeDef, string | BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>>;\n /**\n * Trigger conditions for summarization.\n * Can be a single condition object (all properties must be met) or an array of conditions (any condition must be met).\n *\n * @example\n * ```ts\n * // Single condition: trigger if tokens >= 5000 AND messages >= 3\n * trigger: { tokens: 5000, messages: 3 }\n *\n * // Multiple conditions: trigger if (tokens >= 5000 AND messages >= 3) OR (tokens >= 3000 AND messages >= 6)\n * trigger: [\n * { tokens: 5000, messages: 3 },\n * { tokens: 3000, messages: 6 }\n * ]\n * ```\n */\n trigger: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, z.ZodArray<z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, \"many\">]>>;\n /**\n * Keep conditions for summarization\n */\n keep: z.ZodOptional<z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to keep\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to keep\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>>;\n /**\n * Token counter function to use for summarization\n */\n tokenCounter: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodType<BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>, z.ZodTypeDef, BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>>, \"many\">], z.ZodUnknown>, z.ZodUnion<[z.ZodNumber, z.ZodPromise<z.ZodNumber>]>>>;\n /**\n * Summary prompt to use for summarization\n * @default {@link DEFAULT_SUMMARY_PROMPT}\n */\n summaryPrompt: z.ZodDefault<z.ZodString>;\n /**\n * Number of tokens to trim to before summarizing\n */\n trimTokensToSummarize: z.ZodOptional<z.ZodNumber>;\n /**\n * Prefix to add to the summary\n */\n summaryPrefix: z.ZodOptional<z.ZodString>;\n /**\n * @deprecated Use `trigger: { tokens: value }` instead.\n */\n maxTokensBeforeSummary: z.ZodOptional<z.ZodNumber>;\n /**\n * @deprecated Use `keep: { messages: value }` instead.\n */\n messagesToKeep: z.ZodOptional<z.ZodNumber>;\n}, \"strip\", z.ZodTypeAny, {\n model: string | BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>;\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt: string;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n}, {\n model: string | BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>;\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt?: string | undefined;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n}>;\nexport type SummarizationMiddlewareConfig = InferInteropZodInput<typeof contextSchema>;\n/**\n * Get max input tokens from model profile or fallback to model name lookup\n */\nexport declare function getProfileLimits(input: BaseLanguageModel): number | undefined;\n/**\n * Summarization middleware that automatically summarizes conversation history when token limits are approached.\n *\n * This middleware monitors message token counts and automatically summarizes older\n * messages when a threshold is reached, preserving recent messages and maintaining\n * context continuity by ensuring AI/Tool message pairs remain together.\n *\n * @param options Configuration options for the summarization middleware\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * import { summarizationMiddleware } from \"langchain\";\n * import { createAgent } from \"langchain\";\n *\n * // Single condition: trigger if tokens >= 4000 AND messages >= 10\n * const agent1 = createAgent({\n * llm: model,\n * tools: [getWeather],\n * middleware: [\n * summarizationMiddleware({\n * model: new ChatOpenAI({ model: \"gpt-4o\" }),\n * trigger: { tokens: 4000, messages: 10 },\n * keep: { messages: 20 },\n * })\n * ],\n * });\n *\n * // Multiple conditions: trigger if (tokens >= 5000 AND messages >= 3) OR (tokens >= 3000 AND messages >= 6)\n * const agent2 = createAgent({\n * llm: model,\n * tools: [getWeather],\n * middleware: [\n * summarizationMiddleware({\n * model: new ChatOpenAI({ model: \"gpt-4o\" }),\n * trigger: [\n * { tokens: 5000, messages: 3 },\n * { tokens: 3000, messages: 6 },\n * ],\n * keep: { messages: 20 },\n * })\n * ],\n * });\n *\n * ```\n */\nexport declare function summarizationMiddleware(options: SummarizationMiddlewareConfig): import(\"./types.js\").AgentMiddleware<undefined, z.ZodObject<{\n trigger: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, z.ZodArray<z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, \"many\">]>>;\n keep: z.ZodOptional<z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to keep\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to keep\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>>;\n tokenCounter: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodType<BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>, z.ZodTypeDef, BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>>, \"many\">], z.ZodUnknown>, z.ZodUnion<[z.ZodNumber, z.ZodPromise<z.ZodNumber>]>>>;\n summaryPrompt: z.ZodDefault<z.ZodString>;\n trimTokensToSummarize: z.ZodOptional<z.ZodNumber>;\n summaryPrefix: z.ZodOptional<z.ZodString>;\n maxTokensBeforeSummary: z.ZodOptional<z.ZodNumber>;\n messagesToKeep: z.ZodOptional<z.ZodNumber>;\n} & {\n model: z.ZodOptional<z.ZodType<BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>, z.ZodTypeDef, BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>>>;\n}, \"strip\", z.ZodTypeAny, {\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt: string;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n model?: BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions> | undefined;\n}, {\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt?: string | undefined;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n model?: BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions> | undefined;\n}>, {\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt: string;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n model?: BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions> | undefined;\n}, readonly (import(\"@langchain/core/tools\").ServerTool | import(\"@langchain/core/tools\").ClientTool)[]>;\nexport {};\n//# sourceMappingURL=summarization.d.ts.map"],"mappings":";;;;;;;;;;KAKYQ,YAAAA,cAA0BJ,2BAA2BK;cAC5CC,mBAAmBP,CAAAA,CAAEY,WAAWZ,CAAAA,CAAEW;;;;EAD3CN,QAAAA,EAKEL,CAAAA,CAAES,WALQ,CAKIT,CAAAA,CAAEQ,SALQP,CAAAA;EACjBM;;;EAQOC,MAAAA,EAAhBR,CAAAA,CAAES,WAAcD,CAAFR,CAAAA,CAAEQ,SAAAA,CAAAA;EAAdC;;;EAKAC,QAAAA,EADAV,CAAAA,CAAES,WACFC,CADcV,CAAAA,CAAEQ,SAChBE,CAAAA;CAbuCV,EAAEW,OAAAA,EAa3CX,CAAAA,CAAEU,UAbyCC,EAAAA;EAAbC,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAU,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EA8BxCC,QAAAA,CAAAA,E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AA,CAAES,YAAYT,CAAAA,CAAEQ;kBACxBR,CAAAA,CAAES,YAAYT,CAAAA,CAAEQ;;SAEzBR,CAAAA,CAAES,YAAYT,CAAAA,CAAEqB,QAAQnB,uBAFFgB,qCAAAA,CAEwEC,4BAAAA,GAA+BnB,CAAAA,CAAEoB,YAAYlB,uBAAFgB,qCAAAA,CAAwEC,4BAAAA;YAChNnB,CAAAA,CAAEU;;;;;;;;;;;;;;;2BAeeT,YAAiHJ,yBAAAA,CAAlE4B,iBAfpD5B,yBAAAA,CAewG2B,cAAAA,GAApC3B,yBAAAA,CAAwF6B,WAAAA,qCAAgDpB;;;;;;UAMxNJ,uBAN+NgB,qCAAAA,CAMzJC,4BAAAA;;;;;;;;;;;;;;;;2BAgBrDlB,YAAiHJ,yBAAAA,CAAlE4B,iBAhB/C5B,yBAAAA,CAgBmG2B,cAAAA,GAApC3B,yBAAAA,CAAwF6B,WAAAA,qCAAgDpB;;;;;;UAMxNJ,uBAN+NgB,qCAAAA,CAMzJC,4BAAAA;;;;;;;;;;;;;;;;2BAgBrDlB,YAAiHJ,yBAAAA,CAAlE4B,iBA1JwE5B,yBAAAA,CA0JpB2B,cAAAA,GAApC3B,yBAAAA,CAAwF6B,WAAAA,qCAAgDpB;;;;;;UAMxNJ,uBAN+NgB,qCAAAA,CAMzJC,4BAAAA;aAArDrB,sBAAAA,CACgBsC,UAAAA,GAAUtC,sBAAAA,CAAmCuC"}
|
|
1
|
+
{"version":3,"file":"summarization.d.ts","names":["_langchain_core_messages0","_langchain_core_tools1","__types_js8","z","BaseMessage","BaseLanguageModel","InferInteropZodInput","DEFAULT_SUMMARY_PROMPT","TokenCounter","Promise","contextSizeSchema","ZodNumber","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","ContextSize","infer","keepSchema","KeepSize","contextSchema","_langchain_core_language_models_base3","BaseLanguageModelCallOptions","ZodTypeDef","ZodType","ZodArray","ZodUnion","MessageToolSet","MessageStructure","MessageType","ZodUnknown","ZodTuple","ZodPromise","ZodFunction","ZodString","ZodDefault","SummarizationMiddlewareConfig","getProfileLimits","summarizationMiddleware","ServerTool","ClientTool","AgentMiddleware"],"sources":["../../../src/agents/middleware/summarization.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { InferInteropZodInput } from \"@langchain/core/utils/types\";\nexport declare const DEFAULT_SUMMARY_PROMPT = \"<role>\\nContext Extraction Assistant\\n</role>\\n\\n<primary_objective>\\nYour sole objective in this task is to extract the highest quality/most relevant context from the conversation history below.\\n</primary_objective>\\n\\n<objective_information>\\nYou're nearing the total number of input tokens you can accept, so you must extract the highest quality/most relevant pieces of information from your conversation history.\\nThis context will then overwrite the conversation history presented below. Because of this, ensure the context you extract is only the most important information to your overall goal.\\n</objective_information>\\n\\n<instructions>\\nThe conversation history below will be replaced with the context you extract in this step. Because of this, you must do your very best to extract and record all of the most important context from the conversation history.\\nYou want to ensure that you don't repeat any actions you've already completed, so the context you extract from the conversation history should be focused on the most important information to your overall goal.\\n</instructions>\\n\\nThe user will message you with the full message history you'll be extracting context from, to then replace. Carefully read over it all, and think deeply about what information is most important to your overall goal that should be saved:\\n\\nWith all of this in mind, please carefully read over the entire conversation history, and extract the most important and relevant context to replace it so that you can free up space in the conversation history.\\nRespond ONLY with the extracted context. Do not include any additional information, or text before or after the extracted context.\\n\\n<messages>\\nMessages to summarize:\\n{messages}\\n</messages>\";\nexport type TokenCounter = (messages: BaseMessage[]) => number | Promise<number>;\nexport declare const contextSizeSchema: z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n}, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}>;\nexport type ContextSize = z.infer<typeof contextSizeSchema>;\nexport declare const keepSchema: z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to keep\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to keep\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n messages: z.ZodOptional<z.ZodNumber>;\n}, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n}>;\nexport type KeepSize = z.infer<typeof keepSchema>;\ndeclare const contextSchema: z.ZodObject<{\n /**\n * Model to use for summarization\n */\n model: z.ZodType<string | BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>, z.ZodTypeDef, string | BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>>;\n /**\n * Trigger conditions for summarization.\n * Can be a single condition object (all properties must be met) or an array of conditions (any condition must be met).\n *\n * @example\n * ```ts\n * // Single condition: trigger if tokens >= 5000 AND messages >= 3\n * trigger: { tokens: 5000, messages: 3 }\n *\n * // Multiple conditions: trigger if (tokens >= 5000 AND messages >= 3) OR (tokens >= 3000 AND messages >= 6)\n * trigger: [\n * { tokens: 5000, messages: 3 },\n * { tokens: 3000, messages: 6 }\n * ]\n * ```\n */\n trigger: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, z.ZodArray<z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, \"many\">]>>;\n /**\n * Keep conditions for summarization\n */\n keep: z.ZodOptional<z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to keep\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to keep\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>>;\n /**\n * Token counter function to use for summarization\n */\n tokenCounter: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodType<BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>, z.ZodTypeDef, BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>>, \"many\">], z.ZodUnknown>, z.ZodUnion<[z.ZodNumber, z.ZodPromise<z.ZodNumber>]>>>;\n /**\n * Summary prompt to use for summarization\n * @default {@link DEFAULT_SUMMARY_PROMPT}\n */\n summaryPrompt: z.ZodDefault<z.ZodString>;\n /**\n * Number of tokens to trim to before summarizing\n */\n trimTokensToSummarize: z.ZodOptional<z.ZodNumber>;\n /**\n * Prefix to add to the summary\n */\n summaryPrefix: z.ZodOptional<z.ZodString>;\n /**\n * @deprecated Use `trigger: { tokens: value }` instead.\n */\n maxTokensBeforeSummary: z.ZodOptional<z.ZodNumber>;\n /**\n * @deprecated Use `keep: { messages: value }` instead.\n */\n messagesToKeep: z.ZodOptional<z.ZodNumber>;\n}, \"strip\", z.ZodTypeAny, {\n model: string | BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>;\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt: string;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n}, {\n model: string | BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>;\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt?: string | undefined;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n}>;\nexport type SummarizationMiddlewareConfig = InferInteropZodInput<typeof contextSchema>;\n/**\n * Get max input tokens from model profile or fallback to model name lookup\n */\nexport declare function getProfileLimits(input: BaseLanguageModel): number | undefined;\n/**\n * Summarization middleware that automatically summarizes conversation history when token limits are approached.\n *\n * This middleware monitors message token counts and automatically summarizes older\n * messages when a threshold is reached, preserving recent messages and maintaining\n * context continuity by ensuring AI/Tool message pairs remain together.\n *\n * @param options Configuration options for the summarization middleware\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * import { summarizationMiddleware } from \"langchain\";\n * import { createAgent } from \"langchain\";\n *\n * // Single condition: trigger if tokens >= 4000 AND messages >= 10\n * const agent1 = createAgent({\n * llm: model,\n * tools: [getWeather],\n * middleware: [\n * summarizationMiddleware({\n * model: new ChatOpenAI({ model: \"gpt-4o\" }),\n * trigger: { tokens: 4000, messages: 10 },\n * keep: { messages: 20 },\n * })\n * ],\n * });\n *\n * // Multiple conditions: trigger if (tokens >= 5000 AND messages >= 3) OR (tokens >= 3000 AND messages >= 6)\n * const agent2 = createAgent({\n * llm: model,\n * tools: [getWeather],\n * middleware: [\n * summarizationMiddleware({\n * model: new ChatOpenAI({ model: \"gpt-4o\" }),\n * trigger: [\n * { tokens: 5000, messages: 3 },\n * { tokens: 3000, messages: 6 },\n * ],\n * keep: { messages: 20 },\n * })\n * ],\n * });\n *\n * ```\n */\nexport declare function summarizationMiddleware(options: SummarizationMiddlewareConfig): import(\"./types.js\").AgentMiddleware<undefined, z.ZodObject<{\n trigger: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, z.ZodArray<z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to use as the trigger\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to use as the trigger\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of messages to use as the trigger\n */\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, \"many\">]>>;\n keep: z.ZodOptional<z.ZodEffects<z.ZodObject<{\n /**\n * Fraction of the model's context size to keep\n */\n fraction: z.ZodOptional<z.ZodNumber>;\n /**\n * Number of tokens to keep\n */\n tokens: z.ZodOptional<z.ZodNumber>;\n messages: z.ZodOptional<z.ZodNumber>;\n }, \"strip\", z.ZodTypeAny, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }, {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }>>;\n tokenCounter: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodType<BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>, z.ZodTypeDef, BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>>, \"many\">], z.ZodUnknown>, z.ZodUnion<[z.ZodNumber, z.ZodPromise<z.ZodNumber>]>>>;\n summaryPrompt: z.ZodDefault<z.ZodString>;\n trimTokensToSummarize: z.ZodOptional<z.ZodNumber>;\n summaryPrefix: z.ZodOptional<z.ZodString>;\n maxTokensBeforeSummary: z.ZodOptional<z.ZodNumber>;\n messagesToKeep: z.ZodOptional<z.ZodNumber>;\n} & {\n model: z.ZodOptional<z.ZodType<BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>, z.ZodTypeDef, BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions>>>;\n}, \"strip\", z.ZodTypeAny, {\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt: string;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n model?: BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions> | undefined;\n}, {\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt?: string | undefined;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n model?: BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions> | undefined;\n}>, {\n trigger?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n }[] | {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n keep?: {\n fraction?: number | undefined;\n tokens?: number | undefined;\n messages?: number | undefined;\n } | undefined;\n tokenCounter?: ((args_0: BaseMessage<import(\"@langchain/core/messages\").MessageStructure<import(\"@langchain/core/messages\").MessageToolSet>, import(\"@langchain/core/messages\").MessageType>[], ...args: unknown[]) => number | Promise<number>) | undefined;\n summaryPrompt: string;\n trimTokensToSummarize?: number | undefined;\n summaryPrefix?: string | undefined;\n maxTokensBeforeSummary?: number | undefined;\n messagesToKeep?: number | undefined;\n model?: BaseLanguageModel<any, import(\"@langchain/core/language_models/base\").BaseLanguageModelCallOptions> | undefined;\n}, readonly (import(\"@langchain/core/tools\").ServerTool | import(\"@langchain/core/tools\").ClientTool)[]>;\nexport {};\n//# sourceMappingURL=summarization.d.ts.map"],"mappings":";;;;;;;;;;KAKYQ,YAAAA,cAA0BJ,2BAA2BK;cAC5CC,mBAAmBP,CAAAA,CAAEY,WAAWZ,CAAAA,CAAEW;;;;EAD3CN,QAAAA,EAKEL,CAAAA,CAAES,WALQ,CAKIT,CAAAA,CAAEQ,SALQP,CAAAA;EACjBM;;;EAQOC,MAAAA,EAAhBR,CAAAA,CAAES,WAAcD,CAAFR,CAAAA,CAAEQ,SAAAA,CAAAA;EAAdC;;;EAKAC,QAAAA,EADAV,CAAAA,CAAES,WACFC,CADcV,CAAAA,CAAEQ,SAChBE,CAAAA;CAbuCV,EAAEW,OAAAA,EAa3CX,CAAAA,CAAEU,UAbyCC,EAAAA;EAAbC,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAU,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EA8BxCC,QAAAA,CAAAA,EAAAA,MAAW,GAAA,SAAkBN;AACzC,CAAA,EAAA;EAI8BC,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAdC,MAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAIYD,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;CAAhBR,CAAAA,EAAES;EACgBD,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAdC,MAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EACFC,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;CAVgCV,EAAEW;EAAbC,QAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAU,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EA2BjCI,QAAAA,CAAAA,EAAQ,MAAA,GAAA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