Hunter Lovell 04cc3fc260 fix(deepagents): propagate subagent lc_agent_name for delegated tasks (#566)
## Summary

Fixes #206.

This updates deepagents subagent delegation so tool executions can
reliably identify the active subagent via
`config.metadata.lc_agent_name` instead of inheriting the parent agent
name. It also adds focused regression tests that validate both compiled
subagents and standard subagent specs follow the same metadata behavior.

## Changes

### `libs/deepagents` subagent metadata propagation

- Updated `createTaskTool` subagent invocation config to explicitly set:
  - `metadata.lc_agent_name = subagent_type`
- existing `configurable.ls_agent_type = "subagent"` behavior remains
unchanged
- Added new regression coverage in `subagent.test.ts`:
  - compiled subagent (`runnable`) path
  - standard subagent spec (`systemPrompt/tools/model`) path
- Tests assert tool-time metadata receives the delegated subagent name
(`worker`), preventing parent-name leakage.

### `libs/deepagents` dependency range update

- Bumped `langsmith` peer dependency range in
`libs/deepagents/package.json` from `>=0.6.0 <1.0.0` to `^0.7.1`.
- Updated `pnpm-lock.yaml` accordingly.
2026-06-01 12:54:59 -07:00
2025-08-05 10:25:41 -04:00
2025-08-05 11:47:34 -07:00
2026-01-09 15:10:42 -08:00

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:

  • Planningwrite_todos for task breakdown and progress tracking
  • Filesystemread_file, write_file, edit_file, ls, glob, grep for working memory
  • Sub-agentstask 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
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.

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

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.

S
Description
Latest
2026-05-13 09:39:28 -04:00
Languages
TypeScript 100%