Skip to content

[perf] agents: lazy package __init__ so one agent doesn't load the whole NLP+RAG stack #518

Description

@VforVitorio

src/agents/init.py eagerly imported every agent, so importing any single agent (e.g. the Model Lab asking only for the Pace XGBoost model via 'from src.agents.pace_agent import ...') ran the package init and pulled the radio NLP stack (RoBERTa/SetFit/BERT-NER) + RAG embedder into memory/VRAM. Fix: lazy init via PEP 562 getattr (name->submodule, importlib on first access, cached). Verified: pace import loads no NLP; radio import still resolves. Resolved by #516.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions