Skip to documentation
Docs navigation
Docs/ingestText()
MemoGrafterAgent

ingestText()

Ingest raw text into the current session.

What it does

Ingest raw text into the current session.

When to use it

Use for notes, documents, or other text that should become graph memory without becoming a chat turn.

Signature

TypeScript
ingestText(text: string, options?: IngestTextOptions): Promise<void>

Parameters

text (string) — Raw text to analyze and convert into memories.
options? (IngestTextOptions) — A typed options object. The applicable fields and defaults are documented below.

IngestTextOptions fields

replace? (boolean, default false) — Clear the target session graph before processing this text.
label? (string) — Supply a document/topic label instead of relying only on extraction.
source? (string) — Preserve an application-defined provenance label.

Result

The requested identifier or text value.

Behavior

Chunks text, detects topics, extracts structured memories, and writes or queues them for the current session.
replace: true clears the current session graph before processing; label and source are preserved as metadata.

Side effects and completion

Creates persistent topics, segments, memories, and graph edges. It does not modify chat history.

Errors and empty results

Rejects empty or invalid input, extraction/provider failures, storage failures, or queue-submission failures.

Example

example.ts
await agent.ingestText(releaseNotes, { label: "Release notes" });