Skip to main content

hackagent.storage.remote

RemoteBackend — Store implementation backed by api.hackagent.dev.

This backend centralises all HTTP calls that were previously scattered across the model router, the run orchestrator, Tracker, and StepTracker. It is instantiated when an API key is available and selected automatically by HackAgent.init.

RemoteBackend Objects​

class RemoteBackend()

Store implementation that talks to api.hackagent.dev.

Wraps all HTTP calls behind the Store interface so that the rest of the SDK is entirely decoupled from HTTP concerns.

connect​

@classmethod
def connect(cls,
base_url: str,
api_key: str,
*,
timeout: Optional[float] = 120.0,
raise_on_unexpected_status: bool = False) -> "RemoteBackend"

Create a backend for base_url authenticated with api_key.

check_connection​

def check_connection() -> int

Probe the API with this backend's credentials; return the HTTP status.

/agent is the endpoint that accepts API keys (/key and /organization/me are Auth0-only on the deployed API).

flush​

def flush() -> None

Block until every queued write has been processed.

Called before any read that could observe a deferred write, and at run completion, so callers always see a consistent server state.

close​

def close() -> None

Drain the queue, stop the worker, and report any write failures.

get_context​

def get_context() -> OrganizationContext

Fetch org_id and user_id from the first agent (cached after first call).

create_campaign_run​

def create_campaign_run(agent_id: UUID, name: str,
campaign_config: Dict[str, Any]) -> CampaignRunRecord

Persist a campaign through the existing remote run endpoint.

The hosted API does not yet expose a dedicated campaign-run resource, so a marker distinguishes this parent record from attack runs. Local SQLite uses the normalized table and foreign key directly.

count_result_buckets​

def count_result_buckets() -> Dict[str, int]

Efficiently count results by evaluation status using filtered API calls.