Defined in: packages/components/src/agents/rlm/RLMAgent.ts:111
RLMAgent - Recursive Language Model Agent
Processes long contexts by allowing the LLM to generate code that orchestrates multiple sub-LLM calls for chunking and analysis tasks.
Supports true recursive nesting where Sub-LLM can itself be an RLM instance.
Examples
Basic usage (depth=1):
const agent = new RLMAgent({ rootLLM, subLLM });
const result = await agent.runStream({
context: fileSystemContext,
query: "Analyze this codebase"
});
Recursive RLM (depth=2) with shared context:
const fsContext = new FileSystemContext(basePath, files);
const agent = new RLMAgent({
rootLLM,
subLLM,
maxDepth: 2,
sharedContext: fsContext
});
Extends
Component
Constructors
Constructor
new RLMAgent(config): RLMAgent;
Defined in: packages/components/src/agents/rlm/RLMAgent.ts:115
Parameters
| Parameter | Type |
|---|---|
config |
RLMAgentConfig |
Returns
RLMAgent
Overrides
Component.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
closesWithInputs |
readonly |
boolean |
Whether the node closes its outputs once all its inputs have ended (RFC 0001), so the end of a stream travels on. A node that keeps producing after its inputs end (a timer) overrides it with false and closes its outputs itself. |
Component.closesWithInputs |
node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:204 |
I |
readonly |
PortAccessor |
Resolves an input port. Bound to the node, so it can be passed around as $i. |
Component.I |
node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:167 |
id |
readonly |
string |
- | Component.id |
node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:163 |
identity |
readonly |
symbol |
- | Component.identity |
node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:164 |
inPort |
protected readonly |
Port |
The default in input port. |
Component.inPort |
packages/core/dist/component/index.d.ts:51 |
O |
readonly |
PortAccessor |
Resolves an output port. Bound to the node, so it can be passed around as $o. |
Component.O |
node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:169 |
opts |
public |
object |
- | Component.opts |
node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:165 |
outPort |
protected readonly |
Port |
The default out output port. A pipeline uses it to infer the endpoint. |
Component.outPort |
packages/core/dist/component/index.d.ts:53 |
type |
readonly |
typeof TRANSFORM |
- | Component.type |
node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:197 |
Port |
static |
typeof Port |
Port factory from the HLang runtime. Component.Port.I(name) and Component.Port.O(name) create input and output ports; call .attach(this) in the constructor. |
Component.Port |
packages/core/dist/component/index.d.ts:49 |
Methods
_transform()
_transform($i, $o): void;
Defined in: packages/components/src/agents/rlm/RLMAgent.ts:141
Pipeline mode: receives RLMInput on in and sends the resolved RLMResult on out.
A failed run sends a result with an empty answer and an error message. Input that is
not an RLMInput fails the pipeline run with a TypeError.
Parameters
| Parameter | Type |
|---|---|
$i |
Port |
$o |
Port |
Returns
void
Overrides
Component._transform
E()
E(): Port;
Defined in: node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:208
The error output (@node/error); Readable and Transform nodes have one.
Returns
Port
Inherited from
Component.E
run()
run(data): Promise<RLMResult>;
Defined in: packages/components/src/agents/rlm/RLMAgent.ts:132
Process input through RLM
Parameters
| Parameter | Type |
|---|---|
data |
RLMInput |
Returns
Promise<RLMResult>
Overrides
Component.run
runStream()
runStream(data): AsyncGenerator<RLMChunk>;
Defined in: packages/components/src/agents/rlm/RLMAgent.ts:165
Process input through RLM with streaming output
Parameters
| Parameter | Type |
|---|---|
data |
RLMInput |
Returns
AsyncGenerator<RLMChunk>
throw()
throw(error): void;
Defined in: node_modules/.pnpm/@hlang-org+runtime@2.1.0_rxjs@7.8.2/node_modules/@hlang-org/runtime/lib/index.d.ts:207
Sends error on the error output.
Parameters
| Parameter | Type |
|---|---|
error |
unknown |
Returns
void
Inherited from
Component.throw