langchain 1.1.5 → 1.1.6-dev-1765431816670

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/ReactAgent.d.cts +0 -2
  3. package/dist/agents/ReactAgent.d.cts.map +1 -0
  4. package/dist/agents/ReactAgent.d.ts +0 -2
  5. package/dist/agents/ReactAgent.d.ts.map +1 -0
  6. package/dist/agents/constants.d.cts.map +1 -0
  7. package/dist/agents/constants.d.ts.map +1 -0
  8. package/dist/agents/errors.d.cts.map +1 -0
  9. package/dist/agents/errors.d.ts.map +1 -0
  10. package/dist/agents/index.d.cts +0 -11
  11. package/dist/agents/index.d.cts.map +1 -0
  12. package/dist/agents/index.d.ts +0 -11
  13. package/dist/agents/index.d.ts.map +1 -0
  14. package/dist/agents/middleware/contextEditing.d.cts.map +1 -0
  15. package/dist/agents/middleware/contextEditing.d.ts.map +1 -0
  16. package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -0
  17. package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -0
  18. package/dist/agents/middleware/hitl.d.cts.map +1 -0
  19. package/dist/agents/middleware/hitl.d.ts.map +1 -0
  20. package/dist/agents/middleware/llmToolSelector.d.cts.map +1 -0
  21. package/dist/agents/middleware/llmToolSelector.d.ts.map +1 -0
  22. package/dist/agents/middleware/modelCallLimit.d.cts.map +1 -0
  23. package/dist/agents/middleware/modelCallLimit.d.ts.map +1 -0
  24. package/dist/agents/middleware/modelFallback.d.cts.map +1 -0
  25. package/dist/agents/middleware/modelFallback.d.ts.map +1 -0
  26. package/dist/agents/middleware/modelRetry.d.cts.map +1 -0
  27. package/dist/agents/middleware/modelRetry.d.ts.map +1 -0
  28. package/dist/agents/middleware/pii.d.cts.map +1 -0
  29. package/dist/agents/middleware/pii.d.ts.map +1 -0
  30. package/dist/agents/middleware/piiRedaction.d.cts.map +1 -0
  31. package/dist/agents/middleware/piiRedaction.d.ts.map +1 -0
  32. package/dist/agents/middleware/provider/anthropic/promptCaching.d.cts.map +1 -0
  33. package/dist/agents/middleware/provider/anthropic/promptCaching.d.ts.map +1 -0
  34. package/dist/agents/middleware/provider/openai/moderation.d.cts.map +1 -0
  35. package/dist/agents/middleware/provider/openai/moderation.d.ts.map +1 -0
  36. package/dist/agents/middleware/summarization.d.cts.map +1 -0
  37. package/dist/agents/middleware/summarization.d.ts.map +1 -0
  38. package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -0
  39. package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -0
  40. package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -0
  41. package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -0
  42. package/dist/agents/middleware/toolEmulator.d.cts.map +1 -0
  43. package/dist/agents/middleware/toolEmulator.d.ts.map +1 -0
  44. package/dist/agents/middleware/toolRetry.d.cts.map +1 -0
  45. package/dist/agents/middleware/toolRetry.d.ts.map +1 -0
  46. package/dist/agents/middleware/types.d.cts.map +1 -0
  47. package/dist/agents/middleware/types.d.ts.map +1 -0
  48. package/dist/agents/middleware/utils.d.cts.map +1 -0
  49. package/dist/agents/middleware/utils.d.ts.map +1 -0
  50. package/dist/agents/middleware.d.cts.map +1 -0
  51. package/dist/agents/middleware.d.ts.map +1 -0
  52. package/dist/agents/nodes/types.d.cts.map +1 -0
  53. package/dist/agents/nodes/types.d.ts.map +1 -0
  54. package/dist/agents/responses.d.cts +0 -2
  55. package/dist/agents/responses.d.cts.map +1 -0
  56. package/dist/agents/responses.d.ts +0 -2
  57. package/dist/agents/responses.d.ts.map +1 -0
  58. package/dist/agents/runtime.d.cts +1 -3
  59. package/dist/agents/runtime.d.cts.map +1 -0
  60. package/dist/agents/runtime.d.ts +1 -3
  61. package/dist/agents/runtime.d.ts.map +1 -0
  62. package/dist/agents/tests/utils.d.cts +0 -4
  63. package/dist/agents/tests/utils.d.cts.map +1 -0
  64. package/dist/agents/tests/utils.d.ts +0 -4
  65. package/dist/agents/tests/utils.d.ts.map +1 -0
  66. package/dist/agents/types.d.cts.map +1 -0
  67. package/dist/agents/types.d.ts.map +1 -0
  68. package/dist/chat_models/universal.d.cts +4 -21
  69. package/dist/chat_models/universal.d.cts.map +1 -0
  70. package/dist/chat_models/universal.d.ts +4 -21
  71. package/dist/chat_models/universal.d.ts.map +1 -0
  72. package/dist/hub/base.d.cts.map +1 -0
  73. package/dist/hub/base.d.ts.map +1 -0
  74. package/dist/hub/index.d.cts +0 -1
  75. package/dist/hub/index.d.cts.map +1 -0
  76. package/dist/hub/index.d.ts +0 -1
  77. package/dist/hub/index.d.ts.map +1 -0
  78. package/dist/hub/node.cjs +22 -2
  79. package/dist/hub/node.cjs.map +1 -1
  80. package/dist/hub/node.d.cts.map +1 -0
  81. package/dist/hub/node.d.ts.map +1 -0
  82. package/dist/hub/node.js +22 -2
  83. package/dist/hub/node.js.map +1 -1
  84. package/dist/load/import_type.d.cts +0 -1
  85. package/dist/load/import_type.d.cts.map +1 -0
  86. package/dist/load/import_type.d.ts +0 -1
  87. package/dist/load/import_type.d.ts.map +1 -0
  88. package/dist/load/index.d.cts +1 -7
  89. package/dist/load/index.d.cts.map +1 -0
  90. package/dist/load/index.d.ts +1 -7
  91. package/dist/load/index.d.ts.map +1 -0
  92. package/dist/storage/encoder_backed.d.cts +0 -1
  93. package/dist/storage/encoder_backed.d.cts.map +1 -0
  94. package/dist/storage/encoder_backed.d.ts +0 -1
  95. package/dist/storage/encoder_backed.d.ts.map +1 -0
  96. package/dist/storage/file_system.d.cts.map +1 -0
  97. package/dist/storage/file_system.d.ts.map +1 -0
  98. package/package.json +8 -7
  99. package/chat_models/universal.cjs +0 -1
  100. package/chat_models/universal.d.cts +0 -1
  101. package/chat_models/universal.d.ts +0 -1
  102. package/chat_models/universal.js +0 -1
  103. package/hub/node.cjs +0 -1
  104. package/hub/node.d.cts +0 -1
  105. package/hub/node.d.ts +0 -1
  106. package/hub/node.js +0 -1
  107. package/hub.cjs +0 -1
  108. package/hub.d.cts +0 -1
  109. package/hub.d.ts +0 -1
  110. package/hub.js +0 -1
  111. package/load/serializable.cjs +0 -1
  112. package/load/serializable.d.cts +0 -1
  113. package/load/serializable.d.ts +0 -1
  114. package/load/serializable.js +0 -1
  115. package/load.cjs +0 -1
  116. package/load.d.cts +0 -1
  117. package/load.d.ts +0 -1
  118. package/load.js +0 -1
  119. package/storage/encoder_backed.cjs +0 -1
  120. package/storage/encoder_backed.d.cts +0 -1
  121. package/storage/encoder_backed.d.ts +0 -1
  122. package/storage/encoder_backed.js +0 -1
  123. package/storage/file_system.cjs +0 -1
  124. package/storage/file_system.d.cts +0 -1
  125. package/storage/file_system.d.ts +0 -1
  126. package/storage/file_system.js +0 -1
  127. package/storage/in_memory.cjs +0 -1
  128. package/storage/in_memory.d.cts +0 -1
  129. package/storage/in_memory.d.ts +0 -1
  130. package/storage/in_memory.js +0 -1
package/README.md CHANGED
@@ -58,4 +58,4 @@ As an open-source project in a rapidly developing field, we are extremely open t
58
58
 
