Skip to content

Open-source design agent: on-brand stills, decks, diagrams, charts and motion graphics from a chat thread, built on Deep Agents.

One-paste deploy: a tested coding-agent prompt, hidden key entry, an honest doctor (#56)

Amal Irgashev1a4cd9c6d530
diff --git a/.agents/skills/design-agent-deploy/SKILL.md b/.agents/skills/design-agent-deploy/SKILL.md
index fb960af..ab26534 100644
--- a/.agents/skills/design-agent-deploy/SKILL.md
+++ b/.agents/skills/design-agent-deploy/SKILL.md
@@ -7,8 +7,9 @@ description: Put Design Agent in a team's Slack. Deploy it to Managed Deep Agent
A deployment is what the team uses. Ask before `mda deploy`, before connecting Slack, and before
anything that bills (publishing a snapshot, hosting). Never print a key; name missing settings.
-Setup comes first: `uv run design-agent doctor` should pass and the brand pack should validate
-(`design-agent-onboarding`, `brand-onboarding`).
+Setup comes first: `uv run design-agent doctor` should show no `FAIL` line and the brand pack should
+validate (`design-agent-onboarding`, `brand-onboarding`). A first deploy can use the sample brand
+and needs no local Docker; `doctor`'s `mda-deploy` line lists what the deploy still needs.
| | Managed Deep Agents (recommended) | Self-hosted |
| --- | --- | --- |
@@ -18,8 +19,24 @@ Setup comes first: `uv run design-agent doctor` should pass and the brand pack s
## Managed Deep Agents
+**Ask first, in one message:** do they have a LangSmith Cloud account with Managed Deep Agents (US,
+public beta), which model (Anthropic by default, or the LangSmith Gateway), whether to start with the
+sample brand (fine for a first deploy) or theirs, and whether to deploy a test copy first. Say what
+bills: the snapshot build, hosting and model spend ([pricing](https://www.langchain.com/pricing)).
+
+**Keys never pass through you.** Name the keys (`LANGSMITH_API_KEY`, needs deployment permission,
+and the model's key) and have the person run `uv run design-agent config set LANGSMITH_API_KEY
+ANTHROPIC_API_KEY` in their own terminal: each value is typed hidden. Without a terminal the command
+refuses rather than asking you for the value. Never ask for a key in chat.
+
+**Long and interactive steps.** `sandbox publish` takes 10 to 15 minutes and asks to confirm: after
+their yes, run `sandbox publish --yes` in the background. The first `mda deploy` sets up the Slack
+app and waits for a person: a browser sign-in (no `LANGSMITH_API_KEY` in `.env`), an authorization
+link, and Enter in a real terminal. Have the person run it in their own terminal. Later deploys
+need no Slack step; run them after a yes (`--yes` overwrites same-name resources).
+
1. **Publish the computer once.** `uv run design-agent sandbox build && uv run design-agent sandbox test`
- proves the recipe locally; `uv run design-agent sandbox publish --fs-gib 16` builds the snapshot
+ proves the recipe locally; `uv run design-agent sandbox publish` builds the 16 GiB snapshot
in their workspace (sandbox time is billed). Publish again whenever `sandbox/setup.sh` changes.
2. **Check the keys.** `mda deploy` forwards every `.env` key except LangSmith's as a deployment
secret. List the key *names* in `.env` and confirm they are only what the deployed agent uses
@@ -29,10 +46,15 @@ Setup comes first: `uv run design-agent doctor` should pass and the brand pack s
(`mda-deploy`), and `uv run mda build` compiles what would ship into `.mda/build/`.
3. **Try a copy first.** `uv run mda deploy --name design-agent-test` is a separate deployment; the
team's agent is untouched.
-4. **Deploy** with `uv run mda deploy` after a yes. The first deploy provisions the Slack app; the
- person authorizes it in their Slack workspace. Without a `LANGSMITH_API_KEY`, `mda deploy`
- offers a browser sign-in.
-5. **Verify with real requests:** a quick still, then a short storyboarded teaser. In Slack you
+4. **Deploy** with `uv run mda deploy` after a yes. The first deploy provisions the Slack app
+ (its name is `DESIGN_AGENT_SLACK_NAME` in `.env`). If LangSmith isn't authorized
+ for their Slack workspace, the CLI prints an HTTPS link: they open it, pick the workspace and
+ approve (a workspace admin may have to), then press Enter. Rerun the deploy if the link was
+ missed. Without a `LANGSMITH_API_KEY`, `mda deploy` offers a browser sign-in. The Slack app is
+ managed: there is no manifest or `SLACK_*` key to set, whatever a generic MDA skill says.
+5. **Verify with real requests.** Once live, the agent DMs the person who deployed; they reply,
+ or `/invite` it to a channel and mention it. Start with a quick still, then a short storyboarded
+ teaser. In Slack you
should see live progress, a check-in while it renders, and files attached at the end. Without
Slack, call the deployment's API ([docs/deploy-mda.md](../../../docs/deploy-mda.md) has the
snippet); files attach to the run's LangSmith trace. `uv run mda logs` tails the deployment.
diff --git a/.agents/skills/design-agent-onboarding/SKILL.md b/.agents/skills/design-agent-onboarding/SKILL.md
index 06f36d7..0dce340 100644
--- a/.agents/skills/design-agent-onboarding/SKILL.md
+++ b/.agents/skills/design-agent-onboarding/SKILL.md
@@ -8,15 +8,17 @@ description: Install and configure Design Agent, add a brand, connect Paper, cho
Work through these with the person, in order. Never print a key or token; report missing settings
by name. Do not deploy, connect accounts or publish anything until the person asks.
-1. **Install and prove the computer.** `uv sync`, then `uv run design-agent sandbox build` (Docker;
+1. **Install and prove the computer.** Optional before a first MDA deploy, which needs no Docker.
+ `uv sync`, then `uv run design-agent sandbox build` (Docker;
a cold build downloads about 2 GB and takes several minutes) and `uv run design-agent demo`: a
scripted run renders the sample brand's launch card in three sizes and a 4-second teaser with no
keys. If it fails, `uv run design-agent doctor` says what is missing.
-2. **Model.** `uv run design-agent config set DESIGN_AGENT_MODEL=provider:model` and the provider's
- key (`ANTHROPIC_API_KEY=…`, or `LANGSMITH_GATEWAY_API_KEY` for a `langsmith:` model; typed by the
- person, or set in `.env` by hand). Defaults and other roles: `docs/models.md`. Re-run `doctor`,
- then `uv run design-agent test model`: `doctor` only checks that a key is set, the test makes
- one cheap call with it.
+2. **Model.** `uv run design-agent config set DESIGN_AGENT_MODEL=provider:model`, then the person
+ runs `uv run design-agent config set ANTHROPIC_API_KEY` (or `LANGSMITH_GATEWAY_API_KEY` for a
+ `langsmith:` model) in their own terminal and types the key hidden; never take a key in chat.
+ Defaults and other roles: `docs/models.md`. Re-run `doctor`, then, with their yes,
+ `uv run design-agent test model`: `doctor` only checks that a key is set, the test makes one
+ cheap, billed call with it.
3. **Media keys (optional).** `OPENAI_API_KEY` (image generation), `ELEVENLABS_API_KEY` (voice,
music, sound effects), `GROQ_API_KEY` (fast transcription). Each tool says plainly when its key
is missing.
diff --git a/AGENTS.md b/AGENTS.md
index badd1fb..14d128c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -36,7 +36,9 @@ The harness under the agent has its own skills, vendored unmodified from LangCha
| turning traces into evaluation datasets | [langsmith-dataset](.agents/skills/langsmith-dataset/SKILL.md) |
| LangSmith evaluators and experiments | [langsmith-evaluator](.agents/skills/langsmith-evaluator/SKILL.md) |
-They are written for any project, so where they disagree with this file, this file wins.
+They are written for any project, so where they disagree with this file, this file wins. On Managed
+Deep Agents, for example, `channels/slack.py` declares a managed Slack app: there is no Slack
+manifest or `SLACK_*` key to set, whatever a generic skill says.
For anything else, start from the map of every document, [docs/README.md](docs/README.md). Never
print a key, and ask before deploying, connecting accounts or spending money. The rest of this file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18d9788..1d91dc8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@
### Added
+- A one-paste prompt for coding agents in the README and `docs/deploy-mda.md`: install, keys, checks
+ and deploy, asking before anything that bills. Tested from an empty folder.
+- `config set` with a bare key (`config set ANTHROPIC_API_KEY`) asks for the value with hidden input,
+ so keys never pass through a coding agent's chat. Without a terminal it refuses instead.
- The README in Simplified Chinese (`README.zh-CN.md`) and Japanese (`README.ja.md`), with a
language switcher at the top of each. The English README stays the source of truth.
- Images from Google's Gemini image models (from #50): with `GOOGLE_API_KEY`, or through the
@@ -42,6 +46,10 @@
### Changed
+- `doctor` says "ready for `mda deploy`" only when a deploy would work: until the snapshot is
+ published and the lead model's key is in `.env` (a deploy ships `.env`, not the shell), its
+ `mda-deploy` line lists what to do first. The deploy skill asks the setup questions up front,
+ runs the long steps in the background, and walks through Slack authorization.
- Personal memory reaches Slack channel threads through MDA's per-run layer selection: `agent.py`
is a factory that selects both memory layers for every Slack run, replacing the `allow(context)`
policy MDA deprecated in 0.9.0. Who gets which layer where is unchanged.
diff --git a/README.md b/README.md
index a56dcec..a8631c3 100644
--- a/README.md
+++ b/README.md
@@ -145,7 +145,7 @@ LangSmith Cloud) and a model key:
```bash
curl -fsSL https://raw.githubusercontent.com/langchain-ai/design-agent/main/install.sh | bash
cd design-agent
-uv run design-agent config set LANGSMITH_API_KEY=lsv2_… ANTHROPIC_API_KEY=sk-ant-…
+uv run design-agent config set LANGSMITH_API_KEY ANTHROPIC_API_KEY # type each key; it stays hidden
uv run design-agent sandbox publish # once per workspace, 10-15 min: the agent's computer
uv run mda deploy # the agent itself, and its Slack app
```
@@ -164,15 +164,29 @@ then uses `LANGSMITH_GATEWAY_API_KEY`, else `LANGSMITH_API_KEY`, and image gener
the gateway too when there is no `OPENAI_API_KEY`. For any other OpenAI-compatible endpoint, set
`DESIGN_AGENT_MODEL_BASE_URL` and `DESIGN_AGENT_MODEL_API_KEY_ENV` ([Models](docs/models.md)).
-The first deploy sets up the agent's Slack app. Authorize it in your workspace, then mention the
-agent in a channel. It's how we run ours at LangChain. Try changes on a separate copy with
+The first deploy sets up the agent's Slack app: `mda deploy` prints a Slack link, you approve the
+app for your workspace (an admin may need to), and press Enter. The agent then sends you a DM;
+reply to it, or `/invite` it to a channel and mention it. It's how we run ours at LangChain. Try changes on a separate copy with
`uv run mda deploy --name design-agent-test`. In a workspace with agent mode,
`uv run mda deploy --agent-environment production` (or `staging`, `development`) deploys into that
environment of the agent, and each environment keeps its own traces: open the agent in LangSmith
and pick the environment. `uv run mda dev` traces to its Local environment.
[Deploy with MDA](docs/deploy-mda.md) covers keys, what ships and checking it works.
-**Or ask your coding agent.** Open the repo in Claude Code, Codex or Cursor and say what you want.
+**Or ask your coding agent.** Paste this into Claude Code, Codex or Cursor, from any folder:
+
+```text
+Deploy LangChain's open-source design agent to my Slack workspace with Managed Deep Agents.
+
+1. Install it with `curl -fsSL https://raw.githubusercontent.com/langchain-ai/design-agent/main/install.sh | bash`, then work in the `design-agent` folder it creates.
+2. Read `AGENTS.md` and follow the `design-agent-deploy` skill.
+3. Tell me which keys you need. I'll type them myself with `uv run design-agent config set <KEY>` in my terminal; never ask me to paste a key in chat.
+4. Run `uv run design-agent doctor` and fix what it flags. Its `mda-deploy` line lists what a deploy still needs.
+5. Ask me before `uv run design-agent sandbox publish`, which bills. Then have me run the first deploy, `uv run mda deploy`, in my own terminal, since it sets up the Slack app.
+6. When it's live, walk me through messaging the agent in Slack and sending a first request.
+```
+
+Once the repo is open, say what you want.
[AGENTS.md](AGENTS.md) routes each request to a step-by-step [skill](.agents/skills/):
| Say | It will |
diff --git a/docs/deploy-mda.md b/docs/deploy-mda.md
index a832383..59a30d8 100644
--- a/docs/deploy-mda.md
+++ b/docs/deploy-mda.md
@@ -6,13 +6,26 @@ so `mda deploy` deploys it as it is:
```bash
git clone https://github.com/langchain-ai/design-agent.git && cd design-agent
-uv run design-agent config set LANGSMITH_API_KEY=lsv2_… ANTHROPIC_API_KEY=sk-ant-…
+uv run design-agent config set LANGSMITH_API_KEY ANTHROPIC_API_KEY # type each key; it stays hidden
uv run design-agent sandbox publish
uv run mda deploy
```
`uv run` uses the `mda` CLI pinned in `uv.lock`, so the CLI matches the SDK the agent is built on.
+To have a coding agent do it, paste this into Claude Code, Codex or Cursor:
+
+```text
+Deploy LangChain's open-source design agent to my Slack workspace with Managed Deep Agents.
+
+1. Install it with `curl -fsSL https://raw.githubusercontent.com/langchain-ai/design-agent/main/install.sh | bash`, then work in the `design-agent` folder it creates.
+2. Read `AGENTS.md` and follow the `design-agent-deploy` skill.
+3. Tell me which keys you need. I'll type them myself with `uv run design-agent config set <KEY>` in my terminal; never ask me to paste a key in chat.
+4. Run `uv run design-agent doctor` and fix what it flags. Its `mda-deploy` line lists what a deploy still needs.
+5. Ask me before `uv run design-agent sandbox publish`, which bills. Then have me run the first deploy, `uv run mda deploy`, in my own terminal, since it sets up the Slack app.
+6. When it's live, walk me through messaging the agent in Slack and sending a first request.
+```
+
## What you need
- A LangSmith Cloud account (Managed Deep Agents is in public beta) and an API key with deployment permission
@@ -55,7 +68,11 @@ uv run mda deploy
MDA compiles the project, syncs `instructions.md` and `skills/` to Context Hub, uploads the source,
bakes the sandbox recipe on your snapshot and waits until the deployment is live. On the first
-deploy it provisions the Slack app; authorize it in your Slack workspace when prompted. Channels
+deploy it provisions the Slack app, named by `DESIGN_AGENT_SLACK_NAME`. If LangSmith hasn't been authorized for your Slack workspace yet, the CLI prints an HTTPS
+link: open it, pick the workspace, approve the access (a workspace admin may need to approve the
+app first), and press Enter in the terminal to continue. Once it's live, the agent sends you a
+DM; reply to start a thread, or `/invite` it to a channel and mention it there. Run `uv run mda
+deploy` again if you missed the link: it asks again until Slack is authorized. Channels
require `identity.py` (LangSmith API-key authentication by default; see MDA's identity docs for
per-person identities).
diff --git a/docs/self-hosting.md b/docs/self-hosting.md
index 8fa291d..ca79e55 100644
--- a/docs/self-hosting.md
+++ b/docs/self-hosting.md
@@ -13,7 +13,7 @@ durability, and Docker for the sandbox computers. Docker Compose starts all of i
```bash
cp .env.example .env
-uv run design-agent config set DESIGN_AGENT_MODEL=anthropic:claude-opus-5-5 ANTHROPIC_API_KEY=…
+uv run design-agent config set DESIGN_AGENT_MODEL=anthropic:claude-opus-5-5 ANTHROPIC_API_KEY
uv run design-agent config generate DESIGN_AGENT_API_TOKENS POSTGRES_PASSWORD
docker compose -f deploy/self-host/compose.yaml up -d --build
curl -s http://127.0.0.1:8080/health
diff --git a/install.sh b/install.sh
index 1f6b796..4b83191 100755
--- a/install.sh
+++ b/install.sh
@@ -39,7 +39,7 @@ cat <<EOF
Installed in $DIR. To put it in your team's Slack with Managed Deep Agents:
cd $DIR
- uv run design-agent config set LANGSMITH_API_KEY=lsv2_... ANTHROPIC_API_KEY=sk-ant-...
+ uv run design-agent config set LANGSMITH_API_KEY ANTHROPIC_API_KEY # type each key; it stays hidden
uv run design-agent sandbox publish # once per workspace: the agent's computer
uv run mda deploy
diff --git a/src/design_agent/cli.py b/src/design_agent/cli.py
index 1285b37..27bbd44 100644
--- a/src/design_agent/cli.py
+++ b/src/design_agent/cli.py
@@ -253,19 +253,35 @@ def config_show(as_json: bool) -> None:
click.echo(f"{row['name']:40} {state}")
+def _can_prompt() -> bool:
+ return sys.stdin.isatty()
+
+
@config.command("set")
@click.argument("pairs", nargs=-1, required=True)
def config_set(pairs: tuple[str, ...]) -> None:
- """Set KEY=VALUE pairs (known keys only; the file stays private to you)."""
- from design_agent.envfile import EnvFileError, write_env
+ """Set settings in .env: KEY=VALUE, or a bare KEY to type its value hidden (known keys only)."""
+ from design_agent.envfile import EnvFileError, known_keys, write_env
+ known = known_keys(_root())
updates = {}
for pair in pairs:
name, sep, value = pair.partition("=")
+ name = name.strip()
if not sep:
- click.echo(f"{pair}: use KEY=VALUE", err=True)
- sys.exit(2)
- updates[name.strip()] = value
+ if name not in known:
+ click.echo(
+ f"{name} is not a setting this project documents in .env.example", err=True
+ )
+ sys.exit(1)
+ if not _can_prompt():
+ click.echo(
+ f"{name}: run this in your own terminal, where the value is typed hidden",
+ err=True,
+ )
+ sys.exit(2)
+ value = click.prompt(name, hide_input=True)
+ updates[name] = value
try:
changed = write_env(_root(), updates)
except EnvFileError as error:
diff --git a/src/design_agent/doctor.py b/src/design_agent/doctor.py
index 5278b31..1539c8e 100644
--- a/src/design_agent/doctor.py
+++ b/src/design_agent/doctor.py
@@ -175,8 +175,10 @@ def _check_sandbox(settings: Settings) -> Check:
available, reason = DockerSandboxRunner(image=settings.sandbox_image).available()
return Check(
"sandbox",
- "ok" if available else "fail",
- f"Docker image {settings.sandbox_image}" if available else reason,
+ "ok" if available else "warn",
+ f"Docker image {settings.sandbox_image}"
+ if available
+ else f"{reason} (only local runs need it; an MDA deploy does not)",
)
@@ -197,25 +199,38 @@ def _check_mda_project(root: Path) -> Check:
missing = [p for p in MDA_FILES if not (root / p).is_file()]
if missing:
return Check("mda-project", "warn", "missing " + ", ".join(missing))
- if declared_base(root) == "docker_image":
- return Check(
- "mda-project",
- "warn",
- "declarations present; publish the sandbox snapshot before an MDA deploy (`sandbox publish`)",
- )
+ published = declared_base(root) != "docker_image"
return Check(
- "mda-project", "ok", "declarations present; sandbox declares the published snapshot"
+ "mda-project",
+ "ok",
+ "declarations present" + ("; sandbox declares the published snapshot" if published else ""),
)
-def _check_mda_deploy(root: Path) -> Check:
- """What would make a plain `mda deploy` of this checkout fail or ship the wrong thing."""
+def deploy_model_key(settings: Settings) -> str | None:
+ """The `.env` key the deployed lead model needs, or None when it goes through the gateway."""
+ spec = settings.lead_model()
+ if spec.via_gateway:
+ return None
+ field = PROVIDER_KEYS.get(spec.provider)
+ return field.upper() if field else None
+
+
+def _check_mda_deploy(root: Path, settings: Settings | None = None) -> Check:
+ """What would make a plain `mda deploy` of this checkout fail or ship the wrong thing.
+
+ "Ready" means a deploy works as it stands: the snapshot is published and the lead model's key
+ is in `.env` (a deploy ships `.env`, never the shell). Until then the check says what to do
+ first, as a warning, since a checkout that only runs the local demo needs neither.
+ """
from dotenv import dotenv_values
+ from design_agent.runtime.sandbox.publish import declared_base
from design_agent.skills_lock import is_text, verify
problems: list[str] = []
warnings: list[str] = []
+ first: list[str] = []
binary = [
path.relative_to(root).as_posix()
for path in sorted((root / "skills").rglob("*"))
@@ -229,6 +244,13 @@ def _check_mda_deploy(root: Path) -> Check:
warnings.append("vendored skills differ from skills-lock.json (`skills verify`)")
env_file = root / ".env"
env = dotenv_values(env_file) if env_file.is_file() else {}
+ if (root / "sandbox" / "__init__.py").is_file() and declared_base(root) == "docker_image":
+ if settings is not None and settings.langsmith_api_key is None:
+ first.append("put LANGSMITH_API_KEY in .env (`config set LANGSMITH_API_KEY`)")
+ first.append("publish the sandbox snapshot (`sandbox publish`)")
+ key = deploy_model_key(settings) if settings is not None else None
+ if key and not (env.get(key) or "").strip():
+ first.append(f"put {key} in .env (`config set {key}`); a deploy ships .env, not your shell")
forwarded = [key for key in SELF_HOSTED_KEYS if (env.get(key) or "").strip()]
if forwarded:
warnings.append(
@@ -242,6 +264,8 @@ def _check_mda_deploy(root: Path) -> Check:
f"workspace/out holds {size // (1024 * 1024)} MB of renders, which `mda deploy` "
"archives (200 MB limit): clear old ones"
)
+ if first:
+ warnings.insert(0, "before `mda deploy`: " + ", then ".join(first))
status: Status = "fail" if problems else "warn" if warnings else "ok"
detail = "; ".join(problems + warnings) or "ready for `mda deploy`"
return Check("mda-deploy", status, detail)
@@ -287,7 +311,7 @@ def run_checks(settings: Settings, root: Path) -> list[Check]:
_check_sandbox(settings),
_check_node(),
_check_mda_project(root),
- _check_mda_deploy(root),
+ _check_mda_deploy(root, settings),
_check_mcp(root),
_check_paper(settings),
]
diff --git a/tests/unit/test_cli_commands.py b/tests/unit/test_cli_commands.py
index 5252c08..80b458a 100644
--- a/tests/unit/test_cli_commands.py
+++ b/tests/unit/test_cli_commands.py
@@ -1,4 +1,4 @@
-"""Small CLI commands: brand init, fonts verify, sandbox use, test db."""
+"""Small CLI commands: brand init, fonts verify, sandbox use, test db, config set."""
from __future__ import annotations
@@ -65,3 +65,30 @@ def test_sandbox_use_points_local_runs_at_a_snapshot(project: Path) -> None:
def test_test_db_writes_and_removes_a_row(project: Path) -> None:
result = CliRunner().invoke(cli.main, ["test", "db"])
assert result.exit_code == 0 and "SQLite" in result.output
+
+
+def test_config_set_with_a_bare_key_asks_for_the_value_hidden(
+ project: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(cli, "_can_prompt", lambda: True)
+ result = CliRunner().invoke(
+ cli.main, ["config", "set", "ANTHROPIC_API_KEY"], input="sk-ant-typed\n"
+ )
+ assert result.exit_code == 0, result.output
+ assert "sk-ant-typed" not in result.output
+ assert "ANTHROPIC_API_KEY=sk-ant-typed" in (project / ".env").read_text()
+
+
+def test_config_set_with_a_bare_key_refuses_without_a_terminal(project: Path) -> None:
+ result = CliRunner().invoke(cli.main, ["config", "set", "ANTHROPIC_API_KEY"])
+ assert result.exit_code == 2
+ assert "your own terminal" in result.output
+ assert not (project / ".env").exists()
+
+
+def test_config_set_never_prompts_for_an_unknown_key(
+ project: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(cli, "_can_prompt", lambda: True)
+ result = CliRunner().invoke(cli.main, ["config", "set", "NOT_A_KEY"], input="x\n")
+ assert result.exit_code == 1 and "not a setting" in result.output
diff --git a/tests/unit/test_doctor.py b/tests/unit/test_doctor.py
index 1f16c6e..b6aadd7 100644
--- a/tests/unit/test_doctor.py
+++ b/tests/unit/test_doctor.py
@@ -5,6 +5,9 @@ from __future__ import annotations
import shutil
from pathlib import Path
+import pytest
+
+from design_agent.config import Settings
from design_agent.doctor import _check_mda_deploy
ROOT = Path(__file__).resolve().parents[2]
@@ -41,3 +44,40 @@ def test_self_hosting_keys_in_env_are_named_never_printed(tmp_path: Path) -> Non
assert check.status == "warn"
assert "SLACK_APP_TOKEN" in check.detail and "DATABASE_URL" not in check.detail
assert "secret" not in check.detail.replace("deployment secrets", "")
+
+
+def _settings(monkeypatch: pytest.MonkeyPatch, model: str) -> Settings:
+ monkeypatch.setenv("DESIGN_AGENT_MODEL", model)
+ monkeypatch.delenv("ANTHROPIC_API_KEY", raising=False)
+ monkeypatch.delenv("LANGSMITH_API_KEY", raising=False)
+ return Settings(_env_file=None) # type: ignore[call-arg]
+
+
+def test_an_unpublished_snapshot_and_a_shell_only_key_are_named_first(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ root = _project(tmp_path)
+ shutil.copytree(ROOT / "sandbox", root / "sandbox")
+ settings = _settings(monkeypatch, "anthropic:claude-opus-5-5")
+ monkeypatch.setenv("ANTHROPIC_API_KEY", "sk-ant-only-in-the-shell")
+ check = _check_mda_deploy(root, settings)
+ assert check.status == "warn"
+ assert check.detail.startswith(
+ "before `mda deploy`: put LANGSMITH_API_KEY in .env (`config set LANGSMITH_API_KEY`), "
+ "then publish the sandbox snapshot"
+ )
+ assert "put ANTHROPIC_API_KEY in .env" in check.detail
+ assert "only-in-the-shell" not in check.detail and "ready" not in check.detail
+
+
+def test_the_model_key_in_env_or_a_gateway_model_needs_nothing_more(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ root = _project(tmp_path)
+ (root / ".env").write_text("ANTHROPIC_API_KEY=sk-ant-secret\n")
+ assert (
+ _check_mda_deploy(root, _settings(monkeypatch, "anthropic:claude-opus-5-5")).status == "ok"
+ )
+ (root / ".env").unlink()
+ gateway = _settings(monkeypatch, "langsmith:anthropic/claude-opus-5-5")
+ assert _check_mda_deploy(root, gateway).status == "ok"