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 →

Memory: AGENTS.md loaded with memory=

Memory in Deep Agents is a set of AGENTS.md files, passed with memory=, whose contents are loaded into the system prompt on every run, so project rules and preferences apply without repeating them.

Last updated: 29 Sep, 2026 · Deep Agents 0.7

What AGENTS.md is and why memory stays small · from the Complete Deep Agents Course With LangChain · 88:02 to 93:38

AGENTS.md: a README for agents

The video searches for AGENTS.md: an open format, used by tens of thousands of open-source projects, that works as a README for coding agents, a predictable place for the context and instructions an agent needs. Claude Code's CLAUDE.md does the same job. In Deep Agents a memory file is always loaded with the system prompt, with no loading on demand, so it should stay small: project conventions, user preferences, rules that apply to every conversation. The video's example is a company's stack, FastAPI, PostgreSQL, Redis and Qdrant on AWS, so that "build a RAG pipeline" comes back in that stack.

Loading AGENTS.md with memory= and create_file_data · from the Complete Deep Agents Course With LangChain · 105:10 to 107:50

The video creates projects/AGENTS.md with Claude Code, then passes memory=["/projects/AGENTS.md"] to create_deep_agent. With the default backend the file has to be in the agent's state, so the call seeds it through files, using create_file_data to wrap the text in the shape the backend expects. Asked "What's in your memory? Who are you?", the agent answered from the file: plan first with a to-do tool, offload work to files, delegate to subagents. On screen the path is typed as projects/AGENTS.md; the saved notebook, shown here, uses /projects/AGENTS.md, the same path as the seeded file.

python
from deepagents.backends.utils import create_file_data

agent = create_deep_agent(
    model="openai:gpt-5.4",
    memory=["/projects/AGENTS.md"],
    checkpointer=MemorySaver(),
)
result = agent.invoke(
    {"messages": [{"role": "user", "content": "What's in your memory? Who are you?"}],
     "files": {"/projects/AGENTS.md": create_file_data(agents_md)}},
    config={"configurable": {"thread_id": "default-demo-1"}},
)

Shown as it ran in the video, not run here: it reads the 6,000-character AGENTS.md from the video's repository (github.com/krishnaik06/Deep-agents-With-Langchain). The trip planner below uses a four-line file of its own.

The memory= syntax

python
agent = create_deep_agent(model=model, memory=["/AGENTS.md"])   # a list of paths
agent.invoke({"messages": [...], "files": {"/AGENTS.md": create_file_data(text)}})   # StateBackend: seed it

The trip desk rules

The planner needs both tools. Start trip.py with search_travel and add_costs, from write_todos: planning with TodoListMiddleware:

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}."


@tool
def add_costs(amounts: list[int]) -> int:
    """Add rupee amounts and return the exact total. Use it for every sum."""
    return sum(amounts)
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)
from deepagents.backends.utils import create_file_data
python
AGENTS_MD = """# Trip desk rules
- Plans have one line per day, starting with "Day 1:".
- Write every price as rupees with commas, like 5,200 rupees.
- End every plan with a line "Total: <amount> rupees", added up with add_costs.
"""

An agent that loads the rules

python
agent = create_deep_agent(
    model=model,
    tools=[search_travel, add_costs],
    memory=["/AGENTS.md"],                      # loaded into the system prompt on every run
    system_prompt="You are a travel planner. Use only prices from search_travel.",
)

A plan that follows AGENTS.md

ExampleAPI keytrip.py, continued
result = agent.invoke({
    "messages": [{"role": "user", "content": "Plan 2 days of Paris sightseeing, sights only."}],
    "files": {"/AGENTS.md": create_file_data(AGENTS_MD)},   # the StateBackend reads it from state
})
print(result["messages"][-1].text)

How the reply follows the file

  • One line per day, each starting with "Day 1:", as the first rule says.
  • Prices in rupees with commas, from the catalog.
  • A total line at the end, "Total: 9,200 rupees", as the third rule asks. None of these rules is in the system prompt; they came from /AGENTS.md.

Memory vs system prompt

system_promptmemory=[...]
Where it livesIn your codeIn a file on a backend
Who can change itYou, by editing codeYou, or the agent with edit_file
LoadedEvery callEvery call

Where memory files fit

  • House rules for every answer, like the format above.
  • Facts about a project: its stack, its conventions, where things are.
  • Preferences the agent learns and writes back, kept in a store as the composite-backend lesson showed.

The memory file is read when a thread starts and its text is added to every model call on that thread. An edit the agent makes during a thread shows up from the next thread on.

Watch out. Everything in a memory file is sent on every call. A long AGENTS.md costs tokens on each step and can confuse the model; move detailed, occasional knowledge into skills.
Try it yourself
  • Add a rule "Mention one free activity each day" and run the plan again.
  • Run the same request without the files seed and read how the format changes.
  • Ask the agent "Add a rule that prices also show euros" and print the file it edits.

This is what real progress feels like.