メインコンテンツへ移動

Agent.getMemory()

.getMemory() メソッドは、Agent に関連付けられた Memory システムを取得します。このメソッドは、会話をまたいで情報を保存、取得する Agent の Memory 機能へアクセスするために使います。

使用例
使用例への直接リンク

await agent.getMemory()

パラメータ
パラメータへの直接リンク

options?:

{ requestContext?: RequestContext }
= {}
リクエストコンテキストを含む任意の設定オブジェクト。
{ requestContext?: RequestContext }

requestContext?:

RequestContext
依存性注入とコンテキスト情報に使う Request Context。

戻り値
戻り値への直接リンク

memory:

Promise<MastraMemory | undefined>
Agent に設定された Memory システムへ解決される Promise。Memory システムが設定されていない場合は undefined へ解決されます。

詳細な使用例
詳細な使用例への直接リンク

await agent.getMemory({
requestContext: new RequestContext(),
})