langchain-architecture
Installation
SKILL.md
DeepAgents Masterclass
Build production-grade, autonomous agents using the DeepAgents harness. This framework is 100% compatible with LangChain structures, allowing you to seamlessly integrate any LangChain retriever, tool, or guardrail into a robust autonomous loop.
Core Architecture
DeepAgents operates on a 3-layer architecture designed for durability and context hygiene.
1. The Harness (Cognitive Loop)
The harness create_deep_agent is not just a loop; it is a rigid cognitive architecture that enforces specific behaviors:
- Planning First: The agent is driven by a Todo list (
write_todos). It cannot effectively operate without a plan. - Context-on-Disk: To prevent context window pollution (and hallucinations), the harness prioritizes filesystem operations (
grep,read_file) over loading everything into memory. - Eviction: Large tool outputs are legally evicted from the context window and replaced with file pointers.
2. Middleware (Capabilities)
Middleware extends the agent without cluttering the core graph.
- SubAgentMiddleware: Spawns isolated agents. This is CRITICAL for complex tasks.
- FilesystemMiddleware: Manages valid paths and virtual environments.