59
59
  For detailed information on how to contribute, see [here](https://github.com/langchain-ai/langchainjs/blob/main/CONTRIBUTING.md).
60
60
 
61
- Please report any security issues or concerns following our [security guidelines](https://github.com/langchain-ai/langchainjs/blob/main/SECURITY.md).
61
+ Please report any security issues or concerns following our [security guidelines](https://github.com/langchain-ai/.github/blob/main/SECURITY.md).
@@ -10,8 +10,6 @@ import { Command, CompiledStateGraph, GetStateOptions, LangGraphRunnableConfig,
10
10
  import { CheckpointListOptions } from "@langchain/langgraph-checkpoint";
11
11
 
12
12
  //#region src/agents/ReactAgent.d.ts
13
-
14
- // Helper type to get the state definition with middleware states
15
13
  type MergedAgentState<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware[]> = InferSchemaInput<StateSchema> & (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, "jumpTo"> : Omit<BuiltInState, "jumpTo"> & {
16
14
  structuredResponse: StructuredResponseFormat;
17
15
  }) & InferMiddlewareStates<TMiddleware>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactAgent.d.cts","names":["InteropZodObject","StateGraph","Command","CompiledStateGraph","GetStateOptions","LangGraphRunnableConfig","StreamMode","StreamOutputMap","CheckpointListOptions","IterableReadableStream","Runnable","RunnableConfig","StreamEvent","CreateAgentParams","BuiltInState","UserInput","InvokeConfiguration","StreamConfiguration","AgentMiddleware","InferMiddlewareContextInputs","InferMiddlewareStates","InferMiddlewareInputStates","InferContextInput","AnyAnnotationRoot","InferSchemaInput","ToAnnotationRoot","ResponseFormatUndefined","MergedAgentState","StateSchema","StructuredResponseFormat","TMiddleware","Record","Omit","InvokeStateParameter","AgentGraph","ContextSchema","ReactAgent","TStreamMode","TEncoding","Promise","ArrayBuffer","Uint8Array","Parameters"],"sources":["../../src/agents/ReactAgent.d.ts"],"sourcesContent":["import { InteropZodObject } from \"@langchain/core/utils/types\";\nimport { StateGraph, Command, CompiledStateGraph, type GetStateOptions, type LangGraphRunnableConfig, type StreamMode, type StreamOutputMap } from \"@langchain/langgraph\";\nimport type { CheckpointListOptions } from \"@langchain/langgraph-checkpoint\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport type { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport type { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport type { CreateAgentParams, BuiltInState, UserInput } from \"./types.js\";\nimport type { InvokeConfiguration, StreamConfiguration } from \"./runtime.js\";\nimport type { AgentMiddleware, InferMiddlewareContextInputs, InferMiddlewareStates, InferMiddlewareInputStates, InferContextInput, AnyAnnotationRoot, InferSchemaInput, ToAnnotationRoot } from \"./middleware/types.js\";\nimport { type ResponseFormatUndefined } from \"./responses.js\";\ntype MergedAgentState<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware[]> = InferSchemaInput<StateSchema> & (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, \"jumpTo\"> : Omit<BuiltInState, \"jumpTo\"> & {\n structuredResponse: StructuredResponseFormat;\n}) & InferMiddlewareStates<TMiddleware>;\ntype InvokeStateParameter<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, TMiddleware extends readonly AgentMiddleware[]> = (UserInput<StateSchema> & InferMiddlewareInputStates<TMiddleware>) | Command<any, any, any> | null;\ntype AgentGraph<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = []> = CompiledStateGraph<any, any, any, any, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown>;\nexport declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]> {\n #private;\n options: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema>;\n constructor(options: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema>);\n /**\n * Get the compiled {@link https://docs.langchain.com/oss/javascript/langgraph/use-graph-api | StateGraph}.\n */\n get graph(): AgentGraph<StateSchema, StructuredResponseFormat, ContextSchema, TMiddleware>;\n /**\n * Executes the agent with the given state and returns the final state after all processing.\n *\n * This method runs the agent's entire workflow synchronously, including:\n * - Processing the input messages through any configured middleware\n * - Calling the language model to generate responses\n * - Executing any tool calls made by the model\n * - Running all middleware hooks (beforeModel, afterModel, etc.)\n *\n * @param state - The initial state for the agent execution. Can be:\n * - An object containing `messages` array and any middleware-specific state properties\n * - A Command object for more advanced control flow\n *\n * @param config - Optional runtime configuration including:\n * @param config.context - The context for the agent execution.\n * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n * @param config.recursionLimit - The recursion limit for the agent execution.\n *\n * @returns A Promise that resolves to the final agent state after execution completes.\n * The returned state includes:\n * - a `messages` property containing an array with all messages (input, AI responses, tool calls/results)\n * - a `structuredResponse` property containing the structured response (if configured)\n * - all state values defined in the middleware\n *\n * @example\n * ```typescript\n * const agent = new ReactAgent({\n * llm: myModel,\n * tools: [calculator, webSearch],\n * responseFormat: z.object({\n * weather: z.string(),\n * }),\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"human\", content: \"What's the weather in Paris?\" }]\n * });\n *\n * console.log(result.structuredResponse.weather); // outputs: \"It's sunny and 75°F.\"\n * ```\n */\n invoke(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: InvokeConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>>;\n /**\n * Executes the agent with streaming, returning an async iterable of state updates as they occur.\n *\n * This method runs the agent's workflow similar to `invoke`, but instead of waiting for\n * completion, it streams high-level state updates in real-time. This allows you to:\n * - Display intermediate results to users as they're generated\n * - Monitor the agent's progress through each step\n * - React to state changes as nodes complete\n *\n * For more granular event-level streaming (like individual LLM tokens), use `streamEvents` instead.\n *\n * @param state - The initial state for the agent execution. Can be:\n * - An object containing `messages` array and any middleware-specific state properties\n * - A Command object for more advanced control flow\n *\n * @param config - Optional runtime configuration including:\n * @param config.context - The context for the agent execution.\n * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n * @param config.streamMode - The streaming mode for the agent execution, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/streaming#supported-stream-modes | Supported stream modes}.\n * @param config.recursionLimit - The recursion limit for the agent execution.\n *\n * @returns A Promise that resolves to an IterableReadableStream of state updates.\n * Each update contains the current state after a node completes.\n *\n * @example\n * ```typescript\n * const agent = new ReactAgent({\n * llm: myModel,\n * tools: [calculator, webSearch]\n * });\n *\n * const stream = await agent.stream({\n * messages: [{ role: \"human\", content: \"What's 2+2 and the weather in NYC?\" }]\n * });\n *\n * for await (const chunk of stream) {\n * console.log(chunk); // State update from each node\n * }\n * ```\n */\n stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TEncoding extends \"text/event-stream\" | undefined>(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>, TStreamMode, TEncoding>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, false, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, string, unknown, unknown, TEncoding>>>;\n /**\n * Visualize the graph as a PNG image.\n * @param params - Parameters for the drawMermaidPng method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns PNG image as a buffer\n */\n drawMermaidPng(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<Uint8Array<ArrayBuffer>>;\n /**\n * Draw the graph as a Mermaid string.\n * @param params - Parameters for the drawMermaid method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns Mermaid string\n */\n drawMermaid(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<string>;\n /**\n * The following are internal methods to enable support for LangGraph Platform.\n * They are not part of the createAgent public API.\n *\n * Note: we intentionally return as `never` to avoid type errors due to type inference.\n */\n /**\n * @internal\n */\n streamEvents(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>, StreamMode | StreamMode[] | undefined, \"text/event-stream\" | undefined> & {\n version?: \"v1\" | \"v2\";\n }, streamOptions?: Parameters<Runnable[\"streamEvents\"]>[2]): IterableReadableStream<StreamEvent>;\n /**\n * @internal\n */\n getGraphAsync(config?: RunnableConfig): never;\n /**\n * @internal\n */\n getState(config: RunnableConfig, options?: GetStateOptions): never;\n /**\n * @internal\n */\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): never;\n /**\n * @internal\n */\n getSubgraphs(namespace?: string, recurse?: boolean): never;\n /**\n * @internal\n */\n getSubgraphAsync(namespace?: string, recurse?: boolean): never;\n /**\n * @internal\n */\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: string): never;\n /**\n * @internal\n */\n get builder(): StateGraph<unknown, any, any, any, any, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown, unknown, unknown>;\n}\nexport {};\n//# sourceMappingURL=ReactAgent.d.ts.map"],"mappings":";;;;;;;;;;;;KAUK2B,qCAAqCJ,oBAAoBvB,+DAA+D+B,sBAAsBL,sDAAsDR,qBAAqBM,iBAAiBI,gBAAgBC,iCAA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xBpB4B,OAwBoB5B,CAAAA,MAAAA,CAAAA;EAA0BH;;;;;;EAgBKmB;;;EAAxC1B,YAAAA,CAAAA,KAAAA,EA9BKgC,oBA8BLhC,CA9B0B2B,WA8B1B3B,EA9BuC6B,WA8BvC7B,CAAAA,EAAAA,OAAAA,EA9B8DgB,mBA8B9DhB,CA9BkFqB,iBA8BlFrB,CA9BoGkC,aA8BpGlC,CAAAA,GA9BqHkB,4BA8BrHlB,CA9BkJ6B,WA8BlJ7B,CAAAA,EA9BgKK,UA8BhKL,GA9B6KK,UA8B7KL,EAAAA,GAAAA,SAAAA,EAAAA,mBAAAA,GAAAA,SAAAA,CAAAA,GAAAA;IAAU,OAAA,CAAA,EAAA,IAAA,GAAA,IAAA;qBA5BNyC,WAAWhC,+BAA+BD,uBAAuBG;;;;yBAI7DD;;;;mBAINA,0BAA0BP;;;;0BAInBO,0BAA0BH;;;;;;;;;;;;2BAYzBH,iCAAiC0B;;;;iBAI3C9B,wCAAwC0B,iBAAiBC,aAAaC,0BAA0BC,cAAcL,iBAAiBU"}
@@ -10,8 +10,6 @@ import { CheckpointListOptions } from "@langchain/langgraph-checkpoint";
10
10
  import { StreamEvent } from "@langchain/core/tracers/log_stream";
11
11
 
12
12
  //#region src/agents/ReactAgent.d.ts
13
-
14
- // Helper type to get the state definition with middleware states
15
13
  type MergedAgentState<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware[]> = InferSchemaInput<StateSchema> & (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, "jumpTo"> : Omit<BuiltInState, "jumpTo"> & {
16
14
  structuredResponse: StructuredResponseFormat;
17
15
  }) & InferMiddlewareStates<TMiddleware>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactAgent.d.ts","names":["InteropZodObject","StateGraph","Command","CompiledStateGraph","GetStateOptions","LangGraphRunnableConfig","StreamMode","StreamOutputMap","CheckpointListOptions","IterableReadableStream","Runnable","RunnableConfig","StreamEvent","CreateAgentParams","BuiltInState","UserInput","InvokeConfiguration","StreamConfiguration","AgentMiddleware","InferMiddlewareContextInputs","InferMiddlewareStates","InferMiddlewareInputStates","InferContextInput","AnyAnnotationRoot","InferSchemaInput","ToAnnotationRoot","ResponseFormatUndefined","MergedAgentState","StateSchema","StructuredResponseFormat","TMiddleware","Record","Omit","InvokeStateParameter","AgentGraph","ContextSchema","ReactAgent","TStreamMode","TEncoding","Promise","ArrayBuffer","Uint8Array","Parameters"],"sources":["../../src/agents/ReactAgent.d.ts"],"sourcesContent":["import { InteropZodObject } from \"@langchain/core/utils/types\";\nimport { StateGraph, Command, CompiledStateGraph, type GetStateOptions, type LangGraphRunnableConfig, type StreamMode, type StreamOutputMap } from \"@langchain/langgraph\";\nimport type { CheckpointListOptions } from \"@langchain/langgraph-checkpoint\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport type { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport type { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport type { CreateAgentParams, BuiltInState, UserInput } from \"./types.js\";\nimport type { InvokeConfiguration, StreamConfiguration } from \"./runtime.js\";\nimport type { AgentMiddleware, InferMiddlewareContextInputs, InferMiddlewareStates, InferMiddlewareInputStates, InferContextInput, AnyAnnotationRoot, InferSchemaInput, ToAnnotationRoot } from \"./middleware/types.js\";\nimport { type ResponseFormatUndefined } from \"./responses.js\";\ntype MergedAgentState<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware[]> = InferSchemaInput<StateSchema> & (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, \"jumpTo\"> : Omit<BuiltInState, \"jumpTo\"> & {\n structuredResponse: StructuredResponseFormat;\n}) & InferMiddlewareStates<TMiddleware>;\ntype InvokeStateParameter<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, TMiddleware extends readonly AgentMiddleware[]> = (UserInput<StateSchema> & InferMiddlewareInputStates<TMiddleware>) | Command<any, any, any> | null;\ntype AgentGraph<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = []> = CompiledStateGraph<any, any, any, any, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown>;\nexport declare class ReactAgent<StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]> {\n #private;\n options: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema>;\n constructor(options: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema>);\n /**\n * Get the compiled {@link https://docs.langchain.com/oss/javascript/langgraph/use-graph-api | StateGraph}.\n */\n get graph(): AgentGraph<StateSchema, StructuredResponseFormat, ContextSchema, TMiddleware>;\n /**\n * Executes the agent with the given state and returns the final state after all processing.\n *\n * This method runs the agent's entire workflow synchronously, including:\n * - Processing the input messages through any configured middleware\n * - Calling the language model to generate responses\n * - Executing any tool calls made by the model\n * - Running all middleware hooks (beforeModel, afterModel, etc.)\n *\n * @param state - The initial state for the agent execution. Can be:\n * - An object containing `messages` array and any middleware-specific state properties\n * - A Command object for more advanced control flow\n *\n * @param config - Optional runtime configuration including:\n * @param config.context - The context for the agent execution.\n * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n * @param config.recursionLimit - The recursion limit for the agent execution.\n *\n * @returns A Promise that resolves to the final agent state after execution completes.\n * The returned state includes:\n * - a `messages` property containing an array with all messages (input, AI responses, tool calls/results)\n * - a `structuredResponse` property containing the structured response (if configured)\n * - all state values defined in the middleware\n *\n * @example\n * ```typescript\n * const agent = new ReactAgent({\n * llm: myModel,\n * tools: [calculator, webSearch],\n * responseFormat: z.object({\n * weather: z.string(),\n * }),\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"human\", content: \"What's the weather in Paris?\" }]\n * });\n *\n * console.log(result.structuredResponse.weather); // outputs: \"It's sunny and 75°F.\"\n * ```\n */\n invoke(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: InvokeConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>>): Promise<MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>>;\n /**\n * Executes the agent with streaming, returning an async iterable of state updates as they occur.\n *\n * This method runs the agent's workflow similar to `invoke`, but instead of waiting for\n * completion, it streams high-level state updates in real-time. This allows you to:\n * - Display intermediate results to users as they're generated\n * - Monitor the agent's progress through each step\n * - React to state changes as nodes complete\n *\n * For more granular event-level streaming (like individual LLM tokens), use `streamEvents` instead.\n *\n * @param state - The initial state for the agent execution. Can be:\n * - An object containing `messages` array and any middleware-specific state properties\n * - A Command object for more advanced control flow\n *\n * @param config - Optional runtime configuration including:\n * @param config.context - The context for the agent execution.\n * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.\n * @param config.store - The store for the agent execution for persisting state, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/memory#memory-storage | Memory storage}.\n * @param config.signal - An optional {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} for the agent execution.\n * @param config.streamMode - The streaming mode for the agent execution, see more in {@link https://docs.langchain.com/oss/javascript/langgraph/streaming#supported-stream-modes | Supported stream modes}.\n * @param config.recursionLimit - The recursion limit for the agent execution.\n *\n * @returns A Promise that resolves to an IterableReadableStream of state updates.\n * Each update contains the current state after a node completes.\n *\n * @example\n * ```typescript\n * const agent = new ReactAgent({\n * llm: myModel,\n * tools: [calculator, webSearch]\n * });\n *\n * const stream = await agent.stream({\n * messages: [{ role: \"human\", content: \"What's 2+2 and the weather in NYC?\" }]\n * });\n *\n * for await (const chunk of stream) {\n * console.log(chunk); // State update from each node\n * }\n * ```\n */\n stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TEncoding extends \"text/event-stream\" | undefined>(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>, TStreamMode, TEncoding>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, false, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, string, unknown, unknown, TEncoding>>>;\n /**\n * Visualize the graph as a PNG image.\n * @param params - Parameters for the drawMermaidPng method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns PNG image as a buffer\n */\n drawMermaidPng(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<Uint8Array<ArrayBuffer>>;\n /**\n * Draw the graph as a Mermaid string.\n * @param params - Parameters for the drawMermaid method.\n * @param params.withStyles - Whether to include styles in the graph.\n * @param params.curveStyle - The style of the graph's curves.\n * @param params.nodeColors - The colors of the graph's nodes.\n * @param params.wrapLabelNWords - The maximum number of words to wrap in a node's label.\n * @param params.backgroundColor - The background color of the graph.\n * @returns Mermaid string\n */\n drawMermaid(params?: {\n withStyles?: boolean;\n curveStyle?: string;\n nodeColors?: Record<string, string>;\n wrapLabelNWords?: number;\n backgroundColor?: string;\n }): Promise<string>;\n /**\n * The following are internal methods to enable support for LangGraph Platform.\n * They are not part of the createAgent public API.\n *\n * Note: we intentionally return as `never` to avoid type errors due to type inference.\n */\n /**\n * @internal\n */\n streamEvents(state: InvokeStateParameter<StateSchema, TMiddleware>, config?: StreamConfiguration<InferContextInput<ContextSchema> & InferMiddlewareContextInputs<TMiddleware>, StreamMode | StreamMode[] | undefined, \"text/event-stream\" | undefined> & {\n version?: \"v1\" | \"v2\";\n }, streamOptions?: Parameters<Runnable[\"streamEvents\"]>[2]): IterableReadableStream<StreamEvent>;\n /**\n * @internal\n */\n getGraphAsync(config?: RunnableConfig): never;\n /**\n * @internal\n */\n getState(config: RunnableConfig, options?: GetStateOptions): never;\n /**\n * @internal\n */\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): never;\n /**\n * @internal\n */\n getSubgraphs(namespace?: string, recurse?: boolean): never;\n /**\n * @internal\n */\n getSubgraphAsync(namespace?: string, recurse?: boolean): never;\n /**\n * @internal\n */\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown> | unknown, asNode?: string): never;\n /**\n * @internal\n */\n get builder(): StateGraph<unknown, any, any, any, any, MergedAgentState<StateSchema, StructuredResponseFormat, TMiddleware>, ToAnnotationRoot<ContextSchema>[\"spec\"], unknown, unknown, unknown>;\n}\nexport {};\n//# sourceMappingURL=ReactAgent.d.ts.map"],"mappings":";;;;;;;;;;;;KAUK2B,qCAAqCJ,oBAAoBvB,+DAA+D+B,sBAAsBL,sDAAsDR,qBAAqBM,iBAAiBI,gBAAgBC,iCAAiCH,0BAA0BM,KAAKlB,0BAA0BkB,KAAKlB;sBACtUe;AAFsC,CAAA,CAAA,GAGzDT,qBAFgB,CAEMU,WAFNF,CAAAA;KAGhBK,oBAHqCV,CAAAA,oBAGIA,iBAHJA,GAGwBvB,gBAHxBuB,GAAAA,SAAAA,EAAAA,oBAAAA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B9DhB,CA9BkFqB,iBA8BlFrB,CA9BoGkC,aA8BpGlC,CAAAA,GA9BqHkB,4BA8BrHlB,CA9BkJ6B,WA8BlJ7B,CAAAA,EA9BgKK,UA8BhKL,GA9B6KK,UA8B7KL,EAAAA,GAAAA,SAAAA,EAAAA,mBAAAA,GAAAA,SAAAA,CAAAA,GAAAA;IAAU,OAAA,CAAA,EAAA,IAAA,GAAA,IAAA;qBA5BNyC,WAAWhC,+BAA+BD,uBAAuBG;;;;yBAI7DD;;;;mBAINA,0BAA0BP;;;;0BAInBO,0BAA0BH;;;;;;;;;;;;2BAYzBH,iCAAiC0B;;;;iBAI3C9B,wCAAwC0B,iBAAiBC,aAAaC,0BAA0BC,cAAcL,iBAAiBU"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.cts","names":["JUMP_TO_TARGETS","JumpToTarget"],"sources":["../../src/agents/constants.d.ts"],"sourcesContent":["/**\n * jump targets (user facing)\n */\nexport declare const JUMP_TO_TARGETS: readonly [\"model\", \"tools\", \"end\"];\nexport type JumpToTarget = (typeof JUMP_TO_TARGETS)[number];\n//# sourceMappingURL=constants.d.ts.map"],"mappings":";;AAGA;AACA;cADqBA;KACTC,YAAAA,WAAuBD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","names":["JUMP_TO_TARGETS","JumpToTarget"],"sources":["../../src/agents/constants.d.ts"],"sourcesContent":["/**\n * jump targets (user facing)\n */\nexport declare const JUMP_TO_TARGETS: readonly [\"model\", \"tools\", \"end\"];\nexport type JumpToTarget = (typeof JUMP_TO_TARGETS)[number];\n//# sourceMappingURL=constants.d.ts.map"],"mappings":";;AAGA;AACA;cADqBA;KACTC,YAAAA,WAAuBD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.cts","names":["ToolCall","MultipleToolsBoundError","Error","MultipleStructuredOutputsError","StructuredOutputParsingError","ToolInvocationError"],"sources":["../../src/agents/errors.d.ts"],"sourcesContent":["import type { ToolCall } from \"@langchain/core/messages/tool\";\nexport declare class MultipleToolsBoundError extends Error {\n constructor();\n}\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport declare class MultipleStructuredOutputsError extends Error {\n readonly toolNames: string[];\n constructor(toolNames: string[]);\n}\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport declare class StructuredOutputParsingError extends Error {\n readonly toolName: string;\n readonly errors: string[];\n constructor(toolName: string, errors: string[]);\n}\n/**\n * Raised when a tool call is throwing an error.\n */\nexport declare class ToolInvocationError extends Error {\n readonly toolCall: ToolCall;\n readonly toolError: Error;\n constructor(toolError: unknown, toolCall: ToolCall);\n}\n//# sourceMappingURL=errors.d.ts.map"],"mappings":";;;cACqBC,uBAAAA,SAAgCC,KAAK;;AAA1D;AAMA;AAOA;AAQA;AACuBF,cAhBFG,8BAAAA,SAAuCD,KAAK,CAgB1CF;EACCE,SAAAA,SAAAA,EAAAA,MAAAA,EAAAA;EACsBF,WAAAA,CAAAA,SAAAA,EAAAA,MAAAA,EAAAA;;AAHQ;;;cARjCI,4BAAAA,SAAqCF,KAAK;;;;;;;;cAQ1CG,mBAAAA,SAA4BH,KAAAA;qBAC1BF;sBACCE;4CACsBF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","names":["ToolCall","MultipleToolsBoundError","Error","MultipleStructuredOutputsError","StructuredOutputParsingError","ToolInvocationError"],"sources":["../../src/agents/errors.d.ts"],"sourcesContent":["import type { ToolCall } from \"@langchain/core/messages/tool\";\nexport declare class MultipleToolsBoundError extends Error {\n constructor();\n}\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport declare class MultipleStructuredOutputsError extends Error {\n readonly toolNames: string[];\n constructor(toolNames: string[]);\n}\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport declare class StructuredOutputParsingError extends Error {\n readonly toolName: string;\n readonly errors: string[];\n constructor(toolName: string, errors: string[]);\n}\n/**\n * Raised when a tool call is throwing an error.\n */\nexport declare class ToolInvocationError extends Error {\n readonly toolCall: ToolCall;\n readonly toolError: Error;\n constructor(toolError: unknown, toolCall: ToolCall);\n}\n//# sourceMappingURL=errors.d.ts.map"],"mappings":";;;cACqBC,uBAAAA,SAAgCC,KAAK;;AAA1D;AAMA;AAOA;AAQA;AACuBF,cAhBFG,8BAAAA,SAAuCD,KAAK,CAgB1CF;EACCE,SAAAA,SAAAA,EAAAA,MAAAA,EAAAA;EACsBF,WAAAA,CAAAA,SAAAA,EAAAA,MAAAA,EAAAA;;AAHQ;;;cARjCI,4BAAAA,SAAqCF,KAAK;;;;;;;;cAQ1CG,mBAAAA,SAA4BH,KAAAA;qBAC1BF;sBACCE;4CACsBF"}
