When an agent does something it shouldn't, the trace tells you what it saw. It doesn't tell you which part of that made it act. The usual move is to read through the messages, pick the line that looks guilty, add a rule to the system prompt and rerun once.

Source: [Dev.to](https://dev.to/rehan_mohammed_5b7a1ad99e/finding-the-sentence-that-made-an-ai-agent-misbehave-30f7)

Sponsored