LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagents

deepagents

Description

Deep Agents Logo Deep Agents Logo

The batteries-included agent harness.

npm version License: MIT TypeScript Twitter / X

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:

  • Planning — write_todos for task breakdown and progress tracking
  • Filesystem — read_file, write_file, edit_file, ls, glob, grep for working memory
  • Sub-agents — task for delegating work with isolated context windows
  • Smart defaults — built-in prompt and middleware that make these tools useful out of the box
  • Context management — file-based workflows to keep long tasks manageable

[!NOTE] Looking for the Python package? See langchain-ai/deepagents.

Quickstart

npm install deepagents
# or
pnpm add deepagents
# or
yarn add deepagents

[!IMPORTANT] deepagents declares 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.

Runtime Entrypoints

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";

Customization

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.

LangGraph Native

createDeepAgent returns a compiled LangGraph graph, so you can use streaming, Studio, checkpointers, and other LangGraph features.

Why Use It

  • 100% open source — MIT licensed and extensible
  • Provider agnostic — works with tool-calling chat models
  • Built on LangGraph — production runtime with streaming and persistence
  • Batteries included — planning, file access, sub-agents, and defaults out of the box
  • Fast to start — install and run with sensible defaults
  • Easy to customize — add tools/models/prompts when you need to

Documentation

  • docs.langchain.com - Concepts and guides
  • Examples - Working agents and patterns
  • LangChain Forum - Community discussion and support

Security

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.

Classes

Class

BaseSandbox

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().

Class

CompositeBackend

Backend that routes file operations to different backends based on path prefix.

This enables hybrid storage strategies like:

  • /memories/ → StoreBackend (persistent, cross-thread)
  • Everything else
Class

ContextHubBackend

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

Class

FilesystemBackend

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

Class

LangSmithSandbox

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

Class

LocalShellBackend

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

Class

SandboxError

Custom error class for sandbox operations.

Class

StateBackend

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

Class

StoreBackend

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.

Class

BaseSandbox

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().

Class

CompositeBackend

Backend that routes file operations to different backends based on path prefix.

This enables hybrid storage strategies like:

  • /memories/ → StoreBackend (persistent, cross-thread)
  • Everything else
Class

ContextHubBackend

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

Class

LangSmithSandbox

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

Class

SandboxError

Custom error class for sandbox operations.

Class

StateBackend

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

Class

StoreBackend

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.

Class

ConfigurationError

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

Class

ConfigurationError

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

Class

FilesystemBackend

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

Class

LocalShellBackend

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

Class

BaseSandbox

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().

Class

CompositeBackend

Backend that routes file operations to different backends based on path prefix.

This enables hybrid storage strategies like:

  • /memories/ → StoreBackend (persistent, cross-thread)
  • Everything else
Class

ConfigurationError

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

Class

ContextHubBackend

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

Class

LangSmithSandbox

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

Class

SandboxError

Custom error class for sandbox operations.

Class

StateBackend

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

Class

StoreBackend

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.

Class

BaseSandbox

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().

Class

CompositeBackend

Backend that routes file operations to different backends based on path prefix.

This enables hybrid storage strategies like:

  • /memories/ → StoreBackend (persistent, cross-thread)
  • Everything else
Class

ConfigurationError

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

Class

ContextHubBackend

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

Class

FilesystemBackend

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

Class

LangSmithSandbox

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

Class

LocalShellBackend

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

Class

SandboxError

Custom error class for sandbox operations.

Class

StateBackend

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

Class

StoreBackend

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.

Class

Deferred

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

Functions

Function

createDeepAgent

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

Function

adaptBackendProtocol

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 ReadR
Function

adaptSandboxProtocol

Adapt a sandbox backend from v1 to v2 interface.

This extends adaptBackendProtocol to also preserve sandbox-specific properties from SandboxBackendProtocol: execute and id.

Function

buildGrepResultsDict

Group structured matches into the legacy dict form used by formatters.

Function

checkEmptyContent

Check if content is empty and return warning message.

Function

createFileData

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

Function

createWriteFileData

Function

fileDataToString

Convert FileData to plain string content.

Function

formatContentWithLineNumbers

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

Function

formatContentWithLineNumbersAndBoundaries

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

Function

formatGrepMatches

Format structured grep matches using existing formatting logic.

Function

formatGrepResults

Format grep search results based on output mode.

Function

formatReadResponse

Format file data for read response with line numbers.

Function

formatSourceBlock

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

Function

getMimeType

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

Function

globSearchFiles

Search files dict for paths matching glob pattern.

Function

grepMatchesFromFiles

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

Function

grepSearchFiles

Search file contents for literal text pattern.

Performs literal text search.

Function

isFileDataBinary

Type guard to check if FileData contains binary content (Uint8Array).

Function

isFileDataV1

Type guard to check if FileData is v1 format (content as line array).

Function

isTextMimeType

Check whether a MIME type represents text content.

Function

migrateToFileDataV2

Convert FileData to v2 format, joining v1 line arrays into a single string.

If the data is already v2, returns it unchanged.

Function

normalizeReadPagination

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

Function

performStringReplacement

Perform string replacement with occurrence validation.

Function

sanitizeToolCallId

Sanitize tool_call_id to prevent path traversal and separator issues.

Replaces dangerous characters (., /, ) with underscores.

Function

truncateIfTooLong

Truncate list or string result if it exceeds token limit (rough estimate: 4 chars/token).

Function

updateFileData

Update FileData with new content, preserving creation timestamp.

Function

validateFilePath

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

Function

validatePath

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

Function

applyGrepMaxCount

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.

Function

