From 3a3355befb14299394aa443b9960caf5d5c86497 Mon Sep 17 00:00:00 2001 From: Zamil Majdy Date: Fri, 30 Jan 2026 14:00:01 -0600 Subject: [PATCH] fix: use graph_id from current_agent for exclusion in edit_agent The agent_id parameter might be a library agent ID, not a graph_id, which could cause incorrect agent exclusion when fetching library agents. Always use the graph_id from the fetched current_agent. --- .../backend/backend/api/features/chat/tools/edit_agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogpt_platform/backend/backend/api/features/chat/tools/edit_agent.py b/autogpt_platform/backend/backend/api/features/chat/tools/edit_agent.py index 9f45f88027..2c2c48226b 100644 --- a/autogpt_platform/backend/backend/api/features/chat/tools/edit_agent.py +++ b/autogpt_platform/backend/backend/api/features/chat/tools/edit_agent.py @@ -130,11 +130,11 @@ class EditAgentTool(BaseTool): library_agents = None if user_id: try: - exclude_id = current_agent.get("id") or agent_id + graph_id = current_agent.get("id") library_agents = await get_all_relevant_agents_for_generation( user_id=user_id, search_query=changes, - exclude_graph_id=exclude_id, + exclude_graph_id=graph_id, include_marketplace=True, ) logger.debug(