hackagent.storage.store
The storage protocol that LocalBackend and RemoteBackend implement.
Callers depend on :class:Store only, never on a concrete backend.
Store Objects
class Store(Protocol)
Common interface for storage backends.
All methods are synchronous. The protocol uses duck-typing so concrete backends do not need to explicitly inherit from this class.
get_context
def get_context() -> OrganizationContext
Return the org / user context associated with this backend.
get_api_key
def get_api_key() -> Optional[str]
Return the API key used by this backend, or None (local mode).
flush
def flush() -> None
Block until all deferred writes are persisted (no-op if synchronous).
close
def close() -> None
Release resources / stop background workers. Idempotent.
create_or_update_agent
def create_or_update_agent(name: str,
agent_type: str,
endpoint: str,
metadata: Dict[str, Any],
overwrite_metadata: bool = True) -> AgentRecord
Create a new agent or update an existing one with the same name.
update_campaign_run
def update_campaign_run(campaign_run_id: UUID,
status: Optional[str] = None,
audit: Optional[Dict[str, Any]] = None,
run_notes: Optional[str] = None) -> CampaignRunRecord
Change what was given. None leaves a field as it is; pass ""
to clear a note an earlier update wrote.
count_result_buckets
def count_result_buckets() -> Dict[str, int]
Return {total, jailbreaks, mitigated, failed, pending} across all results.