Deep AgentsDeep Agents 0.7 · Python 3.11+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
28 small wins to finish your pathNext lesson →

System prompt: giving the agent its job

The system prompt is the instruction text that goes to the model before every conversation; in a deep agent it is the system_prompt argument, and it sets the agent's role, rules and answer style.

Last updated: 29 Sep, 2026 · Deep Agents 0.7

Context engineering and input context · from the Complete Deep Agents Course With LangChain · 79:30 to 84:36

Input context and the system prompt

The video treats the system prompt as the first kind of context engineering: giving the agent the right information and tools, in the right format, so it can do a task reliably. Some context arrives when the agent starts. That is the input context: the system prompt, memory files and skills, loaded on every run. Other context arrives while it runs, such as the user's message; later lessons cover runtime context, compressing long histories and isolating work in subagents.

A research assistant system prompt · from the Complete Deep Agents Course With LangChain · 85:02 to 88:02

The example sets a research assistant's prompt: specialize in scientific literature, always cite sources, and use subagents for parallel research on different topics. The prompt is loaded first on every call. The video's code follows, run on Groq with the model line swapped. The reply is long, so the page prints its first 700 characters:

ExampleAPI keyFrom the video, run on Groq
from deepagents import create_deep_agent
from langchain.chat_models import init_chat_model

agent = create_deep_agent(
    model=init_chat_model("groq:openai/gpt-oss-120b", max_retries=6),
    system_prompt=(
        "You are a research assistant specializing in scientific literature. "
        "Always cite sources. Use subagents for parallel research on different topics."
    ),
)
result = agent.invoke({"messages": [{"role": "user", "content": "What is deepagent?"}]})
print(result["messages"][-1].content[:700])

The agent has no search tool, so the whole answer comes from what the model learned in training; nothing in it was looked up. "Always cite sources" in a prompt cannot give an agent sources. Only a tool can, which is why the trip planner's prompt says "use only what search_travel returns".

The notebook says deep agents come with a built-in system prompt inspired by Claude Code's, with long instructions for planning, files and subagents. Since deepagents 0.7 that base prompt is empty: the model receives your system_prompt and the descriptions of its tools. Together with opt-in planning and shorter tool descriptions, this cut a default turn's input tokens by about two thirds. Write the instructions your agent needs.

Comparing no prompt with a travel-planner prompt

Start trip.py with search_travel, the catalog tool from Tools: a travel search the agent can call. Everything below goes in the same file, under it. The loop below builds the agent twice, once with no system prompt and once with the planner's, and asks both the same question.

python
from langchain.tools import tool

CATALOG = {
    "paris": {
        "flight": ["Return flight Delhi to Paris: 42,000 rupees"],
        "hotel": ["Seine Budget Inn, Latin Quarter: 5,200 rupees a night",
                  "Hotel Lumiere, Montmartre: 7,500 rupees a night",
                  "Le Grand Opera Hotel: 16,000 rupees a night"],
        "sight": ["Eiffel Tower summit: 3,100 rupees", "Louvre Museum: 2,000 rupees",
                  "Seine river cruise: 1,500 rupees", "Versailles day trip: 2,600 rupees",
                  "Montmartre walking tour: free"],
        "food": ["Cafe breakfast and bistro dinner: 3,000 rupees a day"],
    },
}


@tool
def search_travel(city: str, kind: str) -> str:
    """Search the travel catalog. kind is "flight", "hotel", "sight" or "food". Prices are in rupees."""
    entries = CATALOG.get(city.lower(), {}).get(kind)
    return "\n".join(entries) if entries else f"The catalog has no {kind} entries for {city}."
python
from deepagents import create_deep_agent
from langchain.chat_models import init_chat_model

model = init_chat_model("groq:openai/gpt-oss-120b", temperature=0, max_retries=6)
ExampleAPI keytrip.py, continued
question = {"messages": [{"role": "user", "content": "Suggest two Paris sights that cost under 2,500 rupees."}]}

for prompt in [None, "You are a travel planner. Look up every price with search_travel and use only what it returns. Answer in two short sentences."]:
    agent = create_deep_agent(model=model, tools=[search_travel], system_prompt=prompt)
    result = agent.invoke(question)
    tools_used = [c["name"] for m in result["messages"] for c in getattr(m, "tool_calls", [])]
    print("system prompt:", "none" if prompt is None else "travel planner")
    print("tools used:   ", tools_used)
    print("answer:       ", result["messages"][-1].text, "\n")

What changed between the two runs

  • Both agents called search_travel.
  • Without a prompt the answer grew into a table with descriptions the catalog never returned, such as what each sight is famous for.
  • With the prompt the answer kept to two sentences and to the catalog's prices, because the prompt said so.

Where the system prompt sits among the agent's context

ContextWhere it comes fromWhen the model sees it
System promptsystem_prompt=Every call
Memory (AGENTS.md)memory=Every call, after the prompt
Skillsskills=Names at start, full text when needed
Tool descriptionsYour tools and the built-insEvery call

What to put in a deep agent's prompt

  • The agent's role and the task it serves: "You are a travel planner."
  • Where facts must come from, and what to do when a tool finds nothing.
  • The shape of the answer: length, format, and what files to write.
Watch out. A long prompt is paid for on every model call. Keep rules that apply to every run in the prompt, and move large reference material into memory files or skills, which Memory: AGENTS.md loaded with memory= and Skills: SKILL.md loaded on demand cover.
Try it yourself
  • Add "Always give prices in euros too" to the planner's prompt and see what the agent does without an exchange rate.
  • Ask the prompted agent about Tokyo and check it says the catalog has nothing.
  • Give the video's research prompt to the travel agent and compare its answer.

Every expert started right here.