# Running and controlling Flare Live

> Documentation version: 3.0
> HTML: https://docs.flarelive.manifolddynamics.com/manual/operation/
> [Complete contents](https://docs.flarelive.manifolddynamics.com/contents.md) · [Agent index](https://docs.flarelive.manifolddynamics.com/llms.txt)

Choose **how Flare Live runs**, then **how to control it**. The recommended setup is a GUI or headless instance controlled by an external Python script using **Workspace RPC (`flarelive-client`)**. The same client can build scenes, edit properties, save projects, control simulation and read results in either mode.

## Running modes

| Mode | Use it for | Recommendation |
| --- | --- | --- |
| GUI | Interactive scene preparation, real-time visualization and experiments with or without a script. | Use when you want a visible application. |
| Headless | Scripted experiments and batches without an application window. | Use CLI `serve`, then connect through RPC. |
| Python Runtime | Hosting the simulator directly inside an external Python process. | **Experimental; not recommended.** |

### GUI

Launch Flare Live normally. You can prepare a scene with the interface and connect an RPC script to that same scene. Keep the application open while the script runs.

Use [GUI workflow](https://docs.flarelive.manifolddynamics.com/manual/gui/workspace.md) for panels and editing, or continue with [RPC connection](https://docs.flarelive.manifolddynamics.com/manual/operation/rpc.md).

### Headless

Start a persistent instance with CLI `serve`. In terminal A, on Windows PowerShell:

```powershell
& 'C:\Tools\FlareLive\bin\flare-live-cli.exe' serve
```

Replace the path with your installation. On Linux, using the downloaded AppImage:

```sh
./FlareLive.AppImage --cli serve
```

Keep terminal A open. In terminal B, run your ordinary Python script with `flarelive-client`; see [RPC connection](https://docs.flarelive.manifolddynamics.com/manual/operation/rpc.md). `serve` uses the current directory as the working directory for a new scene. To open a prepared project at startup:

```sh
flare-live-cli serve --project robot.fll
```

Use your installed CLI path or the AppImage `--cli` prefix on your platform. An FLL can store its own working directory; set it to an existing local folder before simulation. An explicit `--workdir /path/output` overrides it for this instance.

Headless instances support Camera image export with a working graphics driver. On Linux, offscreen rendering requires EGL and GPU graphics access. When finished, press **Ctrl+C** in terminal A to close the instance.

### Python Runtime (experimental)

`flarelive.Runtime()` creates a simulator inside the Python process. This mode requires a matching native Python build and is **experimental and not recommended**. Use GUI or headless mode with `flarelive-client` for the workflows in this manual; Runtime setup is outside their scope.

## Control interfaces

| Interface | Where the control code runs | Recommendation |
| --- | --- | --- |
| **Workspace RPC — `flarelive-client`** | Your own Python environment, connected to a running GUI or headless instance. | **Recommended** for scene editing, project management, simulation control and agent operation. |
| Embedded interpreter | Inside Flare Live, using its bundled Python environment. | **Not recommended for general control.** Use when you need to operate GUI controls or capture the application window; see [GUI scripting](https://docs.flarelive.manifolddynamics.com/reference/api/gui.md). |
| **flcpy / Message control** | An external controller connected to the simulation-I/O TCP listener. | **Not recommended for new workflows.** Retain it for older projects and existing controller integrations; see [legacy flcpy](https://docs.flarelive.manifolddynamics.com/manual/operation/messaging.md). |

RPC is available in both GUI and headless instances. Run the client as the same OS user who owns the instance. The optional Message control listener is configured separately for flcpy.

## Prepare once, save, then run trials

For a complex scene, configure it once with the GUI, an RPC script or both, then save the preparation as **FLL**. Later scripts can load that file, change the few parameters relevant to a trial, run simulation and export results. This avoids repeating imports and reconstructing every object for each run.

Script edits and saving are separate actions:

- **Document edits** change the live scene. Save with the GUI or `ws.save_world()` to write them to an FLL file.
- **Experiment edits** are temporary preparation. Initialize and clear simulation as needed, then end the Experiment to return to Document.
- **Simulation** runs on an initialized copy. Stop/Clear returns to the preparation it came from.

Opening an FLL restores its saved scene and resources. Controller scripts stay separate; run the controller when you want it to supply inputs and advance simulation.

Continue with [RPC connection](https://docs.flarelive.manifolddynamics.com/manual/operation/rpc.md), [simulation advancement](https://docs.flarelive.manifolddynamics.com/manual/control/simulation.md) and [repeatable experiments](https://docs.flarelive.manifolddynamics.com/manual/control/experiments.md). See [projects and saving](https://docs.flarelive.manifolddynamics.com/manual/gui/projects.md) for save completion and which settings are stored in FLL.
