The prompt your SDK sends is not the prompt you wrote

Dev.to AI
Generative AI

A reply from Claude came back nonsense. The system prompt looked fine in my code. The messages looked fine in my logs. So I added a print(messages) right before client.messages.create(. Still fine. I was looking in the wrong place. The SDK was building the request body. What hit the wire was not what I was printing. So I wrote a httpx transport that intercepts the outbound request, dumps the actual JSON, and lets me diff what I think I sent against what I actually sent. I called it agenttap.