- Demo is deployed and accessible
- Agent backend is healthy (check
/api/copilotkitGET —agent_status: "reachable") OPENAI_API_KEYis set in the agent environment
- UI -> agent (write): editing the preferences card writes the new
preferencesobject straight into agent state viaagent.setState. - agent -> UI (read): when the agent invokes its
set_notestool thenotesslice of agent state updates and the Notes card re-renders. - agent -> reads UI writes: a
PreferencesInjectorMiddlewarereadspreferencesout of state every turn and prepends it to the system prompt, so the next reply visibly adapts.
- Navigate to
/demos/shared-state-read-write - The Preferences card (
data-testid="preferences-card") is visible - The Notes card (
data-testid="notes-card") is visible - The Notes card shows "No notes yet" (
data-testid="notes-empty") - The chat input on the right is visible
- Type a name into
pref-name(e.g. "Atai") — the JSON inpref-state-jsonupdates immediately - Change tone to "playful" via
pref-tone— JSON reflects it - Change language to "Spanish" via
pref-language— JSON reflects it - Click two interest pills (e.g. Cooking, Music) — JSON
interestsarray updates
- In chat, send "Say hi and introduce yourself."
- The agent reply addresses the user by the name from the card
- The reply tone matches the selected tone
- If language was changed (e.g. Spanish), the reply is in that language
- Send: "Remember that I prefer morning meetings and that I don't eat dairy."
- Within ~10 seconds, the Notes card transitions away from
notes-empty - At least one
note-itemappears with each remembered fact - Subsequent unrelated chat turns leave the notes intact
- With at least one note showing, click
notes-clear-button - The Notes card returns to
notes-emptyimmediately - No errors in the browser console
- Sending an empty message is handled gracefully (no crash)
- Refreshing the page resets state to defaults; first turn re-seeds it
- Chat loads within 3 seconds
- Each preference edit reflects in
pref-state-jsonimmediately - Note updates land within 10 seconds of asking the agent to remember
- No UI errors or broken layouts; no React warnings in console