Skip to content

Self-hosted AI workspace.

Python

fix(agent): let retrieval run for non-English low-signal queries

Michael057619c70d7e
diff --git a/src/agent_loop.py b/src/agent_loop.py
index 26938c429..5b9bb2ba9 100644
--- a/src/agent_loop.py
+++ b/src/agent_loop.py
@@ -1801,18 +1801,21 @@ async def stream_agent_loop(
logger.info(f"[tool-rag] Using caller-provided relevant_tools ({len(_relevant_tools)} tools)")
if not guide_only and not _relevant_tools and bool(_intent.get("low_signal")):
from src.tool_index import ALWAYS_AVAILABLE
- _relevant_tools = set(ALWAYS_AVAILABLE)
if workspace:
# An active workspace IS the file-work signal: a vague "look at the
# project" means explore this folder. Surface only the READ-ONLY file
# tools (intersection with the plan-mode read-only allowlist) so the
# agent can investigate; write/shell tools stay out until the request
# actually calls for them (RAG retrieval adds those on a real ask).
+ _relevant_tools = set(ALWAYS_AVAILABLE)
from src.tool_security import PLAN_MODE_READONLY_TOOLS
_relevant_tools |= (_DOMAIN_TOOL_MAP["files"] & PLAN_MODE_READONLY_TOOLS)
logger.info("[tool-rag] Low-signal but workspace active; including read-only file tools")
else:
- logger.info("[tool-rag] Low-signal agent message; skipping retrieval and using always-available tools only")
+ # Don't short-circuit: fall through to RAG retrieval below.
+ # Non-English queries are flagged low_signal by the English-only
+ # intent classifier, but fastembed retrieval works across languages.
+ logger.info("[tool-rag] Low-signal query; will run RAG retrieval")
if not guide_only and not _relevant_tools:
try:
from src.tool_index import get_tool_index, ALWAYS_AVAILABLE