Open Agent Loops
API Reference

FileReadBackend

@open-agent-loops/core


Defined in: tools/builtin/builtin.types.ts:250

The read-only filesystem capability seam — implement this against your host.

Remarks

Backs the two read-only file tools (read and glob). Read-only by nature, so — like SearchBackend — it is far less dangerous than a mutating or exec capability, but it still touches a filesystem the core knows nothing about, hence a seam rather than a shipped implementation.

Backing point: this interface is where you back read and glob, exactly the way SearchBackend is where you back search (grep). Wire it to e.g. Node's fs, a virtual filesystem, or a sandbox.

See

Methods

glob()

glob(query, ctx): Promise<string[]>;

Defined in: tools/builtin/builtin.types.ts:266

List files matching a glob pattern.

Parameters

ParameterTypeDescription
queryGlobQueryThe glob pattern and optional root directory.
ctxToolContextPer-call context; ctx.signal may be used to abort the walk.

Returns

Promise<string[]>

The matching file paths.


read()

read(request, ctx): Promise<FileReadResult>;

Defined in: tools/builtin/builtin.types.ts:258

Read a slice of a file's contents.

Parameters

ParameterTypeDescription
requestFileReadRequestThe file path plus an optional 1-based offset and line limit.
ctxToolContextPer-call context; ctx.signal may be used to abort the read.

Returns

Promise<FileReadResult>

The selected lines and the 1-based number of the first line.

On this page