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

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) abstractmethod

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

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,
) -> int:
    """Execute the agent with the given prompt. Returns the exit code."""