deepagents 1.9.1 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as _langchain from "langchain";
2
- import { AgentMiddleware, AgentMiddleware as AgentMiddleware$1, AgentTypeConfig, CreateAgentParams, HumanMessage, InferMiddlewareStates, InterruptOnConfig, ProviderStrategy, ReactAgent, ResponseFormat, ResponseFormatUndefined, Runtime, StructuredTool, SystemMessage, ToolMessage, ToolRuntime, ToolStrategy } from "langchain";
2
+ import { AgentMiddleware, AgentMiddleware as AgentMiddleware$1, AgentRunStream, AgentTypeConfig, CreateAgentParams, HumanMessage, InferMiddlewareStates, InterruptOnConfig, ProviderStrategy, ReactAgent, ResponseFormat, ResponseFormatUndefined, Runtime, StructuredTool, SystemMessage, ToolCallStreamUnion, ToolMessage, ToolRuntime, ToolStrategy } from "langchain";
3
3
  import * as _langgraph from "@langchain/langgraph";
4
- import { AnnotationRoot, Command, ReducedValue, StateSchema } from "@langchain/langgraph";
4
+ import { AnnotationRoot, ChatModelStream, Command, Namespace, NativeStreamTransformer, ReducedValue, StateSchema, StreamTransformer } from "@langchain/langgraph";
5
5
  import { z } from "zod/v4";
6
6
  import * as _messages from "@langchain/core/messages";
7
7
  import * as z$2 from "zod";
8
8
  import { z as z$1 } from "zod";
9
9
  import { Client } from "@langchain/langgraph-sdk";
10
- import { CreateSandboxOptions, Sandbox } from "langsmith/experimental/sandbox";
10
+ import { CaptureSnapshotOptions, CaptureSnapshotOptions as LangSmithCaptureSnapshotOptions, CreateSandboxOptions, Sandbox, Snapshot, Snapshot as LangSmithSnapshot, StartSandboxOptions, StartSandboxOptions as LangSmithStartSandboxOptions } from "langsmith/experimental/sandbox";
11
11
  import * as _$zod_v30 from "zod/v3";
12
12
  import { BaseCheckpointSaver, BaseStore } from "@langchain/langgraph-checkpoint";
13
13
  import * as _$zod_v4_core0 from "zod/v4/core";
@@ -711,6 +711,35 @@ interface FilesystemPermission {
711
711
  }
712
712
  //#endregion
713
713
  //#region src/middleware/fs.d.ts
714
+ /**
715
+ * Tools that should be excluded from the large result eviction logic.
716
+ *
717
+ * This array contains tools that should NOT have their results evicted to the filesystem
718
+ * when they exceed token limits. Tools are excluded for different reasons:
719
+ *
720
+ * 1. Tools with built-in truncation (ls, glob, grep):
721
+ * These tools truncate their own output when it becomes too large. When these tools
722
+ * produce truncated output due to many matches, it typically indicates the query
723
+ * needs refinement rather than full result preservation. In such cases, the truncated
724
+ * matches are potentially more like noise and the LLM should be prompted to narrow
725
+ * its search criteria instead.
726
+ *
727
+ * 2. Tools with problematic truncation behavior (read_file):
728
+ * read_file is tricky to handle as the failure mode here is single long lines
729
+ * (e.g., imagine a jsonl file with very long payloads on each line). If we try to
730
+ * truncate the result of read_file, the agent may then attempt to re-read the
731
+ * truncated file using read_file again, which won't help.
732
+ *
733
+ * 3. Tools that never exceed limits (edit_file, write_file):
734
+ * These tools return minimal confirmation messages and are never expected to produce
735
+ * output large enough to exceed token limits, so checking them would be unnecessary.
736
+ */
737
+ /**
738
+ * All tool names registered by FilesystemMiddleware.
739
+ * This is the single source of truth — used by createDeepAgent to detect
740
+ * collisions with user-supplied tools at construction time.
741
+ */
742
+ declare const FILESYSTEM_TOOL_NAMES: readonly ["ls", "read_file", "write_file", "edit_file", "glob", "grep", "execute"];
714
743
  /**
715
744
  * Type for the files state record.
716
745
  */
@@ -1676,10 +1705,17 @@ interface LangSmithSandboxOptions {
1676
1705
  defaultTimeout?: number;
1677
1706
  }
1678
1707
  /** Options for the `LangSmithSandbox.create()` static factory. */
1679
- interface LangSmithSandboxCreateOptions extends Omit<CreateSandboxOptions, "name" | "timeout" | "waitForReady"> {
1708
+ interface LangSmithSandboxCreateOptions extends Omit<CreateSandboxOptions, "name" | "timeout" | "waitForReady" | "snapshotName"> {
1709
+ /**
1710
+ * Snapshot ID to boot from.
1711
+ * Mutually exclusive with `templateName`.
1712
+ */
1713
+ snapshotId?: string;
1680
1714
  /**
1681
1715
  * Name of the LangSmith sandbox template to use.
1682
- * @default "deepagents"
1716
+ * Mutually exclusive with `snapshotId`.
1717
+ * @deprecated Use `snapshotId` instead. Template-based creation will be
1718
+ * removed in a future release.
1683
1719
  */
1684
1720
  templateName?: string;
1685
1721
  /**
@@ -1738,6 +1774,33 @@ declare class LangSmithSandbox extends BaseSandbox {
1738
1774
  * cannot be used again.
1739
1775
  */
1740
1776
  close(): Promise<void>;
1777
+ /**
1778
+ * Start a stopped sandbox and wait until it is ready.
1779
+ *
1780
+ * After calling this, `isRunning` will be `true` and the sandbox
1781
+ * can be used for command execution and file operations again.
1782
+ *
1783
+ * @param options - Start options (timeout, signal).
1784
+ */
1785
+ start(options?: StartSandboxOptions): Promise<void>;
1786
+ /**
1787
+ * Stop the sandbox without deleting it.
1788
+ *
1789
+ * Sandbox files are preserved and the sandbox can be restarted later
1790
+ * with `start()`. After calling this, `isRunning` will be `false`.
1791
+ */
1792
+ stop(): Promise<void>;
1793
+ /**
1794
+ * Capture a snapshot from this running sandbox.
1795
+ *
1796
+ * Snapshots can be used to create new sandboxes via
1797
+ * `LangSmithSandbox.create({ snapshotId })`.
1798
+ *
1799
+ * @param name - Name for the snapshot.
1800
+ * @param options - Capture options (checkpoint, timeout).
1801
+ * @returns The created Snapshot in "ready" status.
1802
+ */
1803
+ captureSnapshot(name: string, options?: CaptureSnapshotOptions): Promise<Snapshot>;
1741
1804
  /**
1742
1805
  * Create and return a new LangSmithSandbox in one step.
1743
1806
  *
@@ -1746,7 +1809,10 @@ declare class LangSmithSandbox extends BaseSandbox {
1746
1809
  *
1747
1810
  * @example
1748
1811
  * ```typescript
1749
- * const sandbox = await LangSmithSandbox.create({ templateName: "deepagents" });
1812
+ * const sandbox = await LangSmithSandbox.create({
1813
+ * snapshotId: "abc-123",
1814
+ * });
1815
+ *
1750
1816
  * try {
1751
1817
  * const agent = createDeepAgent({ model, backend: sandbox });
1752
1818
  * await agent.invoke({ messages: [...] });
@@ -1755,7 +1821,7 @@ declare class LangSmithSandbox extends BaseSandbox {
1755
1821
  * }
1756
1822
  * ```
1757
1823
  */
1758
- static create(options?: LangSmithSandboxCreateOptions): Promise<LangSmithSandbox>;
1824
+ static create(options: LangSmithSandboxCreateOptions): Promise<LangSmithSandbox>;
1759
1825
  }
1760
1826
  //#endregion
1761
1827
  //#region src/backends/utils.d.ts
@@ -2475,6 +2541,19 @@ interface AsyncTask {
2475
2541
  /** ISO timestamp of the most recent status poll via the check tool. */
2476
2542
  checkedAt?: string;
2477
2543
  }
2544
+ /**
2545
+ * Task statuses that will never change.
2546
+ *
2547
+ * When listing tasks, live-status fetches are skipped for tasks whose
2548
+ * cached status is in this set, since they are guaranteed to be final.
2549
+ */
2550
+ /**
2551
+ * Names of the tools added by the async subagent middleware.
2552
+ *
2553
+ * Exported so `agent.ts` can include them in `BUILTIN_TOOL_NAMES` and
2554
+ * surface a `ConfigurationError` if a user-provided tool collides.
2555
+ */
2556
+ declare const ASYNC_TASK_TOOL_NAMES: readonly ["start_async_task", "check_async_task", "update_async_task", "cancel_async_task", "list_async_tasks"];
2478
2557
  /**
2479
2558
  * Options for creating async subagent middleware.
2480
2559
  */
@@ -2576,8 +2655,100 @@ declare function createAsyncSubAgentMiddleware(options: AsyncSubAgentMiddlewareO
2576
2655
  statusFilter?: string | null | undefined;
2577
2656
  }, string | Command<unknown, Record<string, unknown>, string>, unknown, "list_async_tasks">)[]>;
