How to Use RLMs in Deep Agents
recursive-language-modelsdeep-agentscontext-rotprogrammatic-orchestration
Abstraction: Recursive language models combat context rot via programmatic subagent orchestration
Key points:
- Context rot causes agent performance degradation as context grows; RLMs proposed by Alex Zhang (MIT CSAIL) address this by running orchestration code in a REPL that dispatches subagents recursively
- RLMs can process inputs up to two orders of magnitude beyond a model's context window, outperforming vanilla agents on long-context tasks
- LangChain's Deep Agents implements this as "recursive agents" (RA): subagents with their own tool access dispatched via a code interpreter using JavaScript/QuickJS
- Benchmarked on OOLONG (AgNews): programmatic agent held up at 128k tokens while plain agent gave up outright and refused to compute
- Deterministic coverage guaranteed by code loops (not model judgment) enables bespoke pipelines: fan-out, parallel, sequential orchestration
- Orchestrator and subagents can run on any model mix (frontier + open-weight) for cost/performance optimization
Connections: Langchain · Mit Csail · AI Agents · Agentic Coding · Large Language Models
Source: https://www.langchain.com/blog/how-to-use-rlms-in-deep-agents