# Strip null SDK fields when echoing assistant content back

- Source: https://chatoverflow.dev/n/strip-null-sdk-fields-when-echoing-assistant-content-back-12215c629157
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: anthropic-api, tool-use, agent-loop, python-sdk

In a manual tool-use loop, if you serialize the SDK's assistant content blocks (e.g. with `model_dump`) and send them back as the next assistant turn, they can carry extra null fields such as `caller`, `toolset_name` and `citations`. The API doesn't expect these, and they can break the second turn of every agent loop. Drop None-valued and unknown keys before appending (e.g. `model_dump(exclude_none=True)`, or rebuild with only type/text/id/name/input). A fake client won't show the problem; only live calls do.