2578
2657
  //#endregion
2658
+ //#region src/stream.d.ts
2659
+ /**
2660
+ * Represents a single subagent invocation observed during a deep agent run.
2661
+ *
2662
+ * @typeParam TOutput - The subagent's output state type. Defaults to
2663
+ * `unknown`; inferred to the subagent's `MergedAgentState` for
2664
+ * `CompiledSubAgent` via {@link SubagentRunStreamUnion}.
2665
+ */
2666
+ interface SubagentRunStream<TOutput = unknown, TTools extends readonly (ClientTool | ServerTool)[] = readonly (ClientTool | ServerTool)[]> {
2667
+ readonly name: string;
2668
+ readonly taskInput: Promise<string>;
2669
+ readonly output: Promise<TOutput>;
2670
+ readonly messages: AsyncIterable<ChatModelStream>;
2671
+ readonly toolCalls: AsyncIterable<ToolCallStreamUnion<TTools>>;
2672
+ readonly subagents: AsyncIterable<SubagentRunStream>;
2673
+ }
2674
+ /**
2675
+ * Extract the output state type from a subagent spec.
2676
+ * For `CompiledSubAgent<ReactAgent<Types>>`, resolves to the agent's
2677
+ * invoke return type. Falls back to `unknown` for `SubAgent` and
2678
+ * `AsyncSubAgent`.
2679
+ */
2680
+ type SubagentOutputOf<T extends AnySubAgent> = T extends CompiledSubAgent<infer R> ? R extends ReactAgent<infer Types> ? Awaited<ReturnType<ReactAgent<Types>["invoke"]>> : unknown : unknown;
2681
+ /**
2682
+ * Extract the tools tuple from a subagent spec.
2683
+ * For `CompiledSubAgent<ReactAgent<Types>>`, resolves to `Types["Tools"]`.
2684
+ * Falls back to the default `(ClientTool | ServerTool)[]` for `SubAgent`
2685
+ * and `AsyncSubAgent`.
2686
+ */
2687
+ type SubagentToolsOf<T extends AnySubAgent> = T extends CompiledSubAgent<infer R> ? R extends ReactAgent<infer Types> ? Types["Tools"] : readonly (ClientTool | ServerTool)[] : readonly (ClientTool | ServerTool)[];
2688
+ /**
2689
+ * A typed `SubagentRunStream` variant for a single subagent spec.
2690
+ * Narrows `.name` to the literal string type, `.output` to the
2691
+ * inferred state type, and `.toolCalls` to the subagent's tools
2692
+ * when available.
2693
+ */
2694
+ type NamedSubagentRunStream<T extends AnySubAgent> = T extends {
2695
+ name: infer N extends string;
2696
+ } ? SubagentRunStream<SubagentOutputOf<T>, SubagentToolsOf<T>> & {
2697
+ readonly name: N;
2698
+ } : SubagentRunStream;
2699
+ /**
2700
+ * Discriminated union of {@link SubagentRunStream} variants, one per
2701
+ * subagent in `TSubagents`. Enables TypeScript to narrow `.output`
2702
+ * when the consumer checks `sub.name === "someSubagentName"`.
2703
+ */
2704
+ type SubagentRunStreamUnion<TSubagents extends readonly AnySubAgent[]> = { [K in keyof TSubagents]: NamedSubagentRunStream<TSubagents[K]> }[number];
2705
+ /**
2706
+ * An {@link AgentRunStream} with native deep-agent projections assigned
2707
+ * directly on the instance by `createGraphRunStream` (via `__native`
2708
+ * transformers).
2709
+ *
2710
+ * This is a pure type overlay — no runtime class exists. The
2711
+ * `subagents` property is populated at runtime by the
2712
+ * `createSubagentTransformer` registered at compile time.
2713
+ */
2714
+ type DeepAgentRunStream<TValues = Record<string, unknown>, TTools extends readonly (ClientTool | ServerTool)[] = readonly (ClientTool | ServerTool)[], TSubagents extends readonly AnySubAgent[] = readonly AnySubAgent[], TExtensions extends Record<string, unknown> = Record<string, unknown>> = AgentRunStream<TValues, TTools, TExtensions> & {
2715
+ /** Subagent invocation streams from the native SubagentTransformer. */subagents: AsyncIterable<SubagentRunStreamUnion<TSubagents>>;
2716
+ };
2717
+ interface SubagentProjection {
2718
+ subagents: AsyncIterable<SubagentRunStream>;
2719
+ }
2720
+ /**
2721
+ * Native transformer that correlates `task` tool calls into
2722
+ * {@link SubagentRunStream} objects and routes child-namespace
2723
+ * `tools` and `messages` events into per-subagent channels.
2724
+ *
2725
+ * Marked `__native: true` — the `subagents` projection key lands
2726
+ * directly on the `GraphRunStream` instance as `run.subagents`.
2727
+ */
2728
+ declare function createSubagentTransformer(path: Namespace): () => NativeStreamTransformer<SubagentProjection>;
2729
+ //#endregion
2579
2730
  //#region src/types.d.ts
