diff --git a/src/agent_loop.py b/src/agent_loop.py index 110bb6185..39463ae7d 100644 --- a/src/agent_loop.py +++ b/src/agent_loop.py @@ -793,6 +793,12 @@ def _classify_agent_request(messages: List[Dict], last_user: str) -> Dict[str, o domains.add("documents") if has(r"\b(search|web|google|look up|latest|news|current|weather|forecast|stock price|price of|website|url|https?://|www\.)\b"): domains.add("web") + if has( + r"\b(wyszukaj|wyszukać|wyszukac)\b.*\b(internet|internecie|online|web)\b", + r"\b(sprawd[zź]|znajd[zź])\b.*\b(internet|internecie|online|web)\b", + r"\b(aktualn\w*|bieżąc\w*|biezac\w*|dzisiaj|teraz)\b.*\b(pogod\w*|temperatur\w*)\b", + ): + domains.add("web") if has(r"\b(research|deep dive|investigate|look into)\b"): domains.add("web") if has(r"\b(open|show|toggle|turn on|turn off|disable|enable|switch model|change model|settings|theme|panel)\b"): diff --git a/tests/test_agent_loop.py b/tests/test_agent_loop.py index c99363757..0f1912361 100644 --- a/tests/test_agent_loop.py +++ b/tests/test_agent_loop.py @@ -36,6 +36,7 @@ _IMPORTED_AGENT_LOOP = None try: from src.agent_loop import ( _detect_admin_intent, + _classify_agent_request, _compute_final_metrics, _append_tool_results, _MCP_KEYWORDS, @@ -62,6 +63,16 @@ def test_mcp_keyword_gate_matches_literal_mcp_requests(): assert "mcp" in _MCP_KEYWORDS +def test_polish_internet_search_request_classifies_as_web(): + intent = _classify_agent_request( + [], + "Wyszukaj w internecie i podaj temperaturę w Lubartowie dzisiaj", + ) + + assert intent["low_signal"] is False + assert "web" in intent["domains"] + + # --------------------------------------------------------------------------- # _detect_admin_intent # ---------------------------------------------------------------------------