LLimrun

Drive devices with Argent

Argent is an agent toolkit with tools and an MCP server for driving simulators and emulators. You keep using Argent unmodified: on Android it finds the Limrun emulator over ADB, and on iOS lim ios argent connects the Limrun simulator to it.

Before you start

Drive an Android emulator

Create the emulator with the default ADB connection:

lim android create

lim android create connects the emulator to your local adb server, so it appears in adb devices as 127.0.0.1:<port>. Argent lists it in list-devices like any other ADB device, and its tools take that serial as the device ID:

argent run screenshot --udid 127.0.0.1:<port>

Argent treats a network serial as a physical device. It refuses paste, shake, fold, and network-conditions on it, because those tools need a local emulator.

Drive an iOS simulator

Start the connection to the last iOS instance you created, and leave it running:

lim ios argent

The command prints the ID Argent lists the simulator under, ext:limrun-<udid-prefix>:<udid>, then runs Argent's tool-server until you press Ctrl+C. Run your coding agent, or the Argent CLI, in another terminal with the same Argent install. Argent's tools then take that ID as the device:

argent run describe --udid 'ext:limrun-6fd25487:6FD25487-6CE9-49EB-B008-521EF71C303D'

Pass --id <instance-id> to target a specific instance. Flags after -- go to argent server start:

lim ios argent --id <instance-id> -- --port 4000

With --json, the command prints {"instanceId": "...", "deviceId": "..."} on stdout and sends Argent's own output to stderr.

How the connection works

Argent expects an iOS simulator on the same Mac: it calls xcrun simctl, attaches to a local server for input and screenshots, and starts an accessibility service inside the simulator. lim ios argent stands in for all three on your machine:

Because --force is passed to argent server start, a tool-server that is already running is replaced. Stopping lim ios argent stops the tool-server and removes the provider file.

Supported tools

Taps, swipes, typing, hardware buttons, screenshots, describe, await-ui-element, app launch, URLs, and rotation work as they do locally. After paste, iOS may show its paste permission alert; the agent taps Allow Paste like any other alert.

Screen recording, the native inspection tools, and the native profiler are not available, because they need Argent's helper processes next to the simulator.

Run on Linux

lim ios argent also runs on Linux machines without Xcode, such as CI runners and cloud agent sandboxes. Input, screenshots, app launch, URLs, and rotation work there. Argent's accessibility tools (describe, ui-tree, await-ui-element, fill, and foreground-app) fail on Linux, because Argent refuses to start its accessibility service on a host other than macOS. Run Argent on a macOS machine when the agent needs those tools, or read the screen with lim ios element-tree alongside Argent.

Connect from your own code

The TypeScript and Go SDKs provide the same connection for programs that start Argent themselves. The returned environment must be applied to the Argent tool-server process, because the shim is found through its PATH:

import { spawn } from 'node:child_process';
import { Ios, startArgentBridge } from '@limrun/api';

const client = await Ios.createInstanceClient({ apiUrl, token });
const bridge = await startArgentBridge(client);
console.log(bridge.deviceId);

const server = spawn('argent', ['server', 'start', '--force'], {
  env: { ...process.env, ...bridge.env },
  stdio: 'inherit',
});
// When done: stop the server, then await bridge.close().
client, err := ios.NewClient(apiURL, token)
if err != nil {
	return err
}
defer client.Close()

bridge, err := ios.StartArgentBridge(ctx, client)
if err != nil {
	return err
}
defer bridge.Close()
fmt.Println(bridge.DeviceID)

cmd := exec.Command("argent", "server", "start", "--force")
cmd.Env = os.Environ()
for k, v := range bridge.Env {
	cmd.Env = append(cmd.Env, k+"="+v)
}
err = cmd.Run()

apiUrl and token come from the instance's status.apiUrl and status.token. The bridge needs TypeScript SDK 0.77.0 or Go SDK 0.13.0.

Run Argent next to other tools

While Argent's Android helper app runs, uiautomator dump fails on that emulator, and so do lim android element-tree and other tools that call it. Give each tool its own instance, for example when you compare Argent with another automation tool.