Skip to documentation
Docs navigation
Docs/absorbFromAgent()
MemoGrafterAgent

absorbFromAgent()

Select and copy memory from another agent.

What it does

Select and copy memory from another agent.

When to use it

Use for a one-step select-and-copy workflow between two agent instances.

Signature

TypeScript
absorbFromAgent(sourceAgent: MemoGrafterAgent, options?: AbsorbFromAgentOptions): Promise<TopicNode[]>

Parameters

sourceAgent (MemoGrafterAgent) — The agent whose memory will be considered for copying.
options? (AbsorbFromAgentOptions) — A typed options object. The applicable fields and defaults are documented below.

AbsorbFromAgentOptions fields

topicIds? (string[]) — Select explicit source topics.
prompt? (string) — Select source topics semantically when IDs are unknown.
minSimilarity? (number) — Reject semantic candidates below this score.
limit? (number) — Cap the number of selected source topics.
Do not combine conflicting selection intent. When neither topicIds nor prompt is supplied, all eligible source topics may be considered.

TopicNode fields

id, sessionId, and segmentId identify the topic and its owning session/segment.
label is the short extracted topic name; summary is its generated description.
messageRange is the inclusive source-message index range; topicOrder is its position in the session.
driftScore records the topic-boundary signal. embedding is the stored semantic vector and can be large.
tags and source preserve caller metadata.
suppressed and suppressedAt describe topic lifecycle state.
agentColor, fleetId, and agentId are populated for fleet-owned topics and otherwise are null.
createdAt is a JavaScript Date when read through the package API.

Result

The topic nodes created, selected, or copied by the operation.

Behavior

Selects source topics by explicit IDs or semantic prompt and copies them into the receiving agent. If no selector is supplied, all eligible source topics may be considered.

Side effects and completion

Writes copied topics, memories, and provenance to the target session; source memory is unchanged.

Example

example.ts
await writer.absorbFromAgent(researcher, { prompt: "facts about PostgreSQL" });