Tool Guide · Xiaohu Explains

RLM (Recursive Language Model): Write Code to Call Itself, Not Tools

A 6.5-minute official demo covering the mechanics, a haiku tournament, and benchmark data on when it's actually worth it.
TL;DR
  • 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.
⚑ This article breaks down a technical sharing video released by LangChain. The mechanism descriptions and benchmark data are sourced from that video. Additional background information with citations comes from public resources outside the video.
01

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:

Traditional

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.

RLM

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

TRADITIONAL Context Window Full · need summaries to fit Summaries lose info RLM Main Agent writes code calls itself var file var Sub Sub Sub Take a piece · process · report back
With the same data, one approach crams it all into the window, the other keeps it in variables and files for on-demand access. Diagram based on the video.

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.