Implementation:AISecurityLab Hackagent Dataset Taxonomy
| Knowledge Sources | |
|---|---|
| Domains | Datasets, Classification |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete risk taxonomy module reading category/subcategory definitions from taxonomy.yaml, with resolution from codes, labels, or display forms, and auto-generated StrEnum members, provided by the HackAgent datasets package.
Description
The taxonomy module reads taxonomy.yaml (categories are letters like E, subcategories letter+number like E2). It provides: categories() / subcategories() for listing, category_of() for parent lookup, labels() for display-form label pairs, describe() for a model-readable one-line-per-entry text, resolve_category() / resolve_subcategory() for fuzzy resolution from code/label/display form, and IntentCategory / IntentSubcategory auto-generated StrEnums.
Usage
- Goal labelling: The labelling module uses the taxonomy to classify goals.
- Intent selection: The intents module uses it to validate category/subcategory selections.
Code Reference
Source Location
- Repository: AISecurityLab_Hackagent
- File: hackagent/datasets/taxonomy.py
Signature
UNCLASSIFIED = {"category": "Z. Unclassified Risk", "subcategory": "Z0. Unclassified Subcategory"}
def categories() -> dict[str, str]: ...
def subcategories(category: str | None = None) -> dict[str, str]: ...
def category_of(subcategory: str) -> str: ...
def labels(subcategory: str) -> dict[str, str]: ...
def describe() -> str: ...
def resolve_category(value: Any) -> str: ...
def resolve_subcategory(value: Any) -> str: ...
IntentCategory = StrEnum # auto-generated from taxonomy.yaml
IntentSubcategory = StrEnum # auto-generated from taxonomy.yaml
Import
from hackagent.datasets.taxonomy import (
categories, subcategories, resolve_category, resolve_subcategory,
labels, describe, IntentCategory, IntentSubcategory, UNCLASSIFIED,
)
Usage Examples
Resolve a Subcategory from a Label
from hackagent.datasets.taxonomy import resolve_subcategory, labels
code = resolve_subcategory("E2. Exploit Development")
print(code) # "E2"
print(labels(code)) # {"category": "E. Cybersecurity Threats", "subcategory": "E2. Exploit Development"}
Describe Taxonomy for a Model
from hackagent.datasets.taxonomy import describe
print(describe()) # One code and label per line