> ## Documentation Index
> Fetch the complete documentation index at: https://developers.autoplay.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Step 2 — Add proactive layer

> Use Autoplay.js, a tour provider, and Maven MCP tools to offer and launch guided onboarding tours from Maven.

Maven can call Autoplay MCP tools during a conversation, but **Maven is not proactive on its own**. It does not watch live product events and open a message or tour without another layer.

By this stage, you have already connected the Autoplay MCP server in **[Step 1](/recipes/maven/step-1-connect-real-time-events)**. You do not need to do anything else MCP-wise. Maven already has the context and tools it needs; this step only sets up the proactive prompt and connects the visual guidance layer.

For proactive onboarding with Maven, use:

1. **Autoplay.js** in your app to listen for proactive nudges.
2. **A user tour provider** to show the guided in-app tour.
3. **Maven** to read activity, offer the next step, and launch the tour only after the user says yes.

This guide uses **Appcues** as the concrete example. The same model can work with other tour providers as long as Autoplay.js can dispatch the tour nudge to that provider.

<Warning>
  Maven does not provide its own proactive messaging UI. Since Maven can't show the offer by itself, use your user tour provider (or Autoplay's built-in nudge card) to add the box the user actually sees and can accept or dismiss — Maven only handles the agent conversation once they do.
</Warning>

## ✅ Before you start

Finish these first:

