> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qredence.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Subagents (RLM)

> How rlm(...) spawns real child agents from inside an IPython cell, and how the runtime schedules them.

`rlm(...)` — recursive language model — is how Fleet Prime Agent runs child agents from inside a session. Call it from an IPython cell and you get back a real agent process, not just another model call.

## Why it's different from a function call

A regular tool call runs a fixed piece of code. `rlm(...)` runs a full agent: it has its own kernel, its own transcript, its own tool loop, and it can spawn its own subagents. When the child finishes it returns a result to the parent kernel like any Python function would.

## Spawning children

Inside an IPython cell:

```python theme={null}
result = rlm("Read README.md and return a one-line summary.")
print(result)
```

Parallel fan-out is idiomatic:

```python theme={null}
summaries = rlm.parallel([
    "Summarize packages/agent/README.md",
    "Summarize packages/ai/README.md",
    "Summarize packages/coding-agent/README.md",
])
```

Background runs return a handle you can await later:

```python theme={null}
handle = rlm.background("Comb the repo for TODOs and group by package.")
# ... keep working ...
todos = handle.wait()
```

## What runs where

`SubagentRuntimeHost` schedules children. Each child runs as its own agent process with:

* Its own IPython kernel
* Its own transcript, written under the parent's session tree
* A `parentSession` link and a `rlmDepth` counter so the runtime knows how deep the tree is

The parent turn keeps streaming while children run, and each child shows up as its own tool card in the UI.

## Refinement uses RLM

`/refine` is implemented on top of RLM. The harness spawns evaluator subagents, reads the trajectory, and updates supplemental state based on evidence. See [Refinement](/fleet-prime-agent/concepts/refinement).

## Related

* [Sessions](/fleet-prime-agent/concepts/sessions) — parent/child sessions are the primitive RLM builds on.
* [Streaming protocol](/fleet-prime-agent/concepts/streaming-protocol) — subagent events flow over the same stream as the parent.
