Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AISecurityLab Hackagent Store Protocol

From Leeroopedia
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

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

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment