End-to-end message flow
The most important runtime detail
Browser backend calls, frontend tool calls, and screen-autopilot actions still run from the embedded widget. Live MCP tool discovery and MCP tool calls run server-side inside Warpy after the widget supplies short-lived per-user MCP headers.
Tool routing logic
What each layer is responsible for
| Layer | Responsibility |
|---|---|
| Widget | capture the message, fetch config, execute browser-side tool calls, exchange user session for short-lived MCP headers, return results |
| Warpy API | orchestrate reasoning, choose tools, enforce widget auth, execute live MCP calls, produce the final response |
| Customer app | receive backend requests, expose frontend handlers, or provide live page context |
Backend tool execution path
When Warpy returns a backend tool call, the widget:- reads configured auth settings and custom browser-storage headers
- substitutes path parameters
- builds query string, body, headers, and credential mode
- shows a live inline activity card in the widget while the request runs
- sends the request to your selected base URL
- sends the result back to Warpy
credentials: “include” so the browser attaches cookies
normally. Explicit cookie-to-header mappings still only apply to custom headers
that Warpy builds in JavaScript.
MCP execution path
When a live MCP connection is configured, Warpy can discover and call MCP tools without importing them into Features. Fortoken_exchange connections, the widget:
- calls your token-exchange endpoint with the user’s normal signed-in browser session
- receives short-lived MCP headers for that user
- includes them on the websocket request as run-scoped
mcpAuthBundles
- opens a live MCP client session server-side
- lists tools or calls the chosen MCP tool
- returns the result into the normal reasoning loop
MCP_AUTH_EXPIRED websocket error so the widget can refresh headers once and replay the same request.
Frontend tool execution path
When Warpy returns a manual frontend tool call, the widget:- calls
window.warpy(toolName, vars) - shows the same inline activity card with a readable feature/tool label
- keeps the existing frontend warning banner visible while the handler runs
- waits for your app to finish the handler
- sends the result back to Warpy
Screen autopilot path
When screen autopilot is enabled, Warpy can:- inspect the page structure
- find the right element
- click, type, select, navigate, scroll, or run JavaScript
Security and limits in the flow
- Signed widget tokens are enforced on
WS /widget/sessionwhen enabled. - Token refresh happens through the customer-owned endpoint you configure.
- Per-user rate limits are checked before and after billable execution.
- The widget hides when action availability or rate-limit state says it should.