getMutableAIState

AI SDK RSC is currently experimental. We recommend using AI SDK UI for production. For guidance on migrating from RSC to UI, see our migration guide.

Get a mutable copy of the AI state. You can use this to update the state in the server.

Import

import { getMutableAIState } from "@ai-sdk/rsc"

API Signature

Parameters

key?:

string

Returns

The mutable AI state.

Methods

update:

(newState: any) => void

done:

(newState: any) => void

Examples

Learn to persist and restore states AI and UI states in Next.js