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 Labelling

From Leeroopedia
Knowledge Sources
Domains Datasets, Classification
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete taxonomy classifier that labels unlabelled goals with risk category and subcategory using an LLM model, batching goals and failing open on errors, provided by the HackAgent datasets package.

Description

label_goals() is an async function that takes a list of Goal objects and a ClassifierModel (a protocol with acomplete()). It batches goals (default 20 per batch), asks the model to classify each into one category and subcategory, parses the numbered-line reply, and returns goals with labels. Goals already labelled (from intents) are left alone. The classifier fails open: after the first failed call, the model is not asked again, and unlabelled goals get UNCLASSIFIED labels.

Usage

  • Campaign goal labelling: The campaign runner calls label_goals() to tag goals before running attacks.

Code Reference

Source Location

Signature

async def label_goals(
    goals: Sequence[Goal],
    model: ClassifierModel,
    *,
    batch_size: int = BATCH_SIZE,
    concurrency: int = 1,
) -> list[Goal]: ...

def is_labelled(goal: Goal) -> bool: ...

Import

from hackagent.datasets.labelling import label_goals, is_labelled

Usage Examples

Label Goals with a Model

import asyncio
from hackagent.datasets.labelling import label_goals
from hackagent.core.contracts import Goal

goals = [Goal(text="How to hack a wifi", index=0)]
labelled = asyncio.run(label_goals(goals, model=my_classifier))
for g in labelled:
    print(g.text, g.labels)

Related Pages

Implements Principle

Page Connections

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