isSandboxBackend

Type guard to check if a backend supports execution.

Function

isSandboxProtocol

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.

Function

computeSummarizationDefaults

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

Function

createAsyncSubAgentMiddleware

Function

createCompletionCallbackMiddleware

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

Function

createFilesystemMiddleware

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

Function

createHarnessProfile

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

Function

createMemoryMiddleware

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.

Function

createPatchToolCallsMiddleware

Create middleware that enforces strict tool call / tool response parity in the messages history.

Two kinds of violations are repaired:

  1. Dangling tool_calls — an AIMessage contains tool_calls wi
Function

createSkillsMiddleware

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

Function

createSubAgentMiddleware

Create subagent middleware with task tool

Function

createSummarizationMiddleware

Create summarization middleware with backend support for conversation history offloading.

This middleware:

  1. Monitors conversation length against configured thresholds
  2. When triggered, offloads ol
Function

getHarnessProfile

Look up the HarnessProfile for a model spec string.

Resolution order:

  1. Exact match on spec (e.g., "openai:gpt-5.4").
  2. Provider prefix (everything before :) when spec contains
Function

isAsyncSubAgent

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

Function

isSandboxBackend

Type guard to check if a backend supports execution.

Function

isSandboxProtocol

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.

Function

parseHarnessProfileConfig

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

Function

registerHarnessProfile

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

Function

serializeProfile

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

Function

adaptBackendProtocol

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 ReadR
Function

adaptSandboxProtocol

Adapt a sandbox backend from v1 to v2 interface.

This extends adaptBackendProtocol to also preserve sandbox-specific properties from SandboxBackendProtocol: execute and id.

Function

createDeepAgent

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

Function

createSettings

Create a Settings instance with detected environment.

Function

findProjectRoot

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.

Function

applyGrepMaxCount

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.

Function

createSubAgent

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

Function

listSkills

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.

Function

parseSkillMetadata

Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.

Function

adaptBackendProtocol

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 ReadR
Function

adaptSandboxProtocol

Adapt a sandbox backend from v1 to v2 interface.

This extends adaptBackendProtocol to also preserve sandbox-specific properties from SandboxBackendProtocol: execute and id.

Function

computeSummarizationDefaults

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

Function

createAsyncSubAgentMiddleware

Function

createCompletionCallbackMiddleware

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

Function

createDeepAgent

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

Function

createFilesystemMiddleware

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

Function

createHarnessProfile

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

Function

createMemoryMiddleware

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.

Function

createPatchToolCallsMiddleware

Create middleware that enforces strict tool call / tool response parity in the messages history.

Two kinds of violations are repaired:

  1. Dangling tool_calls — an AIMessage contains tool_calls wi
Function

createSettings

Create a Settings instance with detected environment.

Function

createSkillsMiddleware

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

Function

createSubAgentMiddleware

Create subagent middleware with task tool

Function

createSummarizationMiddleware

Create summarization middleware with backend support for conversation history offloading.

This middleware:

  1. Monitors conversation length against configured thresholds
  2. When triggered, offloads ol
Function

findProjectRoot

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.

Function

getHarnessProfile

Look up the HarnessProfile for a model spec string.

Resolution order:

  1. Exact match on spec (e.g., "openai:gpt-5.4").
  2. Provider prefix (everything before :) when spec contains
Function

isAsyncSubAgent

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

Function

isSandboxBackend

Type guard to check if a backend supports execution.

Function

isSandboxProtocol

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.

Function

normalizeReadPagination

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

Function

parseHarnessProfileConfig

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

Function

registerHarnessProfile

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

Function

serializeProfile

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

Function

appendToSystemMessage

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.

Function

createContentPreview

Create a preview of content showing head and tail with truncation marker.

Function

patchDanglingToolCalls

Patch tool call / tool response parity in a messages array.

Ensures strict 1:1 correspondence between AIMessage tool_calls and ToolMessage responses:

  1. Dangling tool_calls — an AIMessage contai
Function

prependToSystemMessage

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.

Function

computeSummarizationDefaults

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

Function

createAsyncSubAgentMiddleware

Function

createCompletionCallbackMiddleware

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

Function

createFilesystemMiddleware

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

Function

createMemoryMiddleware

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.

Function

createPatchToolCallsMiddleware

Create middleware that enforces strict tool call / tool response parity in the messages history.

Two kinds of violations are repaired:

  1. Dangling tool_calls — an AIMessage contains tool_calls wi
Function

createSkillsMiddleware

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

Function

createSubAgentMiddleware

Create subagent middleware with task tool

Function

createSummarizationMiddleware

Create summarization middleware with backend support for conversation history offloading.

This middleware:

  1. Monitors conversation length against configured thresholds
  2. When triggered, offloads ol
Function

isAsyncSubAgent

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

Function

adaptBackendProtocol

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 ReadR
Function

adaptSandboxProtocol

Adapt a sandbox backend from v1 to v2 interface.

This extends adaptBackendProtocol to also preserve sandbox-specific properties from SandboxBackendProtocol: execute and id.

Function

applyGrepMaxCount

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.

Function

computeSummarizationDefaults

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

Function

createAsyncSubAgentMiddleware

Function

createCompletionCallbackMiddleware

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

Function

createDeepAgent

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

Function

createFilesystemMiddleware

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

Function

createHarnessProfile

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

Function

createMemoryMiddleware

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.

Function

createPatchToolCallsMiddleware

Create middleware that enforces strict tool call / tool response parity in the messages history.

Two kinds of violations are repaired:

  1. Dangling tool_calls — an AIMessage contains tool_calls wi
Function

createSettings

Create a Settings instance with detected environment.

Function

createSkillsMiddleware

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

Function

createSubAgent

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

Function

createSubAgentMiddleware

Create subagent middleware with task tool

Function

createSummarizationMiddleware

Create summarization middleware with backend support for conversation history offloading.

This middleware:

  1. Monitors conversation length against configured thresholds
  2. When triggered, offloads ol
Function

findProjectRoot

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.

Function

getHarnessProfile

Look up the HarnessProfile for a model spec string.

Resolution order:

  1. Exact match on spec (e.g., "openai:gpt-5.4").
  2. Provider prefix (everything before :) when spec contains
Function

isAsyncSubAgent

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

Function

isSandboxBackend

Type guard to check if a backend supports execution.

Function

isSandboxProtocol

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.

Function

listSkills

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.

Function

normalizeReadPagination

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

Function

parseHarnessProfileConfig

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

Function

parseSkillMetadata

Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.

Function

registerHarnessProfile

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

Function

serializeProfile

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

Function

decidePathAccess

Evaluate permission rules against an operation + path and return the access decision.

First-match-wins; permissive default.

Function

globMatch

Test whether path matches a glob pattern.

Supports:

  • ** — any number of directory levels
  • * — within a single path segment
  • {a,b} — brace expansion

Uses micromatch with dot: true so

Function

validatePath

Canonicalize and validate an absolute path before permission checking.

Throws for:

  • Empty or non-string input
  • Non-absolute paths (must start with /)
  • Paths containing ..
  • Paths containing `~
Function

validatePermissionPaths

Validate permission rule paths at setup time. Throws if any path is relative, contains .., or contains ~.

Function

applyProfilePrompt

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

Function

mergeProfiles

Merge two harness profiles, layering override on top of base.

Merge semantics per field:

Field Strategy
baseSystemPrompt Override wins if not undefined
`sy
Function

validateProfileKey

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.

Function

createHarnessProfile

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

Function

getHarnessProfile

Look up the HarnessProfile for a model spec string.

Resolution order:

  1. Exact match on spec (e.g., "openai:gpt-5.4").
  2. Provider prefix (everything before :) when spec contains
Function

parseHarnessProfileConfig

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

Function

registerHarnessProfile

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

Function

serializeProfile

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

Function

isHarnessProfile

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

Function

applyProfilePrompt

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

Function

createHarnessProfile

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

Function

getHarnessProfile

Look up the HarnessProfile for a model spec string.

Resolution order:

  1. Exact match on spec (e.g., "openai:gpt-5.4").
  2. Provider prefix (everything before :) when spec contains
Function

mergeProfiles

Merge two harness profiles, layering override on top of base.

Merge semantics per field:

