Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion pipeline/preprocessors/link_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class LinkMap(TypedDict):
# Deep Agents
"create_deep_agent": "deepagents/graph/create_deep_agent",
"DeepAgentState": "deepagents/graph/DeepAgentState",
"SystemPromptConfig": "deepagents/graph/SystemPromptConfig",
"SubAgent": "deepagents/middleware/subagents/SubAgent",
"CompiledSubAgent": "deepagents/middleware/subagents/CompiledSubAgent",
"SubAgentMiddleware": "deepagents/middleware/subagents/SubAgentMiddleware",
Expand Down
32 changes: 2 additions & 30 deletions src/oss/deepagents/customization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ For detailed configuration options including stdio servers, OAuth authentication

## System prompt

Deep Agents ship with a built-in base system prompt that teaches the agent how to use the harness scaffolding (planning, filesystem tools, subagents). Pass `system_prompt=` to prepend your own instructions before that base prompt:
Pass `system_prompt=` to give the agent your own instructions:

:::python
<CustomizationSystemPromptPy />
Expand All @@ -188,37 +188,9 @@ Deep Agents ship with a built-in base system prompt that teaches the agent how t
:::

<Note>
Besides a string, the main agent also accepts a @[`SystemMessage`] with structured [content blocks](/oss/langchain/messages#standard-content-blocks); Deep Agents preserve those blocks and append the built-in base prompt ([subagent](/oss/deepagents/subagents) dictionary specs remain strings).
Besides a string, the main agent also accepts a @[`SystemMessage`] with structured [content blocks](/oss/langchain/messages#standard-content-blocks); Deep Agents preserve those blocks ([subagent](/oss/deepagents/subagents) dictionary specs remain strings).
</Note>

When middleware adds special tools, like the filesystem tools, it appends its own guidance to the system prompt at runtime.

:::python
<Note>
`SystemPromptConfig` requires `deepagents>=0.7.0a6`.
</Note>

For full control over prompt assembly, pass a @[`SystemPromptConfig`] dict with `prefix`, `base`, and `suffix` keys:

- **`prefix`**: text placed before the base prompt (same as passing a bare string).
- **`base`**: replaces the built-in base prompt. Omit the key to keep the built-in base, or set it to `None` to drop the base entirely.
- **`suffix`**: text placed after the base prompt.

Parts are assembled in order: `prefix` -> `base` -> `suffix` -> any model-specific [profile](/oss/deepagents/profiles) suffix. Each part accepts a `str` or a `SystemMessage` (to preserve `cache_control` markers for Anthropic prompt caching).

```python
# Overwrite the default base prompt:
create_deep_agent(..., system_prompt={"base": "..."})

# No system prompt except from middleware:
create_deep_agent(..., system_prompt={"base": None})

# Sandwich the default base prompt:
create_deep_agent(..., system_prompt={"prefix": "...", "suffix": "..."})
```

For model-specific system prompt customization, such as replacing the base prompt or appending a suffix for a particular provider, use a [harness profile](/oss/deepagents/profiles#harness-profiles).
:::

<AccordionGroup>
<Accordion title="Subagent prompts">
Expand Down
2 changes: 1 addition & 1 deletion src/snippets/create-deep-agent-config-options-js.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const agent = createDeepAgent({
store?: BaseStore,
streamTransformers?: TStreamTransformers,
subagents?: TSubagents,
systemPrompt?: string | SystemMessage<MessageStructure<MessageToolSet>> | SystemPromptConfig,
systemPrompt?: string | SystemMessage<MessageStructure<MessageToolSet>>,
tools?: TTools | StructuredTool<ToolInputSchemaBase, any, any, any, unknown>[]
});
```
Loading