Commit Graph

12 Commits

Author SHA1 Message Date
Mason Daugherty 969cbe8709 chore(deps): update lint and typing dependency floors (#3818)
Dependency floors are refreshed across the monorepo for newer
LangChain/LangSmith releases, provider integrations, pytest tooling,
`ruff`, and `ty`. The code changes are the compatibility work needed for
those newer lint and type checks, with small structural cleanups where
the tools needed clearer narrowing or less complex functions.

## Changes
- Raised runtime and test dependency minimums across SDK, CLI, Code,
ACP, evals, examples, and partner packages, including updated
LangChain/LangSmith/provider pins and current lint/test tooling
baselines.
- Reworked backend factory typing around `BACKEND_TYPES` with
`_resolve_backend`, widened file transfer error fields to support
backend-specific strings, and updated filesystem/summarization
middleware to use the shared resolver.
- Tightened `deepagents-code` typing for middleware stacks, MCP tool
filtering, update checks, and Textual compatibility patches, replacing
stale suppressions with `ty`-specific ignores where runtime behavior is
intentionally narrower than static types.
- Split large CLI command handlers into focused helpers such as
`_dispatch_command`, `_execute_agents_command`, and the MCP server
subcommand helpers while preserving existing command behavior.
- Updated Harbor LangSmith sandbox handling to rely on explicit
`NetworkPolicy` and `capabilities` instead of legacy property overrides,
with tests adjusted around the new capability checks.
- Applied lint/format/type-check cleanups across tests and examples so
the staged code passes the refreshed tooling expectations.
2026-06-09 13:25:21 -04:00
Victor Moreira 04b4bb946f fix(cli): support state deploy backend (#3790)
Updates the deploy CLI backend handling to match the current Managed
Deep Agents API shape. New scaffolded projects use `state`, and
sandbox-backed projects can use `backend.type: "sandbox"` with
`sandbox_config.scope`, policy IDs, and TTL fields. Existing `default`,
`thread_scoped_sandbox`, `agent_scoped_sandbox`, and `backend.sandbox`
configs continue to normalize for compatibility.

This also updates the CLI README and example deploy project so users see
the canonical `sandbox_config` form.

Tests run:
- `uv run --group test python -m pytest tests/unit_tests/`
- `uv run --group test ruff check deepagents_cli/deploy/project.py
deepagents_cli/deploy/commands.py
tests/unit_tests/deploy/test_project.py
tests/unit_tests/deploy/test_payload.py
tests/unit_tests/deploy/test_init_command.py
tests/unit_tests/deploy/test_deploy_command.py`
- `uv run --group test ty check deepagents_cli/deploy/project.py`

Live validation:
- Created a temporary Managed Deep Agent using `backend.type: "sandbox"`
and `sandbox_config.scope: "thread"`.
- Confirmed the API stored `type: "sandbox"` and `sandbox_config.scope:
"thread"`.
- Updated the same temporary agent with `idle_ttl_seconds` and
`delete_after_stop_seconds`; confirmed both fields persisted.
- Deleted the temporary remote agent and verified it returned 404
afterward.
2026-06-07 17:05:02 -04:00
Victor Moreira 72aef52542 feat(cli)!: migrate deepagents deploy to use managed deep agents api [AB-2470] (#3609)
## ⚠ Breaking changes

`deepagents-cli` `0.1.x` → `0.2.0`. The deploy CLI is a private-preview
beta, but
this rewrites the command surface, config format, and deploy backend, so
existing
projects and scripts will not work unchanged.

| What broke | Before (`0.1.x`) | After (`0.2.0`) |
| --- | --- | --- |
| **`deepagents dev` removed** | `deepagents dev --port 2024` ran a
local `langgraph dev` server off the bundle | No replacement. Local
bundling/serving is gone; the project is now a managed agent. |
| **Deploy backend** | `deepagents deploy` bundled the project and
shipped via `langgraph deploy` to LangSmith Deployment | `deepagents
deploy` patches agent metadata + syncs source files through the Managed
Deep Agents API (`/v1/deepagents/*`) |
| **Config file** | `deepagents.toml` (auto-discovered or `--config`) |
`agent.json` (metadata, top-level `backend`, `runtime.model`,
permissions) + `AGENTS.md`, `tools.json`, `skills/`, `subagents/` |
| **`--config` / `--dry-run` flags** | accepted on `deploy`/`dev` |
removed |
| **MCP tool wiring** | prior tool-config shape (deployed an agent with
**no tools**) | `tools.json` with `tools[].mcp_server_url`; servers must
be registered and `can_invoke == true` or deploy fails fast |
| **Deploy state** | derived from the bundle | tracked user-local in
`~/.deepagents/deployments/`, keyed by project root + endpoint (not
committed) |

### Migration

1. **Re-scaffold or convert the project.** Run `deepagents init` to
generate the
   canonical layout (`agent.json`, `AGENTS.md`, `tools.json`, `skills/`,
   `subagents/`), then port settings out of your old `deepagents.toml`:
   - system prompt → `AGENTS.md`
   - model / permissions → `agent.json` (`runtime.model`, `permissions`)
- runtime/sandbox config → top-level `backend` block (`init` scaffolds
`thread_scoped_sandbox`; the legacy value `"sandbox"` is still accepted
as a
     local alias)
2. **Register MCP servers and attach tools.** Use `deepagents
mcp-servers add`
(then `connect` for OAuth servers), and reference them from `tools.json`
via
`tools[].mcp_server_url`. The old tool-config shape silently deployed an
agent
   with no tools.
3. **Replace `deepagents dev`.** There is no local dev-server equivalent
in this
   release; iterate via `deepagents deploy` against your workspace.
4. **Drop removed flags.** Remove `--config` and `--dry-run` from any
deploy
   scripts.

New commands: `deepagents agents` (`get`, `--include-files`, …) and
`deepagents mcp-servers` (`create`/`list`/`get`/`update`/`delete` +
OAuth
`connect`). `get` redacts stored header values.

## Overview

Migrates `deepagents deploy` from the legacy `langgraph deploy` path to
the new
Managed Deep Agents API (`/v1/deepagents/*`). Instead of bundling and
shipping a
deployment, the CLI now treats a project as a managed agent: agent
**metadata**
lives on the agent record and **source files** live in Hub-backed
directory
state. On redeploy, the CLI patches only metadata and syncs the managed
file tree
via Hub directory commits, rather than re-uploading everything.

The CLI surface is now `init` / `deploy` / `agents` / `mcp-servers`,
operating on
the canonical project layout:

```
agent.json              # name, description, top-level backend, runtime.model, permissions
AGENTS.md               # system prompt
tools.json              # MCP tool references (tools[].mcp_server_url) + interrupt_config
skills/<name>/SKILL.md  # frontmatter-tagged skills
subagents/<name>/       # delegated subagent definitions
```

Bumps `deepagents-cli` to `0.2.0`. The deploy flow is gated behind a
beta warning
while Managed Deep Agents is in private preview.

## What changed

**Deploy model**
- Source files are kept in Hub-backed directory state; redeploy patches
agent
metadata only and reconciles files through directory commits (create →
first
  deploy, patch + directory delta → subsequent deploys).
- Deploy state is tracked **user-local** (`~/.deepagents/deployments/`),
keyed by
  project root + endpoint — not committed to the repo.

**Runtime / backend config**
- Managed runtime config moved to a **top-level `backend`** block;
`init` scaffolds
  `thread_scoped_sandbox` by default.
- Backend/sandbox config is validated at load time; legacy `"sandbox"`
is accepted
  as a local alias for `thread_scoped_sandbox`.

**MCP server flows**
- Consistent dotenv loading across all commands (project `.env`
discovered upward,
  then `~/.deepagents/.env`).
- `mcp-servers` supports create/list/get/update/delete plus OAuth
connect; `get`
  redacts stored header values.
- Deploy fails fast when a referenced server is unregistered or the
caller
`can_invoke == false`, with actionable hints (including OAuth
`connect`).

**Tooling docs/examples** (also in this branch)
- `tools.json` (`tools[].mcp_server_url`) is the supported way to attach
MCP tools;
fixed the `deploy-content-writer` example and README quickstart, which
previously
  implied a tool config shape that deploys an agent with no tools.

## Checked with
```bash
uv run --group test python -m pytest tests/unit_tests/deploy -v
uv run --group test ruff check .
uv run --group test ty check
```
Also ran the flow end to end against a live workspace: `init` →
`mcp-servers add`
→ `tools.json` → `deploy` (create + redeploy) → `agents get
--include-files`,
confirming metadata patch, directory sync, and MCP health check.

## Related
- Linear:
https://linear.app/langchain/issue/AB-2470/mda-wrap-apis-in-deepagents-deploy
- Docs PR: `langchain-ai/docs` `vic/mda-cli-update` (reconciles the
Managed Deep
  Agents guide with this behavior)



BREAKING CHANGE: `deepagents deploy` now targets the Managed Deep Agents
API; `deepagents dev`, `deepagents.toml`, and the `--config`/`--dry-run`
flags are removed. Run `deepagents init` to re-scaffold (`agent.json` +
`tools.json`). See
[PR](https://github.com/langchain-ai/deepagents/pull/3609) for the full
migration guide.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Mason Daugherty <mason@langchain.dev>
2026-06-01 18:28:53 -04:00
Sydney Runkle 23bfca6e46 feat(cli): user scoped memory (#2708)
# Per-User Memory for Deep Agents Deploy

## What is it?

When you deploy an agent with `deepagents deploy`, it can now remember
things
about each user across conversations. The agent gets a writable
`AGENTS.md`
file per user — it can read and update this file to store preferences,
context,
and learnings that persist between sessions.

Each user's memory is completely isolated. User A's preferences never
leak into
User B's experience.

## How to use it

1. Create a `user/` directory in your project (next to
`deepagents.toml`)
2. Optionally add a `user/AGENTS.md` with starter content (template for
new users)
3. Deploy — that's it

```txt
my-agent/
├── deepagents.toml
├── AGENTS.md          # shared agent instructions (read-only)
└── user/
    └── AGENTS.md      # per-user memory template (writable at runtime)
```

If you create `user/` but don't add an `AGENTS.md`, an empty one is
seeded
for each user automatically.

## How it works

- At deploy time, `user/AGENTS.md` is bundled into the seed payload
- The first time a user interacts, their own copy is created in the
store
- The agent sees it in context every conversation and can update it via
`edit_file`
- Redeployments never overwrite existing user data
- If no `user/` directory exists, user memory is disabled entirely

## Technical details

- User memory lives at `/memories/user/AGENTS.md` in the VFS
- Namespaced per `(assistant_id, user_id)` — fully isolated per user
- `user_id` comes from `runtime.user.identity` (custom auth)
- Gracefully skipped (with a warning) if no `user_id` is provided
- Shared `AGENTS.md` and skills remain read-only; only user memory is
writable
2026-04-14 11:14:31 -04:00
Alan Pope 9ff79d0a2c docs(examples): improve skill scores across 8 skills (#1809)
Hullo @mdrxy 👋

I ran your skills through `tessl skill review` at work and found some
targeted improvements. The process was run by me, a human meatbag (yes,
I am typing, and that's me (with shorter hair) in the avatar), with some
assistance from a skill and claude, which feels fitting and somewhat
meta, given it's measuring and updating some skills. So I would consider
this a clear disclaimer that I have used AI, but I did human write this.
This is done with good intent, not to land some slop, the goal is to
improve the activation and use of the skills you're sharing here, that's
all. 🙏

<!-- Replace everything above this line with a 1-2 sentence description
of your change. Keep the "Fixes #xx" keyword and update the issue
number. -->

<img width="1312" height="1214" alt="deepagents_score_card"
src="https://github.com/user-attachments/assets/2fbd8b01-b73a-40d9-96b4-2047eb5c4004"
/>

Here's the before/after:

| Skill | Before | After | Change |
|-------|--------|-------|--------|
| query-writing | 53% | 100% | +47% |
| arxiv-search | 52% | 94% | +42% |
| blog-post | 59% | 89% | +30% |
| social-media | 59% | 89% | +30% |
| langgraph-docs | 56% | 86% | +30% |
| web-research | 59% | 89% | +30% |
| schema-exploration | 55% | 83% | +28% |
| skill-creator (built-in) | 84% | 88% | +4% |

<details>
<summary>What changed</summary>

**Description improvements (all skills)**
- Added concrete action verbs to frontmatter descriptions (e.g. "Writes
and structures long-form blog posts" instead of just "Use this skill
when writing...")
- Added explicit "Use when..." clauses with natural trigger terms users
would actually say
- Expanded trigger term coverage (e.g. "tweet", "thread", "caption" for
social-media)

**Body conciseness (7 skills)**
- Removed redundant "When to Use This Skill" body sections — these are
only read after triggering, so they waste context tokens
- Removed filler intro sentences ("This skill provides a structured
workflow for...")
- Removed "Available Tools" and "Research Subagent Configuration"
sections from web-research — the agent already knows its tools
- Removed verbose "Common Exploration Patterns" and "Tips" sections from
schema-exploration that restated earlier content
- Trimmed "About Skills" and "What Skills Provide" sections from both
skill-creator instances

**arxiv-search (52% → 94%)**
- Replaced 103 lines of verbose content with 34 focused lines
- Removed explanations of what arXiv is, "When to Use" section,
"Features" list, and "Notes" section
- Kept only the essential: usage syntax, one example, and dependency
install

**langgraph-docs (56% → 86%)**
- Added concrete capabilities to description (stateful agents,
multi-agent workflows, human-in-the-loop)
- Added error recovery guidance for failed fetch_url calls
- Removed redundant "Overview" section

**query-writing (53% → 100%)**
- Added error recovery section for empty results, syntax errors, and
timeouts

</details>

Honest disclosure — I work at @tesslio where we build tooling around
skills like these. Not a pitch - just saw room for improvement and
wanted to contribute.

Want to self-improve your skills? Just point your agent (Claude Code,
Codex, etc.) at [this Tessl
guide](https://docs.tessl.io/evaluate/optimize-a-skill-using-best-practices)
and ask it to optimize your skill. Ping me -
[@popey](https://github.com/popey) - if you hit any snags.

Thanks in advance 🙏

> **Disclaimer**: This contribution was assisted by generative AI
tooling (Claude Code + tessl skill review).

## make format

```
make format
🎨 Formatting libs/acp
[ "deepagents_acp/ tests/" = "" ] || uv run --group test ruff format deepagents_acp/ tests/
Using CPython 3.12.11
Creating virtual environment at: .venv
      Built deepagents-acp @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/acp
Installed 69 packages in 100ms
11 files left unchanged
[ "deepagents_acp/ tests/" = "" ] || uv run --group test ruff check --fix deepagents_acp/ tests/
All checks passed!
🎨 Formatting libs/cli
[ "." = "" ] || uv run --all-groups ruff format .
Using CPython 3.12.11
Creating virtual environment at: .venv
      Built deepagents-cli @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/cli
      Built deepagents @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/deepagents
Installed 177 packages in 213ms
125 files left unchanged
[ "." = "" ] || uv run --all-groups ruff check --fix .
All checks passed!
🎨 Formatting libs/deepagents
[ "." = "" ] || uv run --all-groups ruff format .
Using CPython 3.12.11
Creating virtual environment at: .venv
Installed 118 packages in 143ms
80 files left unchanged
[ "." = "" ] || uv run --all-groups ruff check --fix .
All checks passed!
🎨 Formatting libs/harbor
[ "deepagents_harbor/ tests/" = "" ] || uv run --group test ruff format deepagents_harbor/ tests/
Using CPython 3.12.11
Creating virtual environment at: .venv
      Built deepagents-cli @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/cli
      Built deepagents-harbor @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/harbor
Installed 198 packages in 390ms
7 files left unchanged
[ "deepagents_harbor/ tests/" = "" ] || uv run --group test ruff check --fix deepagents_harbor/ tests/
All checks passed!
🎨 Formatting libs/partners/daytona
[ "." = "" ] || uv run --all-groups ruff format .
Using CPython 3.12.11
Creating virtual environment at: .venv
      Built langchain-daytona @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/partners/daytona
Installed 115 packages in 133ms
8 files left unchanged
[ "." = "" ] || uv run --all-groups ruff check --fix .
All checks passed!
🎨 Formatting libs/partners/modal
[ "." = "" ] || uv run --all-groups ruff format .
Using CPython 3.12.11
Creating virtual environment at: .venv
      Built langchain-modal @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/partners/modal
Installed 102 packages in 97ms
8 files left unchanged
[ "." = "" ] || uv run --all-groups ruff check --fix .
All checks passed!
🎨 Formatting libs/partners/runloop
[ "." = "" ] || uv run --all-groups ruff format .
Using CPython 3.12.11
Creating virtual environment at: .venv
      Built langchain-runloop @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/partners/runloop
Installed 79 packages in 72ms
8 files left unchanged
[ "." = "" ] || uv run --all-groups ruff check --fix .
All checks passed!
 All packages formatted!
```

## make lint

```
make lint
🔍 Linting libs/acp
[ "deepagents_acp/ tests/" = "" ] ||    uv run --group test ruff format deepagents_acp/ tests/ --diff
11 files already formatted
[ "deepagents_acp/ tests/" = "" ] ||    uv run --group test ruff check deepagents_acp/ tests/
All checks passed!
/Library/Developer/CommandLineTools/usr/bin/make type
uv run --group test ty check deepagents_acp
All checks passed!
🔍 Linting libs/cli
[ "." = "" ] || uv run --all-groups ruff check .
All checks passed!
[ "." = "" ] || uv run --all-groups ruff format . --diff
125 files already formatted
/Library/Developer/CommandLineTools/usr/bin/make type PYTHON_FILES="."
uv run --all-groups ty check .
warning[possibly-missing-attribute]: Attribute `kwargs` may be missing on object of type `_Call | None | @Todo`
    --> tests/unit_tests/test_thread_selector.py:1409:22
     |
1408 |                 mock_list_threads.assert_awaited_once()
1409 |                 kw = mock_list_threads.await_args.kwargs
     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1410 |                 assert kw["limit"] == 20
1411 |                 assert kw["include_message_count"] is False
     |
info: rule `possibly-missing-attribute` is enabled by default

warning[possibly-missing-attribute]: Attribute `kwargs` may be missing on object of type `_Call | None | @Todo`
    --> tests/unit_tests/test_thread_selector.py:1501:22
     |
1500 |                 mock_list_threads.assert_awaited_once()
1501 |                 kw = mock_list_threads.await_args.kwargs
     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1502 |                 assert kw["limit"] == 20
1503 |                 assert kw["include_message_count"] is False
     |
info: rule `possibly-missing-attribute` is enabled by default

Found 2 diagnostics
🔍 Linting libs/deepagents
[ "." = "" ] || uv run --all-groups ruff check .
All checks passed!
[ "." = "" ] || uv run --all-groups ruff format . --diff
80 files already formatted
/Library/Developer/CommandLineTools/usr/bin/make type
uv run --all-groups ty check deepagents
All checks passed!
🔍 Linting libs/harbor
[ "deepagents_harbor/ tests/" = "" ] || uv run --group test ruff format deepagents_harbor/ tests/ --diff
7 files already formatted
/Library/Developer/CommandLineTools/usr/bin/make type PYTHON_FILES="deepagents_harbor/ tests/"
[ "deepagents_harbor/ tests/" = "" ] || uv run --group test ty check deepagents_harbor/ tests/
All checks passed!
🔍 Linting libs/partners/daytona
[ "." = "" ] || uv run --all-groups ruff check .
All checks passed!
[ "." = "" ] || uv run --all-groups ruff format . --diff
8 files already formatted
/Library/Developer/CommandLineTools/usr/bin/make type
uv run --all-groups ty check langchain_daytona
All checks passed!
🔍 Linting libs/partners/modal
[ "." = "" ] || uv run --all-groups ruff check .
All checks passed!
[ "." = "" ] || uv run --all-groups ruff format . --diff
8 files already formatted
/Library/Developer/CommandLineTools/usr/bin/make type
uv run --all-groups ty check langchain_modal
All checks passed!
🔍 Linting libs/partners/runloop
[ "." = "" ] || uv run --all-groups ruff check .
All checks passed!
[ "." = "" ] || uv run --all-groups ruff format . --diff
8 files already formatted
/Library/Developer/CommandLineTools/usr/bin/make type
uv run --all-groups ty check langchain_runloop
All checks passed!
 All packages linted!
```
2026-03-17 00:15:26 -04:00
Mason Daugherty e9710f29c5 style: delete some emojis (#1422) 2026-02-19 10:52:26 -05:00
Mason Daugherty 3da1e8bc20 fix(cli): per-subcommand help screens, short flags, and skills enhancements (#1190)
- Add per-subcommand Rich help screens so that `deepagents <subcommand>
-h` shows context-specific help instead of the global help or argparse
defaults
- Add short flags: `-a` (agent), `-M` (model), `-v` (version)
- Add `ls` alias for `list` in `threads` and `skills` subcommands
- Add `(default)` label in `deepagents list` output
- Add shadow detection in `skills info` (warns when a project skill
overrides a user skill)
- Add `_format_info_fields()` to display optional skill metadata
(license, compatibility, etc.)
- Reverse skill precedence display order to "highest precedence first"
for clarity

(Hard to factor out, as some of this was intertwined)
2026-02-07 04:12:18 -05:00
Mason Daugherty d1a87ed44f docs(cli): behavior about skills locations & creation (#1179) 2026-02-06 18:07:04 -05:00
Mason Daugherty 199d17676a fix(cli): align skill-creator example scripts with agent skills spec (#1177)
- Fix `init_skill.py` help text from "Max 40 characters" to "Max 64
characters" to match every other reference
- Add `compatibility` to `ALLOWED_PROPERTIES` in `quick_validate.py` and
add length validation (max 500 chars per
[spec](https://agentskills.io/specification))
- Add `compatibility` to the allowed properties list in skill-creator
`SKILL.md` docs
2026-02-06 18:06:18 -05:00
Mason Daugherty 6eb93c2c5b chore(cli): turn on type checking & resolve issues (#1086) 2026-02-04 16:41:49 -05:00
Mason Daugherty 2460b1ee01 refactor(cli): format & lint (#1023) 2026-02-03 11:31:47 -05:00
Mason Daugherty 754b5fde94 refactor(cli): rename folder to cli/ (#962)
from `deepagents-cli/` -> `cli/`
2026-01-30 14:53:59 -08:00