* **[Step 1 — Connect real-time events](/recipes/maven/step-1-connect-real-time-events)** so Maven can call Autoplay MCP tools.
* **[Quickstart Step 3 — Connect Autoplay.js](/quickstart#-step-3-—-connect-autoplay-js)** so your app can receive Autoplay nudges.
* A tour provider setup. For Appcues, follow **[Appcues setup](/recipes/appcues/how-to-setup)** so `AP.dispatchNudge(nudge)` can launch Appcues flows.

## 🔧 What Maven already has from MCP

Because you connected the Autoplay MCP server in Step 1, Maven already has these tools in **Capabilities**. You are not adding a second MCP server here; the prompt below tells Maven how to use the tools for proactive onboarding.

| Tool                     | Use it when                                                                                |
| ------------------------ | ------------------------------------------------------------------------------------------ |
| `get_live_user_activity` | Maven needs to understand what the current user recently did before answering.             |
| `get_onboarding_context` | Maven needs the user's next onboarding step, completed steps, or stalled state.            |
| `guide_next_step`        | The user explicitly accepts the offered walkthrough and Maven should launch the next tour. |
| `list_user_tours`        | The user asks what tours are available or wants to choose a tour.                          |
| `trigger_user_tour`      | The user picks a specific tour and Maven should launch that exact tour.                    |

If you need to review Maven's **Agent Inclusion** settings, a typical setup is:

| Tool                     | Agent Inclusion |
| ------------------------ | --------------- |
| `get_live_user_activity` | When relevant   |
| `get_onboarding_context` | When relevant   |
| `list_user_tours`        | When relevant   |
| `guide_next_step`        | Always          |
| `trigger_user_tour`      | Always          |

## 🤖 Add the proactive Maven prompt

In Maven AGI, open your agent and go to **Agent settings** → **Response customization**.

Set **Conversation persona** to **Empathetic supporter**, then paste this into **Additional persona instructions**.

Replace:

* `<YOUR_PRODUCT_ID>` with the Autoplay `product_id` from `onboard_product`.
* `<YOUR_APP_NAME>` with the product name Maven should use in user-facing language.

```text theme={null}
These instructions add live-activity awareness and proactive onboarding. They govern tool use and onboarding flow only. For identity, voice, scope, escalation, and content restrictions, follow your base persona above.

IDS (hardcoded — never ask the user for these)

product_id is ALWAYS "<YOUR_PRODUCT_ID>".
user_id comes from the session.

[AUTOPLAY LAYER 1 START] — activity-aware support

TOOL: get_live_user_activity — your live view of what this user is doing in <YOUR_APP_NAME>.

Call it at the start of every conversation, before your first substantive reply.
Re-call it whenever your next answer could depend on what the user has done, or the conversation has moved on since your last call — never reason from stale activity.
Skip it only for a pure pleasantry ("hi", "thanks") that needs no product context.
Never describe the tool call or its result. Use it only to ground your answer — reference what the user has done, not raw event data.
If it fails or returns empty, answer normally without mentioning it.

[AUTOPLAY LAYER 1 END]

[AUTOPLAY LAYER 2 START] — proactive onboarding (requires Layer 1 above)

Beyond answering questions, you also help the user reach their next onboarding win by launching a guided in-app tour — but ONLY after they say yes. You offer, you don't force; you show, you don't lecture.

TOOLS

get_onboarding_context — the ONLY source of truth for where the user is (next step, what's done, whether they're stalled). Never invent, recall, or guess a step.
guide_next_step — launches the tour for the next step. Call ONLY after an explicit yes in THIS conversation.
list_user_tours / trigger_user_tour — only if the user asks to browse or pick a specific tour.

STEP 1 — OFFER (never launch here)

Trigger: the user arrives, asks what's next, or a proactive opener fires.

Call get_onboarding_context.
Reply in <=2 warm lines: acknowledge what they just did, then OFFER the next step as a yes/no question — e.g. "Nice — account connected! Want me to walk you through setting your posting schedule?"
Do NOT call guide_next_step here. You are only offering.
If the user declines: acknowledge warmly ("No problem — just ask whenever!") and do not offer again this conversation.

STEP 2 — LAUNCH (only after an explicit yes: yes / sure / okay / go ahead / show me)

Call guide_next_step.
If it returns launched=true: reply in ONE short line naming the step it launched (use step_title, in your own words — no fixed template).
If it returns done=true: there's no next step — congratulate in one line.

NEVER

Call guide_next_step, or say a walkthrough is opening, without an explicit yes in THIS conversation.
Offer more than once per conversation.
Call get_onboarding_context more than once unless the user's situation changes.
Invent, recall, or assume step state.

VOICE

Warm, human, tight. One emoji max per line. Match your base persona's tone. Never answer onboarding questions from general knowledge — read context, offer, and launch only on a yes.

[AUTOPLAY LAYER 2 END]
```

## 👀 What a proactive nudge looks like

Once **[Autoplay.js](/quickstart#-step-3-—-add-the-proactive-layer)** is installed and dispatching nudges, your tour provider or Autoplay's built-in nudge card displays the offer without waiting for the user to ask "what's next?". Maven handles the conversation after the user accepts. See the example nudge card in **[Quickstart Step 3 — Add the proactive layer](/quickstart#make-your-chatbot-proactive)**.

## 🧪 Test the handoff

1. Log in as a test user who has your tour provider installed and identified with the same `user_id` used by your activity source.
2. Trigger activity that maps to an onboarding step.
3. Open the Maven widget and ask: **"What's next?"**
4. Maven should call `get_onboarding_context` and offer the next walkthrough.
5. Reply **"yes"**.
6. Maven should call `guide_next_step`, and Autoplay.js should launch the tour in the user's browser.

<AccordionGroup>
  <Accordion title="Maven offers the next step but no tour opens">
    Confirm [Autoplay.js](/quickstart#-step-3-—-connect-autoplay-js) is installed, `connectNudges` is running for this user, and your tour provider is configured. If you are using Appcues, re-check the [Appcues setup](/recipes/appcues/how-to-setup).
  </Accordion>

  <Accordion title="Maven says there is no next step">
    Check that onboarding state exists for the same `product_id` and `user_id` Maven is sending through the MCP tools.
  </Accordion>

  <Accordion title="Maven launches a tour without consent">
    Tighten the prompt and confirm `guide_next_step` is only called after an explicit yes in the current conversation.
  </Accordion>
</AccordionGroup>

Once this works, Maven can stay conversational while your tour provider handles the visual tour experience.
