> ## 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_.

# Connect your agent

> Pass larkxCloud to createRuntime. Install expo-crypto when telemetry is on.

```bash theme={"dark"}
npm install expo-crypto
```

React Native uses `expo-crypto` `randomUUID` for installation and batch ids. The time-and-counter fallback is not used. Without the peer, enabling telemetry cannot mint those ids.

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

const runtime = await createRuntime({
  storage: sqlite(),
  telemetry: larkxCloud({
    projectId: "my-project",
    apiKey: process.env.EXPO_PUBLIC_LARKX_INGESTION_KEY ?? "",
    appId: "field-inspection",
  }),
});
```

`projectId` is sent as `source.appId` unless you set `appId`. Cloud authorizes the ingestion key, not the project id string. `endpoint` overrides the origin. An `http` URL is accepted only when you set it, for a development collector. The endpoint cannot contain userinfo, a query, or a fragment.

`flushIntervalMs` defaults to 15 seconds. Set it to `0` to disable the timer. Call `flushTelemetry()` yourself in that case.

```typescript theme={"dark"}
await runtime.flushTelemetry();
const status = runtime.telemetryStatus();
```

`{ exporter }` is the other accepted config, for a sink you implement. Do not combine it with `larkxCloud` in one object. The type is one or the other.

Enabling telemetry does not backfill runs that already had events. Those runs are sealed for that destination. Runs created after authorization export from sequence 1, including events committed while the device was offline.

Changing the endpoint, the project id, or the ingestion key is a new destination and seals the runs that exist at that moment.


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