Field Strategy
baseSystemPrompt Override wins if not undefined
`sy
Function

parseHarnessProfileConfig

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

Function

registerHarnessProfile

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

Function

serializeProfile

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

Function

listSkills

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.

Function

parseSkillMetadata

Parse YAML frontmatter from a SKILL.md file per Agent Skills spec.

Function

isAnthropicModel

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

Function

isBedrockConverseModel

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

Function

createAgentMemoryMiddleware

deprecated

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

Function

createAgentMemoryMiddleware

deprecated

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

Interfaces

Types

Interface

FormattedContentWithLineNumbers

Interface

BackendProtocolV2

Updated protocol for pluggable memory backends.

Key differences from BackendProtocol:

  • read() returns ReadResult instead of a plain string
  • readRaw() returns ReadRawResult instead of FileData
Interface

DeleteResult

Result from backend delete operations.

Interface

EditResult

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/

Interface

ExecuteResponse

Result of code execution. Simplified schema optimized for LLM consumption.

Interface

FileDownloadResponse

Result of a single file download operation.

Interface

FileInfo

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.

Interface

FileUploadResponse

Result of a single file upload operation.

Interface

GlobResult

Structured result from backend glob operations.

Interface

GrepMatch

Structured grep match entry.

Interface

GrepResult

Structured result from grep/search operations.

Interface

LangSmithCaptureSnapshotOptions

Options for capturing a snapshot from a running sandbox.

Interface

LangSmithSandboxCreateOptions

Options for the LangSmithSandbox.create() static factory.

Interface

LangSmithSandboxOptions

Options for constructing a LangSmithSandbox from an existing Sandbox instance.

Interface

LangSmithSnapshot

Represents a sandbox snapshot.

Snapshots are built from Docker images or captured from running sandboxes. They are used to create new sandboxes.

Interface

LangSmithStartSandboxOptions

Options for starting a stopped sandbox.

Interface

LocalShellBackendOptions

Options for creating a LocalShellBackend instance.

Interface

LsResult

Structured result from backend ls operations.

Interface

ReadRawResult

Structured result from backend readRaw operations.

Interface

ReadResult

Structured result from backend read operations.

Replaces the previous plain string return, giving callers a programmatic way to distinguish errors from content.

Interface

SandboxBackendProtocolV2

Protocol for sandboxed backends with isolated runtime.

Key differences from SandboxBackendProtocol:

  • Extends BackendProtocolV2 instead of BackendProtocol
  • All methods return structured Result types
Interface

SandboxDeleteOptions

Options for deleting a sandbox.

Interface

SandboxGetOrCreateOptions

Options for getting or creating a sandbox.

Interface

SandboxInfo

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.

Interface

SandboxListOptions

Options for listing sandboxes.

Interface

SandboxListResponse

Paginated response from a sandbox list operation.

This structure supports cursor-based pagination for efficiently browsing large collections of sandboxes.

Interface

StoreBackendContext

Context provided to dynamic namespace factory functions.

Interface

StoreBackendOptions

Options for StoreBackend constructor.

Interface

WriteResult

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

Interface

AsyncSubAgent

Specification for an async subagent running on a remote Agent Protocol server.

Async subagents connect to any Agent Protocol-compliant server via the

Interface

AsyncSubAgentMiddlewareOptions

Options for creating async subagent middleware.

Interface

AsyncTask

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

Interface

BackendProtocolV2

Updated protocol for pluggable memory backends.

Key differences from BackendProtocol:

  • read() returns ReadResult instead of a plain string
  • readRaw() returns ReadRawResult instead of FileData
Interface

CompiledSubAgent

Type definitions for pre-compiled agents.

Interface

CompletionCallbackOptions

Options for creating the completion callback middleware.

Interface

DeleteResult

Result from backend delete operations.

Interface

EditResult

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/

Interface

ExecuteResponse

Result of code execution. Simplified schema optimized for LLM consumption.

Interface

FileDownloadResponse

Result of a single file download operation.

Interface

FileInfo

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.

Interface

FilesystemMiddlewareOptions

Options for creating filesystem middleware.

Interface

FilesystemPermission

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

Interface

FileUploadResponse

Result of a single file upload operation.

Interface

GeneralPurposeSubagentConfig

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

Interface

GlobResult

Structured result from backend glob operations.

Interface

GrepMatch

Structured grep match entry.

Interface

GrepResult

Structured result from grep/search operations.

Interface

HarnessProfile

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

Interface

HarnessProfileOptions

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

Interface

LangSmithSandboxCreateOptions

Options for the LangSmithSandbox.create() static factory.

Interface

LangSmithSandboxOptions

Options for constructing a LangSmithSandbox from an existing Sandbox instance.

Interface

LsResult

Structured result from backend ls operations.

Interface

MemoryMiddlewareOptions

Options for the memory middleware.

Interface

ReadRawResult

Structured result from backend readRaw operations.

Interface

ReadResult

Structured result from backend read operations.

Replaces the previous plain string return, giving callers a programmatic way to distinguish errors from content.

Interface

SandboxBackendProtocolV2

Protocol for sandboxed backends with isolated runtime.

Key differences from SandboxBackendProtocol:

  • Extends BackendProtocolV2 instead of BackendProtocol
  • All methods return structured Result types
Interface

SandboxDeleteOptions

Options for deleting a sandbox.

Interface

SandboxGetOrCreateOptions

Options for getting or creating a sandbox.

Interface

SandboxInfo

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.

Interface

SandboxListOptions

Options for listing sandboxes.

Interface

SandboxListResponse

Paginated response from a sandbox list operation.

This structure supports cursor-based pagination for efficiently browsing large collections of sandboxes.

Interface

SkillMetadata

Metadata for a skill per Agent Skills specification.

Interface

SkillsMiddlewareOptions

Options for the skills middleware.

Interface

StoreBackendContext

Context provided to dynamic namespace factory functions.

Interface

StoreBackendOptions

Options for StoreBackend constructor.

Interface

SubAgent

Specification for a declarative subagent.

When using createDeepAgent, subagents automatically receive a default middleware stack (filesystemMiddleware, summarizationMiddleware, etc.) before any cus

Interface

SubAgentMiddlewareOptions

Options for creating subagent middleware

Interface

WriteResult

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

Interface

CreateDeepAgentParams

Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters

Interface

DeepAgent

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

Interface

DeepAgentTypeConfig

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

Interface

DefaultDeepAgentTypeConfig

Default type configuration for deep agents. Used when no explicit type parameters are provided.

Interface

Settings

Settings interface for project detection and path management.

Provides access to:

  • Project root detection (via .git directory)
  • User-level deepagents directory (~/.deepagents)
  • Agent-specific dire
Interface

SettingsOptions

Options for creating a Settings instance.

Interface

AgentMemoryMiddlewareOptions

Options for the agent memory middleware.

Interface

ListSkillsOptions

Options for listing skills.

Interface

LoaderSkillMetadata

Metadata for a skill per Agent Skills spec.

Interface

LocalShellBackendOptions

Options for creating a LocalShellBackend instance.

Interface

AsyncSubAgent

Specification for an async subagent running on a remote Agent Protocol server.

Async subagents connect to any Agent Protocol-compliant server via the

Interface

AsyncSubAgentMiddlewareOptions

Options for creating async subagent middleware.

Interface

AsyncTask

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

Interface

BackendProtocolV2

Updated protocol for pluggable memory backends.

Key differences from BackendProtocol:

  • read() returns ReadResult instead of a plain string
  • readRaw() returns ReadRawResult instead of FileData
Interface

CompiledSubAgent

Type definitions for pre-compiled agents.

Interface

CompletionCallbackOptions

Options for creating the completion callback middleware.

Interface

CreateDeepAgentParams

Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters

Interface

DeepAgent

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

Interface

DeepAgentTypeConfig

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

Interface

DefaultDeepAgentTypeConfig

Default type configuration for deep agents. Used when no explicit type parameters are provided.

Interface

DeleteResult

Result from backend delete operations.

Interface

EditResult

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/

Interface

ExecuteResponse

Result of code execution. Simplified schema optimized for LLM consumption.

Interface

FileDownloadResponse

Result of a single file download operation.

Interface

FileInfo

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.

Interface

FilesystemMiddlewareOptions

Options for creating filesystem middleware.

Interface

FilesystemPermission

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

Interface

FileUploadResponse

Result of a single file upload operation.

Interface

GeneralPurposeSubagentConfig

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

Interface

GlobResult

Structured result from backend glob operations.

Interface

GrepMatch

Structured grep match entry.

Interface

GrepResult

Structured result from grep/search operations.

Interface

HarnessProfile

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

Interface

HarnessProfileOptions

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

Interface

LangSmithCaptureSnapshotOptions

Options for capturing a snapshot from a running sandbox.

Interface

LangSmithSandboxCreateOptions

Options for the LangSmithSandbox.create() static factory.

Interface

LangSmithSandboxOptions

Options for constructing a LangSmithSandbox from an existing Sandbox instance.

Interface

LangSmithSnapshot

Represents a sandbox snapshot.

Snapshots are built from Docker images or captured from running sandboxes. They are used to create new sandboxes.

Interface

LangSmithStartSandboxOptions

Options for starting a stopped sandbox.

Interface

LsResult

Structured result from backend ls operations.

Interface

MemoryMiddlewareOptions

Options for the memory middleware.

Interface

ReadRawResult

Structured result from backend readRaw operations.

Interface

ReadResult

Structured result from backend read operations.

Replaces the previous plain string return, giving callers a programmatic way to distinguish errors from content.

Interface

SandboxBackendProtocolV2

Protocol for sandboxed backends with isolated runtime.

Key differences from SandboxBackendProtocol:

  • Extends BackendProtocolV2 instead of BackendProtocol
  • All methods return structured Result types
Interface

SandboxDeleteOptions

Options for deleting a sandbox.

Interface

SandboxGetOrCreateOptions

Options for getting or creating a sandbox.

Interface

SandboxInfo

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.

Interface

SandboxListOptions

Options for listing sandboxes.

Interface

SandboxListResponse

Paginated response from a sandbox list operation.

This structure supports cursor-based pagination for efficiently browsing large collections of sandboxes.

Interface

Settings

Settings interface for project detection and path management.

Provides access to:

  • Project root detection (via .git directory)
  • User-level deepagents directory (~/.deepagents)
  • Agent-specific dire
Interface

SettingsOptions

Options for creating a Settings instance.

Interface

SkillMetadata

Metadata for a skill per Agent Skills specification.

Interface

SkillsMiddlewareOptions

Options for the skills middleware.

Interface

StoreBackendContext

Context provided to dynamic namespace factory functions.

Interface

StoreBackendOptions

Options for StoreBackend constructor.

Interface

SubAgent

Specification for a declarative subagent.

When using createDeepAgent, subagents automatically receive a default middleware stack (filesystemMiddleware, summarizationMiddleware, etc.) before any cus

Interface

SubAgentMiddlewareOptions

Options for creating subagent middleware

Interface

SubagentRunStream

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

Interface

WriteResult

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

Interface

ContextSize

Context size specification for summarization triggers and retention policies.

Interface

SummarizationMiddlewareOptions

Options for the summarization middleware.

Interface

TruncateArgsSettings

Settings for truncating large tool arguments in old messages.

Interface

AsyncSubAgent

Specification for an async subagent running on a remote Agent Protocol server.

Async subagents connect to any Agent Protocol-compliant server via the

Interface

AsyncSubAgentMiddlewareOptions

Options for creating async subagent middleware.

Interface

AsyncTask

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

Interface

CompiledSubAgent

Type definitions for pre-compiled agents.

Interface

CompletionCallbackOptions

Options for creating the completion callback middleware.

Interface

FilesystemMiddlewareOptions

Options for creating filesystem middleware.

Interface

MemoryMiddlewareOptions

Options for the memory middleware.

Interface

SkillMetadata

Metadata for a skill per Agent Skills specification.

Interface

SkillsMiddlewareOptions

Options for the skills middleware.

Interface

SubAgent

Specification for a declarative subagent.

When using createDeepAgent, subagents automatically receive a default middleware stack (filesystemMiddleware, summarizationMiddleware, etc.) before any cus

Interface

SubAgentMiddlewareOptions

Options for creating subagent middleware

Interface

AgentMemoryMiddlewareOptions

Options for the agent memory middleware.

Interface

AsyncSubAgent

Specification for an async subagent running on a remote Agent Protocol server.

Async subagents connect to any Agent Protocol-compliant server via the

Interface

AsyncSubAgentMiddlewareOptions

Options for creating async subagent middleware.

Interface

AsyncTask

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

Interface

BackendProtocolV2

Updated protocol for pluggable memory backends.

Key differences from BackendProtocol:

  • read() returns ReadResult instead of a plain string
  • readRaw() returns ReadRawResult instead of FileData
Interface

CompiledSubAgent

Type definitions for pre-compiled agents.

Interface

CompletionCallbackOptions

Options for creating the completion callback middleware.

Interface

CreateDeepAgentParams

Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters

Interface

DeepAgent

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

Interface

DeepAgentTypeConfig

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

Interface

DefaultDeepAgentTypeConfig

Default type configuration for deep agents. Used when no explicit type parameters are provided.

Interface

DeleteResult

Result from backend delete operations.

Interface

EditResult

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/

Interface

ExecuteResponse

Result of code execution. Simplified schema optimized for LLM consumption.

Interface

FileDownloadResponse

Result of a single file download operation.

Interface

FileInfo

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.

Interface

FilesystemMiddlewareOptions

Options for creating filesystem middleware.

Interface

FilesystemPermission

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

Interface

FileUploadResponse

Result of a single file upload operation.

Interface

GeneralPurposeSubagentConfig

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

Interface

GlobResult

Structured result from backend glob operations.

Interface

GrepMatch

Structured grep match entry.

Interface

GrepResult

Structured result from grep/search operations.

Interface

HarnessProfile

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

Interface

HarnessProfileOptions

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

Interface

LangSmithCaptureSnapshotOptions

Options for capturing a snapshot from a running sandbox.

Interface

LangSmithSandboxCreateOptions

Options for the LangSmithSandbox.create() static factory.

Interface

LangSmithSandboxOptions

Options for constructing a LangSmithSandbox from an existing Sandbox instance.

Interface

LangSmithSnapshot

Represents a sandbox snapshot.

Snapshots are built from Docker images or captured from running sandboxes. They are used to create new sandboxes.

Interface

LangSmithStartSandboxOptions

Options for starting a stopped sandbox.

Interface

ListSkillsOptions

Options for listing skills.

Interface

LoaderSkillMetadata

Metadata for a skill per Agent Skills spec.

Interface

LocalShellBackendOptions

Options for creating a LocalShellBackend instance.

Interface

LsResult

Structured result from backend ls operations.

Interface

MemoryMiddlewareOptions

Options for the memory middleware.

Interface

ReadRawResult

Structured result from backend readRaw operations.

Interface

ReadResult

Structured result from backend read operations.

Replaces the previous plain string return, giving callers a programmatic way to distinguish errors from content.

Interface

SandboxBackendProtocolV2

Protocol for sandboxed backends with isolated runtime.

Key differences from SandboxBackendProtocol:

  • Extends BackendProtocolV2 instead of BackendProtocol
  • All methods return structured Result types
Interface

SandboxDeleteOptions

Options for deleting a sandbox.

Interface

SandboxGetOrCreateOptions

Options for getting or creating a sandbox.

Interface

SandboxInfo

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.

Interface

SandboxListOptions

Options for listing sandboxes.

Interface

SandboxListResponse

Paginated response from a sandbox list operation.

This structure supports cursor-based pagination for efficiently browsing large collections of sandboxes.

Interface

Settings

Settings interface for project detection and path management.

Provides access to:

  • Project root detection (via .git directory)
  • User-level deepagents directory (~/.deepagents)
  • Agent-specific dire
Interface

SettingsOptions

Options for creating a Settings instance.

Interface

SkillMetadata

Metadata for a skill per Agent Skills specification.

Interface

SkillsMiddlewareOptions

Options for the skills middleware.

Interface

StoreBackendContext

Context provided to dynamic namespace factory functions.

Interface

StoreBackendOptions

Options for StoreBackend constructor.

Interface

SubAgent

Specification for a declarative subagent.

When using createDeepAgent, subagents automatically receive a default middleware stack (filesystemMiddleware, summarizationMiddleware, etc.) before any cus

Interface

SubAgentMiddlewareOptions

Options for creating subagent middleware

Interface

SubagentRunStream

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

Interface

WriteResult

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

Interface

FilesystemPermission

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

Interface

GeneralPurposeSubagentConfig

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

Interface

HarnessProfile

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

Interface

HarnessProfileOptions

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

Interface

ResolveHarnessProfileOpts

Options for resolving a harness profile from model metadata.

Interface

GeneralPurposeSubagentConfig

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

Interface

HarnessProfile

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

Interface

HarnessProfileOptions

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

Interface

ListSkillsOptions

Options for listing skills.

Interface

SkillMetadata

Metadata for a skill per Agent Skills spec.

Interface

SubagentRunStream

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

Interface

CreateDeepAgentParams

Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters

Interface

DeepAgent

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

Interface

DeepAgentTypeConfig

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

Interface

DefaultDeepAgentTypeConfig

Default type configuration for deep agents. Used when no explicit type parameters are provided.

Interface

BackendProtocol

deprecated
Interface

BackendProtocolV1

deprecated

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

Interface

BackendRuntime

deprecated

Agent Runtime with state

Interface

SandboxBackendProtocol

deprecated
Interface

SandboxBackendProtocolV1

deprecated

Protocol for sandboxed backends with isolated runtime. Sandboxed backends run in isolated environments (e.g., containers) and communicate via defined interfaces.

Interface

StateAndStore

deprecated

State and store container for backend initialization.

This provides a clean interface for what backends need to access:

  • state: Current agent state (with files, messages, etc.)
  • store: Optional per
Interface

BackendProtocol

deprecated
Interface

BackendProtocolV1

deprecated

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

Interface

BackendRuntime

deprecated

Agent Runtime with state

Interface

ForkedSubAgent

deprecated

A SubAgent with mode: "fork".

Interface

SandboxBackendProtocol

deprecated
Interface

SandboxBackendProtocolV1

deprecated

Protocol for sandboxed backends with isolated runtime. Sandboxed backends run in isolated environments (e.g., containers) and communicate via defined interfaces.

Interface

StateAndStore

deprecated

State and store container for backend initialization.

This provides a clean interface for what backends need to access:

  • state: Current agent state (with files, messages, etc.)
  • store: Optional per
Interface

SystemPromptConfig

deprecated
Interface

SystemPromptConfig

deprecated
Interface

BackendProtocol

deprecated
Interface

BackendProtocolV1

deprecated

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

Interface

BackendRuntime

deprecated

Agent Runtime with state

Interface

ForkedSubAgent

deprecated

A SubAgent with mode: "fork".

Interface

SandboxBackendProtocol

deprecated
Interface

SandboxBackendProtocolV1

deprecated

Protocol for sandboxed backends with isolated runtime. Sandboxed backends run in isolated environments (e.g., containers) and communicate via defined interfaces.

Interface

StateAndStore

deprecated

State and store container for backend initialization.

This provides a clean interface for what backends need to access:

  • state: Current agent state (with files, messages, etc.)
  • store: Optional per
Interface

SystemPromptConfig

deprecated
Interface

ForkedSubAgent

deprecated

A SubAgent with mode: "fork".

Interface

BackendProtocol

deprecated
Interface

BackendProtocolV1

deprecated

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

Interface

BackendRuntime

deprecated

Agent Runtime with state

Interface

ForkedSubAgent

deprecated

A SubAgent with mode: "fork".

Interface

SandboxBackendProtocol

deprecated
Interface

SandboxBackendProtocolV1

deprecated

Protocol for sandboxed backends with isolated runtime. Sandboxed backends run in isolated environments (e.g., containers) and communicate via defined interfaces.

Interface

StateAndStore

deprecated

State and store container for backend initialization.

This provides a clean interface for what backends need to access:

  • state: Current agent state (with files, messages, etc.)
  • store: Optional per
Interface

SystemPromptConfig

deprecated
Type

AnyBackendProtocol

Union of v1 and v2 backend protocols.

Use this when accepting either protocol version. Pass through adaptBackendProtocol to normalize to BackendProtocolV2.

Type

FileData

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

Type

FileOperationError

Standardized error codes for file upload/download operations.

Type

MaybePromise

Type

SandboxErrorCode

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

StoreBackendNamespaceFactory

Type

AnyBackendProtocol

Union of v1 and v2 backend protocols.

Use this when accepting either protocol version. Pass through adaptBackendProtocol to normalize to BackendProtocolV2.

Type

AsyncTaskStatus

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"

Type

FileData

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

Type

FileOperationError

Standardized error codes for file upload/download operations.

Type

FilesystemOperation

The filesystem operations a permission rule can govern.

Type

FsToolName

Built-in filesystem tool names accepted by createFilesystemMiddleware's tools allowlist.

Type

HarnessProfileConfigData

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().

Type

MaybePromise

Type

PermissionMode

Whether a matched rule permits or blocks the operation.

Type

SandboxErrorCode

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

SkillMetadataEntry

Type for a single skill metadata entry.

Type

StoreBackendNamespaceFactory

Type

AnySubAgent

Any subagent specification — sync, compiled, or async.

Type

ConfigurationErrorCode

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.

Type

DeepAgentRunStream

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

Type

ExtractSubAgentMiddleware

Helper type to extract middleware from a SubAgent definition Handles both mutable and readonly middleware arrays

Type

FlattenSubAgentMiddleware

Helper type to flatten and merge middleware from all subagents

Type

InferDeepAgentSubagents

Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.

Type

InferDeepAgentType

Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.

Type

InferStructuredResponse

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

Type

InferSubagentByName

Helper type to extract a subagent by name from a DeepAgent.

Type

InferSubAgentMiddlewareStates

Helper type to merge states from subagent middleware

Type

InferSubagentReactAgentType

Helper type to extract the ReactAgent type from a subagent definition. This is useful for type-safe streaming of subagent events.

Type

MergedDeepAgentState

Combined state type including custom middleware and subagent middleware states

Type

ResolveDeepAgentTypeConfig

Helper type to resolve a DeepAgentTypeConfig from either:

  • A DeepAgentTypeConfig directly
  • A DeepAgent instance (using typeof agent)
Type

SupportedResponseFormat

Union of all response format types accepted by createDeepAgent.

Matches the formats supported by LangChain's createAgent:

  • ToolStrategy<T> — from ToolStrategy.fromSchema(schema)
  • `ProviderS
