Recursive Language Model

A durable RLM built from Tardigrade components.

What is an RLM?

An RLM puts long context inside a code environment. The model inspects and partitions that context, calls models over smaller pieces, and combines their work into one answer.

Build it with Tardigrade

Code mode provides the environment. Packages expose files, fetch, workspace storage, and child agents. Budgets and compaction keep the recursive work bounded.

README.md / Compose an agentView on GitHub
ts
import {
  actor, agentMethods, agentsPackage, budget,
  budgetAuthority, caller, codeMode, compaction,
  fetchPackage, filesPackage, infer,
  outputValidateOnce, system, workspacePackage
} from "tardie"

const instructions = system(
  "Investigate with code and delegate independent work."
)

const rlm = actor({
  name: "researcher",
  methods: agentMethods,
  components: [
    infer([
      instructions,
      budget([
        codeMode([
          filesPackage(),
          fetchPackage(),
          agentsPackage(),
          workspacePackage()
        ])
      ], { authority: caller() }),
      compaction(),
      outputValidateOnce
    ]),
    budgetAuthority()
  ]
})

How it is assembled

codeMode

Lets the model act by writing JavaScript.

agentsPackage

Lets that code spawn durable child agents.

workspacePackage

Stores large values outside the model context.

budget + compaction

Bounds delegated work and the context sent to the model.

Start from the quickstart

Initialize a project with the RLM template to get this assembly directly.

tdg init researcher --template rlm