> ## 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 a durable execution runtime for on-device AI agents. The public SDK is the npm package @larkxai/react-native.
> Do not import @larkxai/node, @larkxai/host, @larkxai/protocol, @larkxai/telemetry, or @larkxai/cactus in an application. Those packages are private workspace modules.
> Swift and Kotlin SDKs are planned and are not published.
> Prefer the published npm version. The GitHub default branch can contain behavior that is not in that release yet.
> Expo Go cannot load the native module. Use a development build.
> Do not describe external tool or remote effects as exactly-once.

# Creating a runtime

> Open SQLite, set an owner, and close the runtime when the app is done with it.

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

const runtime = await createRuntime({
  storage: sqlite(),
  ownerId: "field",
});
```

One runtime owns one database. Pass `sqlite("file:///path/to/agent.db")` only when you already have a file path. The no-argument form is the one that uses the document directory.

`ownerId` defaults when you omit it. Set it when more than one process or session might open the same file. A stolen or expired claim cannot commit.

## Observing the host

`runtime.observe` reports model requests, tool requests, commits, and the point where reconciliation is required. The listener is local. It is not a Cloud upload.

```typescript theme={null}
const stop = runtime.observe((event) => {
  console.log(event);
});
```

Call the function it returns to remove the listener.

## Closing

```typescript theme={null}
await runtime.close();
```

`close()` waits for in-flight steps, releases ownership, and stops the telemetry timer if one is running. It does not flush telemetry and it does not delete the database. Do not call `close()` from an engine hook.


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