Type

ConfigurationErrorCode

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.

Type

AnyBackendProtocol

Union of v1 and v2 backend protocols.

Use this when accepting either protocol version. Pass through adaptBackendProtocol to normalize to BackendProtocolV2.

Type

AnySubAgent

Any subagent specification — sync, compiled, or async.

Type

AsyncTaskStatus

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"

Type

ConfigurationErrorCode

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.

Type

DeepAgentRunStream

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

Type

ExtractSubAgentMiddleware

Helper type to extract middleware from a SubAgent definition Handles both mutable and readonly middleware arrays

Type

FileData

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

Type

FileOperationError

Standardized error codes for file upload/download operations.

Type

FilesystemOperation

The filesystem operations a permission rule can govern.

Type

FlattenSubAgentMiddleware

Helper type to flatten and merge middleware from all subagents

Type

FsToolName

Built-in filesystem tool names accepted by createFilesystemMiddleware's tools allowlist.

Type

HarnessProfileConfigData

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().

Type

InferDeepAgentSubagents

Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.

Type

InferDeepAgentType

Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.

Type

InferStructuredResponse

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

Type

InferSubagentByName

Helper type to extract a subagent by name from a DeepAgent.

Type

InferSubAgentMiddlewareStates

Helper type to merge states from subagent middleware

