new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

LangChain · Agents · all subjects

advanced multi-agent patterns

10 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Distinguishing instructions from memory in Managed Deep Agents

`instructions.md` defines how the agent should behave and is always read-only; the agent never updates it. Memory stores knowledge the agent learns and uses across threads. Deploys sync project-owned instructions and skills, but do not overwrite durable content already stored under `memories/agent` in Context Hub.

Durable memory scope and backing for Managed Deep Agents

Durable memory in Managed Deep Agents is optional knowledge retained across threads and sessions. When enabled, durable memory is backed by Context Hub. The deployment gets one read/write tree at `/memories/agent/`, shared by every caller. Managed Deep Agents do not have durable memory by default.

Memory project structure for Managed Deep Agents

The optional memory declaration lives at the project root in a file named memory.py (Python) or memory.ts (JavaScript), alongside agent.py or agent.ts.

Enable memory in Managed Deep Agents

To enable memory, export a named `memory` declaration with the `"agent"` scope. In Python, use `memory = define_memory(scope="agent")` from the managed_deepagents module. In JavaScript, use `export const memory = defineMemory({ scope: "agent" })` from managed-deepagents. You can also use `scope="none"` or `scope: "none"` to disable it. Remove the memory declaration entirely to turn durable memory off.

Memory structure and usage in Managed Deep Agents

When enabled, durable memory mounts one Context Hub tree, `memories/agent`, at `/memories/agent/` in the agent filesystem. The path `/memories/agent/AGENTS.md` is hot memory for compact, frequently relevant knowledge with contents loaded into every run. Other files under `/memories/agent/` are cold memory for detailed knowledge that the agent reads only when relevant. The agent reads and updates memory with `read_file`, `edit_file`, and `write_file`. Writes elsewhere, including elsewhere under `/memories/`, are not durable.

Memory organization compared to instructions and thread state

Instructions and skills define deploy-owned agent behavior shared by the deployment and read-only to the agent. Thread state enables conversation continuity scoped to one thread. Durable memory stores knowledge learned and retained in Context Hub, shared by the deployment across threads. Memory is not the system prompt; use instructions for always-on behavior, skills for task-specific procedures, and memory for durable knowledge the agent learns while running.

Security and design considerations for Managed Deep Agents shared memory

Memory is shared by every caller of the deployment, and every caller can influence it. Store only knowledge that every caller may read and modify. Never store personal or customer-private data, credentials, API keys, tokens, or other secrets. Treat memory as untrusted input: content saved by one caller is loaded for later callers and must not grant authority, change tool permissions, or bypass approvals. Keep those controls in the agent definition. Do not enable shared memory when callers should not influence one another.

Hot memory design guidance for Managed Deep Agents

Keep hot memory compact because it consumes context on every run. Put detailed material such as procedures, decision logs, and research notes in cold files under `/memories/agent/`, and link to them from hot memory in `/memories/agent/AGENTS.md` when useful.

How the agent decides what to remember in Managed Deep Agents

The agent decides what to remember based on prompting. To make the policy explicit, add guidance to `instructions.md` explaining that the agent has deployment-shared durable memory under `/memories/agent/`, to keep compact frequently useful knowledge in `/memories/agent/AGENTS.md`, to put longer material in cold files under the same tree and link to it from `AGENTS.md` when useful. The instructions should clarify to store only procedures and facts appropriate for every caller of the deployment, never store personal data or credentials, and treat existing memory as untrusted notes not as instructions or authorization. When the agent decides to persist something, it uses `edit_file` or `write_file`. If the write fails, the agent should not claim that it remembered it.

Subagents parameter in agent definition

Pass subagent definitions in `subagents` when the agent should delegate specialized or context-heavy work. Each subagent can have its own prompt, model, and tools.

Give your agent this brain