Guides
Vite + React integration
Use the Agentronics SDK in a plain Vite + React 18 app.
Vite + React integration
The fastest way to try Agentronics. Vite has no SSR boundary, so everything is plain client React.
1. Install
2. Mount the provider
The provider initializes the SDK once and stores it in Context. Re-renders never re-init.
3. Use the hooks
4. Bootstrap site memory once
Drop this near the root so site memory is available for the whole tree:
installMemoryDelivery writes <meta name="agent-context-*"> tags so DOM agents can read your site memory without a WebMCP runtime.
5. Hook reference
| Hook | What it returns | When it re-renders |
|---|---|---|
useAgentronics() | The SDK client (escape hatch). | Never (stable reference). |
useAgentContext() | { identity, source, updatedAt }. | On detect / declare / authenticate / clear. |
useSiteMemory() | Full SiteMemory snapshot (or dot-path slice). | Whenever the site memory store mutates. |
useGovernedTool() | void. Side-effect hook. | Re-registers when deps change. |
6. Bundle impact
@agentronics/react is < 1 KB gzip on top of the core SDK. The full SDK is < 25 KB; the lite entry (@agentronics/sdk/lite) is < 1 KB if you only need detection + WebMCP.
7. Where to next
- Concepts → Tool management for surfacing, groups, progression, token budget.
- Concepts → Site memory for the four delivery channels.
- Guides → Memory cookbook for vertical-specific snapshots.