Type

InferSubagentReactAgentType

Helper type to extract the ReactAgent type from a subagent definition. This is useful for type-safe streaming of subagent events.

Type

MaybePromise

Type

MergedDeepAgentState

Combined state type including custom middleware and subagent middleware states

Type

PermissionMode

Whether a matched rule permits or blocks the operation.

Type

ResolveDeepAgentTypeConfig

Helper type to resolve a DeepAgentTypeConfig from either:

  • A DeepAgentTypeConfig directly
  • A DeepAgent instance (using typeof agent)
Type

SandboxErrorCode

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

SkillMetadataEntry

Type for a single skill metadata entry.

Type

StoreBackendNamespaceFactory

Type

SupportedResponseFormat

Union of all response format types accepted by createDeepAgent.

Matches the formats supported by LangChain's createAgent:

  • ToolStrategy<T> — from ToolStrategy.fromSchema(schema)
  • `ProviderS
Type

SkillsMiddleware

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

Type

SummarizationEvent

Represents a summarization event that tracks what was summarized and where the cutoff is.

Type

AsyncTaskStatus

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"

Type

FsToolName

Built-in filesystem tool names accepted by createFilesystemMiddleware's tools allowlist.

Type

SkillMetadataEntry

Type for a single skill metadata entry.

Type

AnyBackendProtocol

Union of v1 and v2 backend protocols.

Use this when accepting either protocol version. Pass through adaptBackendProtocol to normalize to BackendProtocolV2.

Type

AnySubAgent

Any subagent specification — sync, compiled, or async.

Type

AsyncTaskStatus

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"

Type

ConfigurationErrorCode

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.

Type

DeepAgentRunStream

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

Type

ExtractSubAgentMiddleware

Helper type to extract middleware from a SubAgent definition Handles both mutable and readonly middleware arrays

Type

FileData

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

Type

FileOperationError

Standardized error codes for file upload/download operations.

Type

FilesystemOperation

The filesystem operations a permission rule can govern.

Type

FlattenSubAgentMiddleware

Helper type to flatten and merge middleware from all subagents

Type

FsToolName

Built-in filesystem tool names accepted by createFilesystemMiddleware's tools allowlist.

Type

HarnessProfileConfigData

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().

Type

InferDeepAgentSubagents

Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.

Type

InferDeepAgentType

Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.

Type

InferStructuredResponse

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

Type

InferSubagentByName

Helper type to extract a subagent by name from a DeepAgent.

Type

InferSubAgentMiddlewareStates

Helper type to merge states from subagent middleware

Type

InferSubagentReactAgentType

Helper type to extract the ReactAgent type from a subagent definition. This is useful for type-safe streaming of subagent events.

Type

MaybePromise

Type

MergedDeepAgentState

Combined state type including custom middleware and subagent middleware states

Type

PermissionMode

Whether a matched rule permits or blocks the operation.

Type

ResolveDeepAgentTypeConfig

Helper type to resolve a DeepAgentTypeConfig from either:

  • A DeepAgentTypeConfig directly
  • A DeepAgent instance (using typeof agent)
Type

SandboxErrorCode

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

SkillMetadataEntry

Type for a single skill metadata entry.

Type

StoreBackendNamespaceFactory

Type

SupportedResponseFormat

Union of all response format types accepted by createDeepAgent.

Matches the formats supported by LangChain's createAgent:

  • ToolStrategy<T> — from ToolStrategy.fromSchema(schema)
  • `ProviderS
Type

FilesystemOperation

The filesystem operations a permission rule can govern.

Type

PermissionMode

Whether a matched rule permits or blocks the operation.

Type

HarnessProfileConfigData

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().

Type

HarnessProfileConfigData

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().

Type

DeepAgentRunStream

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

Type

NamedSubagentRunStream

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

Type

SubagentOutputOf

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.

Type

SubagentRunStreamUnion

Discriminated union of SubagentRunStream variants, one per subagent in TSubagents. Enables TypeScript to narrow .output when the consumer checks sub.name === "someSubagentName".

Type

SubagentToolsOf

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

Type

AnySubAgent

Any subagent specification — sync, compiled, or async.

Type

ExtractSubAgentMiddleware

Helper type to extract middleware from a SubAgent definition Handles both mutable and readonly middleware arrays

Type

FlattenSubAgentMiddleware

Helper type to flatten and merge middleware from all subagents

Type

InferCompiledSubagents

Helper type to extract CompiledSubAgent (subagents with runnable) from a DeepAgent. Uses Extract to filter for subagents that have a runnable property.

Type

InferDeepAgentSubagents

Shorthand helper to extract the Subagents type from a DeepAgentTypeConfig or DeepAgent.

Type

InferDeepAgentType

Helper type to extract any property from a DeepAgentTypeConfig or DeepAgent.

