mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-18 10:45:31 -04:00
Agent prompt builder: stop re-adding ALWAYS_AVAILABLE on top of filtered tools
Found the reason yesterday's tool-retrieval drop wasn't taking effect: in _build_agent_prompt, when relevant_tools was provided, it computed tool_names = set(ALWAYS_AVAILABLE) | set(relevant_tools) which silently re-added every tool get_tools_for_query had just deliberately discarded. So when a 'save this for <person>' query dropped manage_memory from the retrieved set, the prompt builder put it right back, and the model saw both tools again. Trust the relevant_tools set. get_tools_for_query already starts from ALWAYS_AVAILABLE — any discard there is intentional and should propagate. Only force-include ask_user and update_plan here as belt- and-suspenders since the agent loop relies on those for its own control flow. Other callers (task_scheduler) already union ALWAYS_AVAILABLE or ASSISTANT_ALWAYS_AVAILABLE into relevant_tools before passing it in, so they're unaffected.
This commit is contained in:
+8
-2
@@ -1264,8 +1264,14 @@ def _build_base_prompt(
|
||||
disabled.add("generate_image")
|
||||
|
||||
if relevant_tools is not None:
|
||||
# RAG mode: include always-available + retrieved + admin (if needed)
|
||||
tool_names = set(ALWAYS_AVAILABLE) | set(relevant_tools)
|
||||
# RAG mode: trust the relevant_tools set as already-composed.
|
||||
# get_tools_for_query starts from ALWAYS_AVAILABLE and may
|
||||
# *discard* tools that conflict with the query's intent (e.g.
|
||||
# drop manage_memory for clear contact-save patterns). Unioning
|
||||
# ALWAYS_AVAILABLE back in here used to silently undo those
|
||||
# drops. Only force-include the irreducible loop primitives
|
||||
# (ask_user, update_plan) as belt-and-suspenders.
|
||||
tool_names = set(relevant_tools) | {"ask_user", "update_plan"}
|
||||
if needs_admin:
|
||||
tool_names |= _ADMIN_TOOLS
|
||||
agent_prompt = _assemble_prompt(tool_names, disabled, compact=compact)
|
||||
|
||||
Reference in New Issue
Block a user