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

# Durable execution

> Committed steps are replayed. Interrupted steps follow their effect class.

The runtime writes the decision and the result of each step into SQLite before it moves on. Replay reads that record. It does not fold an event journal back into state, and it does not run a completed step handler again.

Step keys come from the caller identity of the step, not from a source line. A completed handler is skipped on purpose.

## What is durable

* The model decision, once committed, is replayed. The model function is not called again for that step.
* A tool result, once committed, is replayed. The handler is not called again.
* A remote delegation stores the operation before the host sends it. Recovery uses that record.

## What is not exactly-once

The process can die after a tool has performed an external effect and before that result is committed. The runtime can then retry a `pure` or `idempotent` step. It cannot prove the first attempt had no effect.

Do not describe a tool, a network call, or a remote agent as exactly-once.

## Versions

Protocol version, storage schema version, and the agent `version` are three different numbers. A run stores the agent version it started with. It is not replayed on another version.

## Telemetry is not the execution record

Cloud, when you enable it, reads a copy of metadata from the journal. It does not start, retry, reconcile, or cancel a run. A failed upload does not fail the agent. See [Privacy and telemetry](https://docs.larkx.ai/cloud/privacy.md).


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