Type

InferOptionalMiddleware

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

Type

InferRegularSubagents

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.

Type

InferStructuredResponse

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

Type

InferSubagentByName

Helper type to extract a subagent by name from a DeepAgent.

Type

InferSubAgentMiddlewareStates

Helper type to merge states from subagent middleware

Type

InferSubagentReactAgentType

Helper type to extract the ReactAgent type from a subagent definition. This is useful for type-safe streaming of subagent events.

Type

MergedDeepAgentState

Combined state type including custom middleware and subagent middleware states

Type

ResolveDeepAgentTypeConfig

Helper type to resolve a DeepAgentTypeConfig from either:

  • A DeepAgentTypeConfig directly
  • A DeepAgent instance (using typeof agent)
Type

SupportedResponseFormat

Union of all response format types accepted by createDeepAgent.

Matches the formats supported by LangChain's createAgent:

  • ToolStrategy<T> — from ToolStrategy.fromSchema(schema)
  • `ProviderS
Type

BackendFactory

deprecated

Factory function type for creating backend instances.

Backends receive BackendRuntime which contains the current state and runtime information, extracted from the execution context.

Type

BackendFactory

deprecated

Factory function type for creating backend instances.

Backends receive BackendRuntime which contains the current state and runtime information, extracted from the execution context.

Type

BackendFactory

deprecated

Factory function type for creating backend instances.

Backends receive BackendRuntime which contains the current state and runtime information, extracted from the execution context.

Type

BackendFactory

deprecated

Factory function type for creating backend instances.

Backends receive BackendRuntime which contains the current state and runtime information, extracted from the execution context.