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

# Overview

> Optional metadata for runs that already execute on the device. Cloud does not start or resume them.

Run the SDK first. Cloud does not make the agent work, and a local run does not need an account.

LarkX Cloud observes runs. It does not start them, retry them, reconcile them, or cancel them. The SQLite file on the device remains the execution record. There is no SDK execution quota in this service. Technical ingestion limits still apply. They are safeguards, not a plan that counts applications, devices, or runs.

Cloud is free during the public beta. That does not change the on-device license. The SDK is Apache 2.0 either way.

## Connect after a local run

**1. Install the SDK and finish a local run**

[Hello World](https://docs.larkx.ai/getting-started/hello-world.md) or [your first on-device agent](https://docs.larkx.ai/getting-started/on-device-agent.md). Telemetry stays off until you opt in.

**2. Create an account and a project**

Open [cloud.larkx.ai](https://cloud.larkx.ai) and create the application you want to observe.

**3. Create an ingestion key**

The key starts with `lkx_ing_`. Store it in the platform keystore. Do not put it in source. See [Ingestion keys](https://docs.larkx.ai/cloud/ingestion-keys.md).

**4. Enable telemetry and run the agent again**

Install the optional `expo-crypto` peer, pass `larkxCloud` to `createRuntime`, and start a new run. Earlier runs are not backfilled.

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

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

**5. Open the trace**

[Execution traces](https://docs.larkx.ai/cloud/traces.md) and [Recovery insights](https://docs.larkx.ai/cloud/recovery.md) show the metadata that arrived. Prompts, model text, tool arguments, and tool results are not in the export. See [Privacy](https://docs.larkx.ai/cloud/privacy.md).

`larkxCloud` is in the published 0.4.0 package. The default endpoint is `https://cloud.larkx.ai`. The client posts `/v1/telemetry/batches`.

Local execution continues when Cloud is unreachable, when the key is rejected, and when a run is refused. `close()` does not wait for the collector.

The device posts the telemetry schema this SDK implements. The Cloud repository accepts the current storage schema. Production `https://cloud.larkx.ai` was last recorded in this repository as a 20 November 2026 deployment that still accepted an older schema, so a phone upload to production is not verified here.

The default branch also contains exporter behavior that is newer than npm 0.4.0: a permanently rejected run stays rejected, and other runs continue. That behavior ships in source until a release whose changelog includes it. See [Troubleshooting](https://docs.larkx.ai/cloud/troubleshooting.md).


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