Frameworks
Vite + React
Authenticate in-page agents in a Vite + React single-page app.
Vite + React
A single-page app only sees agents that run it, so this guide covers in-page agents. Put the server middleware in front of your API as well to authenticate everything else.
1. Install
2. Mount the provider
Use a publishable key (agtx_pk_…). A secret key throws at start-up.
3. React to the agent
useAgentContext() re-renders on detect, declare, authenticate and clear.
4. Authenticate a credential
Credentials are verified through the auth.verifyToken hook — see
WebMCP & browser agents.
Bundle impact
The full SDK is ~25 KB (brotli). If you only need WebMCP detection, import from
@agentronics/sdk/lite (≤ 8 KB).