From 6716b900d0edeb67aeff472c9f514483269595d0 Mon Sep 17 00:00:00 2001 From: MustafaKara7 Date: Mon, 6 Apr 2026 18:14:54 +0300 Subject: [PATCH] fix(agent): #5544 strictly enforce toolset filters for memory provider injection --- run_agent.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/run_agent.py b/run_agent.py index 688b25db772b3..e22551985459e 100644 --- a/run_agent.py +++ b/run_agent.py @@ -1112,14 +1112,21 @@ def __init__( self._memory_manager = None # Inject memory provider tool schemas into the tool surface - if self._memory_manager and self.tools is not None: + # Respect both enabled and disabled toolsets configurations + _memory_allowed = True + if self.enabled_toolsets is not None and "memory" not in self.enabled_toolsets: + _memory_allowed = False + if self.disabled_toolsets is not None and "memory" in self.disabled_toolsets: + _memory_allowed = False + + if self._memory_manager and self.tools is not None and _memory_allowed: for _schema in self._memory_manager.get_all_tool_schemas(): _wrapped = {"type": "function", "function": _schema} self.tools.append(_wrapped) _tname = _schema.get("name", "") if _tname: self.valid_tool_names.add(_tname) - + # Skills config: nudge interval for skill creation reminders self._skill_nudge_interval = 10 try: