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

# Telemetry

> larkxCloud options and TelemetryDeliveryStatus.

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

const telemetry = larkxCloud({
  projectId: "my-project",
  apiKey: "lkx_ing_…",
});
```

## `larkxCloud` options

| Field | Required | Meaning |
| - | - | - |
| `projectId` | Yes | Sent as `source.appId` unless `appId` is set. |
| `apiKey` | Yes | Ingestion key. Must start with `lkx_ing_` to export. |
| `endpoint` | No | Origin. Default `https://cloud.larkx.ai`. |
| `appId` | No | Overrides the app id sent to Cloud. |
| `flushIntervalMs` | No | Default 15000. `0` disables the timer. |
| `batchSize` | No | Upper bound inside the 500-event contract. |
| `requestTimeoutMs` | No | Per-request deadline. |
| `metadata` | No | Installation fields such as `platform` and `deviceModel`. |
| `createId` | No | UUID factory. React Native fills this from `expo-crypto`. |
| `sha256` | No | Destination hash. Hermes can pass `expo-crypto`. |

The custom sink is `{ exporter }`. It is a different object, not extra fields on `larkxCloud`.

## `TelemetryDeliveryStatus`

Returned by `telemetryStatus()` and `flushTelemetry()`.

| Field | Meaning |
| - | - |
| `enabled` | Telemetry was configured. |
| `phase` | `"disabled"`, `"idle"`, `"pending"`, `"offline"`, or `"unauthorized"`. |
| `pendingEvents` | Events still waiting in the local export window. |
| `lastError` | `null`, or a code such as `unauthorized`, `offline`, `rate_limited`, `rejected`, `redirected`, or `unsupported`. |
| `rejectedRuns` | How many runs the exporter is currently skipping. |
| `exportBehind` | More than 2000 eligible events are still unsent. |
| `lastSyncedAt` | When a batch was last accepted, or `null`. |
| `installationId` | The id minted for this installation, or `null` before the first export. |
| `observations` | Host lifecycle observations still held for export. |
| `droppedObservations` | Host observations dropped because the local observation buffer was full. |

`lastError: "rejected"` means synchronization is partial. It does not mean the local run failed.

npm 0.4.0 and the current default branch differ on how long a rejected run stays skipped. The type above is the same. See [Troubleshooting](https://docs.larkx.ai/cloud/troubleshooting.md).


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