> ## 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.

# Rasa skill

> Connects a self-hosted Rasa bot to Autoplay live activity via a small FastAPI bridge that pulls a user's recent activity on demand over REST and exposes it to a Rasa action server. Covers the bridge's /reply endpoint, the Rasa action server's HTTP call to it, and matching Rasa's sender/user id to the activity source. Use when the customer already uses Rasa, Rasa Open Source, or asks how to give a Rasa bot real-time Autoplay context.

# AI Support Agent — Rasa

> Read `autoplay-core` first for install and credentials (`product_id`, `mcp_url`, `mcp_key`).
>
> **Who does this: Mixed.** Scaffolding the Rasa stack itself (Docker services,
> NLU training data, domain/rules/stories files) is a user task — Rasa has no
> API for creating a bot, and you shouldn't invent the customer's training
> data or bot behavior for them. The FastAPI bridge and the Rasa action
> server's HTTP call to it are code you write yourself.
>
> **Stay inside this project's directory tree.** Every file this skill
> touches lives inside the current project root. Never search, list, or read
> outside it.
>
> **Wait for the real `mcp_key` before starting the bridge.** Run
> `onboard_product` yourself first if it hasn't been run yet — never
> hardcode the literal `YOUR_MCP_KEY` placeholder in `bridge/.env`.

## Scoping pattern for Rasa

Rasa has no native MCP support, so a small FastAPI bridge pulls a user's live
activity on demand over REST (`GET /users/{product_id}/{user_id}/live-activity`)
and exposes it over its own `/reply/{user_id}` endpoint. A Rasa custom action
calls that endpoint on every turn — no webhook, no stream, no local event
store to keep in sync. The read is keyed by `product_id` + `user_id` only.

`user_id` must exactly equal the id your activity source identifies the user
with. Read it from `tracker.latest_message.metadata.customData.userId` in the
Rasa action (wired via `credentials.yml`'s `metadata_key: customData`), and
pass it straight through to the bridge — don't fall back to the raw
`tracker.sender_id` socket id unless no better identifier is available.

## Reference

* Full tutorial: [https://developers.autoplay.ai/recipes/rasa/step-1-connect-real-time-events](https://developers.autoplay.ai/recipes/rasa/step-1-connect-real-time-events)
