How to persist Storefront AI Agent (shop-chat-agent) conversation across page navigation?

Hi everyone, :smiley:

I’m currently integrating the Storefront AI Agent (shop-chat-agent) on my Shopify storefront using Storefront MCP. Everything is working as expected except for one issue which is whenever a user navigates to another page on the site, the chat resets and previous messages are lost.

Is there a recommended way to persist the chat conversation across page transitions so the user doesn’t have to start from scratch each time they navigate?

I’ve reviewed the documentation here: About Storefront MCP, but I couldn’t find any specific guidance on message persistence.

Would appreciate any tips or best practices. Thanks in advance!

Hi Dayana - great to hear you’re already building with the Storefront MCP :slight_smile: I have connected with the relevant team to get their recommendation - will update here asap!

2 Likes

Hi again @Dayana-shopify

Typically the standard we use is storing conversations in the database and a conversation ID on the client storage. Here is an example you can reference: shop-chat-agent/app/routes/chat.jsx at 20e2813e1535109ec6ef4543b2750c8acc25191c · Shopify/shop-chat-agent · GitHub