Connect React
The @recursiv/sdk is a zero-dependency TypeScript SDK that runs in any React app (Vite, CRA, or your own bundler). This guide gets a single-page React app from install to a streaming agent.
Install
Configure the key
No account yet? Sign up and mint a key at recursiv.io/account/api-keys.
A pure client-side React app has no server to hide a secret in. Never embed a long-lived sk_live_ key in the bundle. Two safe patterns:
- Call Recursiv from a small backend (or serverless function) that holds the key, and have React call that backend.
- For user-facing apps, sign the user in and use a short-lived, scoped key created per session.
If you do hold a key in a trusted environment, pass it explicitly:
First authenticated call
Project-scoped calls return a { data } envelope. Create a project once, then read from it.
Run and stream an agent
In the browser, chatStream() works directly. It returns an async iterable of { delta } chunks you can render as they arrive.
Create the agent once (server side or in a script). The model field is model agnostic:
Where to go next
- Quickstart for the full set of first calls
- Add AI Agents to React for agent details
- Add Authentication to React for session-based keys
- API Reference for the full REST surface
- Recursiv ships hundreds of data integrations (Slack, email, databases, and more) that agents can call as tools