Skip to content

Discovery

The auto-discovery system scans your Python modules for @vertex-decorated functions and generates flow definitions automatically.

GraphAutoDiscover

from honey_badgeria.back.discovery import GraphAutoDiscover

discover = GraphAutoDiscover(handler_modules=["myproject.vertices"])
graph_dict = discover.run()

How It Works

  1. VertexScanner — Imports each module in handler_modules and scans for functions with __hbia_vertex__ = True.
  2. VertexInspector — Extracts metadata from each decorated function: name, handler path, inputs, outputs.
  3. GraphGenerator — Assembles discovered vertices into a flow dict compatible with GraphBuilder.from_dict().

Example

Given this module:

# vertices/users.py
from honey_badgeria import vertex

@vertex
def normalize(name: str, email: str) -> dict:
    return {"name": name.strip().title(), "email": email.lower()}

@vertex
def validate(name: str, email: str) -> dict:
    return {"is_valid": bool(name and email)}

Discovery produces:

discover = GraphAutoDiscover(handler_modules=["vertices.users"])
result = discover.run()
# {
#     "normalize": {"handler": "vertices.users.normalize", ...},
#     "validate": {"handler": "vertices.users.validate", ...},
# }

Configuration

Set the modules to scan in your settings:

from honey_badgeria.conf import Settings, configure

configure(Settings(
    HANDLER_MODULES=["vertices", "myapp.handlers"],
))

Or in the project's hbia.yaml:

handler_modules:
  - vertices
  - myapp.handlers

CLI

The CLI uses discovery for various commands:

# List all flows found via discovery
hbia flow-list

# Generate AI context (uses discovery to inventory the project)
hbia context --write