Describe the problem/error/question
I’m experiencing an issue with workflows where an AI agent is connected to a Gemini web search tool and runs in a loop.
Occasionally, the agent leaks its internal tool communication or search queries as the final output, even though those are intended only for the tool. I’ve tried explicitly instructing the agent not to do this, but it hasn’t been effective.
Using an output parser isn’t viable in this scenario, so my current workaround is a code node that parses the agent’s output instead of relying on the built-in output parser. This solution uses a universal JSON parser, which prevents the workflow itself from throwing errors. However, it introduces a new problem: some tasks, roughly 1 out of 30, end up being skipped.
Has anyone encountered a similar issue and found a reliable way to prevent the agent from leaking tool-related output?
Actual behaviour
Expected behaviour (the output and format can really be anything but here is an example)
Information on your n8n setup
- n8n version: 1.121.2
- Database : default
- n8n EXECUTIONS_PROCESS setting : default
- Running n8n via : Docker
- Operating system: Windows