@@ -130,56 +130,45 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
130
130
  * }
131
131
  * ```
132
132
  */
133
- // Overload 1: With responseFormat as single InteropZodType
134
133
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {
135
134
  responseFormat: InteropZodType<T>;
136
135
  middleware?: TMiddleware;
137
136
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
138
- // Overload 2: With responseFormat as array of InteropZodTypes (infers union type)
139
137
  declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {
140
138
  responseFormat: T;
141
139
  middleware?: TMiddleware;
142
140
  }): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;
143
- // Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)
144
141
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {
145
142
  responseFormat: JsonSchemaFormat;
146
143
  middleware?: TMiddleware;
147
144
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
148
- // Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)
149
145
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {
150
146
  responseFormat: JsonSchemaFormat[];
151
147
  middleware?: TMiddleware;
152
148
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
153
- // Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
154
149
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
155
150
  responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
156
151
  middleware?: TMiddleware;
157
152
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
158
- // Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)
159
153
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {
160
154
  responseFormat: TypedToolStrategy<T>;
161
155
  middleware?: TMiddleware;
162
156
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
163
- // Overload 6: With responseFormat as single ToolStrategy instance
164
157
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {
165
158
  responseFormat: ToolStrategy<T>;
166
159
  middleware?: TMiddleware;
167
160
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
168
- // Overload 7: With responseFormat as ProviderStrategy
169
161
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {
170
162
  responseFormat: ProviderStrategy<T>;
171
163
  middleware?: TMiddleware;
172
164
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
173
- // Overload 8: Without responseFormat property at all - with proper middleware state typing
174
165
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
175
166
  middleware?: TMiddleware;
176
167
  }): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
177
- // Overload 9: With responseFormat explicitly undefined
178
168
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
179
169
  responseFormat?: undefined;
180
170
  middleware?: TMiddleware;
181
171
  }): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
182
- // Overload 10: For other ResponseFormat values (failsafe)
183
172
  declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {
184
173
  responseFormat: ResponseFormat;
185
174
  middleware?: TMiddleware;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":["InteropZodObject","InteropZodType","ResponseFormatUndefined","CreateAgentParams","AgentMiddleware","AnyAnnotationRoot","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","JsonSchemaFormat","ReactAgent","createAgent","T","StateSchema","ContextSchema","TMiddleware","Record","Omit","StructuredResponseFormat","JumpToTarget","Runtime","toolStrategy","providerStrategy","createMiddleware","FakeToolCallingModel"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["import type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormat, JsonSchemaFormat } from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\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 */\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {\n responseFormat: T;\n middleware?: TMiddleware;\n}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, \"responseFormat\"> & {\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n}): ReactAgent<StructuredResponseFormat, StateSchema, ContextSchema, TMiddleware>;\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, type ResponseFormatUndefined, } from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type * from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;;;AA8HA;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AACd;;;;;;;;;;;;;;;;;;;;AAGc;AACd;;;;;;;;;;;;;;;;;;;;AAGc;AACd;;;;;;;;;;;;;;;AACuCW,iBAjBf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EAAAA,GAAAA,SAWkMd,eAXlMc,EAAAA,CAAAA,CAAAA,MAAAA,EAW6NC,IAX7ND,CAWkOf,iBAXlOe,CAWoPhB,uBAXpPgB,EAW6QH,WAX7QG,EAW0RF,aAX1RE,EAAAA,KAAAA,CAAAA,EAAAA,gBAAAA,CAAAA,GAAAA;EAAyCb,cAAAA,CAAAA,EAAAA,SAAAA;EAAoBL,UAAAA,CAAAA,EAahHiB,WAbgHjB;CAAgEK,CAAAA,EAc7LO,UAd6LP,CAclLH,uBAdkLG,EAczJU,WAdyJV,EAc5IW,aAd4IX,EAc7HY,WAd6HZ,CAAAA;AAAoBL,iBAe7La,WAf6Lb,CAAAA,iCAehJkB,MAfgJlB,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAe1HkB,MAf0HlB,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,oBAejFK,iBAfiFL,GAe7DA,gBAf6DA,GAAAA,SAAAA,GAAAA,SAAAA,EAAAA,sBAeGK,iBAfHL,GAeuBA,gBAfvBA,GAe0CK,iBAf1CL,EAAAA,0BAAAA,SAegGI,eAfhGJ,EAAAA,GAAAA,SAe6HI,eAf7HJ,EAAAA,CAAAA,CAAAA,MAAAA,EAewJG,iBAfxJH,CAe0KoB,wBAf1KpB,EAeoMe,WAfpMf,EAeiNgB,aAfjNhB,EAegOU,cAfhOV,CAAAA,GAAAA;EAAmBK,cAAAA,EAgBpNK,cAhBoNL;EAAsDD,UAAAA,CAAAA,EAiB7Qa,WAjB6Qb;CAA6BA,CAAAA,EAkBvTQ,UAlBuTR,CAkB5SgB,wBAlB4ShB,EAkBlRW,WAlBkRX,EAkBrQY,aAlBqQZ,EAkBtPa,WAlBsPb,CAAAA"}
@@ -130,56 +130,45 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
130
130
  * }
131
131
  * ```
