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

# Run

> A run is one stored execution of an agent, addressed by a caller-supplied run id.

`agent.start` stores a run and starts its driver.

```typescript theme={"dark"}
const run = await agent.start({
  message: "Inspect pump 12",
  runId: "notes-1",
});
const result = await run.result();
```

`runId` is yours. Use a stable id when you need to find the run after a restart. If you omit it, the runtime assigns one.

`run.result()` waits until the run reaches a terminal message. It does not start a second driver. `run.schedule()` starts the driver when you already hold the run and want it to proceed in the background.

## Status

`runtime.listRuns()` returns stored runs. `status` is the native workflow status. Terminal statuses are `COMPLETED`, `FAILED`, and `CANCELLED`. They have no exits. `FAILED` is not retried in place.

`BLOCKED` is not terminal. It means the run is waiting for reconciliation, or for a remote condition the application has to resolve. Continue a blocked tool outcome with `run.reconcile`. See [Tool side effects](https://docs.larkx.ai/concepts/tool-side-effects.md).

## Result

`AgentResult` is the terminal local message:

| Field | Meaning |
| - | - |
| `message` | The model message stored for the completed run. |
| `finish` | `"stop"` or `"length"`. |
| `iterations` | Model turns recorded for the run. |
| `toolCalls` | Tool calls recorded for the run. |

`run.cancel()` requests cancellation. A step that already committed stays committed. Cancelling a remote call does not prove the remote agent stopped.


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