Commit Graph

210 Commits

Author SHA1 Message Date
github-actions[bot] 5af75fffbe chore: version packages (#726)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents-acp@0.1.23

### Patch Changes

- Updated dependencies
[[`590c2a5`](https://github.com/langchain-ai/deepagentsjs/commit/590c2a5042473f096d5fac5ddbb4be96e2ace0f2)]:
  - deepagents@1.12.2
## deepagents@1.12.2

### Patch Changes

- [#723](https://github.com/langchain-ai/deepagentsjs/pull/723)
[`590c2a5`](https://github.com/langchain-ai/deepagentsjs/commit/590c2a5042473f096d5fac5ddbb4be96e2ace0f2)
Thanks
[@thushanth-bengre-langchain](https://github.com/thushanth-bengre-langchain)!
- fix(deepagents): prevent stack overflow in CompositeBackend grep/glob
on huge result sets, and add a grep match-count cap

`CompositeBackend` accumulated merged `ls`/`grep`/`glob` results with
`push(...entries)`, which passes every entry as a separate function
argument and overflows the call stack (RangeError: Maximum call stack
size exceeded) when a broad search over a large tree returns hundreds of
thousands of entries. Results are now accumulated with a plain loop, so
no result-set size can overflow the stack.

`grep` also gains an optional `maxCount` (backend) / `max_count` (tool)
cap, mirroring the Python SDK. When the cap is hit, results are flagged
`truncated: true` on `GrepResult`/`GlobResult` and the grep tool appends
a note telling the model to narrow the search. The cap defaults to 1000
via the `grepMaxCount` middleware option (set to `null` to disable).
`CompositeBackend` splits the budget across routed backends and
OR-propagates the `truncated` flag on merged results.
## @deepagents/evals@0.0.22

### Patch Changes

- Updated dependencies
[[`590c2a5`](https://github.com/langchain-ai/deepagentsjs/commit/590c2a5042473f096d5fac5ddbb4be96e2ace0f2)]:
  - deepagents@1.12.2

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-04 15:20:01 -04:00
thushanth-bengre-langchain 590c2a5042 fix(deepagents): prevent stack overflow in CompositeBackend grep/glob (#723)
## Summary

- Fixes `RangeError: Maximum call stack size exceeded` from
`CompositeBackend.glob`/`grep` when a broad search (e.g.
`**/*.{ts,tsx,...}` at `/`) returns hundreds of thousands of entries.
Root cause: results were merged with `push(...entries)`, which passes
each entry as a separate function argument and overflows V8's
argument-stack limit. Now accumulated with a plain loop.
- Ports the Python SDK's grep match-count cap (`ef591e7`): optional
`maxCount` backend param / `max_count` tool arg, `grepMaxCount`
middleware option (default 1000, `null` disables), `truncated` flag on
`GrepResult`/`GlobResult`, and a truncation note in the grep tool
output. `CompositeBackend` splits the budget across routes and
OR-propagates `truncated`.

## Backward compatibility

- `truncated` is optional; `maxCount` defaults to unset everywhere. No
required changes for existing or new users.

## Test plan

- [x] Regression test: mocked backend returning 200k entries —
`glob`/`grep` complete without `RangeError` (verified it fails with the
old spread).
- [x] Cap enforcement, `truncated` propagation across composite routes,
middleware note rendering.
- [x] `pnpm test` (format + lint + all lib tests) passes.
2026-08-04 11:27:03 -07:00
github-actions[bot] 064b1724de chore: version packages (#715)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents-acp@0.1.22

### Patch Changes

- Updated dependencies
[[`ffec5de`](https://github.com/langchain-ai/deepagentsjs/commit/ffec5de0e66ed5ab64bc4c6bee2ff90effb4bfa1)]:
  - deepagents@1.12.1
## deepagents@1.12.1

### Patch Changes

- [#713](https://github.com/langchain-ai/deepagentsjs/pull/713)
[`ffec5de`](https://github.com/langchain-ai/deepagentsjs/commit/ffec5de0e66ed5ab64bc4c6bee2ff90effb4bfa1)
Thanks [@gethin-langchain](https://github.com/gethin-langchain)! -
fix(deepagents): grep/glob match when `path` points directly at a file
## @deepagents/evals@0.0.21

### Patch Changes

- Updated dependencies
[[`ffec5de`](https://github.com/langchain-ai/deepagentsjs/commit/ffec5de0e66ed5ab64bc4c6bee2ff90effb4bfa1)]:
  - deepagents@1.12.1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-31 08:10:45 +00:00
gethin-langchain ffec5de0e6 fix(deepagents): grep/glob match when path points directly at a file (#713)
## Summary
- `grep`/`glob` on `StateBackend`/`StoreBackend` returned zero matches
whenever `path` pointed at an exact file (no glob) — the shared
`validatePath` helper forced a trailing `/` before prefix-matching, so a
file's own key could never match itself+`/`.
- Added a `filterFilesByPath` helper that checks for an exact key match
in the files map first, falling back to the existing directory-prefix
behavior otherwise.

## Test plan
- [x] Added regression tests in `utils.test.ts`: exact-file path (no
glob) for grep and glob, plus directory + glob/filename non-regression
cases for both.
- [x] `pnpm --filter deepagents test` — all tests pass.
2026-07-31 00:54:11 -07:00
github-actions[bot] bed2d344bc chore: version packages (#712)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents@1.12.0

### Minor Changes

- [#703](https://github.com/langchain-ai/deepagentsjs/pull/703)
[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126)
Thanks [@hntrl](https://github.com/hntrl)! - feat(deepagents): adopt
more minimal prompting

We've observed that current models don't need as verbose of prompting
guidance, so we're reducing the amount of perscriptive guidance that
deepagents has. This is reflected in the generic system prompt (which is
now blank), and in the tool descriptions (which have been simplified).

- [#708](https://github.com/langchain-ai/deepagentsjs/pull/708)
[`1225a7f`](https://github.com/langchain-ai/deepagentsjs/commit/1225a7ff8673686c2a3c0411636a9511b7d8d0d0)
Thanks [@hntrl](https://github.com/hntrl)! - feat(deepagents): make todo
middleware opt-in

- [#674](https://github.com/langchain-ai/deepagentsjs/pull/674)
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)
Thanks [@hntrl](https://github.com/hntrl)! - feat(filesystem): allow
`write_file` to create missing files or completely replace existing
files
## deepagents-acp@0.1.21

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`1225a7f`](https://github.com/langchain-ai/deepagentsjs/commit/1225a7ff8673686c2a3c0411636a9511b7d8d0d0),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0
## @langchain/node-vfs@1.0.0

### Patch Changes

- [#674](https://github.com/langchain-ai/deepagentsjs/pull/674)
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)
Thanks [@hntrl](https://github.com/hntrl)! - fix: allow
`VfsBackend.write` to overwrite existing files while continuing to
reject symlinks
## @langchain/daytona@1.0.0


## @langchain/deno@1.0.0


## @langchain/modal@1.0.0


## @langchain/quickjs@1.0.0


## @langchain/sandbox-standard-tests@2.0.0


## @deepagents/evals@0.0.20

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`1225a7f`](https://github.com/langchain-ai/deepagentsjs/commit/1225a7ff8673686c2a3c0411636a9511b7d8d0d0),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-29 09:47:28 -07:00
Hunter Lovell b177148922 chore: exit pre-release (#711) 2026-07-29 09:26:40 -07:00
github-actions[bot] 149f4585f1 chore: version packages (rc) (#709)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## deepagents@1.12.0-rc.1

### Minor Changes

- [#708](https://github.com/langchain-ai/deepagentsjs/pull/708)
[`1225a7f`](https://github.com/langchain-ai/deepagentsjs/commit/1225a7ff8673686c2a3c0411636a9511b7d8d0d0)
Thanks [@hntrl](https://github.com/hntrl)! - feat(deepagents): make todo
middleware opt-in
## deepagents-acp@0.1.21-rc.1

### Patch Changes

- Updated dependencies
[[`1225a7f`](https://github.com/langchain-ai/deepagentsjs/commit/1225a7ff8673686c2a3c0411636a9511b7d8d0d0)]:
  - deepagents@1.12.0-rc.1
## @deepagents/evals@0.0.20-rc.1

### Patch Changes

- Updated dependencies
[[`1225a7f`](https://github.com/langchain-ai/deepagentsjs/commit/1225a7ff8673686c2a3c0411636a9511b7d8d0d0)]:
  - deepagents@1.12.0-rc.1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-27 08:48:51 -07:00
Hunter Lovell 1225a7ff86 feat(deepagents): make todo middleware opt-in (#708)
## Summary

Makes `todoListMiddleware` opt-in. Default agents and default subagents
no longer expose `write_todos` or the `todos` state channel, reducing
the default tool surface while preserving explicit opt-in.

## Changes

- Remove default todo middleware from the main, general-purpose, and
declarative subagent stacks.
- Preserve opt-in support through `middleware: [todoListMiddleware()]`;
declarative subagents opt in through their own middleware.
- Remove `write_todos` from always-present tool typing and built-in
name-collision handling.
- Update state and subagent documentation plus shared runtime assertions
for the optional todo state/tool.

### Harness profiles and coverage

- Re-add todo middleware in the Codex harness profile because its
model-specific prompt requires `write_todos`
- Apply profile `extraMiddleware` to subagent stacks, with profile
factories creating fresh instances per stack.
- Add coverage for default exclusion, explicit opt-in,
main/GP/declarative isolation, profile middleware propagation, and type
inference.
2026-07-24 15:40:43 -07:00
github-actions[bot] a55022dc2f chore: version packages (rc) (#699)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## deepagents@1.12.0-rc.0

### Minor Changes

- [#703](https://github.com/langchain-ai/deepagentsjs/pull/703)
[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126)
Thanks [@hntrl](https://github.com/hntrl)! - feat(deepagents): adopt
more minimal prompting

We've observed that current models don't need as verbose of prompting
guidance, so we're reducing the amount of perscriptive guidance that
deepagents has. This is reflected in the generic system prompt (which is
now blank), and in the tool descriptions (which have been simplified).

- [#674](https://github.com/langchain-ai/deepagentsjs/pull/674)
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)
Thanks [@hntrl](https://github.com/hntrl)! - feat(filesystem): allow
`write_file` to create missing files or completely replace existing
files
## deepagents-acp@0.1.21-rc.0

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0-rc.0
## @langchain/daytona@1.0.0-rc.0

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0-rc.0
## @langchain/deno@1.0.0-rc.0

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0-rc.0
## @langchain/modal@1.0.0-rc.0

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0-rc.0
## @langchain/node-vfs@1.0.0-rc.0

### Patch Changes

- [#674](https://github.com/langchain-ai/deepagentsjs/pull/674)
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)
Thanks [@hntrl](https://github.com/hntrl)! - fix: allow
`VfsBackend.write` to overwrite existing files while continuing to
reject symlinks

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0-rc.0
## @langchain/quickjs@1.0.0-rc.0

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0-rc.0
## @langchain/sandbox-standard-tests@2.0.0-rc.0

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0-rc.0
## @deepagents/evals@0.0.20-rc.0

### Patch Changes

- Updated dependencies
[[`d25097f`](https://github.com/langchain-ai/deepagentsjs/commit/d25097f78d0e66741da34e1d74551f3c19991126),
[`dd142fe`](https://github.com/langchain-ai/deepagentsjs/commit/dd142fe4fc54c986d5bcf51211d9a839a427e931)]:
  - deepagents@1.12.0-rc.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-23 21:18:40 -07:00
Hunter Lovell d25097f78d feat(deepagents): simplify prompting (#703)
## Summary

The SDK currently ships authored base prose plus middleware guidance
that largely duplicates the tool schemas. This change adopts a more lean
default: no authored base prompt, no duplicate built-in usage prose, and
concise tool descriptions.

Skills, memory, custom system prompts, custom tool descriptions, and
required filesystem routing context remain intact. The legacy
base-prompt surface is removed rather than preserved as a default path.

## Changes

### Default prompt

- Remove the authored default base prompt and its obsolete public
surface.
- Suppress LangChain's default todo middleware prompt while leaving
deepagents-owned middleware prompt-free by default.
- Remove unused filesystem, subagent, async-subagent, and execution
prompt constants and exports.

### Durable tool guidance

- Keep large-result recovery guidance in `read_file` and `grep`
descriptions.
- Keep async task status freshness guidance in `check_async_task` and
`list_async_tasks` descriptions.
- Trim filesystem and task descriptions to their purpose and
load-bearing constraints.
- Build grep and execute descriptions from the configured filesystem
tool set so they do not recommend unavailable tools.

### Token impact

Offline (`o200k_base`, default-agent tool schemas):

| Tool | Before | After | Delta |
| --- | ---: | ---: | ---: |
| `task` | 1,664 | 389 | -77% |
| `read_file` | 728 | 494 | -32% |
| `grep` | 688 | 555 | -19% |
| `edit_file` | 273 | 257 | -6% |
| `glob` | 217 | 172 | -21% |
| `write_file` | 177 | 177 | — |
| `delete` | 146 | 146 | — |
| `ls` | 111 | 111 | — |
| **Total** | **4,005** | **2,302** | **-43%** |

For a default-agent `hello` turn, input tokens drop from 5,395 to 1,895
(-65%).

### Evaluation results

The lean prompt matched the baseline on correctness (0.81) and solve
rate (0.635 vs. 0.634). Unified evaluation macro and micro scores
improved from 0.413 to 0.437 and from 0.371 to 0.394, respectively. (see
more detailed results in
https://github.com/langchain-ai/deepagents/pull/5009 and
https://github.com/langchain-ai/deepagents/pull/4859)
2026-07-23 21:06:12 -07:00
Hunter Lovell ef794da80b chore: rc pre-release (#701) 2026-07-23 18:56:03 -07:00
Hunter Lovell dd142fe4fc feat(deepagents): allow write_file to overwrite files (#674)
## Summary

`write_file` now creates missing files and replaces existing files
entirely, removing the previous create-only error path while preserving
write permissions and symlink protections.

## Changes

### deepagents filesystem backends

- Updated `FilesystemBackend`, `StateBackend`, `StoreBackend`,
`BaseSandbox`, and `node-vfs` write behavior to allow full-file
replacement on existing paths.
- Preserved path safety and symlink protections in filesystem-backed
writes.
- Removed the sandbox existence precheck so writes rely on the
upload/write transport.

### Tool prompts and examples

- Aligned the `write_file` tool description and schema text with the
Python SDK wording.
- Updated sandbox example prompts so `write_file` is described as
creating or fully replacing files.

### Tests and evals

- Updated backend, middleware, and shared sandbox standard tests that
previously expected an existing-file error.
- Added overwrite coverage for filesystem, sandbox, state, store,
middleware, node-vfs, and file-operation evals.

### Release

- Added a changeset for `deepagents` documenting the new overwrite
behavior.
2026-07-22 16:10:05 -07:00
github-actions[bot] 60e32118b0 chore: version packages (#694)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents-acp@0.1.20

### Patch Changes

- Updated dependencies
[[`2ebb178`](https://github.com/langchain-ai/deepagentsjs/commit/2ebb1785e4625ecf82635582e17fe41fbfbac603)]:
  - deepagents@1.11.1
## deepagents@1.11.1

### Patch Changes

- [#693](https://github.com/langchain-ai/deepagentsjs/pull/693)
[`2ebb178`](https://github.com/langchain-ai/deepagentsjs/commit/2ebb1785e4625ecf82635582e17fe41fbfbac603)
Thanks [@colifran](https://github.com/colifran)! - fix(deepagents):
return recoverable errors for invalid/denied filesystem tool paths
instead of throwing
## @deepagents/evals@0.0.19

### Patch Changes

- Updated dependencies
[[`2ebb178`](https://github.com/langchain-ai/deepagentsjs/commit/2ebb1785e4625ecf82635582e17fe41fbfbac603)]:
  - deepagents@1.11.1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-17 15:10:22 -07:00
Colin Francis 2ebb1785e4 fix(deepagents): return recoverable errors for invalid/denied filesystem tool paths instead of throwing (#693)
### Summary

Invalid (non-absolute, `..`, or `~`) or denied filesystem paths passed
by an agent cause the tool to throw which raises a `MiddlewareError` and
causes the whole agent run to crash.

This PR replaces `enforcePermission` which was re-validating the path
without a try/catch with `checkPermission` which returns the error to
the model as a normal tool result so the model can correct the path and
try again instead of crashing.

### Tests

Updated the three permission suites to assert an error result instead of
a throw and added a regression block for `~`/relative/`..` paths that
returns a recoverable error and never calls the backend.
2026-07-17 14:58:14 -07:00
github-actions[bot] f127e3d442 chore: version packages (#676)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents@1.11.0

### Minor Changes

- [#671](https://github.com/langchain-ai/deepagentsjs/pull/671)
[`6ae9d1e`](https://github.com/langchain-ai/deepagentsjs/commit/6ae9d1eab92131ea9cfd7bef024cf1ab343641ea)
Thanks [@hntrl](https://github.com/hntrl)! - feat(filesystem): add
allowlist for filesystem middleware tools

- [#669](https://github.com/langchain-ai/deepagentsjs/pull/669)
[`4643148`](https://github.com/langchain-ai/deepagentsjs/commit/4643148e8b64c796d3144210bac3ad1c6f5b2091)
Thanks [@hntrl](https://github.com/hntrl)! - feat(deepagents): add
structured system prompt configuration

- [#673](https://github.com/langchain-ai/deepagentsjs/pull/673)
[`eb18c70`](https://github.com/langchain-ai/deepagentsjs/commit/eb18c70d8d0871bc72aeb8be6581a98506829c6f)
Thanks [@hntrl](https://github.com/hntrl)! - feat(backends): add delete
protocol support

Adds a `DeleteResult` type and optional backend `delete` method,
preserves delete through backend protocol adaptation, and implements
file deletion across the built-in state, store, filesystem, composite,
context hub, sandbox, and node-vfs backends.

### Patch Changes

- [#691](https://github.com/langchain-ai/deepagentsjs/pull/691)
[`39a7049`](https://github.com/langchain-ai/deepagentsjs/commit/39a7049e4dbf99a31223c4e31cf79a2ed5115634)
Thanks [@colifran](https://github.com/colifran)! - fix(deepagents):
backend adapter drops route prefixes

- [#672](https://github.com/langchain-ai/deepagentsjs/pull/672)
[`cc26c41`](https://github.com/langchain-ai/deepagentsjs/commit/cc26c41df2851acacc86a743878b5c847a8f5d59)
Thanks [@hntrl](https://github.com/hntrl)! - fix(deepagents): allow
custom middleware to replace defaults by name
## deepagents-acp@0.1.19

### Patch Changes

- Updated dependencies
[[`39a7049`](https://github.com/langchain-ai/deepagentsjs/commit/39a7049e4dbf99a31223c4e31cf79a2ed5115634),
[`6ae9d1e`](https://github.com/langchain-ai/deepagentsjs/commit/6ae9d1eab92131ea9cfd7bef024cf1ab343641ea),
[`cc26c41`](https://github.com/langchain-ai/deepagentsjs/commit/cc26c41df2851acacc86a743878b5c847a8f5d59),
[`4643148`](https://github.com/langchain-ai/deepagentsjs/commit/4643148e8b64c796d3144210bac3ad1c6f5b2091),
[`eb18c70`](https://github.com/langchain-ai/deepagentsjs/commit/eb18c70d8d0871bc72aeb8be6581a98506829c6f)]:
  - deepagents@1.11.0
## @langchain/node-vfs@0.2.1

### Patch Changes

- [#673](https://github.com/langchain-ai/deepagentsjs/pull/673)
[`eb18c70`](https://github.com/langchain-ai/deepagentsjs/commit/eb18c70d8d0871bc72aeb8be6581a98506829c6f)
Thanks [@hntrl](https://github.com/hntrl)! - feat(backends): add delete
protocol support

Adds a `DeleteResult` type and optional backend `delete` method,
preserves delete through backend protocol adaptation, and implements
file deletion across the built-in state, store, filesystem, composite,
context hub, sandbox, and node-vfs backends.
## @deepagents/evals@0.0.18

### Patch Changes

- Updated dependencies
[[`39a7049`](https://github.com/langchain-ai/deepagentsjs/commit/39a7049e4dbf99a31223c4e31cf79a2ed5115634),
[`6ae9d1e`](https://github.com/langchain-ai/deepagentsjs/commit/6ae9d1eab92131ea9cfd7bef024cf1ab343641ea),
[`cc26c41`](https://github.com/langchain-ai/deepagentsjs/commit/cc26c41df2851acacc86a743878b5c847a8f5d59),
[`4643148`](https://github.com/langchain-ai/deepagentsjs/commit/4643148e8b64c796d3144210bac3ad1c6f5b2091),
[`eb18c70`](https://github.com/langchain-ai/deepagentsjs/commit/eb18c70d8d0871bc72aeb8be6581a98506829c6f)]:
  - deepagents@1.11.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-15 21:08:41 -07:00
Colin Francis 39a7049e4d fix(deepagents): backend adapter drops route prefixes (#691)
### Summary

`adaptBackendProtocol` rebuilds the backend into a v2 backend protocol
but drops its `routePrefixes`. Since `resolveBackend` runs every backend
through the adapter, a resolved `CompositeBackend` was no longer
detected as composite. That made the execute tool's guard fail at
invocation and disable the execute tool even when filesystem permissions
were correctly scoped to composite routes.

This PR fixes this by forwarding `routePrefixes` through
`adaptBackendProtocol` instead of dropping them.

### Tests

Added unit tests in backends/utils.test.ts to verify that
`routePrefixes` is forwarded through `adaptBackendProtocol` and
`adaptSandboxProtocol` and not added for non-composite backends.
2026-07-15 20:25:35 -07:00
Hunter Lovell cc26c41df2 fix(deepagents): merge custom middleware by name (#672)
## Summary

Adds middleware override behavior to replace default middleware by
`.name` instead of always being appended.

## Changes

- Add name-keyed middleware merging so custom middleware replaces
matching default middleware in-place and appends novel middleware after
the core stack.
- Apply default-slot middleware overrides consistently when constructing
main-agent and subagent middleware stacks, while preventing parent-only
middleware from propagating unless it matches a subagent default slot.
- Move harness tool exclusion into a private `_ToolExclusionMiddleware`
helper so excluded tools are stripped after tool-injecting middleware
has run.
- Add coverage for main-agent replacement, subagent/default override
propagation, parent-only middleware isolation, profile exclusions,
tool-exclusion ordering, and merge precedence.
2026-07-14 19:08:52 -07:00
Hunter Lovell f09bc61d7a feat(deepagents): implement delete across backends (#680)
## Summary

Implements the optional backend `delete` protocol across the built-in
backend implementations now that the delete protocol surface is
available. This keeps delete behavior backend-local and does not expose
a new filesystem tool to agents.

## Changes

### deepagents

- Implements `delete(filePath)` for filesystem, store, composite,
context hub, and sandbox backends.
- Uses backend-specific safety semantics: filesystem deletion goes
through existing path resolution and only unlinks files, store deletion
treats paths as exact keys, context hub deletion commits null entries,
and sandbox deletion uses shell-quoted `rm -f`.
- Adds tests covering successful deletion, missing paths, directory
rejection where applicable, composite route path restoration, store
wildcard literal behavior, and context hub cache updates/failure
handling.

### @langchain/node-vfs

- Implements `delete(filePath)` for the VFS backend.
- Adds tests for file deletion, missing paths, directory rejection, and
preserving non-target files.
2026-07-14 17:31:16 -07:00
Hunter Lovell 6ae9d1eab9 feat(deepagents): add filesystem tool allowlist (#671)
## Summary

Adds a `tools` allowlist option to `createFilesystemMiddleware` so
callers can restrict which built-in filesystem tools are exposed to the
model. The middleware now builds the filesystem system prompt from the
tools that are actually visible on the request, avoiding instructions
for tools that were filtered by the allowlist or backend capability
checks.

## Changes

- Adds a public `FsToolName` type and `tools` option to
`FilesystemMiddlewareOptions`.
- Filters filesystem middleware tools at construction time when an
explicit allowlist is provided, while preserving existing `execute`
backend capability filtering.
- Requires `read_file` in explicit allowlists because it is needed for
filesystem workflows and large-result recovery.
- Generates the filesystem tool prompt dynamically from visible
filesystem tools, and only appends execute-specific instructions when
`execute` is actually available.
- Adds unit and integration coverage for allowlist behavior, prompt
filtering, unsupported `execute`, and user-provided non-filesystem
tools.
2026-07-14 13:42:55 -07:00
Hunter Lovell eb18c70d8d feat(deepagents): add delete protocol support (#673)
## Summary

Adds protocol-level delete support for deepagents backends.

## Changes

### deepagents

- Adds `DeleteResult` to the backend protocol exports.
- Adds optional `delete(filePath)` support to v1 and v2 backend
protocols.
- Preserves optional delete implementations when adapting backends to
the v2 protocol.
- Implements `StateBackend.delete()` for zero-argument StateBackend
instances by sending `{ [filePath]: null }` through `__pregel_send`.
- Adds a changeset for the new backend protocol capability.
2026-07-14 10:20:08 -07:00
Hunter Lovell 4643148e8b feat(deepagents): add structured system prompt configuration (#669)
## Summary

Ports the system prompt configuration in langchain-ai/deepagents#4437
2026-07-13 16:24:56 -07:00
github-actions[bot] 4507acd92e chore: version packages (#670)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents-acp@0.1.18

### Patch Changes

- Updated dependencies
[[`7c8a770`](https://github.com/langchain-ai/deepagentsjs/commit/7c8a770fac90fd50dfe08af67a0ce073a33e4ef7)]:
  - deepagents@1.10.8
## deepagents@1.10.8

### Patch Changes

- [#668](https://github.com/langchain-ai/deepagentsjs/pull/668)
[`7c8a770`](https://github.com/langchain-ai/deepagentsjs/commit/7c8a770fac90fd50dfe08af67a0ce073a33e4ef7)
Thanks [@colifran](https://github.com/colifran)! - fix(deepagents):
fast-glob follows directory symlink cycles leading to ELOOP crashes
## @deepagents/evals@0.0.17

### Patch Changes

- Updated dependencies
[[`7c8a770`](https://github.com/langchain-ai/deepagentsjs/commit/7c8a770fac90fd50dfe08af67a0ce073a33e4ef7)]:
  - deepagents@1.10.8

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-13 12:50:19 -07:00
Colin Francis 7c8a770fac fix(deepagents): fast-glob follows directory symlink cycles leading to ELOOP crashes (#668)
### Summary

`fast-glob` follows symbolic links by default so the `glob`/`grep` tools
in `FilesystemBackend` and `LocalShellBackend` walked directory symlink
cycles recursively causing `ELOOP` crashes. and aborted the run over a
target repo.

This PR fixes by adding`followSymbolicLinks: false` to all four
`fast-glob` calls. Bonus: this keeps traversal inside the search root.

### Tests
Unit tests in `filesystem.test.ts` and `local-shell.test.ts` verifying
that a `sub/sub -> .` cycle now traverses cleanly without traversing
symlinks.

This is an upstream fix for:
https://github.com/langchain-ai/openwiki/issues/72
2026-07-13 12:41:34 -07:00
github-actions[bot] 3eab2cad6f chore: version packages (#660)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents-acp@0.1.17

### Patch Changes

- Updated dependencies
[[`8efde93`](https://github.com/langchain-ai/deepagentsjs/commit/8efde93792dfc324e70b441eacbb810532f347c4)]:
  - deepagents@1.10.7
## deepagents@1.10.7

### Patch Changes

- [#659](https://github.com/langchain-ai/deepagentsjs/pull/659)
[`8efde93`](https://github.com/langchain-ai/deepagentsjs/commit/8efde93792dfc324e70b441eacbb810532f347c4)
Thanks [@Kowshik4593](https://github.com/Kowshik4593)! - Fix: Normalize
`path` to `file_path` in filesystem tools (`read_file`, `write_file`,
and `edit_file`) and align the prompt documentation examples to prevent
validation schema failures on weaker/custom models.
## @deepagents/evals@0.0.16

### Patch Changes

- Updated dependencies
[[`8efde93`](https://github.com/langchain-ai/deepagentsjs/commit/8efde93792dfc324e70b441eacbb810532f347c4)]:
  - deepagents@1.10.7

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Colin Francis <colin.francis@langchain.dev>
2026-07-08 14:04:15 -07:00
Kowshik Padala 8efde93792 feat(deepagents): implement filesystem state management middleware with atomic update support and testing (#659)
## Problem
Addresses #658.

When using weaker or custom LLMs (e.g., smaller open-source models) in
`deepagents` and consumers like `openwiki`, the agent immediately
crashes with a schema validation error on the first filesystem tool
call:


This occurs because:
1. `ls` defines its directory argument as `path`, but `read_file`,
`write_file`, and `edit_file` expect `file_path`. Models often default
to `path` across all filesystem tools.
2. The description prompt examples in `fs.ts` and `skills.ts` show
`read_file(path, ...)`, instructing models to use the wrong parameter
name.

## Proposed Changes
This PR solves both prompt inconsistencies and schema validation
failures with a fully backward-compatible input normalization helper:

1. **Prompt Alignment**: Fixed references in `fs.ts` and `skills.ts` to
instruct the model to use `file_path` (aligned with the prompt fixes in
#644).
2. **Schema Input Normalization**: Added a `normalizeFilePathInput`
preprocessor helper to the `read_file`, `write_file`, and `edit_file`
Zod schemas using `z.preprocess`. This dynamically maps the `path` key
to `file_path` if the model still passes `path`.

## Verification & Tests
- Added unit tests in `fs.test.ts` to assert that:
- `path` parameter normalization maps correctly to `file_path` for
`read_file`, `write_file`, and `edit_file`.
  - All instruction examples contain only valid schema fields.
- Verified that `zod-to-json-schema` unwraps the `z.preprocess` layer
perfectly, preserving the original schema descriptions and definitions
sent to the LLM.
- Ran all filesystem tests successfully (`npx vitest run
src/middleware/fs.test.ts` passes).
2026-07-08 13:20:36 -07:00
github-actions[bot] ff8cc5c4b4 chore: version packages (#607)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @langchain/quickjs@0.6.0

### Minor Changes

- [#606](https://github.com/langchain-ai/deepagentsjs/pull/606)
[`3c8f8b2`](https://github.com/langchain-ai/deepagentsjs/commit/3c8f8b2ea6f0204353c63bf49c3fdc6655bf1069)
Thanks [@colifran](https://github.com/colifran)! - chore(quickjs):
disallow task as a configurable ptc tool
## deepagents-acp@0.1.16

### Patch Changes

- Updated dependencies
[[`d7ecab2`](https://github.com/langchain-ai/deepagentsjs/commit/d7ecab2d9f9d41321a043eed6edc3366a1381a67),
[`1a2b2df`](https://github.com/langchain-ai/deepagentsjs/commit/1a2b2df5528f0f61870b054fff8291355f6a2a0b),
[`42f34b6`](https://github.com/langchain-ai/deepagentsjs/commit/42f34b65ededf4a1fbf3cd4bbff486ddfeb320e9),
[`0ae10d7`](https://github.com/langchain-ai/deepagentsjs/commit/0ae10d7e26c84203a5273939c9ad7a9c8c8661c6)]:
  - deepagents@1.10.6
## deepagents@1.10.6

### Patch Changes

- [#608](https://github.com/langchain-ai/deepagentsjs/pull/608)
[`d7ecab2`](https://github.com/langchain-ai/deepagentsjs/commit/d7ecab2d9f9d41321a043eed6edc3366a1381a67)
Thanks [@aolsenjazz](https://github.com/aolsenjazz)! - fix(deepagents):
forward subagent results as text

Fixed a 400 `invalid_request_error` that occurred when a subagent used
an Anthropic server-side tool (web search, web fetch, or code
execution): the subagent's `server_tool_use`/`*_tool_result` blocks were
forwarded to the parent agent as `tool_result` content, which the API
rejects. Subagent results are now passed back to the parent as their
text content (matching the Python implementation), which resolves the
error and also handles a trailing empty `end_turn` message.

- [#656](https://github.com/langchain-ai/deepagentsjs/pull/656)
[`1a2b2df`](https://github.com/langchain-ai/deepagentsjs/commit/1a2b2df5528f0f61870b054fff8291355f6a2a0b)
Thanks [@colifran](https://github.com/colifran)! - fix(deepagents):
default unknown file extensions to text/plain

- [#611](https://github.com/langchain-ai/deepagentsjs/pull/611)
[`42f34b6`](https://github.com/langchain-ai/deepagentsjs/commit/42f34b65ededf4a1fbf3cd4bbff486ddfeb320e9)
Thanks [@aolsenjazz](https://github.com/aolsenjazz)! - feat(deepagents):
add bedrockPromptCachingMiddleware to default stack

Add bedrockPromptCachingMiddleware to default middleware stack. This
automatically opts-in to Bedrock prompt caching for Nova and Anthropic
models

- [#613](https://github.com/langchain-ai/deepagentsjs/pull/613)
[`0ae10d7`](https://github.com/langchain-ai/deepagentsjs/commit/0ae10d7e26c84203a5273939c9ad7a9c8c8661c6)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix(deepagents): declare LangChain runtime packages as peer dependencies

Move `@langchain/core`, `@langchain/langgraph`,
`@langchain/langgraph-sdk`, and
`langchain` from `dependencies` to `peerDependencies`, and also declare
`@langchain/langgraph-checkpoint` as a peer (its
`BaseCheckpointSaver`/`BaseStore`
types are part of the public API), so they resolve to a single shared
instance in
  the consumer's tree. Previously they were bundled as regular
dependencies, which let a consumer end up with two copies of
`@langchain/core`
(e.g. `1.2.0` vs `1.2.1`). Because these packages ship classes with
private/
protected fields, the duplicate copies are treated as nominally distinct
types,
producing errors like passing a `ChatOpenAI` model to `createDeepAgent`
or a
compiled graph to the local protocol helpers. As peers, the app controls
the
version and bumping `@langchain/core` no longer requires a `deepagents`
release.
## @langchain/daytona@0.2.1

### Patch Changes

- [#614](https://github.com/langchain-ai/deepagentsjs/pull/614)
[`5b462f2`](https://github.com/langchain-ai/deepagentsjs/commit/5b462f2ab2400fba52906e8f1485a500ec5b6e17)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
Replace deprecated `@daytonaio/sdk` dependency with `@daytona/sdk`.
## @langchain/modal@0.1.5

### Patch Changes

- [#657](https://github.com/langchain-ai/deepagentsjs/pull/657)
[`5f93c11`](https://github.com/langchain-ai/deepagentsjs/commit/5f93c114759399002a3981a93e3df13981514b1d)
Thanks [@colifran](https://github.com/colifran)! - fix(modal): modal low
level file handle api `sandbox.open` has been removed
## @deepagents/evals@0.0.15

### Patch Changes

- Updated dependencies
[[`d7ecab2`](https://github.com/langchain-ai/deepagentsjs/commit/d7ecab2d9f9d41321a043eed6edc3366a1381a67),
[`1a2b2df`](https://github.com/langchain-ai/deepagentsjs/commit/1a2b2df5528f0f61870b054fff8291355f6a2a0b),
[`42f34b6`](https://github.com/langchain-ai/deepagentsjs/commit/42f34b65ededf4a1fbf3cd4bbff486ddfeb320e9),
[`0ae10d7`](https://github.com/langchain-ai/deepagentsjs/commit/0ae10d7e26c84203a5273939c9ad7a9c8c8661c6)]:
  - deepagents@1.10.6

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Colin Francis <colin.francis@langchain.dev>
2026-07-08 09:16:25 -07:00
Colin Francis 1a2b2df552 fix(deepagents): default unknown file extensions to text/plain (#656)
### Summary

`read_file` couldn't read many common text files and with Anthropic it
crashes the whole run. `getMimeType()` mapped any unrecognized extension
to `application/octet-stream`, which `isTextMimeType()` treats as
binary, so the file got base64-encoded into a document block.

This defaults unknown extensions to `text/plain` instead. Known binaries
(images, audio, video, PDF/PPT) stay explicitly mapped, so image and PDF
handling is unchanged. Files like `.properties`, `.scss`, `.tf`,
`.lock`, and extension-less files like `Dockerfile` now read as text.

  ### Tests
  
Flipped the unknown-extension unit test to expect `text/plain`.
2026-07-08 09:04:32 -07:00
Colin Francis 5f93c11475 fix(modal): modal sandboxes fail to upload files (#657)
### Summary

Modal v0.8.0 released the following breaking change:
```
Breaking: Removed the deprecated low-level file-handle API: Sandbox.Open / SandboxFile (Go), and sandbox.open / SandboxFile (JS). Use the Sandbox Filesystem API instead: sandbox.Filesystem() (Go) / sandbox.filesystem (JS).
```
Ref:
https://github.com/modal-labs/modal-client/blob/main/CHANGELOG_GO_JS.md

This PR updates our implementation to use the sandbox filesystem api

### Tests

Updated `sandbox.test.ts` mocks to model `sandbox.filesystem`
2026-07-08 08:52:34 -07:00
Christian Bromann 5b462f2ab2 fix: migrate Daytona SDK dependency [closes #609] (#614)
## Description
Closes #609 by updating `@langchain/daytona` to the maintained
`@daytona/sdk` at `^0.184.0` while preserving the same SDK API usage.
Added a patch changeset; `@daytona/sdk` is Apache-2.0 and maintained by
Daytona as the direct replacement for deprecated `@daytonaio/sdk`.

## Self-Hosted Release Note
`@langchain/daytona` now depends on `@daytona/sdk` instead of deprecated
`@daytonaio/sdk`.

## Test Plan
- [ ] Verify package publish metadata resolves `@daytona/sdk`
`^0.184.0`.

Made by [Open
SWE](https://openswe.vercel.app/agents/d6f434c5-39c6-eef7-6cc6-670cf092bb67)

Co-authored-by: Christian Bromann <731337+christian-bromann@users.noreply.github.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-06-29 08:25:57 -07:00
Christian Bromann 0ae10d7e26 fix(deepagents): declare LangChain runtime packages as peer dependencies (#613)
Updates to `@langchain/core` can cause downstream friction with
TypeScript:

```
Type 'ChatOpenAI<ChatOpenAICallOptions>' is not assignable to type 'string | BaseLanguageModel<any, BaseLanguageModelCallOptions> | undefined'.
  Type 'ChatOpenAI<ChatOpenAICallOptions>' is not assignable to type 'BaseLanguageModel<any, BaseLanguageModelCallOptions>'.
    Types of property 'getGraph' are incompatible.
      Type '(_?: import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.1_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/runnables/types").RunnableConfig<Record<string, any>> | undefined) => import("/Users/christian.bromann/Sites/L...' is not assignable to type '(_?: import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.0_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/runnables/types").RunnableConfig<Record<string, any>> | undefined) => import("/Users/christian.bromann/Sites/L...'.
        Types of parameters '_' and '_' are incompatible.
          Type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.0_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/runnables/types").RunnableConfig<Record<string, any>> | undefined' is not assignable to type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.1_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/runnables/types").RunnableConfig<Record<string, any>> | undefined'.
            Type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.0_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/runnables/types").RunnableConfig<Record<string, any>>' is not assignable to type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.1_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/runnables/types").RunnableConfig<Record<string, any>>'.
              Types of property 'callbacks' are incompatible.
                Type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.0_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").Callbacks | undefined' is not assignable to type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.1_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").Callbacks | undefined'.
                  Type 'CallbackManager' is not assignable to type 'Callbacks | undefined'.
                    Type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.0_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").CallbackManager' is not assignable to type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.1_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").CallbackManager'.
                      The types returned by 'handleLLMStart(...)' are incompatible between these types.
                        Type 'Promise<import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.0_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]>' is not assignable to type 'Promise<import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.1_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]>'.
                          Type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.0_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]' is not assignable to type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.1_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]'.
                            Type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.0_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun' is not assignable to type 'import("/Users/christian.bromann/Sites/LangChain/deployment-cookbook/js-langsmith/node_modules/.pnpm/@langchain+core@1.2.1_openai@6.44.0_ws@8.21.0_zod@4.4.3__ws@8.21.0/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun'.
                              Property 'inheritableHandlers' is protected but type 'BaseRunManager' is not a class derived from 'BaseRunManager'.ts(2322)
```

to avoid this we should move the LangChain dependency to become peer
deps.

- Moved `@langchain/core`, `@langchain/langgraph`,
`@langchain/langgraph-sdk`, and `langchain` from `dependencies` to
`peerDependencies` in `libs/deepagents`, keeping dev copies for isolated
build/test.
- Lets consumers bump `@langchain/core` without requiring a new
`deepagents` release; a release is only needed to widen the peer range
across a major.
- Note on install contract: npm 7+ and pnpm 8+ auto-install peers; Yarn
only warns, so Yarn users must add the four packages explicitly (worth a
README follow-up).

---------

Signed-off-by: Christian Bromann <git@bromann.dev>
Co-authored-by: open-swe[bot] <215916821+open-swe[bot]@users.noreply.github.com>
2026-06-22 17:25:00 -07:00
Alexander Olsen d7ecab2d9f fix(deepagents): forward subagent results as text (#608)
## Summary

A deep agent that delegates to a subagent 400s when that subagent uses
an Anthropic server-side tool (web search, web fetch, code execution,
MCP). The subagent's final-message content blocks e.g.
server_tool_use/..._tool_result were forwarded verbatim as the task
ToolMessage content. On the parent agent's next request they serialize
into a tool_result, which Anthropic rejects:

`400 invalid_request_error
messages.N.content.0.tool_result.content.0: Input tag 'server_tool_use'
found using 'type'
does not match any of the expected tags:
'document','image','search_result','text','tool_reference'`

## Solution

Now matches the Python impl: forward only the subagent's text answer.
returnCommandWithStateUpdate now walks back to the last AIMessage with
non-empty text and uses that text (a string) as the ToolMessage content.

- Confirmed the Python deepagents impl is not affected (it forwards
.text); this aligns JS with Python.
- Reproduced the 400 across {web_search, code_execution, web_fetch} ×
{claude-haiku-4-5, claude-sonnet-4-6} on the latest published packages;
all green after the fix.

## Tests
- New: subagent server-tool blocks are filtered from forwarded content.
- New: walk-back uses the last non-empty AIMessage, skipping a trailing
empty message.
- Updated the #239/#245 tests to assert the (now string) ToolMessage
content.
- No regressions in subagent-related tests in the evals suite

---------

Signed-off-by: Alexander Olsen <aolsenjazz@gmail.com>
Co-authored-by: Christian Bromann <git@bromann.dev>
2026-06-22 11:43:03 -04:00
Alexander Olsen 42f34b65ed feat(deepagents): add bedrockPromptCachingMiddleware to default stack (#611)
## Summary

- Adds `bedrockPromptCachingMiddleware` to the default middleware stack
- Adds unit tests for the Bedrock model detection util function covering
the different formats of model strings/`ChatModel`s
2026-06-22 11:12:59 -04:00
Colin Francis 3c8f8b2ea6 chore(quickjs): disallow task as a configurable ptc tool (#606)
### Summary

The code interpreter now comes with a global `task` tool out of the box.
As a result, we should disallow specifying the `task` tool for ptc. This
PR implements logic that forbids the task tool as in ptc and throws with
a detailed error message if found. This PR also updates the RLM agent
example and READMEs.

### Tests

Unit tests validating expected behavior for task by name and tool
instance with "task" name.
2026-06-18 15:07:53 -07:00
github-actions[bot] a9e1ba1b89 chore: version packages (#605)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## deepagents-acp@0.1.15

### Patch Changes

- Updated dependencies
[[`7c4a11e`](https://github.com/langchain-ai/deepagentsjs/commit/7c4a11eacc11c3720b70d802068300ac3b4d8651)]:
  - deepagents@1.10.5
## deepagents@1.10.5

### Patch Changes

- [#598](https://github.com/langchain-ai/deepagentsjs/pull/598)
[`7c4a11e`](https://github.com/langchain-ai/deepagentsjs/commit/7c4a11eacc11c3720b70d802068300ac3b4d8651)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
refactor(stream): use langchain `run.subagents` instead of bespoke
transformer

Remove deepagents' custom `createSubagentTransformer` and rely on the
native
  subagent stream that `createAgent` registers (langchain#37739). Keep
`DeepAgentRunStream` as a compile-time overlay that narrows
`run.subagents` to
declared subagent specs. Update streaming tests for `cause` and
per-subagent
  message coverage.
## @langchain/quickjs@0.5.1

### Patch Changes

- [#602](https://github.com/langchain-ai/deepagentsjs/pull/602)
[`204cb27`](https://github.com/langchain-ai/deepagentsjs/commit/204cb27414c82c34a0c681c7e5a5336e1834f058)
Thanks [@colifran](https://github.com/colifran)! - chore(quickjs):
refine dynamic subagent prompt to trigger on workflow keyword and to
improve iterative eval behavior

- [#604](https://github.com/langchain-ai/deepagentsjs/pull/604)
[`0971007`](https://github.com/langchain-ai/deepagentsjs/commit/0971007ab2491e73eb1a78c5426ab934470d5620)
Thanks [@colifran](https://github.com/colifran)! - fix(quickjs): unwrap
Command/ToolMessage envelopes from tool and subagent results
## @deepagents/evals@0.0.14

### Patch Changes

- Updated dependencies
[[`7c4a11e`](https://github.com/langchain-ai/deepagentsjs/commit/7c4a11eacc11c3720b70d802068300ac3b4d8651)]:
  - deepagents@1.10.5

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-18 09:38:18 -07:00
Christian Bromann 7c4a11eacc fix(deepagents): use langchain run.subagents instead of bespoke transformer (#598)
## Summary
- Remove deepagents' bespoke `createSubagentTransformer` (~460 lines)
and wire `createDeepAgent` to langchain's native `run.subagents`
projection from `createAgent` (langchain#37739).
- Slim `stream.ts` to type-only exports: re-export `SubagentRunStream`
from langchain and keep `DeepAgentRunStream` as a compile-time narrowing
over declared subagent specs.
- Update streaming tests for `sub.cause` (replacing `taskInput`), add
single-subagent `sub.messages` coverage, and document parallel-subagent
streaming behavior.
- Pin `langchain@1.4.6-dev-1781497519109` and `@langchain/langgraph` /
`@langchain/langgraph-checkpoint` to `d2312cf` dev builds (root
`pnpm.overrides`) for end-to-end verification until published releases
are available.
- Clarify `streamTransformers` docs: custom transformers surface on
`run.extensions`; built-in streams like `run.subagents` and
`run.toolCalls` are separate.

fixes #560
2026-06-18 09:36:50 -07:00
Colin Francis 0971007ab2 fix(quickjs): unwrap Command/ToolMessage envelopes from tool and subagent results (#604)
### Summary

The deepagents `task` tool resolves to a LangGraph `Command` (and some
tools return a `ToolMessage` or a list of messages), but the quickjs
bridges passed these envelopes straight to the REPL so `task(...)` and
PTC `tools.*` calls handed the model the wrapper instead of the
subagent's actual output, breaking the contract that a `responseSchema`
dispatch resolves to a typed value.

This PR adds `unwrapToolEnvelope`: a duck-typed unwrap of `Command` /
`ToolMessage` / message-list shapes that reverse-scans `update.messages`
for the last message with content and reads both live and serialized
forms. Non-envelope values pass through unchanged.

`unwrapToolEnvelope` is wired into both bridges, i.e., the `task()`
dispatch and the PTC `tools.*` bridge.

Inspired by the Python's
[`coerce_tool_output_for_ptc`](https://github.com/langchain-ai/deepagents/blob/4c347603162e181c721e5e2a5ca8bbff6828e23c/libs/partners/quickjs/langchain_quickjs/_format.py#L93-L119).

### Tests

- `coerce.test.ts` provide unit test coverage for `unwrapToolEnvelope`:
string/null/undefined passthrough, `Command` (single + multi-message),
reverse-scan past empty trailing messages, serialized `kwargs.content`,
bare `ToolMessage`, message lists, content-block arrays and plain `{
content }` objects left untouched.
- `middleware.test.ts` provides an integration test that the `task()`
bridge returns the parsed structured value from a `Command` result.
2026-06-18 06:27:35 -07:00
Colin Francis 204cb27414 chore(quickjs): refine dynamic subagent prompt to trigger on workflow keyword and to improve iterative eval behavior (#602)
### Summary

Prompt change only, no runtime behavior change.

Reworks the quickjs code-interpreter subagent prompt to steer the
orchestrator toward an explore-then-distribute workflow. It explores
with its own tools first, hands subagents file paths instead of pasted
contents, reuses persisted REPL variables rather than re-pasting prior
eval output, and returns results via the last expression instead of
`console.log`. Also gates the REPL sandbox note so it only mentions the
`tools.*` namespace when PTC is actually exposed.

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 06:27:18 -07:00
github-actions[bot] 750d69c024 chore: version packages (#568)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @langchain/node-vfs@0.2.0

### Minor Changes

- [#575](https://github.com/langchain-ai/deepagentsjs/pull/575)
[`5d266a2`](https://github.com/langchain-ai/deepagentsjs/commit/5d266a213d8d3d15c2281e2e00ab71ee30ca3ffe)
Thanks [@hntrl](https://github.com/hntrl)! - BREAKING: remove shell
execution from the VFS provider

`VfsBackend` now operates as a filesystem-only `BackendProtocolV2`
implementation and no longer exposes command execution.

The provider now implements `read`, `ls`, `grep`, and `glob` directly
against the in-memory VFS, path resolution is confined to the virtual
workspace root, and legacy `VfsSandbox` / `createVfsSandboxFactory*`
aliases are removed.
## @langchain/quickjs@0.5.0

### Minor Changes

- [#590](https://github.com/langchain-ai/deepagentsjs/pull/590)
[`7ee3feb`](https://github.com/langchain-ai/deepagentsjs/commit/7ee3feb674c361305b2a031db9132253e3d0543b)
Thanks [@colifran](https://github.com/colifran)! - chore(quickjs):
remove skills backend and associated plumbing

- [#592](https://github.com/langchain-ai/deepagentsjs/pull/592)
[`72cfb0c`](https://github.com/langchain-ai/deepagentsjs/commit/72cfb0c0384b30059b5e8028139a2e167c1be882)
Thanks [@colifran](https://github.com/colifran)! - feat(quickjs):
implement default subagent primitive in code interpreter for
programmatic subagent calling

### Patch Changes

- [#594](https://github.com/langchain-ai/deepagentsjs/pull/594)
[`61db938`](https://github.com/langchain-ai/deepagentsjs/commit/61db9381494f61b4548cd80b715e5af72fdde381)
Thanks [@colifran](https://github.com/colifran)! - chore(quickjs):
remove configurable concurrency and add subagents option with true
default

- [#546](https://github.com/langchain-ai/deepagentsjs/pull/546)
[`b7a5f26`](https://github.com/langchain-ai/deepagentsjs/commit/b7a5f26fd9cba992b11e1a4cf18607d64533503b)
Thanks [@open-swe](https://github.com/apps/open-swe)! - fix(quickjs):
scope `CodeInterpreterMiddleware` REPL prompt sandbox bullet to the
runtime
## deepagents-acp@0.1.14

### Patch Changes

- Updated dependencies
[[`18557db`](https://github.com/langchain-ai/deepagentsjs/commit/18557db7bbdf92052ed5f994512fb70e11989e69),
[`773cac5`](https://github.com/langchain-ai/deepagentsjs/commit/773cac5dc7efc7843dd882642d91f7d64d6fde81),
[`1ca6dc9`](https://github.com/langchain-ai/deepagentsjs/commit/1ca6dc92fd40a6d845d24b95ba14b8f2643db394),
[`03df237`](https://github.com/langchain-ai/deepagentsjs/commit/03df237385fbdfefd862076c5588eb39cb6e43c3),
[`84f3c0c`](https://github.com/langchain-ai/deepagentsjs/commit/84f3c0c2f1cad271191bcc138b84ba5b9c9205c9),
[`72cfb0c`](https://github.com/langchain-ai/deepagentsjs/commit/72cfb0c0384b30059b5e8028139a2e167c1be882),
[`04cc3fc`](https://github.com/langchain-ai/deepagentsjs/commit/04cc3fc26001ee566ed94de44c2dda2cf6adecc4),
[`18fbb48`](https://github.com/langchain-ai/deepagentsjs/commit/18fbb4839050e98ae3cfd36ec69b11f0725ad6d6),
[`e3d4b53`](https://github.com/langchain-ai/deepagentsjs/commit/e3d4b5367b1825df56c919b483ec4a3e117d631f)]:
  - deepagents@1.10.4
## deepagents@1.10.4

### Patch Changes

- [#551](https://github.com/langchain-ai/deepagentsjs/pull/551)
[`18557db`](https://github.com/langchain-ai/deepagentsjs/commit/18557db7bbdf92052ed5f994512fb70e11989e69)
Thanks [@antonnak](https://github.com/antonnak)! - fix(deepagents): gate
cache_control writes on per-call request.model

`createCacheBreakpointMiddleware` and `createMemoryMiddleware` were
gating
the Anthropic-specific `cache_control` write at agent-creation time
only.
When `modelFallbackMiddleware` swapped `request.model` to a
non-Anthropic
  provider mid-flight (e.g. on Anthropic 5xx), the marker leaked through
  and the fallback provider rejected the request with
  `400 Unknown parameter: 'cache_control'`. Both middlewares now also
check `isAnthropicModel(request.model)` inside `wrapModelCall`. Fixes
[#550](https://github.com/langchain-ai/deepagentsjs/issues/550).

- [#591](https://github.com/langchain-ai/deepagentsjs/pull/591)
[`773cac5`](https://github.com/langchain-ai/deepagentsjs/commit/773cac5dc7efc7843dd882642d91f7d64d6fde81)
Thanks [@colifran](https://github.com/colifran)! - chore(deepagents):
expose createSubAgent

- [#541](https://github.com/langchain-ai/deepagentsjs/pull/541)
[`1ca6dc9`](https://github.com/langchain-ai/deepagentsjs/commit/1ca6dc92fd40a6d845d24b95ba14b8f2643db394)
Thanks [@ixchio](https://github.com/ixchio)! - fix getMimeType to return
application/octet-stream for unknown file extensions instead of
text/plain

- [#572](https://github.com/langchain-ai/deepagentsjs/pull/572)
[`03df237`](https://github.com/langchain-ai/deepagentsjs/commit/03df237385fbdfefd862076c5588eb39cb6e43c3)
Thanks [@hntrl](https://github.com/hntrl)! - fix: scope CompositeBackend
grep/glob route fanout by search path

CompositeBackend now limits fallback route fanout to routes mounted
under the requested search path, instead of querying all routed backends
unconditionally.

This avoids unrelated routed backend calls (and side-effect errors) for
scoped searches like `path="/workspace"`, while preserving full fanout
behavior at root (`path="/"`).

- [#574](https://github.com/langchain-ai/deepagentsjs/pull/574)
[`84f3c0c`](https://github.com/langchain-ai/deepagentsjs/commit/84f3c0c2f1cad271191bcc138b84ba5b9c9205c9)
Thanks [@hntrl](https://github.com/hntrl)! - fix(deepagents): add
explicit browser and node entrypoints
  - add `deepagents/browser` and `deepagents/node` subpath exports
- route browser bundlers to the browser-safe bundle via the root
`browser` export condition
- avoid named Node builtin imports in backend utils that can break
browser builds
  - document browser guidance to import from `deepagents/browser`

- [#592](https://github.com/langchain-ai/deepagentsjs/pull/592)
[`72cfb0c`](https://github.com/langchain-ai/deepagentsjs/commit/72cfb0c0384b30059b5e8028139a2e167c1be882)
Thanks [@colifran](https://github.com/colifran)! - feat(quickjs):
implement default subagent primitive in code interpreter for
programmatic subagent calling

- [#566](https://github.com/langchain-ai/deepagentsjs/pull/566)
[`04cc3fc`](https://github.com/langchain-ai/deepagentsjs/commit/04cc3fc26001ee566ed94de44c2dda2cf6adecc4)
Thanks [@hntrl](https://github.com/hntrl)! - fix(deepagents): propagate
subagent `lc_agent_name` during task delegation
- Ensure `task` tool subagent invocations override
`metadata.lc_agent_name` with the selected `subagent_type`.
- Add regression coverage for both compiled subagents (`runnable`) and
standard subagent specs to verify tool-time metadata reflects the active
subagent.
- Update the `langsmith` peer dependency range in `deepagents` to
`^0.7.1`.

- [#595](https://github.com/langchain-ai/deepagentsjs/pull/595)
[`18fbb48`](https://github.com/langchain-ai/deepagentsjs/commit/18fbb4839050e98ae3cfd36ec69b11f0725ad6d6)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix(deepagents): count tokens once per model call in summarization
middleware

`createSummarizationMiddleware` counted tokens twice on every model
call—once
inside `truncateArgs` and again for the should-summarize check—even when
nothing was truncated or summarized. Count once and pass the total into
`truncateArgs`; recount only when truncation actually modifies messages.

- [#242](https://github.com/langchain-ai/deepagentsjs/pull/242)
[`e3d4b53`](https://github.com/langchain-ai/deepagentsjs/commit/e3d4b5367b1825df56c919b483ec4a3e117d631f)
Thanks [@alvedder](https://github.com/alvedder)! - feat(deepagents):
support direct skill paths as sources in createSkillsMiddleware
## @deepagents/evals@0.0.13

### Patch Changes

- Updated dependencies
[[`18557db`](https://github.com/langchain-ai/deepagentsjs/commit/18557db7bbdf92052ed5f994512fb70e11989e69),
[`773cac5`](https://github.com/langchain-ai/deepagentsjs/commit/773cac5dc7efc7843dd882642d91f7d64d6fde81),
[`1ca6dc9`](https://github.com/langchain-ai/deepagentsjs/commit/1ca6dc92fd40a6d845d24b95ba14b8f2643db394),
[`03df237`](https://github.com/langchain-ai/deepagentsjs/commit/03df237385fbdfefd862076c5588eb39cb6e43c3),
[`84f3c0c`](https://github.com/langchain-ai/deepagentsjs/commit/84f3c0c2f1cad271191bcc138b84ba5b9c9205c9),
[`72cfb0c`](https://github.com/langchain-ai/deepagentsjs/commit/72cfb0c0384b30059b5e8028139a2e167c1be882),
[`04cc3fc`](https://github.com/langchain-ai/deepagentsjs/commit/04cc3fc26001ee566ed94de44c2dda2cf6adecc4),
[`18fbb48`](https://github.com/langchain-ai/deepagentsjs/commit/18fbb4839050e98ae3cfd36ec69b11f0725ad6d6),
[`e3d4b53`](https://github.com/langchain-ai/deepagentsjs/commit/e3d4b5367b1825df56c919b483ec4a3e117d631f)]:
  - deepagents@1.10.4

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-17 15:05:26 -07:00
Christian Bromann 18fbb48390 fix(deepagents): count tokens once per model call in summarization middleware (#595)
## Summary
- Port
[langchain-ai/deepagents#3877](https://github.com/langchain-ai/deepagents/pull/3877):
`createSummarizationMiddleware` now counts tokens once per model call
instead of twice on the common pass-through path.
- Pass the precomputed total into `truncateArgs` via an optional
`totalTokens` parameter; recount only when truncation modifies messages.
- Add a regression test asserting `countTokensApproximately` runs
exactly once when nothing is truncated or summarized.
2026-06-12 17:26:50 -07:00
Colin Francis 61db938149 chore(quickjs): remove configurable concurrency and add subagents option with true default (#594)
### Summary

This PR remove the configurable concurrency option from code interpreter
middleware options and adds a subagents option that is true by default
2026-06-11 16:10:15 -07:00
Colin Francis 72cfb0c038 feat(quickjs): implement default task primitive in code interpreter for programmatic subagent calling (#592)
### Summary

This PR adds a default task primitive to the code interpreter that
allows the agent to natively write code to programmatically dispatch
subagents. The task primitive supports passing response schemas for
dynamic structured output that helps with more complex orchestration
patterns.

This PR also removes the swarm task tool in favor of the task primitive.

---------

Co-authored-by: Hunter Lovell <40191806+hntrl@users.noreply.github.com>
2026-06-11 15:36:01 -07:00
Colin Francis 773cac5dc7 chore(deepagents): expose createSubAgent (#591)
### Summary

Exposes `createSubAgent` as a dedicated function which allows us to
reuse the inner subagent factory outside of the middleware (e.g. using
it as the single source of truth for defining subagents in quickjs).

Port of similar implementation from
https://github.com/langchain-ai/deepagents/pull/3846
2026-06-10 17:16:05 -07:00
Colin Francis 7ee3feb674 chore(quickjs): remove skills backend and associated plumbing (#590)
### Summary

Removes skills backend and associated plumbing from code interpreter
middleware and options
2026-06-10 11:53:13 -07:00
Alexei Vedernikov e3d4b5367b feat(deepagents): support direct skill paths as sources in createSkillsMiddleware (#242)
## Description

Previously, sources had to be parent directories (e.g. `/skills/`) whose
subdirectories each contained a SKILL.md. Passing a direct skill path
(e.g. `/skills/my-skill/`) had no effect because `listSkillsFromBackend`
scanned for subdirectories inside the source, found none, and returned
an empty list.

## Real case

The motivating scenario is when a curated list of skills organised as
individual directories under a shared directory. Each skill has a clear
responsibility, and different skills are intentionally assigned to the
orchestrator agent vs. subagents:

```typescript
// Desired: pass individual skill paths — one per capability
const SHARED_SKILLS = ['/skills/web-research/'];

const ORCHESTRATOR_SKILLS = [
  '/skills/requirement-completeness-validator/',
  '/skills/diff-risk-analyzer/',
];

createDeepAgent({
  skills: [...SHARED_SKILLS, ...ORCHESTRATOR_SKILLS],
  subagents: subagentsConfig.map(agentConfig => ({
    skills: [
      ...SHARED_SKILLS,
      ...agentConfig.skills,
    ]
  }))
});
```

The workaround would be to create nested directories like this:
```
skills/
  web-research/
    web-research/
      SKILL.md
  equirement-completeness-validator/
    equirement-completeness-validator/
      SKILL.md
  ...and so on
```

## What's done

Detection is done by inspecting the lsInfo() result of the source
directory: if a SKILL.md file appears directly in the listing, the
source itself is treated as the skill directory. Otherwise the existing
parent-directory scan runs unchanged.

The two modes can be freely mixed in the sources array:
```ts
sources: [
  '/skills/',               // parent dir: all subdirs with SKILL.md
  '/skills/my-skill/',      // direct path: SKILL.md at its root
 ]
 ```

---------

Co-authored-by: Hunter Lovell <40191806+hntrl@users.noreply.github.com>
2026-06-07 14:08:52 -07:00
Anton Nak 18557db7bb fix(deepagents): gate cache_control writes on per-call request.model (#551)
Fixes #550.

## Problem

`createCacheBreakpointMiddleware` and `createMemoryMiddleware` write
Anthropic-specific `cache_control: { type: "ephemeral" }` markers into
the request payload. Both gate the write at **agent-creation time** in
`createDeepAgent` (whether the *primary* model is Anthropic). When
`modelFallbackMiddleware` swaps `request.model` to a non-Anthropic
provider at request time, the markers leak through and the fallback
provider rejects the request:

```
400 Unknown parameter: 'messages[0].content[N].cache_control'
```

Full root-cause writeup, production trace, and reproduction in #550.

## Fix

Move the model classification from boot-time to **per-call**, using the
existing `isAnthropicModel` helper (`src/utils.ts:9`).

- **`src/middleware/cache.ts`** — bail at the top of `wrapModelCall`
when `request.model` isn't Anthropic.
- **`src/middleware/memory.ts`** — AND the existing `addCacheControl`
flag with the same per-call check. `addCacheControl` keeps its current
public meaning (opt-in switch); the per-call gate is an additional
safety net.
- **`src/agent.ts`** — left untouched. The boot-time install gate stays
(small perf win when primary is non-Anthropic — middleware isn't
installed at all). The new per-call check handles the fallback case
where the middleware *is* installed but the model has been swapped.

## Tests

Each middleware's `.test.ts` got a `per-call provider gating` block.
They build a request with a `ChatAnthropic`-shaped stub vs a
`ChatOpenAI`-shaped stub on `request.model`, run `wrapModelCall`, and
assert `cache_control` is/isn't written. Also covers `ConfigurableModel`
with `modelProvider: "anthropic"` and the string forms
(`"anthropic:claude-..."`, `"openai:gpt-5"`).

Existing fixtures that didn't set `request.model` now pass a
`ChatAnthropic` stub so they keep exercising the write path — they were
previously relying on the unconditional behavior. No behavioral
assertions changed; only the fixture got more explicit.

31/31 tests pass on `libs/deepagents` (`cache.test.ts` +
`memory.test.ts`).

## Compatibility

- **No public API change.** `addCacheControl?: boolean` on
`MemoryMiddlewareOptions` keeps its existing semantics.
- **Anthropic-primary happy path unchanged** — same writes, same cache
hits.
- **Per-call cost:** one `getName()` / string check inside
`wrapModelCall`. Sub-microsecond.
- **Failure mode improvement:** users running `createDeepAgent` with an
Anthropic primary + non-Anthropic fallback no longer get a 400 from the
fallback provider on swap.

## Changeset

`patch` bump on `deepagents`.

## Out of scope

`request.modelSettings.cache_control` (written by LangChain core's
`anthropicPromptCachingMiddleware`) can also leak across the swap.
Mentioned in #550 for tracking — that's a LangChain-side fix, not
deepagents.

---------

Co-authored-by: Anton Nakaliuzhnyi <anakaliuzhnyi@gipartners.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 14:04:23 -07:00
Aman Pandey 1ca6dc92fd fix(deepagents): return application/octet-stream for unknown MIME types (#541)
Fixes #542.

`getMimeType()` falls back to `"text/plain"` for any extension not in
the `MIME_TYPES` lookup table. Since `isTextMimeType("text/plain")`
returns `true`, this means binary files (.zip, .exe, .wasm, .sqlite,
.pyc, .class, .jar, etc.) get treated as text everywhere downstream —
grep searches through them and returns garbage, read_file splits their
content on newlines and paginates it, and StateBackend can silently
corrupt binary data stored via createFileData().

The fix is straightforward: change the default to
`"application/octet-stream"`, which is what unknown binary data should
be. `isTextMimeType()` already returns `false` for it, so binary files
stop getting mangled.

To avoid breaking existing behavior for actual text files that were
previously relying on the fallback (like .txt, .ts, .py, .json, .js —
none of which had explicit entries), this also adds those to the
MIME_TYPES map directly. Covers ~67 common text/code extensions.

All 386 backend tests pass (10 files). The updated test expectations in
utils.test.ts verify both sides: known text extensions still resolve
correctly, and unknown/binary extensions now get
`application/octet-stream` instead of being misidentified as text.

---------

Co-authored-by: Hunter Lovell <40191806+hntrl@users.noreply.github.com>
2026-06-02 13:44:48 -07:00
Hunter Lovell 5d266a213d refactor(node-vfs): make VfsSandbox filesystem-only (#575)
## Summary

This PR removes command-execution semantics from `@langchain/node-vfs`
and aligns `VfsSandbox` with `BackendProtocolV2` as a filesystem-only
backend.

The provider no longer uses sandbox execution abstractions and now
performs core file operations directly against the in-memory VFS.

## Changes

### Protocol alignment

- `VfsSandbox` now implements `BackendProtocolV2` directly instead of
extending sandbox/base-execution abstractions.
- Removed command execution from the provider surface (`execute` is no
longer part of this backend implementation).
- Removed `timeout` from `VfsSandboxOptions` and corresponding docs.

### Runtime behavior

- Added native backend implementations for:
  - `read`
  - `readRaw`
  - `write`
  - `edit`
  - `ls`
  - `grep`
  - `glob`
- Kept upload/download support and added path confinement handling for
invalid traversal paths.
- Continued in-memory VFS-only operation (no temp-dir shell sync path).

### Tests and docs

- Updated unit and integration tests to remove execute-focused
assertions and validate filesystem behavior.
- Updated package docs to describe `BackendProtocolV2` usage and removed
execute/timeout references.
- Added changeset for `@langchain/node-vfs`.
2026-06-02 19:47:14 +00:00
open-swe[bot] b7a5f26fd9 fix(quickjs): scope REPL prompt sandbox bullet to the runtime (#546)
Ports langchain-ai/deepagents#3528 to deepagentsjs.

The base `CodeInterpreterMiddleware` REPL prompt asserted "no
filesystem, no stdlib, no network, no real clock, no `fetch`, no
`require`". When `ptc` is configured, the same system prompt also
exposes a `tools.*` namespace whose members can include things like web
fetch, file I/O, or shell access — directly contradicting the sandbox
bullet.

A model reading both sections sees "no network" *and* `await
tools.webFetch({...})` in the same prompt. With PTC disabled it's even
worse: exposed tools are still reachable through the normal tool-calling
path *outside* `eval`, and the model could interpret the bullet as a
statement about the agent's capabilities rather than the REPL's.

This rewords the bullet to scope it to the QuickJS runtime, and notes
that external side effects from inside the REPL flow through `tools.*`
when it's exposed (otherwise the REPL is pure computation).
`@langchain/quickjs` middleware unit tests, lint, and format all pass
locally.

_Opened collaboratively by Mason Daugherty and open-swe._

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Co-authored-by: Mason Daugherty <61371264+mdrxy@users.noreply.github.com>
2026-06-02 10:41:20 -07:00
Hunter Lovell 84f3c0c2f1 fix(deepagents): add browser and node entrypoints (#574)
## Summary

Fixes #292, #543

This updates `deepagents` packaging to split environment-specific
exports and avoid browser build failures caused by Node-only imports in
the default bundle. Browser consumers now have an explicit
`deepagents/browser` entrypoint, while Node consumers can keep using
`deepagents` (or optionally `deepagents/node`) for the full runtime API.

## Changes

### `deepagents` package exports and entrypoints

- Added `src/browser.ts` as a browser-safe public barrel that excludes
Node-only APIs.
- Added `src/node.ts` as an explicit Node entrypoint that re-exports the
full API.
- Updated `package.json` exports to:
  - route the root `browser` condition to `./dist/browser.js`
  - expose `./browser` and `./node` subpath exports (ESM + CJS + types).
- Updated `tsdown` config to build `index`, `browser`, and `node`
outputs.

### Runtime import graph hardening

- Updated `createDeepAgent` to import `StateBackend` directly from
`backends/state` so it no longer pulls in the full Node-oriented
backends barrel.
- Updated `types.ts` to import `AnyBackendProtocol` from
`backends/protocol` instead of `backends/index`.
- Removed named Node builtin path imports from `backends/utils.ts` by
replacing `path.basename`/`path.extname` with local helpers.

### Documentation and release notes

- Added a README section documenting import guidance: browser apps
should use `deepagents/browser`, and Node apps can continue to use
`deepagents`.
- Added a patch changeset for `deepagents` describing the entrypoint and
packaging fix.
2026-06-02 10:32:55 -07:00
Hunter Lovell 03df237385 fix(deepagents): scope composite route search fanout by path (#572)
## Summary

Fixes #241.

This updates `CompositeBackend` search routing so scoped `grep`/`glob`
requests only fan out to routed backends mounted under the requested
path. Previously, non-route paths (for example `/workspace`) still
queried all routes, which could trigger unrelated backend errors.

## Changes

### `libs/deepagents/src/backends/composite.ts`

- Added route/path helper predicates to distinguish:
  - when a search path is inside a route,
  - when a route is a descendant of the requested search path.
- Updated `grep` fallback behavior to query the default backend plus
only descendant routes (instead of unconditional all-route fanout).
- Updated `glob` fallback behavior to use the same descendant-route
filtering.
- Normalized `grep` path handling to accept `null` and treat it as root
(`/`).
- Reused the same route-matching helper in `ls` for consistent prefix
matching semantics.

### `libs/deepagents/src/backends/composite.test.ts`

- Added regression test to ensure `grep("...", "/workspace")` does not
call unrelated routes (for example `/skills/`) while still searching
relevant descendant routes.
- Added regression test for equivalent `glob` behavior.

Co-authored-by: Christian Bromann <731337+christian-bromann@users.noreply.github.com>
2026-06-02 10:12:26 -07:00