132
132
  */
133
- // Overload 1: With responseFormat as single InteropZodType
134
133
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {
135
134
  responseFormat: InteropZodType<T>;
136
135
  middleware?: TMiddleware;
137
136
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
138
- // Overload 2: With responseFormat as array of InteropZodTypes (infers union type)
139
137
  declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {
140
138
  responseFormat: T;
141
139
  middleware?: TMiddleware;
142
140
  }): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;
143
- // Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)
144
141
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {
145
142
  responseFormat: JsonSchemaFormat;
146
143
  middleware?: TMiddleware;
147
144
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
148
- // Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)
149
145
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {
150
146
  responseFormat: JsonSchemaFormat[];
151
147
  middleware?: TMiddleware;
152
148
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
153
- // Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
154
149
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
155
150
  responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
156
151
  middleware?: TMiddleware;
157
152
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
158
- // Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)
159
153
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {
160
154
  responseFormat: TypedToolStrategy<T>;
161
155
  middleware?: TMiddleware;
162
156
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
163
- // Overload 6: With responseFormat as single ToolStrategy instance
164
157
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {
165
158
  responseFormat: ToolStrategy<T>;
166
159
  middleware?: TMiddleware;
167
160
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
168
- // Overload 7: With responseFormat as ProviderStrategy
169
161
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {
170
162
  responseFormat: ProviderStrategy<T>;
171
163
  middleware?: TMiddleware;
172
164
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
173
- // Overload 8: Without responseFormat property at all - with proper middleware state typing
174
165
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
175
166
  middleware?: TMiddleware;
176
167
  }): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
177
- // Overload 9: With responseFormat explicitly undefined
178
168
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
179
169
  responseFormat?: undefined;
180
170
  middleware?: TMiddleware;
181
171
  }): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
182
- // Overload 10: For other ResponseFormat values (failsafe)
183
172
  declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {
184
173
  responseFormat: ResponseFormat;
185
174
  middleware?: TMiddleware;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["InteropZodObject","InteropZodType","ResponseFormatUndefined","CreateAgentParams","AgentMiddleware","AnyAnnotationRoot","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","JsonSchemaFormat","ReactAgent","createAgent","T","StateSchema","ContextSchema","TMiddleware","Record","Omit","StructuredResponseFormat","JumpToTarget","Runtime","toolStrategy","providerStrategy","createMiddleware","FakeToolCallingModel"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["import type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormat, JsonSchemaFormat } from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\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 */\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {\n responseFormat: T;\n middleware?: TMiddleware;\n}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, \"responseFormat\"> & {\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\nexport declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n}): ReactAgent<StructuredResponseFormat, StateSchema, ContextSchema, TMiddleware>;\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, type ResponseFormatUndefined, } from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type * from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;;;AA8HA;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AACd;;;;;;;;;;;;;;;;;;;;AAGc;AACd;;;;;;;;;;;;;;;;;;;;AAGc;AACd;;;;;;;;;;;;;;;AACuCW,iBAjBfE,WAiBeF,CAAAA,UAjBOO,MAiBPP,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAjB6BO,MAiB7BP,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,oBAjBsEN,iBAiBtEM,GAjB0FX,gBAiB1FW,GAAAA,SAAAA,GAAAA,SAAAA,EAAAA,sBAjB0JN,iBAiB1JM,GAjB8KX,gBAiB9KW,GAjBiMN,iBAiBjMM,EAAAA,0BAAAA,SAjBuPP,eAiBvPO,EAAAA,GAAAA,SAjBoRP,eAiBpRO,EAAAA,CAAAA,CAAAA,MAAAA,EAjB+SR,iBAiB/SQ,CAjBiUG,CAiBjUH,EAjBoUI,WAiBpUJ,EAjBiVK,aAiBjVL,EAjBgWV,cAiBhWU,CAjB+WG,CAiB/WH,CAAAA,CAAAA,GAAAA;EACtBM,cAAAA,EAjBGhB,cAiBHgB,CAjBkBH,CAiBlBG,CAAAA;EACFC,UAAAA,CAAAA,EAjBED,W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,EAAAA,sBAeGK,iBAfHL,GAeuBA,gBAfvBA,GAe0CK,iBAf1CL,EAAAA,0BAAAA,SAegGI,eAfhGJ,EAAAA,GAAAA,SAe6HI,eAf7HJ,EAAAA,CAAAA,CAAAA,MAAAA,EAewJG,iBAfxJH,CAe0KoB,wBAf1KpB,EAeoMe,WAfpMf,EAeiNgB,aAfjNhB,EAegOU,cAfhOV,CAAAA,GAAAA;EAAmBK,cAAAA,EAgBpNK,cAhBoNL;EAAsDD,UAAAA,CAAAA,EAiB7Qa,WAjB6Qb;CAA6BA,CAAAA,EAkBvTQ,UAlBuTR,CAkB5SgB,wBAlB4ShB,EAkBlRW,WAlBkRX,EAkBrQY,aAlBqQZ,EAkBtPa,WAlBsPb,CAAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextEditing.d.cts","names":["BaseMessage","BaseLanguageModel","ContextSize","KeepSize","TokenCounter","ContextEdit","Promise","ClearToolUsesEditConfig","ClearToolUsesEdit","Set","ContextEditingMiddlewareConfig","contextEditingMiddleware","__types_js10","AgentMiddleware"],"sources":["../../../src/agents/middleware/contextEditing.d.ts"],"sourcesContent":["/**\n * Context editing middleware.\n *\n * This middleware mirrors Anthropic's context editing capabilities by clearing\n * older tool results once the conversation grows beyond a configurable token\n * threshold. The implementation is intentionally model-agnostic so it can be used\n * with any LangChain chat model.\n */\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { type ContextSize, type KeepSize, type TokenCounter } from \"./summarization.js\";\n/**\n * Protocol describing a context editing strategy.\n *\n * Implement this interface to create custom strategies for managing\n * conversation context size. The `apply` method should modify the\n * messages array in-place and return the updated token count.\n *\n * @example\n * ```ts\n * import { HumanMessage, type ContextEdit, type BaseMessage } from \"langchain\";\n *\n * class RemoveOldHumanMessages implements ContextEdit {\n * constructor(private keepRecent: number = 10) {}\n *\n * async apply({ messages, countTokens }) {\n * // Check current token count\n * const tokens = await countTokens(messages);\n *\n * // Remove old human messages if over limit, keeping the most recent ones\n * if (tokens > 50000) {\n * const humanMessages: number[] = [];\n *\n * // Find all human message indices\n * for (let i = 0; i < messages.length; i++) {\n * if (HumanMessage.isInstance(messages[i])) {\n * humanMessages.push(i);\n * }\n * }\n *\n * // Remove old human messages (keep only the most recent N)\n * const toRemove = humanMessages.slice(0, -this.keepRecent);\n * for (let i = toRemove.length - 1; i >= 0; i--) {\n * messages.splice(toRemove[i]!, 1);\n * }\n * }\n * }\n * }\n * ```\n */\nexport interface ContextEdit {\n /**\n * Apply an edit to the message list, returning the new token count.\n *\n * This method should:\n * 1. Check if editing is needed based on `tokens` parameter\n * 2. Modify the `messages` array in-place (if needed)\n * 3. Return the new token count after modifications\n *\n * @param params - Parameters for the editing operation\n * @returns The updated token count after applying edits\n */\n apply(params: {\n /**\n * Array of messages to potentially edit (modify in-place)\n */\n messages: BaseMessage[];\n /**\n * Function to count tokens in a message array\n */\n countTokens: TokenCounter;\n /**\n * Optional model instance for model profile information\n */\n model?: BaseLanguageModel;\n }): void | Promise<void>;\n}\n/**\n * Configuration for clearing tool outputs when token limits are exceeded.\n */\nexport interface ClearToolUsesEditConfig {\n /**\n * Trigger conditions for context editing.\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 >= 100000 AND messages >= 50\n * trigger: { tokens: 100000, messages: 50 }\n *\n * // Multiple conditions: trigger if (tokens >= 100000 AND messages >= 50) OR (tokens >= 50000 AND messages >= 100)\n * trigger: [\n * { tokens: 100000, messages: 50 },\n * { tokens: 50000, messages: 100 }\n * ]\n *\n * // Fractional trigger: trigger at 80% of model's max input tokens\n * trigger: { fraction: 0.8 }\n * ```\n */\n trigger?: ContextSize | ContextSize[];\n /**\n * Context retention policy applied after editing.\n * Specify how many tool results to preserve using messages, tokens, or fraction.\n *\n * @example\n * ```ts\n * // Keep 3 most recent tool results\n * keep: { messages: 3 }\n *\n * // Keep tool results that fit within 1000 tokens\n * keep: { tokens: 1000 }\n *\n * // Keep tool results that fit within 30% of model's max input tokens\n * keep: { fraction: 0.3 }\n * ```\n */\n keep?: KeepSize;\n /**\n * Whether to clear the originating tool call parameters on the AI message.\n * @default false\n */\n clearToolInputs?: boolean;\n /**\n * List of tool names to exclude from clearing.\n * @default []\n */\n excludeTools?: string[];\n /**\n * Placeholder text inserted for cleared tool outputs.\n * @default \"[cleared]\"\n */\n placeholder?: string;\n /**\n * @deprecated Use `trigger: { tokens: value }` instead.\n */\n triggerTokens?: number;\n /**\n * @deprecated Use `keep: { messages: value }` instead.\n */\n keepMessages?: number;\n /**\n * @deprecated This property is deprecated and will be removed in a future version.\n * Use `keep: { tokens: value }` or `keep: { messages: value }` instead to control retention.\n */\n clearAtLeast?: number;\n}\n/**\n * Strategy for clearing tool outputs when token limits are exceeded.\n *\n * This strategy mirrors Anthropic's `clear_tool_uses_20250919` behavior by\n * replacing older tool results with a placeholder text when the conversation\n * grows too large. It preserves the most recent tool results and can exclude\n * specific tools from being cleared.\n *\n * @example\n * ```ts\n * import { ClearToolUsesEdit } from \"langchain\";\n *\n * const edit = new ClearToolUsesEdit({\n * trigger: { tokens: 100000 }, // Start clearing at 100K tokens\n * keep: { messages: 3 }, // Keep 3 most recent tool results\n * excludeTools: [\"important\"], // Never clear \"important\" tool\n * clearToolInputs: false, // Keep tool call arguments\n * placeholder: \"[cleared]\", // Replacement text\n * });\n *\n * // Multiple trigger conditions\n * const edit2 = new ClearToolUsesEdit({\n * trigger: [\n * { tokens: 100000, messages: 50 },\n * { tokens: 50000, messages: 100 }\n * ],\n * keep: { messages: 3 },\n * });\n *\n * // Fractional trigger with model profile\n * const edit3 = new ClearToolUsesEdit({\n * trigger: { fraction: 0.8 }, // Trigger at 80% of model's max tokens\n * keep: { fraction: 0.3 }, // Keep 30% of model's max tokens\n * });\n * ```\n */\nexport declare class ClearToolUsesEdit implements ContextEdit {\n #private;\n trigger: ContextSize | ContextSize[];\n keep: KeepSize;\n clearToolInputs: boolean;\n excludeTools: Set<string>;\n placeholder: string;\n model: BaseLanguageModel;\n clearAtLeast: number;\n constructor(config?: ClearToolUsesEditConfig);\n apply(params: {\n messages: BaseMessage[];\n model: BaseLanguageModel;\n countTokens: TokenCounter;\n }): Promise<void>;\n}\n/**\n * Configuration for the Context Editing Middleware.\n */\nexport interface ContextEditingMiddlewareConfig {\n /**\n * Sequence of edit strategies to apply. Defaults to a single\n * ClearToolUsesEdit mirroring Anthropic defaults.\n */\n edits?: ContextEdit[];\n /**\n * Whether to use approximate token counting (faster, less accurate)\n * or exact counting implemented by the chat model (potentially slower, more accurate).\n * Currently only OpenAI models support exact counting.\n * @default \"approx\"\n */\n tokenCountMethod?: \"approx\" | \"model\";\n}\n/**\n * Middleware that automatically prunes tool results to manage context size.\n *\n * This middleware applies a sequence of edits when the total input token count\n * exceeds configured thresholds. By default, it uses the `ClearToolUsesEdit` strategy\n * which mirrors Anthropic's `clear_tool_uses_20250919` behaviour by clearing older\n * tool results once the conversation exceeds 100,000 tokens.\n *\n * ## Basic Usage\n *\n * Use the middleware with default settings to automatically manage context:\n *\n * @example Basic usage with defaults\n * ```ts\n * import { contextEditingMiddleware } from \"langchain\";\n * import { createAgent } from \"langchain\";\n *\n * const agent = createAgent({\n * model: \"anthropic:claude-sonnet-4-5\",\n * tools: [searchTool, calculatorTool],\n * middleware: [\n * contextEditingMiddleware(),\n * ],\n * });\n * ```\n *\n * The default configuration:\n * - Triggers when context exceeds **100,000 tokens**\n * - Keeps the **3 most recent** tool results\n * - Uses **approximate token counting** (fast)\n * - Does not clear tool call arguments\n *\n * ## Custom Configuration\n *\n * Customize the clearing behavior with `ClearToolUsesEdit`:\n *\n * @example Custom ClearToolUsesEdit configuration\n * ```ts\n * import { contextEditingMiddleware, ClearToolUsesEdit } from \"langchain\";\n *\n * // Single condition: trigger if tokens >= 50000 AND messages >= 20\n * const agent1 = createAgent({\n * model: \"anthropic:claude-sonnet-4-5\",\n * tools: [searchTool, calculatorTool],\n * middleware: [\n * contextEditingMiddleware({\n * edits: [\n * new ClearToolUsesEdit({\n * trigger: { tokens: 50000, messages: 20 },\n * keep: { messages: 5 },\n * excludeTools: [\"search\"],\n * clearToolInputs: true,\n * }),\n * ],\n * tokenCountMethod: \"approx\",\n * }),\n * ],\n * });\n *\n * // Multiple conditions: trigger if (tokens >= 50000 AND messages >= 20) OR (tokens >= 30000 AND messages >= 50)\n * const agent2 = createAgent({\n * model: \"anthropic:claude-sonnet-4-5\",\n * tools: [searchTool, calculatorTool],\n * middleware: [\n * contextEditingMiddleware({\n * edits: [\n * new ClearToolUsesEdit({\n * trigger: [\n * { tokens: 50000, messages: 20 },\n * { tokens: 30000, messages: 50 },\n * ],\n * keep: { messages: 5 },\n * }),\n * ],\n * }),\n * ],\n * });\n *\n * // Fractional trigger with model profile\n * const agent3 = createAgent({\n * model: chatModel,\n * tools: [searchTool, calculatorTool],\n * middleware: [\n * contextEditingMiddleware({\n * edits: [\n * new ClearToolUsesEdit({\n * trigger: { fraction: 0.8 }, // Trigger at 80% of model's max tokens\n * keep: { fraction: 0.3 }, // Keep 30% of model's max tokens\n * model: chatModel,\n * }),\n * ],\n * }),\n * ],\n * });\n * ```\n *\n * ## Custom Editing Strategies\n *\n * Implement your own context editing strategy by creating a class that\n * implements the `ContextEdit` interface:\n *\n * @example Custom editing strategy\n * ```ts\n * import { contextEditingMiddleware, type ContextEdit, type TokenCounter } from \"langchain\";\n * import type { BaseMessage } from \"@langchain/core/messages\";\n *\n * class CustomEdit implements ContextEdit {\n * async apply(params: {\n * tokens: number;\n * messages: BaseMessage[];\n * countTokens: TokenCounter;\n * }): Promise<number> {\n * // Implement your custom editing logic here\n * // and apply it to the messages array, then\n * // return the new token count after edits\n * return countTokens(messages);\n * }\n * }\n * ```\n *\n * @param config - Configuration options for the middleware\n * @returns A middleware instance that can be used with `createAgent`\n */\nexport declare function contextEditingMiddleware(config?: ContextEditingMiddlewareConfig): import(\"./types.js\").AgentMiddleware<undefined, undefined, any>;\n//# sourceMappingURL=contextEditing.d.ts.map"],"mappings":";;;;;;;AA2EsB;AAKtB;;;;AAqCmB;AAkEnB;;;;;;;;;;;;AAA6D;AAmB7D;AAyIA;;;;;;;;;;;;;;;;;;;UAjSiBK,WAAAA;;;;;;;;;;;;;;;;cAgBCL;;;;iBAIGI;;;;YAILH;aACDK;;;;;UAKEC,uBAAAA;;;;;;;;;;;;;;;;;;;;YAoBHL,cAAcA;;;;;;;;;;;;;;;;;SAiBjBC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkEUK,iBAAAA,YAA6BH;;WAErCH,cAAcA;QACjBC;;gBAEQM;;SAEPR;;uBAEcM;;cAEPP;WACHC;iBACMG;MACbE;;;;;UAKSI,8BAAAA;;;;;UAKLL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoIYM,wBAAAA,UAAkCD,iCAAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextEditing.d.ts","names":["BaseMessage","BaseLanguageModel","ContextSize","KeepSize","TokenCounter","ContextEdit","Promise","ClearToolUsesEditConfig","ClearToolUsesEdit","Set","ContextEditingMiddlewareConfig","contextEditingMiddleware","__types_js10","AgentMiddleware"],"sources":["../../../src/agents/middleware/contextEditing.d.ts"],"sourcesContent":["/**\n * Context editing middleware.\n *\n * This middleware mirrors Anthropic's context editing capabilities by clearing\n * older tool results once the conversation grows beyond a configurable token\n * threshold. The implementation is intentionally model-agnostic so it can be used\n * with any LangChain chat model.\n */\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { type ContextSize, type KeepSize, type TokenCounter } from \"./summarization.js\";\n/**\n * Protocol describing a context editing strategy.\n *\n * Implement this interface to create custom strategies for managing\n * conversation context size. The `apply` method should modify the\n * messages array in-place and return the updated token count.\n *\n * @example\n * ```ts\n * import { HumanMessage, type ContextEdit, type BaseMessage } from \"langchain\";\n *\n * class RemoveOldHumanMessages implements ContextEdit {\n * constructor(private keepRecent: number = 10) {}\n *\n * async apply({ messages, countTokens }) {\n * // Check current token count\n * const tokens = await countTokens(messages);\n *\n * // Remove old human messages if over limit, keeping the most recent ones\n * if (tokens > 50000) {\n * const humanMessages: number[] = [];\n *\n * // Find all human message indices\n * for (let i = 0; i < messages.length; i++) {\n * if (HumanMessage.isInstance(messages[i])) {\n * humanMessages.push(i);\n * }\n * }\n *\n * // Remove old human messages (keep only the most recent N)\n * const toRemove = humanMessages.slice(0, -this.keepRecent);\n * for (let i = toRemove.length - 1; i >= 0; i--) {\n * messages.splice(toRemove[i]!, 1);\n * }\n * }\n * }\n * }\n * ```\n */\nexport interface ContextEdit {\n /**\n * Apply an edit to the message list, returning the new token count.\n *\n * This method should:\n * 1. Check if editing is needed based on `tokens` parameter\n * 2. Modify the `messages` array in-place (if needed)\n * 3. Return the new token count after modifications\n *\n * @param params - Parameters for the editing operation\n * @returns The updated token count after applying edits\n */\n apply(params: {\n /**\n * Array of messages to potentially edit (modify in-place)\n */\n messages: BaseMessage[];\n /**\n * Function to count tokens in a message array\n */\n countTokens: TokenCounter;\n /**\n * Optional model instance for model profile information\n */\n model?: BaseLanguageModel;\n }): void | Promise<void>;\n}\n/**\n * Configuration for clearing tool outputs when token limits are exceeded.\n */\nexport interface ClearToolUsesEditConfig {\n /**\n * Trigger conditions for context editing.\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 >= 100000 AND messages >= 50\n * trigger: { tokens: 100000, messages: 50 }\n *\n * // Multiple conditions: trigger if (tokens >= 100000 AND messages >= 50) OR (tokens >= 50000 AND messages >= 100)\n * trigger: [\n * { tokens: 100000, messages: 50 },\n * { tokens: 50000, messages: 100 }\n * ]\n *\n * // Fractional trigger: trigger at 80% of model's max input tokens\n * trigger: { fraction: 0.8 }\n * ```\n */\n trigger?: ContextSize | ContextSize[];\n /**\n * Context retention policy applied after editing.\n * Specify how many tool results to preserve using messages, tokens, or fraction.\n *\n * @example\n * ```ts\n * // Keep 3 most recent tool results\n * keep: { messages: 3 }\n *\n * // Keep tool results that fit within 1000 tokens\n * keep: { tokens: 1000 }\n *\n * // Keep tool results that fit within 30% of model's max input tokens\n * keep: { fraction: 0.3 }\n * ```\n */\n keep?: KeepSize;\n /**\n * Whether to clear the originating tool call parameters on the AI message.\n * @default false\n */\n clearToolInputs?: boolean;\n /**\n * List of tool names to exclude from clearing.\n * @default []\n */\n excludeTools?: string[];\n /**\n * Placeholder text inserted for cleared tool outputs.\n * @default \"[cleared]\"\n */\n placeholder?: string;\n /**\n * @deprecated Use `trigger: { tokens: value }` instead.\n */\n triggerTokens?: number;\n /**\n * @deprecated Use `keep: { messages: value }` instead.\n */\n keepMessages?: number;\n /**\n * @deprecated This property is deprecated and will be removed in a future version.\n * Use `keep: { tokens: value }` or `keep: { messages: value }` instead to control retention.\n */\n clearAtLeast?: number;\n}\n/**\n * Strategy for clearing tool outputs when token limits are exceeded.\n *\n * This strategy mirrors Anthropic's `clear_tool_uses_20250919` behavior by\n * replacing older tool results with a placeholder text when the conversation\n * grows too large. It preserves the most recent tool results and can exclude\n * specific tools from being cleared.\n *\n * @example\n * ```ts\n * import { ClearToolUsesEdit } from \"langchain\";\n *\n * const edit = new ClearToolUsesEdit({\n * trigger: { tokens: 100000 }, // Start clearing at 100K tokens\n * keep: { messages: 3 }, // Keep 3 most recent tool results\n * excludeTools: [\"important\"], // Never clear \"important\" tool\n * clearToolInputs: false, // Keep tool call arguments\n * placeholder: \"[cleared]\", // Replacement text\n * });\n *\n * // Multiple trigger conditions\n * const edit2 = new ClearToolUsesEdit({\n * trigger: [\n * { tokens: 100000, messages: 50 },\n * { tokens: 50000, messages: 100 }\n * ],\n * keep: { messages: 3 },\n * });\n *\n * // Fractional trigger with model profile\n * const edit3 = new ClearToolUsesEdit({\n * trigger: { fraction: 0.8 }, // Trigger at 80% of model's max tokens\n * keep: { fraction: 0.3 }, // Keep 30% of model's max tokens\n * });\n * ```\n */\nexport declare class ClearToolUsesEdit implements ContextEdit {\n #private;\n trigger: ContextSize | ContextSize[];\n keep: KeepSize;\n clearToolInputs: boolean;\n excludeTools: Set<string>;\n placeholder: string;\n model: BaseLanguageModel;\n clearAtLeast: number;\n constructor(config?: ClearToolUsesEditConfig);\n apply(params: {\n messages: BaseMessage[];\n model: BaseLanguageModel;\n countTokens: TokenCounter;\n }): Promise<void>;\n}\n/**\n * Configuration for the Context Editing Middleware.\n */\nexport interface ContextEditingMiddlewareConfig {\n /**\n * Sequence of edit strategies to apply. Defaults to a single\n * ClearToolUsesEdit mirroring Anthropic defaults.\n */\n edits?: ContextEdit[];\n /**\n * Whether to use approximate token counting (faster, less accurate)\n * or exact counting implemented by the chat model (potentially slower, more accurate).\n * Currently only OpenAI models support exact counting.\n * @default \"approx\"\n */\n tokenCountMethod?: \"approx\" | \"model\";\n}\n/**\n * Middleware that automatically prunes tool results to manage context size.\n *\n * This middleware applies a sequence of edits when the total input token count\n * exceeds configured thresholds. By default, it uses the `ClearToolUsesEdit` strategy\n * which mirrors Anthropic's `clear_tool_uses_20250919` behaviour by clearing older\n * tool results once the conversation exceeds 100,000 tokens.\n *\n * ## Basic Usage\n *\n * Use the middleware with default settings to automatically manage context:\n *\n * @example Basic usage with defaults\n * ```ts\n * import { contextEditingMiddleware } from \"langchain\";\n * import { createAgent } from \"langchain\";\n *\n * const agent = createAgent({\n * model: \"anthropic:claude-sonnet-4-5\",\n * tools: [searchTool, calculatorTool],\n * middleware: [\n * contextEditingMiddleware(),\n * ],\n * });\n * ```\n *\n * The default configuration:\n * - Triggers when context exceeds **100,000 tokens**\n * - Keeps the **3 most recent** tool results\n * - Uses **approximate token counting** (fast)\n * - Does not clear tool call arguments\n *\n * ## Custom Configuration\n *\n * Customize the clearing behavior with `ClearToolUsesEdit`:\n *\n * @example Custom ClearToolUsesEdit configuration\n * ```ts\n * import { contextEditingMiddleware, ClearToolUsesEdit } from \"langchain\";\n *\n * // Single condition: trigger if tokens >= 50000 AND messages >= 20\n * const agent1 = createAgent({\n * model: \"anthropic:claude-sonnet-4-5\",\n * tools: [searchTool, calculatorTool],\n * middleware: [\n * contextEditingMiddleware({\n * edits: [\n * new ClearToolUsesEdit({\n * trigger: { tokens: 50000, messages: 20 },\n * keep: { messages: 5 },\n * excludeTools: [\"search\"],\n * clearToolInputs: true,\n * }),\n * ],\n * tokenCountMethod: \"approx\",\n * }),\n * ],\n * });\n *\n * // Multiple conditions: trigger if (tokens >= 50000 AND messages >= 20) OR (tokens >= 30000 AND messages >= 50)\n * const agent2 = createAgent({\n * model: \"anthropic:claude-sonnet-4-5\",\n * tools: [searchTool, calculatorTool],\n * middleware: [\n * contextEditingMiddleware({\n * edits: [\n * new ClearToolUsesEdit({\n * trigger: [\n * { tokens: 50000, messages: 20 },\n * { tokens: 30000, messages: 50 },\n * ],\n * keep: { messages: 5 },\n * }),\n * ],\n * }),\n * ],\n * });\n *\n * // Fractional trigger with model profile\n * const agent3 = createAgent({\n * model: chatModel,\n * tools: [searchTool, calculatorTool],\n * middleware: [\n * contextEditingMiddleware({\n * edits: [\n * new ClearToolUsesEdit({\n * trigger: { fraction: 0.8 }, // Trigger at 80% of model's max tokens\n * keep: { fraction: 0.3 }, // Keep 30% of model's max tokens\n * model: chatModel,\n * }),\n * ],\n * }),\n * ],\n * });\n * ```\n *\n * ## Custom Editing Strategies\n *\n * Implement your own context editing strategy by creating a class that\n * implements the `ContextEdit` interface:\n *\n * @example Custom editing strategy\n * ```ts\n * import { contextEditingMiddleware, type ContextEdit, type TokenCounter } from \"langchain\";\n * import type { BaseMessage } from \"@langchain/core/messages\";\n *\n * class CustomEdit implements ContextEdit {\n * async apply(params: {\n * tokens: number;\n * messages: BaseMessage[];\n * countTokens: TokenCounter;\n * }): Promise<number> {\n * // Implement your custom editing logic here\n * // and apply it to the messages array, then\n * // return the new token count after edits\n * return countTokens(messages);\n * }\n * }\n * ```\n *\n * @param config - Configuration options for the middleware\n * @returns A middleware instance that can be used with `createAgent`\n */\nexport declare function contextEditingMiddleware(config?: ContextEditingMiddlewareConfig): import(\"./types.js\").AgentMiddleware<undefined, undefined, any>;\n//# sourceMappingURL=contextEditing.d.ts.map"],"mappings":";;;;;;;AA2EsB;AAKtB;;;;AAqCmB;AAkEnB;;;;;;;;;;;;AAA6D;AAmB7D;AAyIA;;;;;;;;;;;;;;;;;;;UAjSiBK,WAAAA;;;;;;;;;;;;;;;;cAgBCL;;;;iBAIGI;;;;YAILH;aACDK;;;;;UAKEC,uBAAAA;;;;;;;;;;;;;;;;;;;;YAoBHL,cAAcA;;;;;;;;;;;;;;;;;SAiBjBC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkEUK,iBAAAA,YAA6BH;;WAErCH,cAAcA;QACjBC;;gBAEQM;;SAEPR;;uBAEcM;;cAEPP;WACHC;iBACMG;MACbE;;;;;UAKSI,8BAAAA;;;;;UAKLL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoIYM,wBAAAA,UAAkCD,iCAAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamicSystemPrompt.d.cts","names":["SystemMessage","Runtime","AgentBuiltInState","DynamicSystemPromptMiddlewareConfig","TContextSchema","Promise","dynamicSystemPromptMiddleware","__types_js9","AgentMiddleware"],"sources":["../../../src/agents/middleware/dynamicSystemPrompt.d.ts"],"sourcesContent":["import { SystemMessage } from \"@langchain/core/messages\";\nimport type { Runtime, AgentBuiltInState } from \"../runtime.js\";\nexport type DynamicSystemPromptMiddlewareConfig<TContextSchema> = (state: AgentBuiltInState, runtime: Runtime<TContextSchema>) => string | SystemMessage | Promise<string | SystemMessage>;\n/**\n * Dynamic System Prompt Middleware\n *\n * Allows setting the system prompt dynamically right before each model invocation.\n * Useful when the prompt depends on the current agent state or per-invocation context.\n *\n * @typeParam TContextSchema - The shape of the runtime context available at invocation time.\n * If your agent defines a `contextSchema`, pass the inferred type here to get full type-safety\n * for `runtime.context`.\n *\n * @param fn - Function that receives the current agent `state` and `runtime`, and\n * returns the system prompt for the next model call as a string.\n *\n * @returns A middleware instance that sets `systemPrompt` for the next model call.\n *\n * @example Basic usage with typed context\n * ```ts\n * import { z } from \"zod\";\n * import { dynamicSystemPrompt } from \"langchain\";\n * import { createAgent, SystemMessage } from \"langchain\";\n *\n * const contextSchema = z.object({ region: z.string().optional() });\n *\n * const middleware = dynamicSystemPrompt<z.infer<typeof contextSchema>>(\n * (_state, runtime) => `You are a helpful assistant. Region: ${runtime.context.region ?? \"n/a\"}`\n * );\n *\n * const agent = createAgent({\n * model: \"anthropic:claude-3-5-sonnet\",\n * contextSchema,\n * middleware: [middleware],\n * });\n *\n * await agent.invoke({ messages }, { context: { region: \"EU\" } });\n * ```\n *\n * @public\n */\nexport declare function dynamicSystemPromptMiddleware<TContextSchema = unknown>(fn: DynamicSystemPromptMiddlewareConfig<TContextSchema>): import(\"./types.js\").AgentMiddleware<undefined, undefined, any>;\n//# sourceMappingURL=dynamicSystemPrompt.d.ts.map"],"mappings":";;;;;KAEYG,8DAA8DD,4BAA4BD,QAAQG,6BAA6BJ,gBAAgBK,iBAAiBL;;;AAA5K;;;;;;;AAAkK;AAuClK;;;;AAA8K;;;;;;;;;;;;;;;;;;;;;;;;iBAAtJM,4DAA4DH,oCAAoCC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamicSystemPrompt.d.ts","names":["SystemMessage","Runtime","AgentBuiltInState","DynamicSystemPromptMiddlewareConfig","TContextSchema","Promise","dynamicSystemPromptMiddleware","__types_js9","AgentMiddleware"],"sources":["../../../src/agents/middleware/dynamicSystemPrompt.d.ts"],"sourcesContent":["import { SystemMessage } from \"@langchain/core/messages\";\nimport type { Runtime, AgentBuiltInState } from \"../runtime.js\";\nexport type DynamicSystemPromptMiddlewareConfig<TContextSchema> = (state: AgentBuiltInState, runtime: Runtime<TContextSchema>) => string | SystemMessage | Promise<string | SystemMessage>;\n/**\n * Dynamic System Prompt Middleware\n *\n * Allows setting the system prompt dynamically right before each model invocation.\n * Useful when the prompt depends on the current agent state or per-invocation context.\n *\n * @typeParam TContextSchema - The shape of the runtime context available at invocation time.\n * If your agent defines a `contextSchema`, pass the inferred type here to get full type-safety\n * for `runtime.context`.\n *\n * @param fn - Function that receives the current agent `state` and `runtime`, and\n * returns the system prompt for the next model call as a string.\n *\n * @returns A middleware instance that sets `systemPrompt` for the next model call.\n *\n * @example Basic usage with typed context\n * ```ts\n * import { z } from \"zod\";\n * import { dynamicSystemPrompt } from \"langchain\";\n * import { createAgent, SystemMessage } from \"langchain\";\n *\n * const contextSchema = z.object({ region: z.string().optional() });\n *\n * const middleware = dynamicSystemPrompt<z.infer<typeof contextSchema>>(\n * (_state, runtime) => `You are a helpful assistant. Region: ${runtime.context.region ?? \"n/a\"}`\n * );\n *\n * const agent = createAgent({\n * model: \"anthropic:claude-3-5-sonnet\",\n * contextSchema,\n * middleware: [middleware],\n * });\n *\n * await agent.invoke({ messages }, { context: { region: \"EU\" } });\n * ```\n *\n * @public\n */\nexport declare function dynamicSystemPromptMiddleware<TContextSchema = unknown>(fn: DynamicSystemPromptMiddlewareConfig<TContextSchema>): import(\"./types.js\").AgentMiddleware<undefined, undefined, any>;\n//# sourceMappingURL=dynamicSystemPrompt.d.ts.map"],"mappings":";;;;;KAEYG,8DAA8DD,4BAA4BD,QAAQG,6BAA6BJ,gBAAgBK,iBAAiBL;;;AAA5K;;;;;;;AAAkK;AAuClK;;;;AAA8K;;;;;;;;;;;;;;;;;;;;;;;;iBAAtJM,4DAA4DH,oCAAoCC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hitl.d.cts","names":["z","ToolCall","InferInteropZodInput","AgentBuiltInState","Runtime","DescriptionFunctionSchema","Record","ZodTypeDef","ZodType","ZodUnknown","ZodTuple","ZodString","ZodPromise","ZodUnion","ZodFunction","DescriptionFactory","infer","DecisionType","ZodEnum","InterruptOnConfigSchema","ZodArray","ZodOptional","ZodAny","ZodRecord","ZodTypeAny","Promise","ZodObject","InterruptOnConfig","input","Action","ActionRequest","ReviewConfig","HITLRequest","ApproveDecision","EditDecision","RejectDecision","Decision","HITLResponse","contextSchema","ZodBoolean","ZodDefault","HumanInTheLoopMiddlewareConfig","humanInTheLoopMiddleware","NonNullable","__types_js7","AgentMiddleware"],"sources":["../../../src/agents/middleware/hitl.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { ToolCall } from \"@langchain/core/messages\";\nimport { InferInteropZodInput } from \"@langchain/core/utils/types\";\nimport type { AgentBuiltInState, Runtime } from \"../runtime.js\";\ndeclare const DescriptionFunctionSchema: z.ZodFunction<z.ZodTuple<[z.ZodType<ToolCall<string, Record<string, any>>, z.ZodTypeDef, ToolCall<string, Record<string, any>>>, z.ZodType<AgentBuiltInState, z.ZodTypeDef, AgentBuiltInState>, z.ZodType<Runtime<unknown>, z.ZodTypeDef, Runtime<unknown>>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>;\n/**\n * Function type that dynamically generates a description for a tool call approval request.\n *\n * @param toolCall - The tool call being reviewed\n * @param state - The current agent state\n * @param runtime - The agent runtime context\n * @returns A string description or Promise that resolves to a string description\n *\n * @example\n * ```typescript\n * import { type DescriptionFactory, type ToolCall } from \"langchain\";\n *\n * const descriptionFactory: DescriptionFactory = (toolCall, state, runtime) => {\n * return `Please review: ${toolCall.name}(${JSON.stringify(toolCall.args)})`;\n * };\n * ```\n */\nexport type DescriptionFactory = z.infer<typeof DescriptionFunctionSchema>;\ndeclare const DecisionType: z.ZodEnum<[\"approve\", \"edit\", \"reject\"]>;\nexport type DecisionType = z.infer<typeof DecisionType>;\ndeclare const InterruptOnConfigSchema: z.ZodObject<{\n /**\n * The decisions that are allowed for this action.\n */\n allowedDecisions: z.ZodArray<z.ZodEnum<[\"approve\", \"edit\", \"reject\"]>, \"many\">;\n /**\n * The description attached to the request for human input.\n * Can be either:\n * - A static string describing the approval request\n * - A callable that dynamically generates the description based on agent state,\n * runtime, and tool call information\n *\n * @example\n * Static string description\n * ```typescript\n * import type { InterruptOnConfig } from \"langchain\";\n *\n * const config: InterruptOnConfig = {\n * allowedDecisions: [\"approve\", \"reject\"],\n * description: \"Please review this tool execution\"\n * };\n * ```\n *\n * @example\n * Dynamic callable description\n * ```typescript\n * import type {\n * AgentBuiltInState,\n * Runtime,\n * DescriptionFactory,\n * ToolCall,\n * InterruptOnConfig\n * } from \"langchain\";\n *\n * const formatToolDescription: DescriptionFactory = (\n * toolCall: ToolCall,\n * state: AgentBuiltInState,\n * runtime: Runtime<unknown>\n * ) => {\n * return `Tool: ${toolCall.name}\\nArguments:\\n${JSON.stringify(toolCall.args, null, 2)}`;\n * };\n *\n * const config: InterruptOnConfig = {\n * allowedDecisions: [\"approve\", \"edit\"],\n * description: formatToolDescription\n * };\n * ```\n */\n description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<ToolCall<string, Record<string, any>>, z.ZodTypeDef, ToolCall<string, Record<string, any>>>, z.ZodType<AgentBuiltInState, z.ZodTypeDef, AgentBuiltInState>, z.ZodType<Runtime<unknown>, z.ZodTypeDef, Runtime<unknown>>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;\n /**\n * JSON schema for the arguments associated with the action, if edits are allowed.\n */\n argsSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;\n}, \"strip\", z.ZodTypeAny, {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n}, {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n}>;\nexport type InterruptOnConfig = z.input<typeof InterruptOnConfigSchema>;\n/**\n * Represents an action with a name and arguments.\n */\nexport interface Action {\n /**\n * The type or name of action being requested (e.g., \"add_numbers\").\n */\n name: string;\n /**\n * Key-value pairs of arguments needed for the action (e.g., {\"a\": 1, \"b\": 2}).\n */\n args: Record<string, any>;\n}\n/**\n * Represents an action request with a name, arguments, and description.\n */\nexport interface ActionRequest {\n /**\n * The name of the action being requested.\n */\n name: string;\n /**\n * Key-value pairs of arguments needed for the action (e.g., {\"a\": 1, \"b\": 2}).\n */\n args: Record<string, any>;\n /**\n * The description of the action to be reviewed.\n */\n description?: string;\n}\n/**\n * Policy for reviewing a HITL request.\n */\nexport interface ReviewConfig {\n /**\n * Name of the action associated with this review configuration.\n */\n actionName: string;\n /**\n * The decisions that are allowed for this request.\n */\n allowedDecisions: DecisionType[];\n /**\n * JSON schema for the arguments associated with the action, if edits are allowed.\n */\n argsSchema?: Record<string, any>;\n}\n/**\n * Request for human feedback on a sequence of actions requested by a model.\n *\n * @example\n * ```ts\n * const hitlRequest: HITLRequest = {\n * actionRequests: [\n * { name: \"send_email\", args: { to: \"user@example.com\", subject: \"Hello\" } }\n * ],\n * reviewConfigs: [\n * {\n * actionName: \"send_email\",\n * allowedDecisions: [\"approve\", \"edit\", \"reject\"],\n * description: \"Please review the email before sending\"\n * }\n * ]\n * };\n * const response = interrupt(hitlRequest);\n * ```\n */\nexport interface HITLRequest {\n /**\n * A list of agent actions for human review.\n */\n actionRequests: ActionRequest[];\n /**\n * Review configuration for all possible actions.\n */\n reviewConfigs: ReviewConfig[];\n}\n/**\n * Response when a human approves the action.\n */\nexport interface ApproveDecision {\n type: \"approve\";\n}\n/**\n * Response when a human edits the action.\n */\nexport interface EditDecision {\n type: \"edit\";\n /**\n * Edited action for the agent to perform.\n * Ex: for a tool call, a human reviewer can edit the tool name and args.\n */\n editedAction: Action;\n}\n/**\n * Response when a human rejects the action.\n */\nexport interface RejectDecision {\n type: \"reject\";\n /**\n * The message sent to the model explaining why the action was rejected.\n */\n message?: string;\n}\n/**\n * Union of all possible decision types.\n */\nexport type Decision = ApproveDecision | EditDecision | RejectDecision;\n/**\n * Response payload for a HITLRequest.\n */\nexport interface HITLResponse {\n /**\n * The decisions made by the human.\n */\n decisions: Decision[];\n}\ndeclare const contextSchema: z.ZodObject<{\n /**\n * Mapping of tool name to allowed reviewer responses.\n * If a tool doesn't have an entry, it's auto-approved by default.\n *\n * - `true` -> pause for approval and allow approve/edit/reject decisions\n * - `false` -> auto-approve (no human review)\n * - `InterruptOnConfig` -> explicitly specify which decisions are allowed for this tool\n */\n interruptOn: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodObject<{\n /**\n * The decisions that are allowed for this action.\n */\n allowedDecisions: z.ZodArray<z.ZodEnum<[\"approve\", \"edit\", \"reject\"]>, \"many\">;\n /**\n * The description attached to the request for human input.\n * Can be either:\n * - A static string describing the approval request\n * - A callable that dynamically generates the description based on agent state,\n * runtime, and tool call information\n *\n * @example\n * Static string description\n * ```typescript\n * import type { InterruptOnConfig } from \"langchain\";\n *\n * const config: InterruptOnConfig = {\n * allowedDecisions: [\"approve\", \"reject\"],\n * description: \"Please review this tool execution\"\n * };\n * ```\n *\n * @example\n * Dynamic callable description\n * ```typescript\n * import type {\n * AgentBuiltInState,\n * Runtime,\n * DescriptionFactory,\n * ToolCall,\n * InterruptOnConfig\n * } from \"langchain\";\n *\n * const formatToolDescription: DescriptionFactory = (\n * toolCall: ToolCall,\n * state: AgentBuiltInState,\n * runtime: Runtime<unknown>\n * ) => {\n * return `Tool: ${toolCall.name}\\nArguments:\\n${JSON.stringify(toolCall.args, null, 2)}`;\n * };\n *\n * const config: InterruptOnConfig = {\n * allowedDecisions: [\"approve\", \"edit\"],\n * description: formatToolDescription\n * };\n * ```\n */\n description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<ToolCall<string, Record<string, any>>, z.ZodTypeDef, ToolCall<string, Record<string, any>>>, z.ZodType<AgentBuiltInState, z.ZodTypeDef, AgentBuiltInState>, z.ZodType<Runtime<unknown>, z.ZodTypeDef, Runtime<unknown>>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;\n /**\n * JSON schema for the arguments associated with the action, if edits are allowed.\n */\n argsSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;\n }, \"strip\", z.ZodTypeAny, {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n }, {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n }>]>>>;\n /**\n * Prefix used when constructing human-facing approval messages.\n * Provides context about the tool call being reviewed; does not change the underlying action.\n *\n * Note: This prefix is only applied for tools that do not provide a custom\n * `description` via their {@link InterruptOnConfig}. If a tool specifies a custom\n * `description`, that per-tool text is used and this prefix is ignored.\n */\n descriptionPrefix: z.ZodDefault<z.ZodString>;\n}, \"strip\", z.ZodTypeAny, {\n interruptOn?: Record<string, boolean | {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n }> | undefined;\n descriptionPrefix: string;\n}, {\n interruptOn?: Record<string, boolean | {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n }> | undefined;\n descriptionPrefix?: string | undefined;\n}>;\nexport type HumanInTheLoopMiddlewareConfig = InferInteropZodInput<typeof contextSchema>;\n/**\n * Creates a Human-in-the-Loop (HITL) middleware for tool approval and oversight.\n *\n * This middleware intercepts tool calls made by an AI agent and provides human oversight\n * capabilities before execution. It enables selective approval workflows where certain tools\n * require human intervention while others can execute automatically.\n *\n * A invocation result that has been interrupted by the middleware will have a `__interrupt__`\n * property that contains the interrupt request.\n *\n * ```ts\n * import { type HITLRequest, type HITLResponse } from \"langchain\";\n * import { type Interrupt } from \"langchain\";\n *\n * const result = await agent.invoke(request);\n * const interruptRequest = result.__interrupt__?.[0] as Interrupt<HITLRequest>;\n *\n * // Examine the action requests and review configs\n * const actionRequests = interruptRequest.value.actionRequests;\n * const reviewConfigs = interruptRequest.value.reviewConfigs;\n *\n * // Create decisions for each action\n * const resume: HITLResponse = {\n * decisions: actionRequests.map((action, i) => {\n * if (action.name === \"calculator\") {\n * return { type: \"approve\" };\n * } else if (action.name === \"write_file\") {\n * return {\n * type: \"edit\",\n * editedAction: { name: \"write_file\", args: { filename: \"safe.txt\", content: \"Safe content\" } }\n * };\n * }\n * return { type: \"reject\", message: \"Action not allowed\" };\n * })\n * };\n *\n * // Resume with decisions\n * await agent.invoke(new Command({ resume }), config);\n * ```\n *\n * ## Features\n *\n * - **Selective Tool Approval**: Configure which tools require human approval\n * - **Multiple Decision Types**: Approve, edit, or reject tool calls\n * - **Asynchronous Workflow**: Uses LangGraph's interrupt mechanism for non-blocking approval\n * - **Custom Approval Messages**: Provide context-specific descriptions for approval requests\n *\n * ## Decision Types\n *\n * When a tool requires approval, the human operator can respond with:\n * - `approve`: Execute the tool with original arguments\n * - `edit`: Modify the tool name and/or arguments before execution\n * - `reject`: Provide a manual response instead of executing the tool\n *\n * @param options - Configuration options for the middleware\n * @param options.interruptOn - Per-tool configuration mapping tool names to their settings\n * @param options.interruptOn[toolName].allowedDecisions - Array of decision types allowed for this tool (e.g., [\"approve\", \"edit\", \"reject\"])\n * @param options.interruptOn[toolName].description - Custom approval message for the tool. Can be either a static string or a callable that dynamically generates the description based on agent state, runtime, and tool call information\n * @param options.interruptOn[toolName].argsSchema - JSON schema for the arguments associated with the action, if edits are allowed\n * @param options.descriptionPrefix - Default prefix for approval messages (default: \"Tool execution requires approval\"). Only used for tools that do not define a custom `description` in their InterruptOnConfig.\n *\n * @returns A middleware instance that can be passed to `createAgent`\n *\n * @example\n * Basic usage with selective tool approval\n * ```typescript\n * import { humanInTheLoopMiddleware } from \"langchain\";\n * import { createAgent } from \"langchain\";\n *\n * const hitlMiddleware = humanInTheLoopMiddleware({\n * interruptOn: {\n * // Interrupt write_file tool and allow edits or approvals\n * \"write_file\": {\n * allowedDecisions: [\"approve\", \"edit\"],\n * description: \"⚠️ File write operation requires approval\"\n * },\n * // Auto-approve read_file tool\n * \"read_file\": false\n * }\n * });\n *\n * const agent = createAgent({\n * model: \"openai:gpt-4\",\n * tools: [writeFileTool, readFileTool],\n * middleware: [hitlMiddleware]\n * });\n * ```\n *\n * @example\n * Handling approval requests\n * ```typescript\n * import { type HITLRequest, type HITLResponse, type Interrupt } from \"langchain\";\n * import { Command } from \"@langchain/langgraph\";\n *\n * // Initial agent invocation\n * const result = await agent.invoke({\n * messages: [new HumanMessage(\"Write 'Hello' to output.txt\")]\n * }, config);\n *\n * // Check if agent is paused for approval\n * if (result.__interrupt__) {\n * const interruptRequest = result.__interrupt__?.[0] as Interrupt<HITLRequest>;\n *\n * // Show tool call details to user\n * console.log(\"Actions:\", interruptRequest.value.actionRequests);\n * console.log(\"Review configs:\", interruptRequest.value.reviewConfigs);\n *\n * // Resume with approval\n * const resume: HITLResponse = {\n * decisions: [{ type: \"approve\" }]\n * };\n * await agent.invoke(\n * new Command({ resume }),\n * config\n * );\n * }\n * ```\n *\n * @example\n * Different decision types\n * ```typescript\n * import { type HITLResponse } from \"langchain\";\n *\n * // Approve the tool call as-is\n * const resume: HITLResponse = {\n * decisions: [{ type: \"approve\" }]\n * };\n *\n * // Edit the tool arguments\n * const resume: HITLResponse = {\n * decisions: [{\n * type: \"edit\",\n * editedAction: { name: \"write_file\", args: { filename: \"safe.txt\", content: \"Modified\" } }\n * }]\n * };\n *\n * // Reject with feedback\n * const resume: HITLResponse = {\n * decisions: [{\n * type: \"reject\",\n * message: \"File operation not allowed in demo mode\"\n * }]\n * };\n * ```\n *\n * @example\n * Production use case with database operations\n * ```typescript\n * const hitlMiddleware = humanInTheLoopMiddleware({\n * interruptOn: {\n * \"execute_sql\": {\n * allowedDecisions: [\"approve\", \"edit\", \"reject\"],\n * description: \"🚨 SQL query requires DBA approval\\nPlease review for safety and performance\"\n * },\n * \"read_schema\": false, // Reading metadata is safe\n * \"delete_records\": {\n * allowedDecisions: [\"approve\", \"reject\"],\n * description: \"⛔ DESTRUCTIVE OPERATION - Requires manager approval\"\n * }\n * },\n * descriptionPrefix: \"Database operation pending approval\"\n * });\n * ```\n *\n * @example\n * Using dynamic callable descriptions\n * ```typescript\n * import { type DescriptionFactory, type ToolCall } from \"langchain\";\n * import type { AgentBuiltInState, Runtime } from \"langchain/agents\";\n *\n * // Define a dynamic description factory\n * const formatToolDescription: DescriptionFactory = (\n * toolCall: ToolCall,\n * state: AgentBuiltInState,\n * runtime: Runtime<unknown>\n * ) => {\n * return `Tool: ${toolCall.name}\\nArguments:\\n${JSON.stringify(toolCall.args, null, 2)}`;\n * };\n *\n * const hitlMiddleware = humanInTheLoopMiddleware({\n * interruptOn: {\n * \"write_file\": {\n * allowedDecisions: [\"approve\", \"edit\"],\n * // Use dynamic description that can access tool call, state, and runtime\n * description: formatToolDescription\n * },\n * // Or use an inline function\n * \"send_email\": {\n * allowedDecisions: [\"approve\", \"reject\"],\n * description: (toolCall, state, runtime) => {\n * const { to, subject } = toolCall.args;\n * return `Email to ${to}\\nSubject: ${subject}\\n\\nRequires approval before sending`;\n * }\n * }\n * }\n * });\n * ```\n *\n * @remarks\n * - Tool calls are processed in the order they appear in the AI message\n * - Auto-approved tools execute immediately without interruption\n * - Multiple tools requiring approval are bundled into a single interrupt request\n * - The middleware operates in the `afterModel` phase, intercepting before tool execution\n * - Requires a checkpointer to maintain state across interruptions\n *\n * @see {@link createAgent} for agent creation\n * @see {@link Command} for resuming interrupted execution\n * @public\n */\nexport declare function humanInTheLoopMiddleware(options: NonNullable<HumanInTheLoopMiddlewareConfig>): import(\"./types.js\").AgentMiddleware<undefined, z.ZodObject<{\n /**\n * Mapping of tool name to allowed reviewer responses.\n * If a tool doesn't have an entry, it's auto-approved by default.\n *\n * - `true` -> pause for approval and allow approve/edit/reject decisions\n * - `false` -> auto-approve (no human review)\n * - `InterruptOnConfig` -> explicitly specify which decisions are allowed for this tool\n */\n interruptOn: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodObject<{\n /**\n * The decisions that are allowed for this action.\n */\n allowedDecisions: z.ZodArray<z.ZodEnum<[\"approve\", \"edit\", \"reject\"]>, \"many\">;\n /**\n * The description attached to the request for human input.\n * Can be either:\n * - A static string describing the approval request\n * - A callable that dynamically generates the description based on agent state,\n * runtime, and tool call information\n *\n * @example\n * Static string description\n * ```typescript\n * import type { InterruptOnConfig } from \"langchain\";\n *\n * const config: InterruptOnConfig = {\n * allowedDecisions: [\"approve\", \"reject\"],\n * description: \"Please review this tool execution\"\n * };\n * ```\n *\n * @example\n * Dynamic callable description\n * ```typescript\n * import type {\n * AgentBuiltInState,\n * Runtime,\n * DescriptionFactory,\n * ToolCall,\n * InterruptOnConfig\n * } from \"langchain\";\n *\n * const formatToolDescription: DescriptionFactory = (\n * toolCall: ToolCall,\n * state: AgentBuiltInState,\n * runtime: Runtime<unknown>\n * ) => {\n * return `Tool: ${toolCall.name}\\nArguments:\\n${JSON.stringify(toolCall.args, null, 2)}`;\n * };\n *\n * const config: InterruptOnConfig = {\n * allowedDecisions: [\"approve\", \"edit\"],\n * description: formatToolDescription\n * };\n * ```\n */\n description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<ToolCall<string, Record<string, any>>, z.ZodTypeDef, ToolCall<string, Record<string, any>>>, z.ZodType<AgentBuiltInState, z.ZodTypeDef, AgentBuiltInState>, z.ZodType<Runtime<unknown>, z.ZodTypeDef, Runtime<unknown>>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;\n /**\n * JSON schema for the arguments associated with the action, if edits are allowed.\n */\n argsSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;\n }, \"strip\", z.ZodTypeAny, {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n }, {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n }>]>>>;\n /**\n * Prefix used when constructing human-facing approval messages.\n * Provides context about the tool call being reviewed; does not change the underlying action.\n *\n * Note: This prefix is only applied for tools that do not provide a custom\n * `description` via their {@link InterruptOnConfig}. If a tool specifies a custom\n * `description`, that per-tool text is used and this prefix is ignored.\n */\n descriptionPrefix: z.ZodDefault<z.ZodString>;\n}, \"strip\", z.ZodTypeAny, {\n interruptOn?: Record<string, boolean | {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n }> | undefined;\n descriptionPrefix: string;\n}, {\n interruptOn?: Record<string, boolean | {\n allowedDecisions: (\"approve\" | \"edit\" | \"reject\")[];\n description?: string | ((args_0: ToolCall<string, Record<string, any>>, args_1: AgentBuiltInState, args_2: Runtime<unknown>, ...args: unknown[]) => string | Promise<string>) | undefined;\n argsSchema?: Record<string, any> | undefined;\n }> | undefined;\n descriptionPrefix?: string | undefined;\n}>, any>;\nexport {};\n//# sourceMappingURL=hitl.d.ts.map"],"mappings":";;;;;;;cAIcK,2BAA2BL,CAAAA,CAAEc,YAAYd,CAAAA,CAAEU,UAAUV,CAAAA,CAAEQ,QAAQP,iBAAiBK,sBAAsBN,CAAAA,CAAEO,YAAYN,iBAAiBK,uBAAuBN,CAAAA,CAAEQ,QAAQL,mBAAmBH,CAAAA,CAAEO,YAAYJ,oBAAoBH,CAAAA,CAAEQ,QAAQJ,kBAAkBJ,CAAAA,CAAEO,YAAYH,oBAAoBJ,CAAAA,CAAES,aAAaT,CAAAA,CAAEa,UAAUb,CAAAA,CAAEW,WAAWX,CAAAA,CAAEY,WAAWZ,CAAAA,CAAEW;;;AAD9R;;;;;;;;;;;;;;;AACyOF,KAkB7RM,kBAAAA,GAAqBf,CAAAA,CAAEgB,KAlBsQP,CAAAA,OAkBzPJ,yBAlByPI,CAAAA;cAmB3RQ,YAnB2CP,EAmB7BV,CAAAA,CAAEkB,OAnB2BR,CAAAA,CAAAA,SAAAA,EAAAA,MAAAA,EAAAA,QAAAA,CAAAA,CAAAA;AAA2QC,KAoBxTM,YAAAA,GAAejB,CAAAA,CAAEgB,KApBuSL,CAAAA,OA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