Implementation:AISecurityLab Hackagent Store Protocol
| Knowledge Sources | |
|---|---|
| Domains | Storage, Contracts |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete storage protocol interface that LocalBackend and RemoteBackend implement, providing synchronous CRUD operations for agents, attacks, runs, results, and traces, provided by the HackAgent storage package.
Description
Store is a Protocol using duck-typing so concrete backends need not explicitly inherit. It defines methods for: context (get_context, get_api_key), lifecycle (flush, close), agents (create_or_update_agent, list_agents, get_agent, delete_agent), attacks (create_attack, etc.), runs (create_run, update_run, etc.), results (create_result, etc.), and traces. All methods are synchronous; the RemoteBackend wraps async writes internally.
Usage
- Campaign tracking: RunTracker uses a Store to persist run records.
- Backends: LocalBackend (SQLite) and RemoteBackend (HTTP API) implement this protocol.
Code Reference
Source Location
- Repository: AISecurityLab_Hackagent
- File: hackagent/storage/store.py
Signature
class Store(Protocol):
def get_context(self) -> OrganizationContext: ...
def get_api_key(self) -> Optional[str]: ...
def flush(self) -> None: ...
def close(self) -> None: ...
def create_or_update_agent(self, name, agent_type, endpoint, metadata, ...) -> AgentRecord: ...
def list_agents(self, page=1, page_size=100) -> PaginatedResult[AgentRecord]: ...
def get_agent(self, agent_id: UUID) -> AgentRecord: ...
def delete_agent(self, agent_id: UUID) -> None: ...
def create_attack(self, attack_type, agent_id, configuration, ...) -> AttackRecord: ...
# ... run, result, trace methods ...
Import
from hackagent.storage.store import Store