harness.runner¶
A Runner is the compute backend that
launches the FLARE agent container for a populated working directory. Each
start() call returns an
AgentRun handle that owns the
lifecycle of the in-flight run.
Base¶
- class milp_flare.harness.runner.base.Runner[source]¶
Launch the FLARE agent container for a populated working directory.
- Attributes:
- abstractmethod start(wd, auth)[source]¶
Launch the agent with the given working directory and credentials.
- Parameters:
- wd
pathlib.Path The populated agent working directory.
- auth
AuthSpec Credential-forwarding spec from the harness.
- wd
- Returns:
AgentRunHandle to the in-flight run.
- class milp_flare.harness.runner.base.AgentRun(start=None)[source]¶
Handle for a running agent, returned by
Runner.start().The handle owns the lifecycle of an active agent run. The caller is responsible for iterating
stdoutto retrieve agent output until the run ends (ifstdoutis not drained, the buffer will fill and block the agent). Useclose()to stop the agent, capture any partial artifacts, and release the compute. Additionally,cancel()offers a thread-safe way to stop the agent without waiting for completion.- Attributes:
- Returns:
AgentRunHandle to the in-flight run.
- abstractmethod cancel()[source]¶
Stop the agent process.
This does not capture partial artifacts or release compute. It solely stops the agent process and makes the
stdoutiteration end. This allows for thread-safe cancellation. Any consumer thread can detect cancellation by the end of the stream.
- duration_s = 0.0¶
- class milp_flare.harness.runner.base.AuthSpec(env, home_dirs)[source]¶
Compute-agnostic description for forwarding agent credentials.
- milp_flare.harness.runner.base.IMAGE = 'flare-agent:latest'¶
The default name of the Docker image containing the agent environment. This image is expected to be built prior to running FLARE. See Installation.
Docker¶
- class milp_flare.harness.runner.docker.DockerRunner(image='flare-agent:latest')[source]¶
Bases:
RunnerRun the agent in a local Docker container.
- class milp_flare.harness.runner.docker.DockerAgentRun(popen, name, stderr_f, start)[source]¶
Bases:
AgentRunLive handle for a single in-flight Docker agent run.
- Parameters:
- popen
subprocess.Popen[str] The Popen handle for the
docker runrunning container process.- name
str The unique container name for this run, used to target cancellation.
- stderr_f
IO[bytes] The file where the container’s stderr is being redirected.
- start
float The wall-clock time when the container was launched, for duration tracking.
- popen
Modal¶
- class milp_flare.harness.runner.modal.ModalRunner(image='flare-agent:latest', app='flare', cpu=4.0, memory=4096, timeout=1800)[source]¶
Bases:
RunnerRun the agent in a Modal Sandbox.
Note that the agent process runs via a
Sandbox.exec()to allow for pushing and pulling the working directory via the filesystem API before and after the run, respectively. The logs on the Modal dashboard will not show any agent output because only a main process’s stdout is captured.- Parameters:
- image
str, defaultIMAGE The Modal named image to launch. Built via
milp-flare build-modal-image; see Modal.- app
str, default"flare" The Modal app the Sandbox is associated with.
- cpu
float, default4.0 Requested CPU cores (a guaranteed floor; the Sandbox may burst higher).
- memory
int, default4096 Requested memory in MiB.
- timeout
int, default1800 Hard cap on Sandbox lifetime, in seconds.
- image
- class milp_flare.harness.runner.modal.ModalAgentRun(proc, sb, wd, runner, start)[source]¶
Bases:
AgentRunLive handle for a single in-flight Modal Sandbox agent run.
- Parameters:
- proc
ContainerProcess[str] The ContainerProcess handle for the running agent exec.
- sb
Sandbox The Sandbox the agent is running in.
- wd
pathlib.Path The host working directory where agent artifacts are synced to.
- runner
ModalRunner The parent runner.
- start
float The wall-clock time when the agent was launched, for duration tracking.
- proc