Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/better-harness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ The visible/private split in this repo is meant to support train-vs-holdout opti
Two load modes are supported:

- `module_attr`
- patch a Python attribute such as `deepagents.graph:BASE_AGENT_PROMPT`
- patch a Python attribute such as `package.module:ATTRIBUTE`
- `workspace_file`
- temporarily replace a file in the target workspace for one eval run

Expand Down
14 changes: 1 addition & 13 deletions examples/better-harness/examples/deepagents_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# Notes:
# - This example is intentionally one file. It uses `base_value` so the outer
# agent can see the starting prompt/tools/skills/middleware directly.
# agent can see the starting tools, skills, and middleware directly.
# - Middleware usually needs two surfaces:
# 1. the middleware implementation file
# 2. the file that wires that middleware into `create_deep_agent(...)`
Expand All @@ -32,18 +32,6 @@ model_flag = "--model"
summary_flag = "--evals-report-file"
pytest_args = ["-q"]

[surfaces.prompt]
kind = "module_attr"
target = "deepagents.graph:BASE_AGENT_PROMPT"
filename = "prompt.txt"
base_value = """
You are a helpful agent.

If a request is underspecified, ask the minimum followup needed to make the next useful move.
Do not ask for details the user already supplied.
Use reasonable defaults when the request clearly implies them.
"""

[surfaces.tools]
kind = "workspace_file"
target = "libs/deepagents/deepagents/custom_tools.py"
Expand Down
2 changes: 0 additions & 2 deletions libs/deepagents/deepagents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from deepagents._version import __version__
from deepagents.graph import (
BASE_AGENT_PROMPT,
DeepAgentState,
SystemPromptConfig,
create_deep_agent,
Expand All @@ -28,7 +27,6 @@
)

__all__ = [
"BASE_AGENT_PROMPT",
"AsyncSubAgent",
"AsyncSubAgentMiddleware",
"CompiledSubAgent",
Expand Down
45 changes: 0 additions & 45 deletions libs/deepagents/deepagents/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,51 +73,6 @@ class DeepAgentState(AgentState):
messages: Required[Annotated[list[AnyMessage], DeltaChannel(_messages_delta_reducer, snapshot_frequency=50)]] # ty: ignore[invalid-argument-type]


BASE_AGENT_PROMPT = """You are a deep agent, an AI assistant that helps users accomplish tasks using tools. You respond with text and tool calls. The user can see your responses and tool outputs in real time.
Comment thread
robin-agent[bot] marked this conversation as resolved.
Resolved

## Core Behavior

- Be concise and direct. Don't over-explain unless asked.
- NEVER add unnecessary preamble (\"Sure!\", \"Great question!\", \"I'll now...\").
- Don't say \"I'll now do X\" — just do it.
- If the request is underspecified, ask only the minimum followup needed to take the next useful action.
- If asked how to approach something, explain first, then act.

## Professional Objectivity

- Prioritize accuracy over validating the user's beliefs
- Disagree respectfully when the user is incorrect
- Avoid unnecessary superlatives, praise, or emotional validation

## Doing Tasks

When the user asks you to do something:

1. **Understand first** — read relevant files, check existing patterns. Quick but thorough — gather enough evidence to start, then iterate.
2. **Act** — implement the solution. Work quickly but accurately.
3. **Verify** — check your work against what was asked, not against your own output. Your first attempt is rarely correct — iterate.

Keep working until the task is fully complete. Don't stop partway and explain what you would do — just do it. Only yield back to the user when the task is done or you're genuinely blocked.

**When things go wrong:**

- If something fails repeatedly, stop and analyze *why* — don't keep retrying the same approach.
- If you're blocked, tell the user what's wrong and ask for guidance.

## Clarifying Requests

- Do not ask for details the user already supplied.
- Use reasonable defaults when the request clearly implies them.
- Prioritize missing semantics like content, delivery, detail level, or alert criteria.
- Avoid opening with a long explanation of tool, scheduling, or integration limitations when a concise blocking followup question would move the task forward.
- Ask domain-defining questions before implementation questions.
- For monitoring or alerting requests, ask what signals, thresholds, or conditions should trigger an alert.

## Progress Updates

For longer tasks, provide brief progress updates at reasonable intervals — a concise sentence recapping what you've done and what's next.""" # noqa: E501


class SystemPromptConfig(TypedDict, total=False):
"""Structured `system_prompt` for `create_deep_agent`.

Expand Down
22 changes: 0 additions & 22 deletions libs/deepagents/tests/unit_tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from deepagents.graph import (
_REQUIRED_MIDDLEWARE_CLASSES,
_REQUIRED_MIDDLEWARE_NAMES,
BASE_AGENT_PROMPT,
DeepAgentState,
_apply_custom_middleware,
create_deep_agent,
Expand Down Expand Up @@ -565,7 +564,6 @@ def test_profile_base_system_prompt_replaces_base(self) -> None:
HarnessProfile(base_system_prompt="You are a custom agent."),
)
assert prompt == "You are a custom agent."
assert BASE_AGENT_PROMPT not in prompt

def test_profile_base_system_prompt_with_suffix(self) -> None:
prompt = self._build_and_capture_system_prompt(
Expand All @@ -576,7 +574,6 @@ def test_profile_base_system_prompt_with_suffix(self) -> None:
),
)
assert prompt == "You are a custom agent.\n\nBe concise."
assert BASE_AGENT_PROMPT not in prompt

def test_suffix_without_base_system_prompt_omits_empty_base(self) -> None:
prompt = self._build_and_capture_system_prompt(
Expand All @@ -592,7 +589,6 @@ def test_user_system_prompt_prepended_before_profile_base(self) -> None:
system_prompt="User instructions.",
)
assert prompt == "User instructions.\n\nCustom base."
assert BASE_AGENT_PROMPT not in prompt

def test_user_system_prompt_is_used_without_default_base(self) -> None:
prompt = self._build_and_capture_system_prompt(
Expand All @@ -612,7 +608,6 @@ def test_triple_combo_all_three_inputs(self) -> None:
system_prompt="User instructions.",
)
assert prompt == "User instructions.\n\nCustom base.\n\nExtra."
assert BASE_AGENT_PROMPT not in prompt

def test_system_message_with_profile_base(self) -> None:
msg = SystemMessage(content="User content.")
Expand All @@ -625,15 +620,13 @@ def test_system_message_with_profile_base(self) -> None:
# Last content block should contain the custom base.
last_block = result.content_blocks[-1]
assert "Custom base." in last_block["text"]
assert BASE_AGENT_PROMPT not in last_block["text"]

def test_empty_string_base_system_prompt_replaces_with_empty(self) -> None:
prompt = self._build_and_capture_system_prompt(
"custprov",
HarnessProfile(base_system_prompt=""),
)
assert prompt == ""
assert BASE_AGENT_PROMPT not in prompt

def test_empty_string_suffix_still_appended(self) -> None:
prompt = self._build_and_capture_system_prompt(
Expand All @@ -649,21 +642,6 @@ def test_default_base_is_empty(self) -> None:
"""With no profile base and no caller base, the assembled base is empty."""
prompt = self._build_and_capture_system_prompt("defprov", HarnessProfile())
assert prompt == ""
assert BASE_AGENT_PROMPT not in prompt

def test_base_agent_prompt_restores_base(self) -> None:
"""Callers opt the authored prose back in via `system_prompt={"base": ...}`."""
prompt = self._build_and_capture_system_prompt(
"defprov",
HarnessProfile(),
system_prompt={"base": BASE_AGENT_PROMPT},
)
assert prompt == BASE_AGENT_PROMPT

def test_base_agent_prompt_holds_authored_prose(self) -> None:
"""The authored prose is preserved (not deleted) so it can be restored."""
assert "You are a deep agent" in BASE_AGENT_PROMPT
assert "Professional Objectivity" in BASE_AGENT_PROMPT


_ABSENT = object()
Expand Down
18 changes: 6 additions & 12 deletions libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,9 @@ def make_bare_graph(config: dict[str, object] | None = None) -> object:
configurable = _configurable(config)
model = _build_model(configurable)
backend = LocalShellBackend(root_dir=_workdir(configurable), inherit_env=False)
# No `system_prompt`: left unset, `create_deep_agent` builds the prompt from
# the library's own `BASE_AGENT_PROMPT` — the value this benchmark varies
# across branches. A harness override is normalized to a prepended
# `{"prefix": ...}` that would sit ahead of that base on every arm, masking
# the difference and giving the no-system-prompt arm a prompt it should not
# have. The sandbox workdir is already enforced by the shell backend's
# `root_dir`.
# No `system_prompt`: keep the bare agent on `create_deep_agent`'s
# prompt-free default. The sandbox workdir is already enforced by the shell
# backend's `root_dir`.
return create_deep_agent(
model=model,
backend=backend,
Expand Down Expand Up @@ -451,11 +447,9 @@ async def make_tau3_graph(config: dict[str, object] | None = None) -> object:
model = _build_model(configurable)
client = MultiServerMCPClient(_mcp_connections(configurable))
tools = await client.get_tools()
# No `system_prompt`: the agent uses the overlaid branch's own
# BASE_AGENT_PROMPT (the value this benchmark varies) and learns the
# tau3-runtime conversation protocol from the MCP tools' server-advertised
# descriptions, keeping the conversation category a fair, base-prompt-only
# comparison parallel to the bare path.
# No `system_prompt`: the tau3-runtime conversation protocol comes from the
# MCP tools' server-advertised descriptions, without adding an authored base
# prompt.
return create_deep_agent(
model=model,
tools=tools,
Expand Down
2 changes: 1 addition & 1 deletion libs/evals/tests/evals/test_langchain_middleware_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
`WRITE_TODOS_TOOL_DESCRIPTION` directly — using `create_agent` +
`TodoListMiddleware` (not `create_deep_agent`) — so they exercise the
prompt content that ships in `langchain.agents.middleware.todo` without
any deepagents-side `BASE_AGENT_PROMPT` running in front of it.
any Deep Agents system prompt running in front of it.

The companion langchain PR landed a fix for the "wasted post-tool turn"
pattern that fhuang originally reported on Sonnet 4.6: when the model
Expand Down
9 changes: 4 additions & 5 deletions libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ def fake_create_deep_agent(**kwargs: object) -> object:
assert captured_create
assert captured_create[0]["model"] == "chat-model"
assert captured_create[0]["backend"] is backend
# The bare path must not inject a harness system prompt; the overlaid
# branch's own BASE_AGENT_PROMPT is the variable this benchmark tests.
# The bare path must not inject a harness system prompt, preserving the
# prompt-free SDK default.
assert "system_prompt" not in captured_create[0]


Expand Down Expand Up @@ -674,9 +674,8 @@ def fake_create_deep_agent(**kwargs: object) -> object:
assert result == "graph"
assert captured_create
assert captured_create[0]["model"] == "chat-model"
# The tau3 conversation protocol comes from the MCP tools' descriptions, not a
# harness system prompt; the overlaid branch's BASE_AGENT_PROMPT is the only
# injected system-prompt content, parallel to the bare path.
# The tau3 conversation protocol comes from the MCP tools' descriptions, not
# a harness system prompt.
assert "system_prompt" not in captured_create[0]
assert captured_create[0]["tools"] == [
"start_conversation",
Expand Down