DOCSAPI reference

CLASS

RLMAgent

Defined in: packages/components/src/agents/rlm/RLMAgent.ts:101

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:105

Parameters

Parameter Type
config RLMAgentConfig

Returns

RLMAgent

Overrides

Component.constructor

Properties

Property Modifier Type Description Inherited from Defined in
flow public Flow | null - Component.flow node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:24
I public (name) => Port - Component.I node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:26
id public string - Component.id node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:18
identity public Symbol - Component.identity node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:25
inPort protected readonly Port The default in input port. Component.inPort packages/core/dist/component/index.d.ts:49
isRunning public boolean - Component.isRunning node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:23
O public (name) => Port - Component.O node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:27
opts public object - Component.opts node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:19
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:51
portMap public PortMap - Component.portMap node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:22
type public Symbol - Component.type node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:17
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:47

Methods

_transform()

_transform($i, $o): void;

Defined in: packages/components/src/agents/rlm/RLMAgent.ts:130

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.

Parameters

Parameter Type
$i Port
$o Port

Returns

void

Overrides

Component._transform


attach()

attach(flow): void;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:31

Parameters

Parameter Type
flow any

Returns

void

Inherited from

Component.attach


attachPort()

attachPort(port): void;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:32

Parameters

Parameter Type
port any

Returns

void

Inherited from

Component.attachPort


E()

E(): Port;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:30

Returns

Port

Inherited from

Component.E


executeOnce()

executeOnce(type, ...args): void;

Defined in: node_modules/.pnpm/@hlang-org+runtime@1.0.5/node_modules/@hlang-org/runtime/lib/node/node.d.ts:29

Parameters

Parameter Type
type any
...args any[]

Returns

void

Inherited from

Component.executeOnce


run()

run(data): Promise<RLMResult>;

Defined in: packages/components/src/agents/rlm/RLMAgent.ts:122

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:149

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@1.0.5/node_modules/@hlang-org/runtime/lib/node/transform.d.ts:4

Parameters

Parameter Type
error any

Returns

void

Inherited from

Component.throw