DocsReferenceMemory.getThreadById()

getThreadById Reference

The getThreadById function retrieves a specific thread by its ID from storage.

Usage Example

import { Memory } from "@mastra/core/memory";
 
const memory = new Memory(config);
 
const thread = await memory.getThreadById({ threadId: "thread-123" });

Parameters

threadId:

string
The ID of the thread to be retrieved.

Returns

StorageThreadType | null:

Promise
A promise that resolves to the thread associated with the given ID, or null if not found.