Skip to main content
This is the primary LarkX path: a model on the device, a tool that reads local data, and a run that can be opened again from the same SQLite file. It uses Cactus through @larkxai/react-native/cactus. LarkX does not embed the model. The supported demo checkpoint is qwen3-0.6b. The download and init() happen before agent.start, so they are not replayed as agent steps. This repository has not executed that download or a completion on a phone. Host tests cover the adapter with a stand-in. Treat the snippet as the supported API, and confirm it on your development build.

Prepare the model

Install the optional peers from the Local inference tab and rebuild the development client. Then download once. The download needs a network. After init() resolves, local steps in this agent do not.
The phone needs enough free storage for the checkpoint and enough memory for Cactus to initialize it. This repository does not publish a measured size. Leave the screen that owns the model only after you are finished with it. The field-inspection demo calls destroy() when that screen closes.

Run the agent

The message is the model’s completion, not a scripted string. result.finish is "stop" when the model stops without another tool call. Turn on airplane mode after init() if you want to see that this run does not need the network. Airplane mode does not by itself tell the runtime that a remote agent is offline. This agent has no remote agent.

Recover the same run

Force-quit is something you do on the device. The code below is the restart path. It opens a new runtime on the same database. Do not call resume on the runtime you already closed.
Register the agent before resume. The name and version must match the stored run. A committed tool call is not executed again. If the process died during a pure tool, that tool may run again. If it died during a non-idempotent tool, the run is BLOCKED until the application reconciles it. See Crash recovery. model must already be initialized in the new process. download() and init() are not restored by resume.