Deep Agents is an agent harness. An opinionated, ready-to-run agent out of the box. Instead of wiring prompts, tools, and context management yourself, you get a working agent immediately and customize what you need.
What's included:
write_todos for task breakdown and progress trackingread_file, write_file, edit_file, ls, glob, grep for working memorytask for delegating work with isolated context windows[!NOTE] Looking for the Python package? See langchain-ai/deepagents.
npm install deepagents
# or
pnpm add deepagents
# or
yarn add deepagents
[!IMPORTANT]
deepagentsdeclares the LangChain runtime packages as peer dependencies so your app controls their versions and everything resolves to a single shared copy. npm 7+ and pnpm 8+ install these automatically; Yarn users must add them explicitly:yarn add @langchain/core @langchain/langgraph @langchain/langgraph-checkpoint @langchain/langgraph-sdk langchain langsmith
import { createDeepAgent } from "deepagents";
const agent = createDeepAgent();
const result = await agent.invoke({
messages: [
{
role: "user",
content: "Research LangGraph and write a summary in summary.md",
},
],
});
The agent can plan, read/write files, and manage longer tasks with sub-agents and filesystem tools.
[!TIP] For developing, debugging, and deploying AI agents and LLM applications, see LangSmith.
deepagents now publishes environment-specific entrypoints:
deepagents - default Node.js/server entrypoint with the full API.deepagents/browser - recommended browser entrypoint (no Node-only exports).deepagents/node - optional explicit Node.js entrypoint (same full API as deepagents).// Browser-safe usage
import { createDeepAgent, StateBackend } from "deepagents/browser";
// Node.js usage (recommended)
import { createDeepAgent, FilesystemBackend } from "deepagents";
// Optional explicit Node.js usage
// import { createDeepAgent, FilesystemBackend } from "deepagents/node";
Add tools, swap models, and customize prompts as needed:
import { ChatOpenAI } from "@langchain/openai";
import { createDeepAgent } from "deepagents";
const agent = createDeepAgent({
model: new ChatOpenAI({ model: "gpt-5", temperature: 0 }),
tools: [myCustomTool],
systemPrompt: "You are a research assistant.",
});
See the JavaScript Deep Agents docs for full configuration options.
createDeepAgent returns a compiled LangGraph graph, so you can use streaming, Studio, checkpointers, and other LangGraph features.
Deep Agents follows a "trust the LLM" model. The agent can do anything its tools allow. Enforce boundaries at the tool/sandbox level, not by expecting the model to self-police. See the security policy for more information.
Base sandbox implementation with execute() as the only abstract method.
This class provides default implementations for all SandboxBackendProtocol methods using shell commands executed via execute().
Backend that routes file operations to different backends based on path prefix.
This enables hybrid storage strategies like:
/memories/ → StoreBackend (persistent, cross-thread)Backend that stores files in a LangSmith Hub agent repository.
Mutation model
Mutations are accepted in call order, coalesced for a short window, and pushed by one worker. Only one batch is in fl
Backend that reads and writes files directly from the filesystem.
Files are accessed using their actual filesystem paths. Relative paths are resolved relative to the current working directory. Conten
LangSmith Sandbox backend for deepagents.
Extends BaseSandbox to provide command execution and file operations
via the LangSmith Sandbox API.
Use the static LangSmithSandbox.create() factory for
Filesystem backend with unrestricted local shell command execution.
This backend extends FilesystemBackend to add shell command execution capabilities. Commands are executed directly on the host syst
Custom error class for sandbox operations.
Backend that stores files in agent state (ephemeral).
Uses LangGraph's state management and checkpointing. Files persist within a conversation thread but not across threads. State is automatically ch
Backend that stores files in LangGraph's BaseStore (persistent).
Uses LangGraph's Store for persistent, cross-conversation storage. Files are organized via namespaces and persist across all threads.
Base sandbox implementation with execute() as the only abstract method.
This class provides default implementations for all SandboxBackendProtocol methods using shell commands executed via execute().
Backend that routes file operations to different backends based on path prefix.
This enables hybrid storage strategies like:
/memories/ → StoreBackend (persistent, cross-thread)Backend that stores files in a LangSmith Hub agent repository.
Mutation model
Mutations are accepted in call order, coalesced for a short window, and pushed by one worker. Only one batch is in fl
LangSmith Sandbox backend for deepagents.
Extends BaseSandbox to provide command execution and file operations
via the LangSmith Sandbox API.
Use the static LangSmithSandbox.create() factory for
Custom error class for sandbox operations.
Backend that stores files in agent state (ephemeral).
Uses LangGraph's state management and checkpointing. Files persist within a conversation thread but not across threads. State is automatically ch
Backend that stores files in LangGraph's BaseStore (persistent).
Uses LangGraph's Store for persistent, cross-conversation storage. Files are organized via namespaces and persist across all threads.
Thrown when createDeepAgent receives invalid configuration.
Follows the same pattern as SandboxError: a human-readable
message, a structured code for programmatic handling, and a
static `isInst
Thrown when createDeepAgent receives invalid configuration.
Follows the same pattern as SandboxError: a human-readable
message, a structured code for programmatic handling, and a
static `isInst
Backend that reads and writes files directly from the filesystem.
Files are accessed using their actual filesystem paths. Relative paths are resolved relative to the current working directory. Conten
Filesystem backend with unrestricted local shell command execution.
This backend extends FilesystemBackend to add shell command execution capabilities. Commands are executed directly on the host syst
Base sandbox implementation with execute() as the only abstract method.
This class provides default implementations for all SandboxBackendProtocol methods using shell commands executed via execute().
Backend that routes file operations to different backends based on path prefix.
This enables hybrid storage strategies like:
/memories/ → StoreBackend (persistent, cross-thread)Thrown when createDeepAgent receives invalid configuration.
Follows the same pattern as SandboxError: a human-readable
message, a structured code for programmatic handling, and a
static `isInst
Backend that stores files in a LangSmith Hub agent repository.
Mutation model
Mutations are accepted in call order, coalesced for a short window, and pushed by one worker. Only one batch is in fl
LangSmith Sandbox backend for deepagents.
Extends BaseSandbox to provide command execution and file operations
via the LangSmith Sandbox API.
Use the static LangSmithSandbox.create() factory for
Custom error class for sandbox operations.
Backend that stores files in agent state (ephemeral).
Uses LangGraph's state management and checkpointing. Files persist within a conversation thread but not across threads. State is automatically ch
Backend that stores files in LangGraph's BaseStore (persistent).
Uses LangGraph's Store for persistent, cross-conversation storage. Files are organized via namespaces and persist across all threads.
Base sandbox implementation with execute() as the only abstract method.
This class provides default implementations for all SandboxBackendProtocol methods using shell commands executed via execute().
Backend that routes file operations to different backends based on path prefix.
This enables hybrid storage strategies like:
/memories/ → StoreBackend (persistent, cross-thread)Thrown when createDeepAgent receives invalid configuration.
Follows the same pattern as SandboxError: a human-readable
message, a structured code for programmatic handling, and a
static `isInst
Backend that stores files in a LangSmith Hub agent repository.
Mutation model
Mutations are accepted in call order, coalesced for a short window, and pushed by one worker. Only one batch is in fl
Backend that reads and writes files directly from the filesystem.
Files are accessed using their actual filesystem paths. Relative paths are resolved relative to the current working directory. Conten
LangSmith Sandbox backend for deepagents.
Extends BaseSandbox to provide command execution and file operations
via the LangSmith Sandbox API.
Use the static LangSmithSandbox.create() factory for
Filesystem backend with unrestricted local shell command execution.
This backend extends FilesystemBackend to add shell command execution capabilities. Commands are executed directly on the host syst
Custom error class for sandbox operations.
Backend that stores files in agent state (ephemeral).
Uses LangGraph's state management and checkpointing. Files persist within a conversation thread but not across threads. State is automatically ch
Backend that stores files in LangGraph's BaseStore (persistent).
Uses LangGraph's Store for persistent, cross-conversation storage. Files are organized via namespaces and persist across all threads.
A one-shot promise whose settlement is controlled externally.
Use this when one part of a workflow must wait for an event that is owned elsewhere—for example, a queued mutation waiting for the worker
Create a Deep Agent.
This is the main entry point for building a production-style agent with deepagents. It gives you a strong default runtime (filesystem, tasks, subagents, summarization) and lets y
Adapt a v1 BackendProtocol to BackendProtocolV2.
If the backend already implements v2, it is returned as-is. For v1 backends, wraps returns in Result types:
read() string returns wrapped in ReadRAdapt a sandbox backend from v1 to v2 interface.
This extends adaptBackendProtocol to also preserve sandbox-specific
properties from SandboxBackendProtocol: execute and id.
Group structured matches into the legacy dict form used by formatters.
Check if content is empty and return warning message.
Create a FileData object.
Defaults to v2 format (content as single string). Pass fileFormat: "v1" for
backward compatibility with older readers during a rolling deployment.
Binary content (Uint8Arr
Convert FileData to plain string content.
Format file content with line numbers (cat -n style).
Lines longer than MAX_LINE_LENGTH are split into continuation rows such as
5.1 and 5.2. Use formatContentWithLineNumbersAndBoundaries whe
Format file content with line numbers and structured source-line boundaries.
The boundaries let downstream size limiting truncate only after complete source lines without reparsing the rendered gutte
Format structured grep matches using existing formatting logic.
Format grep search results based on output mode.
Format file data for read response with line numbers.
Join file content into the unmodified source body of a read_file result.
Source lines are emitted unchanged, with no numbering. A status header carries the line-range metadata separately, so nothin
Determine MIME type from a file path's extension.
Defaults to "text/plain" for unknown extensions. Only the known non-text formats above (images, audio, video, PDF/PPT) are treated as binary by isTex
Search files dict for paths matching glob pattern.
Return structured grep matches from an in-memory files mapping.
Performs literal text search (not regex). Binary files are skipped.
If path names an exact file, only that file is considered.
Return
Search file contents for literal text pattern.
Performs literal text search.
Type guard to check if FileData contains binary content (Uint8Array).
Type guard to check if FileData is v1 format (content as line array).
Check whether a MIME type represents text content.
Convert FileData to v2 format, joining v1 line arrays into a single string.
If the data is already v2, returns it unchanged.
Normalize model- or caller-supplied text pagination bounds.
Every backend must slice content and calculate pagination metadata from the same normalized values. Otherwise a fractional or negative argu
Perform string replacement with occurrence validation.
Sanitize tool_call_id to prevent path traversal and separator issues.
Replaces dangerous characters (., /, ) with underscores.
Truncate list or string result if it exceeds token limit (rough estimate: 4 chars/token).
Update FileData with new content, preserving creation timestamp.
Validate and normalize a file path for security.
Ensures paths are safe to use by preventing directory traversal attacks and enforcing consistent formatting. All paths are normalized to use forward s
Validate and normalize a directory path.
Ensures paths are safe to use by preventing directory traversal attacks and enforcing consistent formatting. All paths are normalized to use forward slashes a
Enforce a match cap after a backend grep has completed.
When maxCount is set and the result exceeds it, the matches are sliced
to the cap and the result is flagged truncated: true.
Type guard to check if a backend supports execution.
Type guard to check if a backend is a sandbox protocol (v1 or v2).
Checks for the presence of execute function and id string,
which are the defining features of sandbox protocols.
Compute summarization defaults based on model profile.
Mirrors Python's _compute_summarization_defaults.
If the model has a profile with maxInputTokens, uses fraction-based
settings. Otherwise, u
Create a completion callback middleware for async subagents.
Experimental — this middleware is experimental and may change.
This middleware is added to a subagent's middleware stack. On success
Create middleware that provides built-in filesystem tools and optional custom prompt guidance.
By default, the middleware registers every built-in filesystem tool listed in FILESYSTEM_TOOL_NAMES. Use
Create a frozen HarnessProfile from user-provided options.
Validates all fields, converts mutable collections to their frozen counterparts, and returns a frozen object. Empty options produce a no-op
Create middleware for loading agent memory from AGENTS.md files.
Loads memory content from configured sources and injects into the system prompt. Supports multiple sources that are combined together.
Create middleware that enforces strict tool call / tool response parity in the messages history.
Two kinds of violations are repaired:
Create backend-agnostic middleware for loading and exposing agent skills.
This middleware loads skills from configurable backend sources and injects skill metadata into the system prompt. It implemen
Create subagent middleware with task tool
Create summarization middleware with backend support for conversation history offloading.
This middleware:
Look up the HarnessProfile for a model spec string.
Resolution order:
spec (e.g., "openai:gpt-5.4").:) when spec containsType guard to distinguish async SubAgents from sync SubAgents/CompiledSubAgents.
Uses the presence of the graphId field as the runtime discriminant —
AsyncSubAgent requires it, while SubAgent a
Type guard to check if a backend supports execution.
Type guard to check if a backend is a sandbox protocol (v1 or v2).
Checks for the presence of execute function and id string,
which are the defining features of sandbox protocols.
Parse an untrusted JSON/YAML object into a validated HarnessProfile.
Combines Zod schema validation with prototype-pollution protection and profile construction validation. Use this for any config da
Register a harness profile for a provider or specific model.
Accepts either a pre-built HarnessProfile (from createHarnessProfile) or raw HarnessProfileOptions that will be validated and frozen autom
Serialize a HarnessProfile to a JSON-compatible object.
Omits undefined fields and extraMiddleware (runtime-only).
Throws if extraMiddleware contains instances — callers should
strip it before
Adapt a v1 BackendProtocol to BackendProtocolV2.
If the backend already implements v2, it is returned as-is. For v1 backends, wraps returns in Result types:
read() string returns wrapped in ReadRAdapt a sandbox backend from v1 to v2 interface.
This extends adaptBackendProtocol to also preserve sandbox-specific
properties from SandboxBackendProtocol: execute and id.
Create a Deep Agent.
This is the main entry point for building a production-style agent with deepagents. It gives you a strong default runtime (filesystem, tasks, subagents, summarization) and lets y
Create a Settings instance with detected environment.
Find the project root by looking for .git directory.
Walks up the directory tree from startPath (or cwd) looking for a .git directory, which indicates the project root.
Enforce a match cap after a backend grep has completed.
When maxCount is set and the result exceeds it, the matches are sliced
to the cap and the result is flagged truncated: true.
Create a runnable agent from a declarative SubAgent spec.
This is the shared entrypoint for compiling a SubAgent into a
ReactAgent. Pre-compiled CompiledSubAgent runnables bypass this
functio
Support is read from model.profile (see
https://docs.langchain.com/oss/javascript/langchain/models#model-profiles).
Place this middleware last in the agent's middleware list, so that if
some othe
List skills from user and/or project directories.
When both directories are provided, project skills with the same name as user skills will override them.
Whether the model accepts a multimodal block.
Missing profile fields default to supported, since profile coverage is
incomplete — except file blocks, where a missing fileMimeTypes
defaults to uns
Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.
Without this, a request carrying content the model can't accept (e.g. a
.zip file sent to a model without file support) fails with a
non-retryable 400, and since the content stays in history, every
Adapt a v1 BackendProtocol to BackendProtocolV2.
If the backend already implements v2, it is returned as-is. For v1 backends, wraps returns in Result types:
read() string returns wrapped in ReadRAdapt a sandbox backend from v1 to v2 interface.
This extends adaptBackendProtocol to also preserve sandbox-specific
properties from SandboxBackendProtocol: execute and id.
Compute summarization defaults based on model profile.
Mirrors Python's _compute_summarization_defaults.
If the model has a profile with maxInputTokens, uses fraction-based
settings. Otherwise, u
Create a completion callback middleware for async subagents.
Experimental — this middleware is experimental and may change.
This middleware is added to a subagent's middleware stack. On success
Create a Deep Agent.
This is the main entry point for building a production-style agent with deepagents. It gives you a strong default runtime (filesystem, tasks, subagents, summarization) and lets y
Create middleware that provides built-in filesystem tools and optional custom prompt guidance.
By default, the middleware registers every built-in filesystem tool listed in FILESYSTEM_TOOL_NAMES. Use
Create a frozen HarnessProfile from user-provided options.
Validates all fields, converts mutable collections to their frozen counterparts, and returns a frozen object. Empty options produce a no-op
Create middleware for loading agent memory from AGENTS.md files.
Loads memory content from configured sources and injects into the system prompt. Supports multiple sources that are combined together.
Create middleware that enforces strict tool call / tool response parity in the messages history.
Two kinds of violations are repaired:
Create a Settings instance with detected environment.
Create backend-agnostic middleware for loading and exposing agent skills.
This middleware loads skills from configurable backend sources and injects skill metadata into the system prompt. It implemen
Create subagent middleware with task tool
Create summarization middleware with backend support for conversation history offloading.
This middleware:
Find the project root by looking for .git directory.
Walks up the directory tree from startPath (or cwd) looking for a .git directory, which indicates the project root.
Look up the HarnessProfile for a model spec string.
Resolution order:
spec (e.g., "openai:gpt-5.4").:) when spec containsType guard to distinguish async SubAgents from sync SubAgents/CompiledSubAgents.
Uses the presence of the graphId field as the runtime discriminant —
AsyncSubAgent requires it, while SubAgent a
Type guard to check if a backend supports execution.
Type guard to check if a backend is a sandbox protocol (v1 or v2).
Checks for the presence of execute function and id string,
which are the defining features of sandbox protocols.
Normalize model- or caller-supplied text pagination bounds.
Every backend must slice content and calculate pagination metadata from the same normalized values. Otherwise a fractional or negative argu
Parse an untrusted JSON/YAML object into a validated HarnessProfile.
Combines Zod schema validation with prototype-pollution protection and profile construction validation. Use this for any config da
Register a harness profile for a provider or specific model.
Accepts either a pre-built HarnessProfile (from createHarnessProfile) or raw HarnessProfileOptions that will be validated and frozen autom
Serialize a HarnessProfile to a JSON-compatible object.
Omits undefined fields and extraMiddleware (runtime-only).
Throws if extraMiddleware contains instances — callers should
strip it before
Append text to a system message.
Creates a new SystemMessage with the text appended to the existing content. If the original message has content, the new text is separated by two newlines.
Create a preview of content showing head and tail with truncation marker.
Patch tool call / tool response parity in a messages array.
Ensures strict 1:1 correspondence between AIMessage tool_calls and ToolMessage responses:
Prepend text to a system message.
Creates a new SystemMessage with the text prepended to the existing content. If the original message has content, the new text is separated by two newlines.
Compute summarization defaults based on model profile.
Mirrors Python's _compute_summarization_defaults.
If the model has a profile with maxInputTokens, uses fraction-based
settings. Otherwise, u
Create a completion callback middleware for async subagents.
Experimental — this middleware is experimental and may change.
This middleware is added to a subagent's middleware stack. On success
Create middleware that provides built-in filesystem tools and optional custom prompt guidance.
By default, the middleware registers every built-in filesystem tool listed in FILESYSTEM_TOOL_NAMES. Use
Create middleware for loading agent memory from AGENTS.md files.
Loads memory content from configured sources and injects into the system prompt. Supports multiple sources that are combined together.
Create middleware that enforces strict tool call / tool response parity in the messages history.
Two kinds of violations are repaired:
Create backend-agnostic middleware for loading and exposing agent skills.
This middleware loads skills from configurable backend sources and injects skill metadata into the system prompt. It implemen
Create subagent middleware with task tool
Create summarization middleware with backend support for conversation history offloading.
This middleware:
Support is read from model.profile (see
https://docs.langchain.com/oss/javascript/langchain/models#model-profiles).
Place this middleware last in the agent's middleware list, so that if
some othe
Type guard to distinguish async SubAgents from sync SubAgents/CompiledSubAgents.
Uses the presence of the graphId field as the runtime discriminant —
AsyncSubAgent requires it, while SubAgent a
Whether the model accepts a multimodal block.
Missing profile fields default to supported, since profile coverage is
incomplete — except file blocks, where a missing fileMimeTypes
defaults to uns
Without this, a request carrying content the model can't accept (e.g. a
.zip file sent to a model without file support) fails with a
non-retryable 400, and since the content stays in history, every
Adapt a v1 BackendProtocol to BackendProtocolV2.
If the backend already implements v2, it is returned as-is. For v1 backends, wraps returns in Result types:
read() string returns wrapped in ReadRAdapt a sandbox backend from v1 to v2 interface.
This extends adaptBackendProtocol to also preserve sandbox-specific
properties from SandboxBackendProtocol: execute and id.
Enforce a match cap after a backend grep has completed.
When maxCount is set and the result exceeds it, the matches are sliced
to the cap and the result is flagged truncated: true.
Compute summarization defaults based on model profile.
Mirrors Python's _compute_summarization_defaults.
If the model has a profile with maxInputTokens, uses fraction-based
settings. Otherwise, u
Create a completion callback middleware for async subagents.
Experimental — this middleware is experimental and may change.
This middleware is added to a subagent's middleware stack. On success
Create a Deep Agent.
This is the main entry point for building a production-style agent with deepagents. It gives you a strong default runtime (filesystem, tasks, subagents, summarization) and lets y
Create middleware that provides built-in filesystem tools and optional custom prompt guidance.
By default, the middleware registers every built-in filesystem tool listed in FILESYSTEM_TOOL_NAMES. Use
Create a frozen HarnessProfile from user-provided options.
Validates all fields, converts mutable collections to their frozen counterparts, and returns a frozen object. Empty options produce a no-op
Create middleware for loading agent memory from AGENTS.md files.
Loads memory content from configured sources and injects into the system prompt. Supports multiple sources that are combined together.
Create middleware that enforces strict tool call / tool response parity in the messages history.
Two kinds of violations are repaired:
Create a Settings instance with detected environment.
Create backend-agnostic middleware for loading and exposing agent skills.
This middleware loads skills from configurable backend sources and injects skill metadata into the system prompt. It implemen
Create a runnable agent from a declarative SubAgent spec.
This is the shared entrypoint for compiling a SubAgent into a
ReactAgent. Pre-compiled CompiledSubAgent runnables bypass this
functio
Create subagent middleware with task tool
Create summarization middleware with backend support for conversation history offloading.
This middleware:
Support is read from model.profile (see
https://docs.langchain.com/oss/javascript/langchain/models#model-profiles).
Place this middleware last in the agent's middleware list, so that if
some othe
Find the project root by looking for .git directory.
Walks up the directory tree from startPath (or cwd) looking for a .git directory, which indicates the project root.
Look up the HarnessProfile for a model spec string.
Resolution order:
spec (e.g., "openai:gpt-5.4").:) when spec containsType guard to distinguish async SubAgents from sync SubAgents/CompiledSubAgents.
Uses the presence of the graphId field as the runtime discriminant —
AsyncSubAgent requires it, while SubAgent a
Type guard to check if a backend supports execution.
Type guard to check if a backend is a sandbox protocol (v1 or v2).
Checks for the presence of execute function and id string,
which are the defining features of sandbox protocols.
List skills from user and/or project directories.
When both directories are provided, project skills with the same name as user skills will override them.
Whether the model accepts a multimodal block.
Missing profile fields default to supported, since profile coverage is
incomplete — except file blocks, where a missing fileMimeTypes
defaults to uns
Normalize model- or caller-supplied text pagination bounds.
Every backend must slice content and calculate pagination metadata from the same normalized values. Otherwise a fractional or negative argu
Parse an untrusted JSON/YAML object into a validated HarnessProfile.
Combines Zod schema validation with prototype-pollution protection and profile construction validation. Use this for any config da
Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.
Register a harness profile for a provider or specific model.
Accepts either a pre-built HarnessProfile (from createHarnessProfile) or raw HarnessProfileOptions that will be validated and frozen autom
Without this, a request carrying content the model can't accept (e.g. a
.zip file sent to a model without file support) fails with a
non-retryable 400, and since the content stays in history, every
Serialize a HarnessProfile to a JSON-compatible object.
Omits undefined fields and extraMiddleware (runtime-only).
Throws if extraMiddleware contains instances — callers should
strip it before
Evaluate permission rules against an operation + path and return the access decision.
First-match-wins; permissive default.
Test whether path matches a glob pattern.
Supports:
** — any number of directory levels* — within a single path segment{a,b} — brace expansionUses micromatch with dot: true so
Canonicalize and validate an absolute path before permission checking.
Throws for:
/)..Validate permission rule paths at setup time. Throws if any path is
relative, contains .., or contains ~.
Apply a profile's prompt overlay to a base prompt string.
baseSystemPrompt (when set) replaces basePrompt entirely.systemPromptSuffix (when set) is appended with \n\n.Both are independ
Merge two harness profiles, layering override on top of base.
Merge semantics per field:
| Field | Strategy |
|---|---|
baseSystemPrompt |
Override wins if not undefined |
| `sy |
Normalize and validate a profile registry key.
Trims leading/trailing whitespace, then enforces the "provider" or
"provider:model" shape. Rejects empty strings, multiple colons, and
empty halves.
Create a frozen HarnessProfile from user-provided options.
Validates all fields, converts mutable collections to their frozen counterparts, and returns a frozen object. Empty options produce a no-op
Look up the HarnessProfile for a model spec string.
Resolution order:
spec (e.g., "openai:gpt-5.4").:) when spec containsParse an untrusted JSON/YAML object into a validated HarnessProfile.
Combines Zod schema validation with prototype-pollution protection and profile construction validation. Use this for any config da
Register a harness profile for a provider or specific model.
Accepts either a pre-built HarnessProfile (from createHarnessProfile) or raw HarnessProfileOptions that will be validated and frozen autom
Serialize a HarnessProfile to a JSON-compatible object.
Omits undefined fields and extraMiddleware (runtime-only).
Throws if extraMiddleware contains instances — callers should
strip it before
Type guard: is this a fully-constructed HarnessProfile (frozen with Set fields) or raw options?
Options use arrays for excludedTools; profiles use Set. We
distinguish by checking whether `exclude
Apply a profile's prompt overlay to a base prompt string.
baseSystemPrompt (when set) replaces basePrompt entirely.systemPromptSuffix (when set) is appended with \n\n.Both are independ
Create a frozen HarnessProfile from user-provided options.
Validates all fields, converts mutable collections to their frozen counterparts, and returns a frozen object. Empty options produce a no-op
Look up the HarnessProfile for a model spec string.
Resolution order:
spec (e.g., "openai:gpt-5.4").:) when spec containsMerge two harness profiles, layering override on top of base.
Merge semantics per field:
| Field | Strategy |
|---|---|
baseSystemPrompt |
Override wins if not undefined |
| `sy |
Parse an untrusted JSON/YAML object into a validated HarnessProfile.
Combines Zod schema validation with prototype-pollution protection and profile construction validation. Use this for any config da
Register a harness profile for a provider or specific model.
Accepts either a pre-built HarnessProfile (from createHarnessProfile) or raw HarnessProfileOptions that will be validated and frozen autom
Serialize a HarnessProfile to a JSON-compatible object.
Omits undefined fields and extraMiddleware (runtime-only).
Throws if extraMiddleware contains instances — callers should
strip it before
List skills from user and/or project directories.
When both directories are provided, project skills with the same name as user skills will override them.
Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.
Detect whether a model is an Anthropic model.
Used to gate Anthropic-specific prompt caching optimizations (cache_control breakpoints).
Accepts the wider RunnableInterface shape (the type of `requ
Detect whether a model is an AWS Bedrock Converse model.
Accepts the wider RunnableInterface shape (the type of request.model
inside wrapModelCall, aliased as AgentLanguageModelLike in langch
Create middleware for loading agent-specific long-term memory.
This middleware loads the agent's long-term memory from a file (agent.md) and injects it into the system prompt. The memory is loaded on
Create middleware for loading agent-specific long-term memory.
This middleware loads the agent's long-term memory from a file (agent.md) and injects it into the system prompt. The memory is loaded on
Updated protocol for pluggable memory backends.
Key differences from BackendProtocol:
read() returns ReadResult instead of a plain stringreadRaw() returns ReadRawResult instead of FileDataResult from backend delete operations.
Result from backend edit operations.
Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state. External backends set filesUpdate to null (already persisted to disk/S3/
Result of code execution. Simplified schema optimized for LLM consumption.
Result of a single file download operation.
Structured file listing info.
Minimal contract used across backends. Only "path" is required. Other fields are best-effort and may be absent depending on backend.
Result of a single file upload operation.
Structured result from backend glob operations.
Structured grep match entry.
Structured result from grep/search operations.
Options for capturing a snapshot from a running sandbox.
Options for the LangSmithSandbox.create() static factory.
Options for constructing a LangSmithSandbox from an existing Sandbox instance.
Represents a sandbox snapshot.
Snapshots are built from Docker images or captured from running sandboxes. They are used to create new sandboxes.
Options for starting a stopped sandbox.
Options for creating a LocalShellBackend instance.
Structured result from backend ls operations.
Structured result from backend readRaw operations.
Structured result from backend read operations.
Replaces the previous plain string return, giving callers a programmatic way to distinguish errors from content.
Protocol for sandboxed backends with isolated runtime.
Key differences from SandboxBackendProtocol:
Options for deleting a sandbox.
Options for getting or creating a sandbox.
Metadata for a single sandbox instance.
This lightweight structure is returned from list operations and provides basic information about a sandbox without requiring a full connection.
Options for listing sandboxes.
Paginated response from a sandbox list operation.
This structure supports cursor-based pagination for efficiently browsing large collections of sandboxes.
Context provided to dynamic namespace factory functions.
Options for StoreBackend constructor.
Result from backend write operations.
Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state. External backends set filesUpdate to null (already persisted to disk/S3
Specification for an async subagent running on a remote Agent Protocol server.
Async subagents connect to any Agent Protocol-compliant server via the
Options for creating async subagent middleware.
A tracked async subagent task persisted in agent state.
Each task maps to a single thread + run on a remote Agent Protocol server.
The taskId is the same as threadId, so it can be used to look up
Updated protocol for pluggable memory backends.
Key differences from BackendProtocol:
read() returns ReadResult instead of a plain stringreadRaw() returns ReadRawResult instead of FileDataType definitions for pre-compiled agents.
Options for creating the completion callback middleware.
Result from backend delete operations.
Result from backend edit operations.
Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state. External backends set filesUpdate to null (already persisted to disk/S3/
Result of code execution. Simplified schema optimized for LLM consumption.
Result of a single file download operation.
Structured file listing info.
Minimal contract used across backends. Only "path" is required. Other fields are best-effort and may be absent depending on backend.
Options for creating filesystem middleware.
A single filesystem permission rule.
Rules are evaluated in declaration order; the first rule whose
operations includes the requested operation AND whose paths
glob-matches the target path determ
Result of a single file upload operation.
Configuration for the auto-added general-purpose subagent.
All fields use three-state semantics: undefined inherits the
default, an explicit value overrides it. This allows model-level
profiles to
Structured result from backend glob operations.
Structured grep match entry.
Structured result from grep/search operations.
Frozen runtime harness profile that shapes agent behavior at assembly time.
Created by createHarnessProfile from user-provided
HarnessProfileOptions. Collection types are narrowed
(arrays → Set, re
User-facing options for creating a HarnessProfile.
Accepts plain arrays and records; the factory function converts them to their frozen counterparts. All fields are optional — an empty object produce
Options for the LangSmithSandbox.create() static factory.
Options for constructing a LangSmithSandbox from an existing Sandbox instance.
Structured result from backend ls operations.
Options for the memory middleware.
Structured result from backend readRaw operations.
Structured result from backend read operations.
Replaces the previous plain string return, giving callers a programmatic way to distinguish errors from content.
Protocol for sandboxed backends with isolated runtime.
Key differences from SandboxBackendProtocol:
Options for deleting a sandbox.
Options for getting or creating a sandbox.
Metadata for a single sandbox instance.
This lightweight structure is returned from list operations and provides basic information about a sandbox without requiring a full connection.
Options for listing sandboxes.
Paginated response from a sandbox list operation.
This structure supports cursor-based pagination for efficiently browsing large collections of sandboxes.
Metadata for a skill per Agent Skills specification.
Options for the skills middleware.
Context provided to dynamic namespace factory functions.
Options for StoreBackend constructor.
Specification for a declarative subagent.
When using createDeepAgent, subagents automatically receive a default middleware
stack (filesystemMiddleware, summarizationMiddleware, etc.) before any cus
Options for creating subagent middleware
Result from backend write operations.
Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state. External backends set filesUpdate to null (already persisted to disk/S3
Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters
DeepAgent extends ReactAgent with additional subagent type information.
This type wraps ReactAgent but includes the DeepAgentTypeConfig which contains subagent types for type-safe streaming and deleg
Type bag that extends AgentTypeConfig with subagent type information.
This interface bundles all the generic type parameters used throughout the deep agent system including subagent types for type-sa
Default type configuration for deep agents. Used when no explicit type parameters are provided.
Settings interface for project detection and path management.
Provides access to:
Options for creating a Settings instance.
Options for the agent memory middleware.
Options for listing skills.
Metadata for a skill per Agent Skills spec.
Options for creating a LocalShellBackend instance.
Specification for an async subagent running on a remote Agent Protocol server.
Async subagents connect to any Agent Protocol-compliant server via the
Options for creating async subagent middleware.
A tracked async subagent task persisted in agent state.
Each task maps to a single thread + run on a remote Agent Protocol server.
The taskId is the same as threadId, so it can be used to look up
Updated protocol for pluggable memory backends.
Key differences from BackendProtocol:
read() returns ReadResult instead of a plain stringreadRaw() returns ReadRawResult instead of FileDataType definitions for pre-compiled agents.
Options for creating the completion callback middleware.
Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters
DeepAgent extends ReactAgent with additional subagent type information.
This type wraps ReactAgent but includes the DeepAgentTypeConfig which contains subagent types for type-safe streaming and deleg
Type bag that extends AgentTypeConfig with subagent type information.
This interface bundles all the generic type parameters used throughout the deep agent system including subagent types for type-sa
Default type configuration for deep agents. Used when no explicit type parameters are provided.
Result from backend delete operations.
Result from backend edit operations.
Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state. External backends set filesUpdate to null (already persisted to disk/S3/
Result of code execution. Simplified schema optimized for LLM consumption.
Result of a single file download operation.
Structured file listing info.
Minimal contract used across backends. Only "path" is required. Other fields are best-effort and may be absent depending on backend.
Options for creating filesystem middleware.
A single filesystem permission rule.
Rules are evaluated in declaration order; the first rule whose
operations includes the requested operation AND whose paths
glob-matches the target path determ
Result of a single file upload operation.
Configuration for the auto-added general-purpose subagent.
All fields use three-state semantics: undefined inherits the
default, an explicit value overrides it. This allows model-level
profiles to
Structured result from backend glob operations.
Structured grep match entry.
Structured result from grep/search operations.
Frozen runtime harness profile that shapes agent behavior at assembly time.
Created by createHarnessProfile from user-provided
HarnessProfileOptions. Collection types are narrowed
(arrays → Set, re
User-facing options for creating a HarnessProfile.
Accepts plain arrays and records; the factory function converts them to their frozen counterparts. All fields are optional — an empty object produce
Options for capturing a snapshot from a running sandbox.
Options for the LangSmithSandbox.create() static factory.
Options for constructing a LangSmithSandbox from an existing Sandbox instance.
Represents a sandbox snapshot.
Snapshots are built from Docker images or captured from running sandboxes. They are used to create new sandboxes.
Options for starting a stopped sandbox.
Structured result from backend ls operations.
Options for the memory middleware.
Structured result from backend readRaw operations.
Structured result from backend read operations.
Replaces the previous plain string return, giving callers a programmatic way to distinguish errors from content.
Protocol for sandboxed backends with isolated runtime.
Key differences from SandboxBackendProtocol:
Options for deleting a sandbox.
Options for getting or creating a sandbox.
Metadata for a single sandbox instance.
This lightweight structure is returned from list operations and provides basic information about a sandbox without requiring a full connection.
Options for listing sandboxes.
Paginated response from a sandbox list operation.
This structure supports cursor-based pagination for efficiently browsing large collections of sandboxes.
Settings interface for project detection and path management.
Provides access to:
Options for creating a Settings instance.
Metadata for a skill per Agent Skills specification.
Options for the skills middleware.
Context provided to dynamic namespace factory functions.
Options for StoreBackend constructor.
Specification for a declarative subagent.
When using createDeepAgent, subagents automatically receive a default middleware
stack (filesystemMiddleware, summarizationMiddleware, etc.) before any cus
Options for creating subagent middleware
A nested named-agent execution surfaced on run.subagents.
A subagent is a nested createAgent run whose lc_agent_name differs from
its parent's — e.g. a createAgent({ name }) invoked inside a
Result from backend write operations.
Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state. External backends set filesUpdate to null (already persisted to disk/S3
Context size specification for summarization triggers and retention policies.
Options for the summarization middleware.
Settings for truncating large tool arguments in old messages.
Specification for an async subagent running on a remote Agent Protocol server.
Async subagents connect to any Agent Protocol-compliant server via the
Options for creating async subagent middleware.
A tracked async subagent task persisted in agent state.
Each task maps to a single thread + run on a remote Agent Protocol server.
The taskId is the same as threadId, so it can be used to look up
Type definitions for pre-compiled agents.
Options for creating the completion callback middleware.
Options for creating filesystem middleware.
Options for the memory middleware.
Metadata for a skill per Agent Skills specification.
Options for the skills middleware.
Specification for a declarative subagent.
When using createDeepAgent, subagents automatically receive a default middleware
stack (filesystemMiddleware, summarizationMiddleware, etc.) before any cus
Options for creating subagent middleware
Options for the agent memory middleware.
Specification for an async subagent running on a remote Agent Protocol server.
Async subagents connect to any Agent Protocol-compliant server via the
Options for creating async subagent middleware.
A tracked async subagent task persisted in agent state.
Each task maps to a single thread + run on a remote Agent Protocol server.
The taskId is the same as threadId, so it can be used to look up
Updated protocol for pluggable memory backends.
Key differences from BackendProtocol:
read() returns ReadResult instead of a plain stringreadRaw() returns ReadRawResult instead of FileDataType definitions for pre-compiled agents.
Options for creating the completion callback middleware.
Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters
DeepAgent extends ReactAgent with additional subagent type information.
This type wraps ReactAgent but includes the DeepAgentTypeConfig which contains subagent types for type-safe streaming and deleg
Type bag that extends AgentTypeConfig with subagent type information.
This interface bundles all the generic type parameters used throughout the deep agent system including subagent types for type-sa
Default type configuration for deep agents. Used when no explicit type parameters are provided.
Result from backend delete operations.
Result from backend edit operations.
Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state. External backends set filesUpdate to null (already persisted to disk/S3/
Result of code execution. Simplified schema optimized for LLM consumption.
Result of a single file download operation.
Structured file listing info.
Minimal contract used across backends. Only "path" is required. Other fields are best-effort and may be absent depending on backend.
Options for creating filesystem middleware.
A single filesystem permission rule.
Rules are evaluated in declaration order; the first rule whose
operations includes the requested operation AND whose paths
glob-matches the target path determ
Result of a single file upload operation.
Configuration for the auto-added general-purpose subagent.
All fields use three-state semantics: undefined inherits the
default, an explicit value overrides it. This allows model-level
profiles to
Structured result from backend glob operations.
Structured grep match entry.
Structured result from grep/search operations.
Frozen runtime harness profile that shapes agent behavior at assembly time.
Created by createHarnessProfile from user-provided
HarnessProfileOptions. Collection types are narrowed
(arrays → Set, re
User-facing options for creating a HarnessProfile.
Accepts plain arrays and records; the factory function converts them to their frozen counterparts. All fields are optional — an empty object produce
Options for capturing a snapshot from a running sandbox.
Options for the LangSmithSandbox.create() static factory.
Options for constructing a LangSmithSandbox from an existing Sandbox instance.
Represents a sandbox snapshot.
Snapshots are built from Docker images or captured from running sandboxes. They are used to create new sandboxes.
Options for starting a stopped sandbox.
Options for listing skills.
Metadata for a skill per Agent Skills spec.
Options for creating a LocalShellBackend instance.
Structured result from backend ls operations.
Options for the memory middleware.
Structured result from backend readRaw operations.
Structured result from backend read operations.
Replaces the previous plain string return, giving callers a programmatic way to distinguish errors from content.
Protocol for sandboxed backends with isolated runtime.
Key differences from SandboxBackendProtocol:
Options for deleting a sandbox.
Options for getting or creating a sandbox.
Metadata for a single sandbox instance.
This lightweight structure is returned from list operations and provides basic information about a sandbox without requiring a full connection.
Options for listing sandboxes.
Paginated response from a sandbox list operation.
This structure supports cursor-based pagination for efficiently browsing large collections of sandboxes.
Settings interface for project detection and path management.
Provides access to:
Options for creating a Settings instance.
Metadata for a skill per Agent Skills specification.
Options for the skills middleware.
Context provided to dynamic namespace factory functions.
Options for StoreBackend constructor.
Specification for a declarative subagent.
When using createDeepAgent, subagents automatically receive a default middleware
stack (filesystemMiddleware, summarizationMiddleware, etc.) before any cus
Options for creating subagent middleware
A nested named-agent execution surfaced on run.subagents.
A subagent is a nested createAgent run whose lc_agent_name differs from
its parent's — e.g. a createAgent({ name }) invoked inside a
Result from backend write operations.
Checkpoint backends populate filesUpdate with {file_path: file_data} for LangGraph state. External backends set filesUpdate to null (already persisted to disk/S3
A single filesystem permission rule.
Rules are evaluated in declaration order; the first rule whose
operations includes the requested operation AND whose paths
glob-matches the target path determ
Configuration for the auto-added general-purpose subagent.
All fields use three-state semantics: undefined inherits the
default, an explicit value overrides it. This allows model-level
profiles to
Frozen runtime harness profile that shapes agent behavior at assembly time.
Created by createHarnessProfile from user-provided
HarnessProfileOptions. Collection types are narrowed
(arrays → Set, re
User-facing options for creating a HarnessProfile.
Accepts plain arrays and records; the factory function converts them to their frozen counterparts. All fields are optional — an empty object produce
Options for resolving a harness profile from model metadata.
Configuration for the auto-added general-purpose subagent.
All fields use three-state semantics: undefined inherits the
default, an explicit value overrides it. This allows model-level
profiles to
Frozen runtime harness profile that shapes agent behavior at assembly time.
Created by createHarnessProfile from user-provided
HarnessProfileOptions. Collection types are narrowed
(arrays → Set, re
User-facing options for creating a HarnessProfile.
Accepts plain arrays and records; the factory function converts them to their frozen counterparts. All fields are optional — an empty object produce
Options for listing skills.
Metadata for a skill per Agent Skills spec.
A nested named-agent execution surfaced on run.subagents.
A subagent is a nested createAgent run whose lc_agent_name differs from
its parent's — e.g. a createAgent({ name }) invoked inside a
Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters
DeepAgent extends ReactAgent with additional subagent type information.
This type wraps ReactAgent but includes the DeepAgentTypeConfig which contains subagent types for type-safe streaming and deleg
Type bag that extends AgentTypeConfig with subagent type information.
This interface bundles all the generic type parameters used throughout the deep agent system including subagent types for type-sa
Default type configuration for deep agents. Used when no explicit type parameters are provided.
Protocol for pluggable memory backends (single, unified).
Backends can store files in different locations (state, filesystem, database, etc.) and provide a uniform interface for file operations.
All
Agent Runtime with state
Protocol for sandboxed backends with isolated runtime. Sandboxed backends run in isolated environments (e.g., containers) and communicate via defined interfaces.
State and store container for backend initialization.
This provides a clean interface for what backends need to access:
Protocol for pluggable memory backends (single, unified).
Backends can store files in different locations (state, filesystem, database, etc.) and provide a uniform interface for file operations.
All
Agent Runtime with state
A SubAgent with mode: "fork".
Protocol for sandboxed backends with isolated runtime. Sandboxed backends run in isolated environments (e.g., containers) and communicate via defined interfaces.
State and store container for backend initialization.
This provides a clean interface for what backends need to access:
Protocol for pluggable memory backends (single, unified).
Backends can store files in different locations (state, filesystem, database, etc.) and provide a uniform interface for file operations.
All
Agent Runtime with state
A SubAgent with mode: "fork".
Protocol for sandboxed backends with isolated runtime. Sandboxed backends run in isolated environments (e.g., containers) and communicate via defined interfaces.
State and store container for backend initialization.
This provides a clean interface for what backends need to access:
A SubAgent with mode: "fork".
Protocol for pluggable memory backends (single, unified).
Backends can store files in different locations (state, filesystem, database, etc.) and provide a uniform interface for file operations.
All
Agent Runtime with state
A SubAgent with mode: "fork".
Protocol for sandboxed backends with isolated runtime. Sandboxed backends run in isolated environments (e.g., containers) and communicate via defined interfaces.
State and store container for backend initialization.
This provides a clean interface for what backends need to access:
Union of v1 and v2 backend protocols.
Use this when accepting either protocol version. Pass through adaptBackendProtocol to normalize to BackendProtocolV2.
Union of v1 and v2 file data formats.
Backends may encounter either format when reading from state or store (v1 from legacy data, v2 from new writes). Use isFileDataV1 from utils for runtime discrimi
Standardized error codes for file upload/download operations.
Common error codes shared across all sandbox provider implementations.
These represent the core error conditions that any sandbox provider may encounter. Provider-specific error codes should extend t
Union of v1 and v2 backend protocols.
Use this when accepting either protocol version. Pass through adaptBackendProtocol to normalize to BackendProtocolV2.
Possible statuses for an async subagent task.
Statuses set by the middleware tools: "running", "success", "error", "cancelled".
Statuses that may be returned by the remote server: "pending"
Union of v1 and v2 file data formats.
Backends may encounter either format when reading from state or store (v1 from legacy data, v2 from new writes). Use isFileDataV1 from utils for runtime discrimi
Standardized error codes for file upload/download operations.
The filesystem operations a permission rule can govern.
Built-in filesystem tool names accepted by
createFilesystemMiddleware's tools allowlist.
TypeScript type inferred from the Zod config schema.
Represents the JSON/YAML-compatible shape of a harness profile. This
is the type of data that comes out of harnessProfileConfigSchema.parse().
Whether a matched rule permits or blocks the operation.
Common error codes shared across all sandbox provider implementations.
These represent the core error conditions that any sandbox provider may encounter. Provider-specific error codes should extend t
Type for a single skill metadata entry.
Return the skill tools that one metadata.include_tools name stands for.
A resolver lets a skill list tools whose real names are only known at runtime, such as generated MCP tool names, and lets one
Any subagent specification — sync, compiled, or async.
Error codes for ConfigurationError.
Each code represents a distinct misconfiguration that can be detected at agent-construction time. Add new codes here as new validations are added.
An AgentRunStream whose subagents projection is narrowed to the
deep agent's declared subagents.
This is a pure type overlay — no runtime class exists. The subagents
iterable is populated by the
Helper type to extract middleware from a SubAgent definition Handles both mutable and readonly middleware arrays
Helper type to flatten and merge middleware from all subagents
Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.
Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.
Utility type to extract the parsed response type from a ResponseFormat strategy.
Maps ToolStrategy<T>, ProviderStrategy<T>, and TypedToolStrategy<T> to T
(the parsed output type), so that `st
Helper type to extract a subagent by name from a DeepAgent.
Helper type to merge states from subagent middleware
Helper type to extract the ReactAgent type from a subagent definition. This is useful for type-safe streaming of subagent events.
Combined state type including custom middleware and subagent middleware states
Helper type to resolve a DeepAgentTypeConfig from either:
typeof agent)Union of all response format types accepted by createDeepAgent.
Matches the formats supported by LangChain's createAgent:
ToolStrategy<T> — from ToolStrategy.fromSchema(schema)Error codes for ConfigurationError.
Each code represents a distinct misconfiguration that can be detected at agent-construction time. Add new codes here as new validations are added.
Union of v1 and v2 backend protocols.
Use this when accepting either protocol version. Pass through adaptBackendProtocol to normalize to BackendProtocolV2.
Any subagent specification — sync, compiled, or async.
Possible statuses for an async subagent task.
Statuses set by the middleware tools: "running", "success", "error", "cancelled".
Statuses that may be returned by the remote server: "pending"
Error codes for ConfigurationError.
Each code represents a distinct misconfiguration that can be detected at agent-construction time. Add new codes here as new validations are added.
An AgentRunStream whose subagents projection is narrowed to the
deep agent's declared subagents.
This is a pure type overlay — no runtime class exists. The subagents
iterable is populated by the
Helper type to extract middleware from a SubAgent definition Handles both mutable and readonly middleware arrays
Union of v1 and v2 file data formats.
Backends may encounter either format when reading from state or store (v1 from legacy data, v2 from new writes). Use isFileDataV1 from utils for runtime discrimi
Standardized error codes for file upload/download operations.
The filesystem operations a permission rule can govern.
Helper type to flatten and merge middleware from all subagents
Built-in filesystem tool names accepted by
createFilesystemMiddleware's tools allowlist.
TypeScript type inferred from the Zod config schema.
Represents the JSON/YAML-compatible shape of a harness profile. This
is the type of data that comes out of harnessProfileConfigSchema.parse().
Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.
Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.
Utility type to extract the parsed response type from a ResponseFormat strategy.
Maps ToolStrategy<T>, ProviderStrategy<T>, and TypedToolStrategy<T> to T
(the parsed output type), so that `st
Helper type to extract a subagent by name from a DeepAgent.
Helper type to merge states from subagent middleware
Helper type to extract the ReactAgent type from a subagent definition. This is useful for type-safe streaming of subagent events.
Combined state type including custom middleware and subagent middleware states
Whether a matched rule permits or blocks the operation.
Helper type to resolve a DeepAgentTypeConfig from either:
typeof agent)Common error codes shared across all sandbox provider implementations.
These represent the core error conditions that any sandbox provider may encounter. Provider-specific error codes should extend t
Type for a single skill metadata entry.
Return the skill tools that one metadata.include_tools name stands for.
A resolver lets a skill list tools whose real names are only known at runtime, such as generated MCP tool names, and lets one
Union of all response format types accepted by createDeepAgent.
Matches the formats supported by LangChain's createAgent:
ToolStrategy<T> — from ToolStrategy.fromSchema(schema)The middleware value returned by createSkillsMiddleware.
Exported so createDeepAgent can splice the skills state (skillsMetadata)
into an agent's inferred state when the skills option is presen
Represents a summarization event that tracks what was summarized and where the cutoff is.
Possible statuses for an async subagent task.
Statuses set by the middleware tools: "running", "success", "error", "cancelled".
Statuses that may be returned by the remote server: "pending"
Built-in filesystem tool names accepted by
createFilesystemMiddleware's tools allowlist.
Type for a single skill metadata entry.
Return the skill tools that one metadata.include_tools name stands for.
A resolver lets a skill list tools whose real names are only known at runtime, such as generated MCP tool names, and lets one
Union of v1 and v2 backend protocols.
Use this when accepting either protocol version. Pass through adaptBackendProtocol to normalize to BackendProtocolV2.
Any subagent specification — sync, compiled, or async.
Possible statuses for an async subagent task.
Statuses set by the middleware tools: "running", "success", "error", "cancelled".
Statuses that may be returned by the remote server: "pending"
Error codes for ConfigurationError.
Each code represents a distinct misconfiguration that can be detected at agent-construction time. Add new codes here as new validations are added.
An AgentRunStream whose subagents projection is narrowed to the
deep agent's declared subagents.
This is a pure type overlay — no runtime class exists. The subagents
iterable is populated by the
Helper type to extract middleware from a SubAgent definition Handles both mutable and readonly middleware arrays
Union of v1 and v2 file data formats.
Backends may encounter either format when reading from state or store (v1 from legacy data, v2 from new writes). Use isFileDataV1 from utils for runtime discrimi
Standardized error codes for file upload/download operations.
The filesystem operations a permission rule can govern.
Helper type to flatten and merge middleware from all subagents
Built-in filesystem tool names accepted by
createFilesystemMiddleware's tools allowlist.
TypeScript type inferred from the Zod config schema.
Represents the JSON/YAML-compatible shape of a harness profile. This
is the type of data that comes out of harnessProfileConfigSchema.parse().
Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.
Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.
Utility type to extract the parsed response type from a ResponseFormat strategy.
Maps ToolStrategy<T>, ProviderStrategy<T>, and TypedToolStrategy<T> to T
(the parsed output type), so that `st
Helper type to extract a subagent by name from a DeepAgent.
Helper type to merge states from subagent middleware
Helper type to extract the ReactAgent type from a subagent definition. This is useful for type-safe streaming of subagent events.
Combined state type including custom middleware and subagent middleware states
Whether a matched rule permits or blocks the operation.
Helper type to resolve a DeepAgentTypeConfig from either:
typeof agent)Common error codes shared across all sandbox provider implementations.
These represent the core error conditions that any sandbox provider may encounter. Provider-specific error codes should extend t
Type for a single skill metadata entry.
Return the skill tools that one metadata.include_tools name stands for.
A resolver lets a skill list tools whose real names are only known at runtime, such as generated MCP tool names, and lets one
Union of all response format types accepted by createDeepAgent.
Matches the formats supported by LangChain's createAgent:
ToolStrategy<T> — from ToolStrategy.fromSchema(schema)The filesystem operations a permission rule can govern.
Whether a matched rule permits or blocks the operation.
TypeScript type inferred from the Zod config schema.
Represents the JSON/YAML-compatible shape of a harness profile. This
is the type of data that comes out of harnessProfileConfigSchema.parse().
TypeScript type inferred from the Zod config schema.
Represents the JSON/YAML-compatible shape of a harness profile. This
is the type of data that comes out of harnessProfileConfigSchema.parse().
An AgentRunStream whose subagents projection is narrowed to the
deep agent's declared subagents.
This is a pure type overlay — no runtime class exists. The subagents
iterable is populated by the
A typed SubagentRunStream variant for a single subagent spec.
Narrows .name to the literal string type, .output to the
inferred state type, and .toolCalls to the subagent's tools
when availabl
Extract the output state type from a subagent spec.
For CompiledSubAgent<ReactAgent<Types>>, resolves to the agent's
invoke return type. Falls back to unknown for SubAgent and
AsyncSubAgent.
Discriminated union of SubagentRunStream variants, one per
subagent in TSubagents. Enables TypeScript to narrow .output
when the consumer checks sub.name === "someSubagentName".
Extract the tools tuple from a subagent spec.
For CompiledSubAgent<ReactAgent<Types>>, resolves to Types["Tools"].
Falls back to the default (ClientTool | ServerTool)[] for SubAgent
and `Async
Any subagent specification — sync, compiled, or async.
Helper type to extract middleware from a SubAgent definition Handles both mutable and readonly middleware arrays
Helper type to flatten and merge middleware from all subagents
Helper type to extract CompiledSubAgent (subagents with runnable) from a DeepAgent.
Uses Extract to filter for subagents that have a runnable property.
Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.
Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.
Middleware that createDeepAgent mounts only when the corresponding option
is passed, expressed at the type level so the agent's state reflects it.
skills mounts SkillsMiddleware, which contribu
Helper type to extract SubAgent (subagents with middleware) from a DeepAgent.
Uses Extract to filter for subagents that have a middleware property but no runnable.
Utility type to extract the parsed response type from a ResponseFormat strategy.
Maps ToolStrategy<T>, ProviderStrategy<T>, and TypedToolStrategy<T> to T
(the parsed output type), so that `st
Helper type to extract a subagent by name from a DeepAgent.
Helper type to merge states from subagent middleware
Helper type to extract the ReactAgent type from a subagent definition. This is useful for type-safe streaming of subagent events.
Combined state type including custom middleware and subagent middleware states
Helper type to resolve a DeepAgentTypeConfig from either:
typeof agent)Union of all response format types accepted by createDeepAgent.
Matches the formats supported by LangChain's createAgent:
ToolStrategy<T> — from ToolStrategy.fromSchema(schema)Factory function type for creating backend instances.
Backends receive BackendRuntime which contains the current state and runtime information, extracted from the execution context.
Factory function type for creating backend instances.
Backends receive BackendRuntime which contains the current state and runtime information, extracted from the execution context.
Factory function type for creating backend instances.
Backends receive BackendRuntime which contains the current state and runtime information, extracted from the execution context.
Factory function type for creating backend instances.
Backends receive BackendRuntime which contains the current state and runtime information, extracted from the execution context.