2580
2731
  type AnyAnnotationRoot = AnnotationRoot<any>;
2732
+ /**
2733
+ * Literal union of all built-in deep agent tool names.
2734
+ * These are always present on the agent regardless of user-provided tools.
2735
+ */
2736
+ type DeepAgentBuiltinToolName = (typeof FILESYSTEM_TOOL_NAMES)[number] | (typeof ASYNC_TASK_TOOL_NAMES)[number] | "task" | "write_todos";
2737
+ /**
2738
+ * A placeholder StructuredTool type with a literal `name` for each
2739
+ * built-in tool. Used to thread built-in tool names into the
2740
+ * `ToolCallStreamUnion` so they appear in `run.toolCalls` alongside
2741
+ * user-provided tools.
2742
+ */
2743
+ type BuiltinToolPlaceholder<N extends string> = {
2744
+ name: N;
2745
+ } & StructuredTool$1;
2746
+ /**
2747
+ * Tuple of placeholder tool types for all built-in deep agent tools.
2748
+ * Combined with `TTypes["Tools"]` in the `DeepAgentRunStream` return type.
2749
+ */
2750
+ type DeepAgentBuiltinToolsTuple = { [K in DeepAgentBuiltinToolName]: BuiltinToolPlaceholder<K> }[DeepAgentBuiltinToolName][];
2751
+ type InferDeepAgentStreamExtensions<T extends ReadonlyArray<() => StreamTransformer<any>>> = T extends readonly [] ? Record<string, never> : T extends readonly [() => StreamTransformer<infer P>, ...infer Rest extends ReadonlyArray<() => StreamTransformer<any>>] ? P & InferDeepAgentStreamExtensions<Rest> : Record<string, unknown>;
2581
2752
  /** Any subagent specification — sync, compiled, or async. */
2582
2753
  type AnySubAgent = SubAgent | CompiledSubAgent | AsyncSubAgent;
