From 602a0a4fb1cf4fe937eff25716999b3d91832791 Mon Sep 17 00:00:00 2001 From: Zamil Majdy Date: Tue, 10 Feb 2026 14:11:27 +0400 Subject: [PATCH] fix(backend/chat): Strip tool call noise from conversation history context --- .../backend/api/features/chat/sdk/service.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/autogpt_platform/backend/backend/api/features/chat/sdk/service.py b/autogpt_platform/backend/backend/api/features/chat/sdk/service.py index 722eb8a814..7578cfa221 100644 --- a/autogpt_platform/backend/backend/api/features/chat/sdk/service.py +++ b/autogpt_platform/backend/backend/api/features/chat/sdk/service.py @@ -159,15 +159,11 @@ def _format_conversation_history(session: ChatSession) -> str: if msg.role == "user": history_parts.append(f"User: {msg.content or ''}") elif msg.role == "assistant": - history_parts.append(f"Assistant: {msg.content or ''}") - if msg.tool_calls: - for tc in msg.tool_calls: - func = tc.get("function", {}) - history_parts.append( - f" [Called tool: {func.get('name', 'unknown')}]" - ) - elif msg.role == "tool": - history_parts.append(f" [Tool result: {msg.content or ''}]") + # Only include text content, skip tool call metadata + # (tool calls are noise for history context) + if msg.content: + history_parts.append(f"Assistant: {msg.content}") + # Skip tool result messages — they're not useful for conversation context history_parts.append("") history_parts.append("")