Skip to main content

Class: JsonExporter

Defined in: packages/agentos/src/cognition/memory/io/JsonExporter.ts:143

Exports a Brain to a structured JSON file.

Usage:

const exporter = new JsonExporter(brain);
await exporter.export('/path/to/export.json', { includeEmbeddings: false });

Constructors

Constructor

new JsonExporter(brain): JsonExporter

Defined in: packages/agentos/src/cognition/memory/io/JsonExporter.ts:147

Parameters

brain

Brain

The Brain instance to read from.

Returns

JsonExporter

Methods

export()

export(outputPath, options?): Promise<void>

Defined in: packages/agentos/src/cognition/memory/io/JsonExporter.ts:163

Export the full brain state to a JSON file at outputPath.

Parameters

outputPath

string

Absolute path to write the JSON output.

options?

ExportOptions

Optional export configuration.

Returns

Promise<void>


exportToString()

exportToString(options?): Promise<string>

Defined in: packages/agentos/src/cognition/memory/io/JsonExporter.ts:175

Export the full brain state as a JSON string without filesystem access.

Parameters

options?

ExportOptions

Optional export configuration (embeddings, conversations).

Returns

Promise<string>

Pretty-printed JSON string of the full brain payload.