useAIState is a React hook from the Vercel AI SDK that reads AI state defined by a surrounding AI context. It lets child components access application-level AI data while useUIState handles UI data and useActions exposes configured server actions. section 4.2.2 section 4.2.3
The hook depends on an AI provider created with createAI and placed around the application layout. That provider defines initial AI state, initial UI state, and available actions, making the shared context available to descendant components. section 4.2.2
Reading AI state in a chat component
A client component can read the current AI state alongside UI conversation state and server actions: `const [conversation, setConversation] = useUIState(); const [aiState] = useAIState(); const { continueConversation } = useActions();`. The example keeps conversation messages in UI state while making AI state available for more complex conversation-aware behavior. section 4.2.3
