Skip to content

Backend

backend

Abstract base class for sandbox backends.

Backend(workdir='.', image=None, *, harness)

Bases: ABC

Base class for sandbox backends.

Subclasses implement setup() and run() to provide different execution environments (OpenShell sandbox, Podman container, etc.).

Source code in src/agentic_ci/backend.py
def __init__(self, workdir=".", image=None, *, harness: Harness):
    self.workdir = os.path.abspath(workdir)
    self.image = image
    self.harness = harness
    self.verdict_path: Path | None = None
    self.output_file: Path | None = None
    self._host_git: GitControlSnapshot | None = None

setup(otel_port=None) abstractmethod

Prepare the backend. Idempotent.

Source code in src/agentic_ci/backend.py
@abstractmethod
def setup(self, otel_port: int | None = None):
    """Prepare the backend. Idempotent."""

stop() abstractmethod

Tear down the sandbox environment.

Source code in src/agentic_ci/backend.py
@abstractmethod
def stop(self):
    """Tear down the sandbox environment."""

run(prompt, model, streaming=True, otel_port=None, otel_rate_file=None, extra_args=None, traceparent=None, effort=None) abstractmethod

Execute the agent with the given prompt. Returns the exit code.

effort is the resolved reasoning effort (None when no effort flag is passed). It is exported to the agent as AGENT_REASONING_EFFORT next to AGENT_MODEL; the matching CLI flags come from the caller through extra_args.

Source code in src/agentic_ci/backend.py
@abstractmethod
def run(
    self,
    prompt,
    model,
    streaming=True,
    otel_port=None,
    otel_rate_file=None,
    extra_args=None,
    traceparent=None,
    effort=None,
) -> int:
    """Execute the agent with the given prompt. Returns the exit code.

    *effort* is the resolved reasoning effort (``None`` when no effort
    flag is passed). It is exported to the agent as
    ``AGENT_REASONING_EFFORT`` next to ``AGENT_MODEL``; the matching CLI
    flags come from the caller through *extra_args*.
    """