> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.recursiv.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.recursiv.io/_mcp/server.

# Connect React Native

The `@recursiv/sdk` works in React Native and Expo with zero extra dependencies and no native modules. It uses the runtime's native `fetch`. The one difference from web is agent streaming: React Native does not expose `ReadableStream`, so you use `chatStreamText()` instead of `chatStream()`.

## Install

```bash
npx expo install @recursiv/sdk
```

Or with npm:

```bash
npm install @recursiv/sdk
```

## Configure the key

No account yet? [Sign up](https://recursiv.io/register) and mint a key at [recursiv.io/account/api-keys](https://recursiv.io/account/api-keys).

A mobile app ships its bundle to the device, so never hardcode a long-lived `sk_live_` key. Sign the user in and store a short-lived, scoped key in the platform keychain via `expo-secure-store`. Never use `AsyncStorage` for secrets.

```typescript
import { Recursiv } from '@recursiv/sdk';
import * as SecureStore from 'expo-secure-store';

async function getClient(): Promise<Recursiv> {
  const apiKey = await SecureStore.getItemAsync('recursiv_api_key');
  if (!apiKey) throw new Error('Not authenticated');
  return new Recursiv({ apiKey });
}
```

## First authenticated call

All non-streaming methods work normally. Project-scoped calls return a `{ data }` envelope.

```typescript
const r = await getClient();

const { data: result } = await r.databases.query({
  project_id: projectId,
  sql: 'SELECT NOW() as time',
});

console.log(result.rows);
```

## Run and stream an agent

> **Warning**
>
> Do not use `chatStream()` in React Native. The native `fetch` does not support `ReadableStream`. Use `chatStreamText()`, which delivers text deltas without requiring a readable stream.

```typescript
import { useState } from 'react';
import { Recursiv } from '@recursiv/sdk';

export function useAgentChat(agentId: string, apiKey: string) {
  const [text, setText] = useState('');

  async function send(message: string) {
    const r = new Recursiv({ apiKey });
    setText('');
    await r.agents.chatStreamText(agentId, { message }, (delta) => {
      setText((prev) => prev + delta);
    });
  }

  return { text, send };
}
```

For a full SSE-based component and auth flow, see the [React Native SDK guide](/sdk/platform/react-native).

Create the agent once (server side or in a script). The `model` field is model agnostic:

```typescript
const { data: agent } = await r.agents.create({
  project_id: projectId,
  name: 'Support Bot',
  model: 'anthropic/claude-sonnet-4.6',
  system_prompt: 'You are a helpful assistant.',
});
```

## Where to go next

* [React Native SDK guide](/sdk/platform/react-native) for the full streaming and auth patterns
* [Add AI Agents to React Native](/recipes/cookbook/agents) for agent details
* [Add Authentication to React Native](/recipes/cookbook/apps) for the SecureStore auth flow
* [API Reference](/api-reference) for the full REST surface
* Recursiv ships hundreds of data integrations (Slack, email, databases, and more) that agents can call as tools