Shared State

What is Shared State?

Shared State creates a real-time, two-way synchronization between your application's UI and the Eucera agent. It's the feature that allows your agent to become a true copilot, aware of what the user is doing in your app and able to interact with your UI directly.

While AI Actions let the agent perform tasks, Shared State gives the agent eyes and hands inside your application. It breaks down the wall between the chat widget and your main app, enabling truly seamless and intelligent user experiences.

Why Use Shared State?

Shared State unlocks a new level of interactivity, allowing the agent and your application to work together as one.


Contextual Awareness

Make the agent aware of the user's context in real-time. If a user navigates to the billing page, the agent can proactively suggest billing-related actions.

Interactive Guidance

Enable the agent to guide users through your UI. A user can ask, "How do I change my password?" and the agent can highlight the correct menu item in your app.

Seamless Task Automation

Allow users to fill out complex forms conversationally. A user can say, "Fill out the contact form with my details," and the agent can populate the fields in your application's UI instantly.

How It Works: A Two-Way Street

Shared State creates a synchronized link between a piece of state in your application and the agent.

  1. Your App → Agent: Your application uses shareState() to send a snapshot of its UI state to the agent. You call this on initialization and every time the state changes (e.g., on user input).
  2. Agent → Your App: The agent can send an updated state object back to your application, which is received by a handler function that you provide. This handler is responsible for updating your UI.

Next Steps

Ready to create a truly integrated co-pilot?