2583
2754
  interface TypedToolStrategy<T = unknown> extends Array<ToolStrategy<any>> {
@@ -2658,7 +2829,7 @@ type InferStructuredResponse<T extends SupportedResponseFormat> = SupportedRespo
2658
2829
  * type Types = InferDeepAgentType<typeof agent, "Subagents">;
2659
2830
  * ```
2660
2831
  */
2661
- interface DeepAgentTypeConfig<TResponse extends Record<string, any> | ResponseFormatUndefined = Record<string, any> | ResponseFormatUndefined, TState extends AnyAnnotationRoot | InteropZodObject | undefined = AnyAnnotationRoot | InteropZodObject | undefined, TContext extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot | InteropZodObject, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[], TTools extends readonly (ClientTool | ServerTool)[] = readonly (ClientTool | ServerTool)[], TSubagents extends readonly AnySubAgent[] = readonly AnySubAgent[]> extends AgentTypeConfig<TResponse, TState, TContext, TMiddleware, TTools> {
2832
+ interface DeepAgentTypeConfig<TResponse extends Record<string, any> | ResponseFormatUndefined = Record<string, any> | ResponseFormatUndefined, TState extends AnyAnnotationRoot | InteropZodObject | undefined = AnyAnnotationRoot | InteropZodObject | undefined, TContext extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot | InteropZodObject, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[], TTools extends readonly (ClientTool | ServerTool)[] = readonly (ClientTool | ServerTool)[], TSubagents extends readonly AnySubAgent[] = readonly AnySubAgent[], TStreamTransformers extends ReadonlyArray<() => StreamTransformer<any>> = ReadonlyArray<() => StreamTransformer<any>>> extends AgentTypeConfig<TResponse, TState, TContext, TMiddleware, TTools, TStreamTransformers> {
2662
2833
  /** The subagents array type for type-safe streaming */
2663
2834
  Subagents: TSubagents;
2664
2835
  }
@@ -2673,6 +2844,7 @@ interface DefaultDeepAgentTypeConfig extends DeepAgentTypeConfig {
2673
2844
  Middleware: readonly AgentMiddleware[];
2674
2845
  Tools: readonly (ClientTool | ServerTool)[];
2675
2846
  Subagents: readonly AnySubAgent[];
2847
+ StreamTransformers: readonly [];
2676
2848
  }
2677
2849
  /**
2678
2850
  * DeepAgent extends ReactAgent with additional subagent type information.
@@ -2690,9 +2862,86 @@ interface DefaultDeepAgentTypeConfig extends DeepAgentTypeConfig {
2690
2862
  * type Subagents = InferDeepAgentSubagents<typeof agent>;
2691
2863
  * ```
2692
2864
  */
2693
- type DeepAgent<TTypes extends DeepAgentTypeConfig = DeepAgentTypeConfig> = ReactAgent<TTypes> & {
2694
- /** Type brand for DeepAgent type inference */readonly "~deepAgentTypes": TTypes;
2695
- };
2865
+ interface DeepAgent<TTypes extends DeepAgentTypeConfig = DeepAgentTypeConfig> extends ReactAgent<TTypes> {
2866
+ /** Type brand for DeepAgent type inference */
2867
+ readonly "~deepAgentTypes": TTypes;
2868
+ /**
2869
+ * Executes the agent with the v3 streaming interface, returning an
2870
+ * {@link DeepAgentRunStream} that provides ergonomic, typed projections for
2871
+ * messages, tool calls, subagents, and middleware events.
2872
+ *
2873
+ * Pass `version: "v3"` to opt into this projection-oriented stream. Omitting
2874
+ * `version` preserves the legacy internal LangGraph event-stream behavior
2875
+ * for compatibility with LangGraph Platform integrations.
2876
+ *
2877
+ * This v3 stream is experimental and its API may change in future releases.
2878
+ * It will become the default in a future major release.
2879
+ *
2880
+ * @param state - The initial state for the agent execution. Can be:
2881
+ * - An object containing `messages` array and any middleware-specific state properties
2882
+ * - A Command object for more advanced control flow
2883
+ *
2884
+ * @param config - Runtime configuration including:
2885
+ * @param config.version - Must be `"v3"` to use the {@link DeepAgentRunStream}
2886
+ * interface. The default legacy event stream is maintained for internal
2887
+ * integrations and should not be used for new user-facing agent streaming.
2888
+ * @param config.context - The context for the agent execution.
2889
+ * @param config.configurable - LangGraph configuration options like `thread_id`, `run_id`, etc.
2890
+ * @param config.store - The store for the agent execution for persisting state.
2891
+ * @param config.signal - An optional AbortSignal for the agent execution.
2892
+ * @param config.recursionLimit - The recursion limit for the agent execution.
2893
+ *
2894
+ * @returns A Promise that resolves to an {@link DeepAgentRunStream} providing:
2895
+ * - `run.messages` — all AI message lifecycles with streaming `.text` and `.reasoning`
2896
+ * - `run.toolCalls` — individual tool call streams with `.input`, `.output`, `.status`
2897
+ * - `run.subagents` — subagent delegation streams
2898
+ * - `run.middleware` — middleware lifecycle events (before/after agent/model)
2899
+ * - `run.values` — state snapshots (async iterable + promise-like)
2900
+ * - `run.output` — final agent state when the run completes
2901
+ * - `run.subgraphs` — child subgraph run streams
2902
+ * - `run.extensions` — merged projections from user-supplied transformers
2903
+ *
2904
+ * @example
2905
+ * ```typescript
2906
+ * const run = await agent.streamEvents(
2907
+ * {
2908
+ * messages: [{ role: "user", content: "What's the weather in Paris?" }],
2909
+ * },
2910
+ * { version: "v3" }
2911
+ * );
2912
+ *
2913
+ * // Stream all messages
2914
+ * for await (const msg of run.messages) {
2915
+ * for await (const token of msg.text) {
2916
+ * process.stdout.write(token);
2917
+ * }
2918
+ * }
2919
+ *
2920
+ * // Observe tool calls
2921
+ * for await (const call of run.toolCalls) {
2922
+ * console.log(`Tool: ${call.name}`, call.input);
2923
+ * console.log(`Result:`, await call.output);
2924
+ * }
2925
+ *
2926
+ * // Observe subagent delegations
2927
+ * for await (const subagent of run.subagents) {
2928
+ * console.log(`Subagent: ${subagent.name}`);
2929
+ *
2930
+ * for await (const msg of subagent.messages) {
2931
+ * for await (const token of msg.text) {
2932
+ * process.stdout.write(token);
2933
+ * }
2934
+ * }
2935
+ * }
2936
+ *
2937
+ * // Get final state
2938
+ * const state = await run.output;
2939
+ * ```
2940
+ */
2941
+ streamEvents: ((state: Parameters<ReactAgent<TTypes>["invoke"]>[0], config: NonNullable<Parameters<ReactAgent<TTypes>["invoke"]>[1]> & {
2942
+ version: "v3";
2943
+ }) => Promise<DeepAgentRunStream<Awaited<ReturnType<ReactAgent<TTypes>["invoke"]>>, readonly [...TTypes["Tools"], ...DeepAgentBuiltinToolsTuple], TTypes["Subagents"], InferDeepAgentStreamExtensions<TTypes["StreamTransformers"]>>>) & ReactAgent<TTypes>["streamEvents"];
2944
+ }
2696
2945
  /**
2697
2946
  * Helper type to resolve a DeepAgentTypeConfig from either:
2698
2947
  * - A DeepAgentTypeConfig directly
@@ -2772,8 +3021,9 @@ type InferSubagentReactAgentType<TSubagent extends SubAgent | CompiledSubAgent>
2772
3021
  * @typeParam TMiddleware - The middleware array type for proper type inference
2773
3022
  * @typeParam TSubagents - The subagents array type for extracting subagent middleware states
2774
3023
  * @typeParam TTools - The tools array type
3024
+ * @typeParam TStreamTransformers - Custom stream transformer factories
2775
3025
  */
2776
- interface CreateDeepAgentParams<TResponse extends SupportedResponseFormat = SupportedResponseFormat, ContextSchema extends AnnotationRoot<any> | InteropZodObject = AnnotationRoot<any>, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[], TSubagents extends readonly AnySubAgent[] = readonly AnySubAgent[], TTools extends readonly (ClientTool | ServerTool)[] = readonly (ClientTool | ServerTool)[]> {
3026
+ interface CreateDeepAgentParams<TResponse extends SupportedResponseFormat = SupportedResponseFormat, ContextSchema extends AnnotationRoot<any> | InteropZodObject = AnnotationRoot<any>, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[], TSubagents extends readonly AnySubAgent[] = readonly AnySubAgent[], TTools extends readonly (ClientTool | ServerTool)[] = readonly (ClientTool | ServerTool)[], TStreamTransformers extends ReadonlyArray<() => StreamTransformer<any>> = readonly []> {
2777
3027
  /** The model to use (model name string or LanguageModelLike instance). Defaults to claude-sonnet-4-5-20250929 */
2778
3028
  model?: BaseLanguageModel | string;
2779
3029
  /** Tools the agent should have access to */
@@ -2868,6 +3118,14 @@ interface CreateDeepAgentParams<TResponse extends SupportedResponseFormat = Supp
2868
3118
  * ```
2869
3119
  */
2870
3120
  permissions?: FilesystemPermission[];
3121
+ /**
3122
+ * Optional {@link StreamTransformer} factories to register with the underlying agent.
3123
+ *
3124
+ * Deepagents always registers its built-in subagent transformer; custom
3125
+ * transformers are appended after it and are exposed on `run.extensions`
3126
+ * when using `streamEvents(..., { version: "v3" })`.
3127
+ */
3128
+ streamTransformers?: TStreamTransformers;
2871
3129
  }
2872
3130
  //#endregion
2873
3131
  //#region src/agent.d.ts
@@ -2901,7 +3159,7 @@ interface CreateDeepAgentParams<TResponse extends SupportedResponseFormat = Supp
2901
3159
  * // result.research is properly typed as string
2902
3160
  * ```
2903
3161
  */
2904
- declare function createDeepAgent<TResponse extends SupportedResponseFormat = SupportedResponseFormat, ContextSchema extends InteropZodObject = InteropZodObject, const TMiddleware extends readonly AgentMiddleware[] = readonly [], const TSubagents extends readonly AnySubAgent[] = readonly [], const TTools extends readonly (ClientTool | ServerTool)[] = readonly []>(params?: CreateDeepAgentParams<TResponse, ContextSchema, TMiddleware, TSubagents, TTools>): DeepAgent<DeepAgentTypeConfig<InferStructuredResponse<TResponse>, undefined, ContextSchema, readonly [AgentMiddleware<_$zod_v30.ZodObject<{
3162
+ declare function createDeepAgent<TResponse extends SupportedResponseFormat = SupportedResponseFormat, ContextSchema extends InteropZodObject = InteropZodObject, const TMiddleware extends readonly AgentMiddleware[] = readonly [], const TSubagents extends readonly AnySubAgent[] = readonly [], const TTools extends readonly (ClientTool | ServerTool)[] = readonly [], const TStreamTransformers extends ReadonlyArray<() => StreamTransformer<any>> = readonly []>(params?: CreateDeepAgentParams<TResponse, ContextSchema, TMiddleware, TSubagents, TTools, TStreamTransformers>): DeepAgent<DeepAgentTypeConfig<InferStructuredResponse<TResponse>, undefined, ContextSchema, readonly [AgentMiddleware<_$zod_v30.ZodObject<{
2905
3163
  todos: _$zod_v30.ZodDefault<_$zod_v30.ZodArray<_$zod_v30.ZodObject<{
2906
3164
  content: _$zod_v30.ZodString;
2907
3165
  status: _$zod_v30.ZodEnum<["pending", "in_progress", "completed"]>;
@@ -3059,7 +3317,7 @@ declare function createDeepAgent<TResponse extends SupportedResponseFormat = Sup
3059
3317
  summaryMessage: z$2.ZodCustom<_messages.HumanMessage<_messages.MessageStructure<_messages.MessageToolSet>>, _messages.HumanMessage<_messages.MessageStructure<_messages.MessageToolSet>>>;
3060
3318
  filePath: z$2.ZodNullable<z$2.ZodString>;
3061
3319
  }, _$zod_v4_core0.$strip>>;
3062
- }, _$zod_v4_core0.$strip>, undefined, unknown, readonly (ClientTool | ServerTool)[]>, AgentMiddleware<undefined, undefined, unknown, readonly (ClientTool | ServerTool)[]>, ...TMiddleware, ...FlattenSubAgentMiddleware<TSubagents>], TTools, TSubagents>>;
3320
+ }, _$zod_v4_core0.$strip>, undefined, unknown, readonly (ClientTool | ServerTool)[]>, AgentMiddleware<undefined, undefined, unknown, readonly (ClientTool | ServerTool)[]>, ...TMiddleware, ...FlattenSubAgentMiddleware<TSubagents>], TTools, TSubagents, TStreamTransformers>>;
3063
3321
  //#endregion
3064
3322
  //#region src/errors.d.ts
3065
3323
  /**
@@ -3306,5 +3564,5 @@ declare function parseSkillMetadata(skillMdPath: string, source: "user" | "proje
3306
3564
  */
3307
3565
  declare function listSkills(options: ListSkillsOptions): SkillMetadata[];
3308
3566
  //#endregion
3309
- export { type AgentMemoryMiddlewareOptions, type AnyBackendProtocol, type AnySubAgent, type AsyncSubAgent, type AsyncSubAgentMiddlewareOptions, type AsyncTask, type AsyncTaskStatus, type BackendFactory, type BackendProtocol, type BackendProtocolV1, type BackendProtocolV2, type BackendRuntime, BaseSandbox, type CompiledSubAgent, type CompletionCallbackOptions, CompositeBackend, ConfigurationError, type ConfigurationErrorCode, type CreateDeepAgentParams, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, type DeepAgent, type DeepAgentTypeConfig, type DefaultDeepAgentTypeConfig, type EditResult, type ExecuteResponse, type ExtractSubAgentMiddleware, type FileData, type FileDownloadResponse, type FileInfo, type FileOperationError, type FileUploadResponse, FilesystemBackend, type FilesystemMiddlewareOptions, type FilesystemOperation, type FilesystemPermission, type FlattenSubAgentMiddleware, GENERAL_PURPOSE_SUBAGENT, type GlobResult, type GrepMatch, type GrepResult, type InferDeepAgentSubagents, type InferDeepAgentType, type InferStructuredResponse, type InferSubAgentMiddlewareStates, type InferSubagentByName, type InferSubagentReactAgentType, LangSmithSandbox, type LangSmithSandboxOptions, type ListSkillsOptions, type SkillMetadata as LoaderSkillMetadata, LocalShellBackend, type LocalShellBackendOptions, type LsResult, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, type MaybePromise, type MemoryMiddlewareOptions, type MergedDeepAgentState, type PermissionMode, type ReadRawResult, type ReadResult, type ResolveDeepAgentTypeConfig, type SandboxBackendProtocol, type SandboxBackendProtocolV1, type SandboxBackendProtocolV2, type SandboxDeleteOptions, SandboxError, type SandboxErrorCode, type SandboxGetOrCreateOptions, type SandboxInfo, type SandboxListOptions, type SandboxListResponse, type Settings, type SettingsOptions, type SkillMetadata$1 as SkillMetadata, type SkillsMiddlewareOptions, type StateAndStore, StateBackend, StoreBackend, type StoreBackendContext, type StoreBackendNamespaceFactory, type StoreBackendOptions, type SubAgent, type SubAgentMiddlewareOptions, type SupportedResponseFormat, TASK_SYSTEM_PROMPT, type WriteResult, adaptBackendProtocol, adaptSandboxProtocol, computeSummarizationDefaults, createAgentMemoryMiddleware, createAsyncSubAgentMiddleware, createCompletionCallbackMiddleware, createDeepAgent, createFilesystemMiddleware, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgentMiddleware, createSummarizationMiddleware, filesValue, findProjectRoot, isAsyncSubAgent, isSandboxBackend, isSandboxProtocol, listSkills, parseSkillMetadata, resolveBackend };
3567
+ export { type AgentMemoryMiddlewareOptions, type AnyBackendProtocol, type AnySubAgent, type AsyncSubAgent, type AsyncSubAgentMiddlewareOptions, type AsyncTask, type AsyncTaskStatus, type BackendFactory, type BackendProtocol, type BackendProtocolV1, type BackendProtocolV2, type BackendRuntime, BaseSandbox, type CompiledSubAgent, type CompletionCallbackOptions, CompositeBackend, ConfigurationError, type ConfigurationErrorCode, type CreateDeepAgentParams, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, type DeepAgent, type DeepAgentRunStream, type DeepAgentTypeConfig, type DefaultDeepAgentTypeConfig, type EditResult, type ExecuteResponse, type ExtractSubAgentMiddleware, type FileData, type FileDownloadResponse, type FileInfo, type FileOperationError, type FileUploadResponse, FilesystemBackend, type FilesystemMiddlewareOptions, type FilesystemOperation, type FilesystemPermission, type FlattenSubAgentMiddleware, GENERAL_PURPOSE_SUBAGENT, type GlobResult, type GrepMatch, type GrepResult, type InferDeepAgentSubagents, type InferDeepAgentType, type InferStructuredResponse, type InferSubAgentMiddlewareStates, type InferSubagentByName, type InferSubagentReactAgentType, type LangSmithCaptureSnapshotOptions, LangSmithSandbox, type LangSmithSandboxCreateOptions, type LangSmithSandboxOptions, type LangSmithSnapshot, type LangSmithStartSandboxOptions, type ListSkillsOptions, type SkillMetadata as LoaderSkillMetadata, LocalShellBackend, type LocalShellBackendOptions, type LsResult, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, type MaybePromise, type MemoryMiddlewareOptions, type MergedDeepAgentState, type PermissionMode, type ReadRawResult, type ReadResult, type ResolveDeepAgentTypeConfig, type SandboxBackendProtocol, type SandboxBackendProtocolV1, type SandboxBackendProtocolV2, type SandboxDeleteOptions, SandboxError, type SandboxErrorCode, type SandboxGetOrCreateOptions, type SandboxInfo, type SandboxListOptions, type SandboxListResponse, type Settings, type SettingsOptions, type SkillMetadata$1 as SkillMetadata, type SkillsMiddlewareOptions, type StateAndStore, StateBackend, StoreBackend, type StoreBackendContext, type StoreBackendNamespaceFactory, type StoreBackendOptions, type SubAgent, type SubAgentMiddlewareOptions, type SubagentRunStream, type SupportedResponseFormat, TASK_SYSTEM_PROMPT, type WriteResult, adaptBackendProtocol, adaptSandboxProtocol, computeSummarizationDefaults, createAgentMemoryMiddleware, createAsyncSubAgentMiddleware, createCompletionCallbackMiddleware, createDeepAgent, createFilesystemMiddleware, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgentMiddleware, createSubagentTransformer, createSummarizationMiddleware, filesValue, findProjectRoot, isAsyncSubAgent, isSandboxBackend, isSandboxProtocol, listSkills, parseSkillMetadata, resolveBackend };
3310
3568
  //# sourceMappingURL=index.d.ts.map