RLM (Recursive Language Model): Write Code to Call Itself, Not Tools
- RLM gives models the ability to "call themselves": the main agent writes code to spawn sub-agents, shifting context from the model window into variables and files.
- Official benchmarks draw a practical line: at a 64k context, there's little difference; at 128k, the gap becomes clear.
- The trade-offs are stated upfront: higher latency and token costs, in exchange for accuracy and determinism.
What RLM (Recursive Language Model) Is
In plain terms, RLM gives an AI model the ability to "call itself."
That definition is easy to hear and move past. It only makes sense when you see it next to the traditional approach:
You give the agent a huge file, and it has to stuff everything into its limited memory (the context window) to analyze it.
The result is often that it forgets earlier parts, or loses significant detail when summarizing.
The model's orchestration logic lives in code. The main agent acts as a director, writing code to create multiple sub-agents for parallel work—a divide-and-conquer strategy.
Most of the context and intermediate data is held in variables or local files, rather than being force-fed into the context window.
The real-world difference: the model doesn't need to "memorize the whole book before answering"; it "writes a processing pipeline and looks up the page it needs."
Background not covered in the video: RLM wasn't introduced by LangChain. It comes from a blog post by Alex Zhang in October 2025, later formalized in a paper (arXiv:2512.24601). LangChain integrated this paradigm into its agent framework to make it directly usable.
This article examines a 6-minute 36-second official tech talk by LangChain open-source engineer Sydney Runkle, focused on using RLM within Deep Agents.
The full LangChain official demo, 6 min 36 sec, with our bilingual subtitles. The breakdown below covers this video.
