> ## Documentation Index
> Fetch the complete documentation index at: https://docs.larkx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> LarkX is open-source execution infrastructure for on-device AI agents. It is not an inference engine, an LLM wrapper, a cloud-only agent framework, or a replacement for LangGraph or Cactus.
> Install the public SDK with npm install @larkxai/react-native. The published version is the sdkVersion variable on the Installation page. Import createRuntime, defineTool, scriptedModel, sqlite, remoteAgent, and larkxCloud from @larkxai/react-native. Import cactusModel from @larkxai/react-native/cactus only when the app uses local inference.
> Do not import @larkxai/node, @larkxai/host, @larkxai/protocol, @larkxai/telemetry, or @larkxai/cactus. Those packages are private. Swift and Kotlin SDKs are not published.
> Hello World uses scriptedModel and does not download a model or need Cloud. A Cactus agent needs cactus-react-native 1.13.1, react-native-nitro-modules 0.33.9 or newer, download(), and init() before start. Expo Go cannot load the native module.
> Recovery opens a new createRuntime on the same SQLite file, registers the same agent name and version, then calls resume. Do not call resume on a runtime that has already been closed. Do not describe external effects as exactly-once. A killed process does not keep running.
> Cloud telemetry is optional. Pass larkxCloud({ projectId, apiKey }) only after a local run already works. The key must start with lkx_ing_.

# Installation

> Install @larkxai/react-native for Expo or bare React Native. Add Cactus or Cloud only if you use them.

The published SDK is `@larkxai/react-native` 0.4.0. Import the public API from that package:

```typescript theme={"dark"}
import { createRuntime, defineTool, scriptedModel, sqlite } from "@larkxai/react-native";
```

`react` and `react-native` are required peers. `expo-file-system` is a required peer because `sqlite()` with no path stores `larkx.db` in the application documents directory. Cactus and Cloud peers are optional. Do not install them for Hello World.

The native compile is separate from the first run. After the development build exists, [Hello World](https://docs.larkx.ai/getting-started/hello-world.md) does not download a model. A Cactus model download is a later, separate step.

> [tab] Expo
>
> Install the SDK and the file-system peer with Expo so the versions match the project:
>
> ```bash theme={"dark"}
> npx expo install @larkxai/react-native expo-file-system
> ```
>
> Create a development build and run it on a simulator or a device:
>
> ```bash theme={"dark"}
> npx expo prebuild
> npx expo run:ios
> npx expo run:android
> ```
>
> `createRuntime` loads the native module `LarkXNativeCore`. Expo Go does not include that module, and there is no JavaScript fallback. If `createRuntime` throws `LarkXNativeCore is not installed`, the binary was built without the module. Rebuild the development client. Do not catch that error and substitute another engine.
>
> `prebuild` and the native compile are the slow step. They are not part of the agent run.

> [tab] Bare React Native
>
> ```bash theme={"dark"}
> npm install @larkxai/react-native expo-file-system
> ```
>
> The published package includes the iOS project, `LarkXNativeCore.podspec`, the Android project, and React Native autolinking. You do not copy the C++ sources into the app.
>
> Install the iOS pods after the package is on disk:
>
> ```bash theme={"dark"}
> cd ios && pod install && cd ..
> ```
>
> Rebuild the iOS and Android apps with the project's usual native commands. A binary built before this install will not contain `LarkXNativeCore`.
>
> Android autolinking uses the package `react-native.config.js`. A normal Gradle build picks up the module. The Android build needs the NDK version your React Native app already uses.

> [tab] Local inference
>
> Install these peers only in an app that imports `@larkxai/react-native/cactus`. Hello World does not.
>
> ```bash theme={"dark"}
> npm install cactus-react-native@1.13.1 react-native-nitro-modules@^0.33.9
> ```
>
> The supported demo model is `qwen3-0.6b`. Call `download()` and `init()` before `agent.start`. Both happen outside the run. The download needs a network once. Later local steps do not. The phone needs enough storage for that checkpoint and enough memory for Cactus to initialize it. This repository has not measured that download on a device.
>
> Rebuild the development client after adding these native modules. Then follow [Your first on-device agent](https://docs.larkx.ai/getting-started/on-device-agent.md).

> [tab] Cloud
>
> Skip this until a local run succeeds. Telemetry stays off when `createRuntime` has no `telemetry` option.
>
> ```bash theme={"dark"}
> npx expo install expo-crypto
> ```
>
> `expo-crypto` is the optional peer the runtime uses for installation and batch ids. Then create a project at [cloud.larkx.ai](https://cloud.larkx.ai), create an ingestion key that starts with `lkx_ing_`, and pass it to `larkxCloud`. The steps are in [Connect your agent](https://docs.larkx.ai/cloud/connecting.md).

## Published package and git source

npm 0.4.0 is the contract for an installed app. The changelog for that version includes A2A 1.0, `run.provideInput`, and `larkxCloud`. Redirect rejection inside the React Native HTTP module, and keeping one permanently rejected telemetry run from blocking other runs, are on the default branch and are not in that changelog. Treat the release notes of the version you install as the contract.

Do not install `@larkxai/node`, `@larkxai/host`, `@larkxai/protocol`, `@larkxai/telemetry`, or `@larkxai/cactus` in an application. The React Native package bundles the JavaScript it needs. The unscoped npm name `larkx` is an unrelated project. Swift and Kotlin distributions are not published.

Open a new SQLite file. The runtime rejects a file whose `application_id` is not `LXRT` (`0x4C585254`). It does not migrate a database from the removed TypeScript engine.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.