coding_agent¶
The backend abstraction behind --coding-agent: the interface each spawned
binary (claude, codex, opencode) implements — spawn argv, model
validation, availability checks. Read this page to add or change a backend.
Like every API page, it is for contributors changing cafleet and embedders
driving it from Python; CLI users find the command surface in
CLI options.
base ¶
Registry contract for coding-agent backends (claude, codex, opencode).
The :class:CodingAgent Protocol defines the surface every backend must
implement; the concrete impls live alongside this module
(cafleet.coding_agent.claude, ...codex, ...opencode) and are
selected via the placement.coding_agent column. The Director picks a
backend per member at create time and the multiplexer spawns the resulting
argv inside a fresh pane.
CodingAgent ¶
Bases: Protocol
Coding-agent binary that runs inside a multiplexer pane.
Source code in cafleet/src/cafleet/coding_agent/base.py
ensure_available ¶
Raise if any spawn precondition is unmet.
Preconditions covered by impls include: the backend binary is on
PATH, any required config file is writable, and (for backends
with bundled presets) the preset has been materialized to disk.
Impls MAY materialize required config files here as a side effect —
see OpencodeAgent.ensure_available for the canonical example.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If any precondition is unmet. |
Source code in cafleet/src/cafleet/coding_agent/base.py
validate_model ¶
Raise ValueError if model is not acceptable to this backend.
None (flag omitted) is always valid. Called by member create
before any registration or tmux side effect.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in cafleet/src/cafleet/coding_agent/base.py
build_spawn_argv ¶
Return the argv list passed to the multiplexer's split_window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
str
|
The initial prompt text the backend should be launched with (e.g. the member's role-defining spawn prompt). |
required |
display_name
|
str
|
Pane title. Honored by backends that support a
pane-title flag (currently only |
required |
model
|
str | None
|
Model forwarded to the binary via its |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
argv list ready to hand to |
Source code in cafleet/src/cafleet/coding_agent/base.py
ensure_binary_on_path ¶
Shared availability check used by every CodingAgent impl.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
binary_name
|
str
|
Executable name to resolve via |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If |