"""Hypothesis Agent — generates investigative hypotheses from phenomena. Generates hypotheses only. Phenomenon→Hypothesis linking is handled centrally by Orchestrator._judge_new_phenomena, so all link logic lives in one place. """ from __future__ import annotations import logging from base_agent import BaseAgent from evidence_graph import EvidenceGraph from llm_client import LLMClient logger = logging.getLogger(__name__) class HypothesisAgent(BaseAgent): name = "hypothesis" role = ( "Hypothesis analyst. You review all phenomena discovered so far " "and formulate investigative hypotheses about what happened on this system. " "Your ultimate goal: build the most complete picture of events that occurred." ) def __init__(self, llm: LLMClient, graph: EvidenceGraph) -> None: super().__init__(llm, graph) self._register_hypothesis_tools() def _register_hypothesis_tools(self) -> None: self.register_tool( name="add_hypothesis", description=( "Create a new investigative hypothesis about what happened on the system. " "Each hypothesis should be a specific, testable claim." ), input_schema={ "type": "object", "properties": { "title": { "type": "string", "description": "Short title for the hypothesis.", }, "description": { "type": "string", "description": "Detailed description of what this hypothesis claims.", }, }, "required": ["title", "description"], }, executor=self._add_hypothesis, ) async def _add_hypothesis(self, title: str, description: str) -> str: hid = await self.graph.add_hypothesis( title=title, description=description, created_by=self.name, ) return f"Hypothesis created: {hid} — {title} (confidence: 0.50)"