deepagents 1.0.0 → 1.1.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,5 +1,624 @@
1
- export { createDeepAgent } from "./graph.js";
2
- export { DeepAgentState, DeepAgentStateType, Todo, Files } from "./state.js";
3
- export { SubAgent } from "./subAgent.js";
4
- export { getDefaultModel } from "./model.js";
5
- export { writeTodos, writeFile, readFile, ls, editFile } from "./tools.js";
1
+ import * as langchain0 from "langchain";
2
+ import { AgentMiddleware, AgentMiddleware as AgentMiddleware$1, InterruptOnConfig, ReactAgent, StructuredTool } from "langchain";
3
+ import { AnnotationRoot } from "@langchain/langgraph";
4
+ import { StructuredTool as StructuredTool$1 } from "@langchain/core/tools";
5
+ import { BaseLanguageModel, LanguageModelLike } from "@langchain/core/language_models/base";
6
+ import { BaseCheckpointSaver, BaseStore } from "@langchain/langgraph-checkpoint";
7
+ import { InteropZodObject } from "@langchain/core/utils/types";
8
+
9
+ //#region src/backends/protocol.d.ts
10
+
11
+ /**
12
+ * Structured file listing info.
13
+ *
14
+ * Minimal contract used across backends. Only "path" is required.
15
+ * Other fields are best-effort and may be absent depending on backend.
16
+ */
17
+ interface FileInfo {
18
+ /** File path */
19
+ path: string;
20
+ /** Whether this is a directory */
21
+ is_dir?: boolean;
22
+ /** File size in bytes (approximate) */
23
+ size?: number;
24
+ /** ISO 8601 timestamp of last modification */
25
+ modified_at?: string;
26
+ }
27
+ /**
28
+ * Structured grep match entry.
29
+ */
30
+ interface GrepMatch {
31
+ /** File path where match was found */
32
+ path: string;
33
+ /** Line number (1-indexed) */
34
+ line: number;
35
+ /** The matching line text */
36
+ text: string;
37
+ }
38
+ /**
39
+ * File data structure used by backends.
40
+ *
41
+ * All file data is represented as objects with this structure:
42
+ */
43
+ interface FileData {
44
+ /** Lines of text content */
45
+ content: string[];
46
+ /** ISO format timestamp of creation */
47
+ created_at: string;
48
+ /** ISO format timestamp of last modification */
49
+ modified_at: string;
50
+ }
51
+ /**
52
+ * Result from backend write operations.
53
+ *
54
+ * Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state.
55
+ * External backends set filesUpdate to null (already persisted to disk/S3/database/etc).
56
+ */
57
+ interface WriteResult {
58
+ /** Error message on failure, undefined on success */
59
+ error?: string;
60
+ /** File path of written file, undefined on failure */
61
+ path?: string;
62
+ /**
63
+ * State update dict for checkpoint backends, null for external storage.
64
+ * Checkpoint backends populate this with {file_path: file_data} for LangGraph state.
65
+ * External backends set null (already persisted to disk/S3/database/etc).
66
+ */
67
+ filesUpdate?: Record<string, FileData> | null;
68
+ }
69
+ /**
70
+ * Result from backend edit operations.
71
+ *
72
+ * Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state.
73
+ * External backends set filesUpdate to null (already persisted to disk/S3/database/etc).
74
+ */
75
+ interface EditResult {
76
+ /** Error message on failure, undefined on success */
77
+ error?: string;
78
+ /** File path of edited file, undefined on failure */
79
+ path?: string;
80
+ /**
81
+ * State update dict for checkpoint backends, null for external storage.
82
+ * Checkpoint backends populate this with {file_path: file_data} for LangGraph state.
83
+ * External backends set null (already persisted to disk/S3/database/etc).
84
+ */
85
+ filesUpdate?: Record<string, FileData> | null;
86
+ /** Number of replacements made, undefined on failure */
87
+ occurrences?: number;
88
+ }
89
+ /**
90
+ * Protocol for pluggable memory backends (single, unified).
91
+ *
92
+ * Backends can store files in different locations (state, filesystem, database, etc.)
93
+ * and provide a uniform interface for file operations.
94
+ *
95
+ * All file data is represented as objects with the FileData structure.
96
+ *
97
+ * Methods can return either direct values or Promises, allowing both
98
+ * synchronous and asynchronous implementations.
99
+ */
100
+ interface BackendProtocol {
101
+ /**
102
+ * Structured listing with file metadata.
103
+ *
104
+ * Lists files and directories in the specified directory (non-recursive).
105
+ * Directories have a trailing / in their path and is_dir=true.
106
+ *
107
+ * @param path - Absolute path to directory
108
+ * @returns List of FileInfo objects for files and directories directly in the directory
109
+ */
110
+ lsInfo(path: string): FileInfo[] | Promise<FileInfo[]>;
111
+ /**
112
+ * Read file content with line numbers or an error string.
113
+ *
114
+ * @param filePath - Absolute file path
115
+ * @param offset - Line offset to start reading from (0-indexed), default 0
116
+ * @param limit - Maximum number of lines to read, default 2000
117
+ * @returns Formatted file content with line numbers, or error message
118
+ */
119
+ read(filePath: string, offset?: number, limit?: number): string | Promise<string>;
120
+ /**
121
+ * Structured search results or error string for invalid input.
122
+ *
123
+ * Searches file contents for a regex pattern.
124
+ *
125
+ * @param pattern - Regex pattern to search for
126
+ * @param path - Base path to search from (default: null)
127
+ * @param glob - Optional glob pattern to filter files (e.g., "*.py")
128
+ * @returns List of GrepMatch objects or error string for invalid regex
129
+ */
130
+ grepRaw(pattern: string, path?: string | null, glob?: string | null): GrepMatch[] | string | Promise<GrepMatch[] | string>;
131
+ /**
132
+ * Structured glob matching returning FileInfo objects.
133
+ *
134
+ * @param pattern - Glob pattern (e.g., `*.py`, `**\/*.ts`)
135
+ * @param path - Base path to search from (default: "/")
136
+ * @returns List of FileInfo objects matching the pattern
137
+ */
138
+ globInfo(pattern: string, path?: string): FileInfo[] | Promise<FileInfo[]>;
139
+ /**
140
+ * Create a new file.
141
+ *
142
+ * @param filePath - Absolute file path
143
+ * @param content - File content as string
144
+ * @returns WriteResult with error populated on failure
145
+ */
146
+ write(filePath: string, content: string): WriteResult | Promise<WriteResult>;
147
+ /**
148
+ * Edit a file by replacing string occurrences.
149
+ *
150
+ * @param filePath - Absolute file path
151
+ * @param oldString - String to find and replace
152
+ * @param newString - Replacement string
153
+ * @param replaceAll - If true, replace all occurrences (default: false)
154
+ * @returns EditResult with error, path, filesUpdate, and occurrences
155
+ */
156
+ edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): EditResult | Promise<EditResult>;
157
+ }
158
+ /**
159
+ * State and store container for backend initialization.
160
+ *
161
+ * This provides a clean interface for what backends need to access:
162
+ * - state: Current agent state (with files, messages, etc.)
163
+ * - store: Optional persistent store for cross-conversation data
164
+ *
165
+ * Different contexts build this differently:
166
+ * - Tools: Extract state via getCurrentTaskInput(config)
167
+ * - Middleware: Use request.state directly
168
+ */
169
+ interface StateAndStore {
170
+ /** Current agent state with files, messages, etc. */
171
+ state: unknown;
172
+ /** Optional BaseStore for persistent cross-conversation storage */
173
+ store?: BaseStore;
174
+ /** Optional assistant ID for per-assistant isolation in store */
175
+ assistantId?: string;
176
+ }
177
+ /**
178
+ * Factory function type for creating backend instances.
179
+ *
180
+ * Backends receive StateAndStore which contains the current state
181
+ * and optional store, extracted from the execution context.
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * // Using in middleware
186
+ * const middleware = createFilesystemMiddleware({
187
+ * backend: (stateAndStore) => new StateBackend(stateAndStore)
188
+ * });
189
+ * ```
190
+ */
191
+ type BackendFactory = (stateAndStore: StateAndStore) => BackendProtocol;
192
+ //#endregion
193
+ //#region src/middleware/fs.d.ts
194
+ /**
195
+ * Options for creating filesystem middleware.
196
+ */
197
+ interface FilesystemMiddlewareOptions {
198
+ /** Backend instance or factory (default: StateBackend) */
199
+ backend?: BackendProtocol | BackendFactory;
200
+ /** Optional custom system prompt override */
201
+ systemPrompt?: string | null;
202
+ /** Optional custom tool descriptions override */
203
+ customToolDescriptions?: Record<string, string> | null;
204
+ /** Optional token limit before evicting a tool result to the filesystem (default: 20000 tokens, ~80KB) */
205
+ toolTokenLimitBeforeEvict?: number | null;
206
+ }
207
+ /**
208
+ * Create filesystem middleware with all tools and features.
209
+ */
210
+ declare function createFilesystemMiddleware(options?: FilesystemMiddlewareOptions): langchain0.AgentMiddleware<any, undefined, any>;
211
+ //#endregion
212
+ //#region src/middleware/subagents.d.ts
213
+ /**
214
+ * Type definitions for subagents
215
+ */
216
+ interface SubAgent {
217
+ /** The name of the agent */
218
+ name: string;
219
+ /** The description of the agent */
220
+ description: string;
221
+ /** The system prompt to use for the agent */
222
+ systemPrompt: string;
223
+ /** The tools to use for the agent (tool instances, not names). Defaults to defaultTools */
224
+ tools?: StructuredTool[];
225
+ /** The model for the agent. Defaults to default_model */
226
+ model?: LanguageModelLike | string;
227
+ /** Additional middleware to append after default_middleware */
228
+ middleware?: AgentMiddleware$1[];
229
+ /** The tool configs to use for the agent */
230
+ interruptOn?: Record<string, boolean | InterruptOnConfig>;
231
+ }
232
+ /**
233
+ * Options for creating subagent middleware
234
+ */
235
+ interface SubAgentMiddlewareOptions {
236
+ /** The model to use for subagents */
237
+ defaultModel: LanguageModelLike | string;
238
+ /** The tools to use for the default general-purpose subagent */
239
+ defaultTools?: StructuredTool[];
240
+ /** Default middleware to apply to all subagents */
241
+ defaultMiddleware?: AgentMiddleware$1[] | null;
242
+ /** The tool configs for the default general-purpose subagent */
243
+ defaultInterruptOn?: Record<string, boolean | InterruptOnConfig> | null;
244
+ /** A list of additional subagents to provide to the agent */
245
+ subagents?: Array<SubAgent>;
246
+ /** Full system prompt override */
247
+ systemPrompt?: string | null;
248
+ /** Whether to include the general-purpose agent */
249
+ generalPurposeAgent?: boolean;
250
+ /** Custom description for the task tool */
251
+ taskDescription?: string | null;
252
+ }
253
+ /**
254
+ * Create subagent middleware with task tool
255
+ */
256
+ declare function createSubAgentMiddleware(options: SubAgentMiddlewareOptions): AgentMiddleware$1;
257
+ //#endregion
258
+ //#region src/middleware/patch_tool_calls.d.ts
259
+ /**
260
+ * Create middleware that patches dangling tool calls in the messages history.
261
+ *
262
+ * When an AI message contains tool_calls but subsequent messages don't include
263
+ * the corresponding ToolMessage responses, this middleware adds synthetic
264
+ * ToolMessages saying the tool call was cancelled.
265
+ *
266
+ * @returns AgentMiddleware that patches dangling tool calls
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * import { createAgent } from "langchain";
271
+ * import { createPatchToolCallsMiddleware } from "./middleware/patch_tool_calls";
272
+ *
273
+ * const agent = createAgent({
274
+ * model: "claude-sonnet-4-5-20250929",
275
+ * middleware: [createPatchToolCallsMiddleware()],
276
+ * });
277
+ * ```
278
+ */
279
+ declare function createPatchToolCallsMiddleware(): AgentMiddleware;
280
+ //#endregion
281
+ //#region src/backends/state.d.ts
282
+ /**
283
+ * Backend that stores files in agent state (ephemeral).
284
+ *
285
+ * Uses LangGraph's state management and checkpointing. Files persist within
286
+ * a conversation thread but not across threads. State is automatically
287
+ * checkpointed after each agent step.
288
+ *
289
+ * Special handling: Since LangGraph state must be updated via Command objects
290
+ * (not direct mutation), operations return filesUpdate in WriteResult/EditResult
291
+ * for the middleware to apply via Command.
292
+ */
293
+ declare class StateBackend implements BackendProtocol {
294
+ private stateAndStore;
295
+ constructor(stateAndStore: StateAndStore);
296
+ /**
297
+ * Get files from current state.
298
+ */
299
+ private getFiles;
300
+ /**
301
+ * List files and directories in the specified directory (non-recursive).
302
+ *
303
+ * @param path - Absolute path to directory
304
+ * @returns List of FileInfo objects for files and directories directly in the directory.
305
+ * Directories have a trailing / in their path and is_dir=true.
306
+ */
307
+ lsInfo(path: string): FileInfo[];
308
+ /**
309
+ * Read file content with line numbers.
310
+ *
311
+ * @param filePath - Absolute file path
312
+ * @param offset - Line offset to start reading from (0-indexed)
313
+ * @param limit - Maximum number of lines to read
314
+ * @returns Formatted file content with line numbers, or error message
315
+ */
316
+ read(filePath: string, offset?: number, limit?: number): string;
317
+ /**
318
+ * Create a new file with content.
319
+ * Returns WriteResult with filesUpdate to update LangGraph state.
320
+ */
321
+ write(filePath: string, content: string): WriteResult;
322
+ /**
323
+ * Edit a file by replacing string occurrences.
324
+ * Returns EditResult with filesUpdate and occurrences.
325
+ */
326
+ edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): EditResult;
327
+ /**
328
+ * Structured search results or error string for invalid input.
329
+ */
330
+ grepRaw(pattern: string, path?: string, glob?: string | null): GrepMatch[] | string;
331
+ /**
332
+ * Structured glob matching returning FileInfo objects.
333
+ */
334
+ globInfo(pattern: string, path?: string): FileInfo[];
335
+ }
336
+ //#endregion
337
+ //#region src/backends/store.d.ts
338
+ /**
339
+ * Backend that stores files in LangGraph's BaseStore (persistent).
340
+ *
341
+ * Uses LangGraph's Store for persistent, cross-conversation storage.
342
+ * Files are organized via namespaces and persist across all threads.
343
+ *
344
+ * The namespace can include an optional assistant_id for multi-agent isolation.
345
+ */
346
+ declare class StoreBackend implements BackendProtocol {
347
+ private stateAndStore;
348
+ constructor(stateAndStore: StateAndStore);
349
+ /**
350
+ * Get the store instance.
351
+ *
352
+ * @returns BaseStore instance
353
+ * @throws Error if no store is available
354
+ */
355
+ private getStore;
356
+ /**
357
+ * Get the namespace for store operations.
358
+ *
359
+ * If an assistant_id is available in stateAndStore, return
360
+ * [assistant_id, "filesystem"] to provide per-assistant isolation.
361
+ * Otherwise return ["filesystem"].
362
+ */
363
+ private getNamespace;
364
+ /**
365
+ * Convert a store Item to FileData format.
366
+ *
367
+ * @param storeItem - The store Item containing file data
368
+ * @returns FileData object
369
+ * @throws Error if required fields are missing or have incorrect types
370
+ */
371
+ private convertStoreItemToFileData;
372
+ /**
373
+ * Convert FileData to a value suitable for store.put().
374
+ *
375
+ * @param fileData - The FileData to convert
376
+ * @returns Object with content, created_at, and modified_at fields
377
+ */
378
+ private convertFileDataToStoreValue;
379
+ /**
380
+ * Search store with automatic pagination to retrieve all results.
381
+ *
382
+ * @param store - The store to search
383
+ * @param namespace - Hierarchical path prefix to search within
384
+ * @param options - Optional query, filter, and page_size
385
+ * @returns List of all items matching the search criteria
386
+ */
387
+ private searchStorePaginated;
388
+ /**
389
+ * List files and directories in the specified directory (non-recursive).
390
+ *
391
+ * @param path - Absolute path to directory
392
+ * @returns List of FileInfo objects for files and directories directly in the directory.
393
+ * Directories have a trailing / in their path and is_dir=true.
394
+ */
395
+ lsInfo(path: string): Promise<FileInfo[]>;
396
+ /**
397
+ * Read file content with line numbers.
398
+ *
399
+ * @param filePath - Absolute file path
400
+ * @param offset - Line offset to start reading from (0-indexed)
401
+ * @param limit - Maximum number of lines to read
402
+ * @returns Formatted file content with line numbers, or error message
403
+ */
404
+ read(filePath: string, offset?: number, limit?: number): Promise<string>;
405
+ /**
406
+ * Create a new file with content.
407
+ * Returns WriteResult. External storage sets filesUpdate=null.
408
+ */
409
+ write(filePath: string, content: string): Promise<WriteResult>;
410
+ /**
411
+ * Edit a file by replacing string occurrences.
412
+ * Returns EditResult. External storage sets filesUpdate=null.
413
+ */
414
+ edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): Promise<EditResult>;
415
+ /**
416
+ * Structured search results or error string for invalid input.
417
+ */
418
+ grepRaw(pattern: string, path?: string, glob?: string | null): Promise<GrepMatch[] | string>;
419
+ /**
420
+ * Structured glob matching returning FileInfo objects.
421
+ */
422
+ globInfo(pattern: string, path?: string): Promise<FileInfo[]>;
423
+ }
424
+ //#endregion
425
+ //#region src/backends/filesystem.d.ts
426
+ /**
427
+ * Backend that reads and writes files directly from the filesystem.
428
+ *
429
+ * Files are accessed using their actual filesystem paths. Relative paths are
430
+ * resolved relative to the current working directory. Content is read/written
431
+ * as plain text, and metadata (timestamps) are derived from filesystem stats.
432
+ */
433
+ declare class FilesystemBackend implements BackendProtocol {
434
+ private cwd;
435
+ private virtualMode;
436
+ private maxFileSizeBytes;
437
+ constructor(options?: {
438
+ rootDir?: string;
439
+ virtualMode?: boolean;
440
+ maxFileSizeMb?: number;
441
+ });
442
+ /**
443
+ * Resolve a file path with security checks.
444
+ *
445
+ * When virtualMode=true, treat incoming paths as virtual absolute paths under
446
+ * this.cwd, disallow traversal (.., ~) and ensure resolved path stays within root.
447
+ * When virtualMode=false, preserve legacy behavior: absolute paths are allowed
448
+ * as-is; relative paths resolve under cwd.
449
+ *
450
+ * @param key - File path (absolute, relative, or virtual when virtualMode=true)
451
+ * @returns Resolved absolute path string
452
+ * @throws Error if path traversal detected or path outside root
453
+ */
454
+ private resolvePath;
455
+ /**
456
+ * List files and directories in the specified directory (non-recursive).
457
+ *
458
+ * @param dirPath - Absolute directory path to list files from
459
+ * @returns List of FileInfo objects for files and directories directly in the directory.
460
+ * Directories have a trailing / in their path and is_dir=true.
461
+ */
462
+ lsInfo(dirPath: string): Promise<FileInfo[]>;
463
+ /**
464
+ * Read file content with line numbers.
465
+ *
466
+ * @param filePath - Absolute or relative file path
467
+ * @param offset - Line offset to start reading from (0-indexed)
468
+ * @param limit - Maximum number of lines to read
469
+ * @returns Formatted file content with line numbers, or error message
470
+ */
471
+ read(filePath: string, offset?: number, limit?: number): Promise<string>;
472
+ /**
473
+ * Create a new file with content.
474
+ * Returns WriteResult. External storage sets filesUpdate=null.
475
+ */
476
+ write(filePath: string, content: string): Promise<WriteResult>;
477
+ /**
478
+ * Edit a file by replacing string occurrences.
479
+ * Returns EditResult. External storage sets filesUpdate=null.
480
+ */
481
+ edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): Promise<EditResult>;
482
+ /**
483
+ * Structured search results or error string for invalid input.
484
+ */
485
+ grepRaw(pattern: string, dirPath?: string, glob?: string | null): Promise<GrepMatch[] | string>;
486
+ /**
487
+ * Try to use ripgrep for fast searching.
488
+ * Returns null if ripgrep is not available or fails.
489
+ */
490
+ private ripgrepSearch;
491
+ /**
492
+ * Fallback regex search implementation.
493
+ */
494
+ private pythonSearch;
495
+ /**
496
+ * Structured glob matching returning FileInfo objects.
497
+ */
498
+ globInfo(pattern: string, searchPath?: string): Promise<FileInfo[]>;
499
+ }
500
+ //#endregion
501
+ //#region src/backends/composite.d.ts
502
+ /**
503
+ * Backend that routes file operations to different backends based on path prefix.
504
+ *
505
+ * This enables hybrid storage strategies like:
506
+ * - `/memories/` → StoreBackend (persistent, cross-thread)
507
+ * - Everything else → StateBackend (ephemeral, per-thread)
508
+ *
509
+ * The CompositeBackend handles path prefix stripping/re-adding transparently.
510
+ */
511
+ declare class CompositeBackend implements BackendProtocol {
512
+ private default;
513
+ private routes;
514
+ private sortedRoutes;
515
+ constructor(defaultBackend: BackendProtocol, routes: Record<string, BackendProtocol>);
516
+ /**
517
+ * Determine which backend handles this key and strip prefix.
518
+ *
519
+ * @param key - Original file path
520
+ * @returns Tuple of [backend, stripped_key] where stripped_key has the route
521
+ * prefix removed (but keeps leading slash).
522
+ */
523
+ private getBackendAndKey;
524
+ /**
525
+ * List files and directories in the specified directory (non-recursive).
526
+ *
527
+ * @param path - Absolute path to directory
528
+ * @returns List of FileInfo objects with route prefixes added, for files and directories
529
+ * directly in the directory. Directories have a trailing / in their path and is_dir=true.
530
+ */
531
+ lsInfo(path: string): Promise<FileInfo[]>;
532
+ /**
533
+ * Read file content, routing to appropriate backend.
534
+ *
535
+ * @param filePath - Absolute file path
536
+ * @param offset - Line offset to start reading from (0-indexed)
537
+ * @param limit - Maximum number of lines to read
538
+ * @returns Formatted file content with line numbers, or error message
539
+ */
540
+ read(filePath: string, offset?: number, limit?: number): Promise<string>;
541
+ /**
542
+ * Structured search results or error string for invalid input.
543
+ */
544
+ grepRaw(pattern: string, path?: string, glob?: string | null): Promise<GrepMatch[] | string>;
545
+ /**
546
+ * Structured glob matching returning FileInfo objects.
547
+ */
548
+ globInfo(pattern: string, path?: string): Promise<FileInfo[]>;
549
+ /**
550
+ * Create a new file, routing to appropriate backend.
551
+ *
552
+ * @param filePath - Absolute file path
553
+ * @param content - File content as string
554
+ * @returns WriteResult with path or error
555
+ */
556
+ write(filePath: string, content: string): Promise<WriteResult>;
557
+ /**
558
+ * Edit a file, routing to appropriate backend.
559
+ *
560
+ * @param filePath - Absolute file path
561
+ * @param oldString - String to find and replace
562
+ * @param newString - Replacement string
563
+ * @param replaceAll - If true, replace all occurrences
564
+ * @returns EditResult with path, occurrences, or error
565
+ */
566
+ edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): Promise<EditResult>;
567
+ }
568
+ //#endregion
569
+ //#region src/agent.d.ts
570
+ /**
571
+ * Configuration parameters for creating a Deep Agent
572
+ * Matches Python's create_deep_agent parameters
573
+ */
574
+ interface CreateDeepAgentParams<ContextSchema extends AnnotationRoot<any> | InteropZodObject = AnnotationRoot<any>> {
575
+ /** The model to use (model name string or LanguageModelLike instance). Defaults to claude-sonnet-4-5-20250929 */
576
+ model?: BaseLanguageModel | string;
577
+ /** Tools the agent should have access to */
578
+ tools?: StructuredTool$1[];
579
+ /** Custom system prompt for the agent. This will be combined with the base agent prompt */
580
+ systemPrompt?: string;
581
+ /** Custom middleware to apply after standard middleware */
582
+ middleware?: AgentMiddleware[];
583
+ /** List of subagent specifications for task delegation */
584
+ subagents?: SubAgent[];
585
+ /** Structured output response format for the agent */
586
+ responseFormat?: any;
587
+ /** Optional schema for context (not persisted between invocations) */
588
+ contextSchema?: ContextSchema;
589
+ /** Optional checkpointer for persisting agent state between runs */
590
+ checkpointer?: BaseCheckpointSaver | boolean;
591
+ /** Optional store for persisting longterm memories */
592
+ store?: BaseStore;
593
+ /**
594
+ * Optional backend for filesystem operations.
595
+ * Can be either a backend instance or a factory function that creates one.
596
+ * The factory receives a config object with state and store.
597
+ */
598
+ backend?: BackendProtocol | ((config: {
599
+ state: unknown;
600
+ store?: BaseStore;
601
+ }) => BackendProtocol);
602
+ /** Optional interrupt configuration mapping tool names to interrupt configs */
603
+ interruptOn?: Record<string, boolean | InterruptOnConfig>;
604
+ /** The name of the agent */
605
+ name?: string;
606
+ }
607
+ /**
608
+ * Create a Deep Agent with middleware-based architecture.
609
+ *
610
+ * Matches Python's create_deep_agent function, using middleware for all features:
611
+ * - Todo management (todoListMiddleware)
612
+ * - Filesystem tools (createFilesystemMiddleware)
613
+ * - Subagent delegation (createSubAgentMiddleware)
614
+ * - Conversation summarization (summarizationMiddleware)
615
+ * - Prompt caching (anthropicPromptCachingMiddleware)
616
+ * - Tool call patching (createPatchToolCallsMiddleware)
617
+ * - Human-in-the-loop (humanInTheLoopMiddleware) - optional
618
+ *
619
+ * @param params Configuration parameters for the agent
620
+ * @returns ReactAgent instance ready for invocation
621
+ */
622
+ declare function createDeepAgent<ContextSchema extends AnnotationRoot<any> | InteropZodObject = AnnotationRoot<any>>(params?: CreateDeepAgentParams<ContextSchema>): ReactAgent<any, any, ContextSchema, any>;
623
+ //#endregion
624
+ export { type BackendFactory, type BackendProtocol, CompositeBackend, type CreateDeepAgentParams, type EditResult, type FileData, type FileInfo, FilesystemBackend, type FilesystemMiddlewareOptions, type GrepMatch, StateBackend, StoreBackend, type SubAgent, type SubAgentMiddlewareOptions, type WriteResult, createDeepAgent, createFilesystemMiddleware, createPatchToolCallsMiddleware, createSubAgentMiddleware };