feat(agent): add learn action flow and grounding guards

This commit is contained in:
Dom
2026-06-02 16:24:10 +02:00
parent 86b3c8f7e7
commit d38f0b0f2f
39 changed files with 5901 additions and 212 deletions

View File

@@ -137,11 +137,31 @@ class AutonomousPlanner:
logger.info(f"AutonomousPlanner initialized (LLM: {self.llm_model}, available: {self.llm_available}, visual: {self._owl_detector is not None}, vlm: {self._vlm_client is not None})")
def _init_visual_detection(self):
"""Initialise le détecteur visuel OWL-v2."""
"""Initialise le détecteur visuel OWL-v2.
Désactivé par défaut depuis 2026-05-25 (C1b) : OWL-v2 chargeait sur
CUDA au boot et retenait ~600 MiB VRAM même en cas d'OOM silencieux,
fausssant les benchs perf et contribuant à l'offload Ollama VLM.
Comme `autonomous_planner` est largement non-wired au runtime actif
(cf. mémoire projet : HTTP 410 dépréciés), le défaut est skip.
Activation : `AGENT_CHAT_ENABLE_OWL=1` (env var).
Device : `AGENT_CHAT_OWL_DEVICE=cuda|cpu` (override l'auto-détect).
"""
if os.environ.get("AGENT_CHAT_ENABLE_OWL", "0").strip() not in ("1", "true", "yes"):
logger.info(
"OWL-v2 visual detector skipped at boot "
"(AGENT_CHAT_ENABLE_OWL!=1, économie ~600 MiB VRAM)"
)
return
if VISUAL_DETECTION_AVAILABLE and OwlDetector:
try:
self._owl_detector = OwlDetector(confidence_threshold=0.1)
logger.info("OWL-v2 visual detector initialized")
device = os.environ.get("AGENT_CHAT_OWL_DEVICE", "").strip() or None
self._owl_detector = OwlDetector(
confidence_threshold=0.1,
device=device,
)
logger.info(f"OWL-v2 visual detector initialized (device={device or 'auto'})")
except Exception as e:
logger.warning(f"Could not initialize OWL detector: {e}")
self._owl_detector = None