{"version":"2.1.290","anchor":"structured-outputsdk-turn-result-tweaks","canonical_anchor":"structured-outputsdk-turn-result-tweaks","heading":"Agent SDK results no longer pick up an API error as the reply","tier":"notice","area":"SDK","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.290\/e\/structured-outputsdk-turn-result-tweaks","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.290","markdown":"### Agent SDK results no longer pick up an API error as the reply\n\nIn the Agent SDK, a successful turn's result text no longer comes from an assistant message that reports an API error\n\n**Unclear.** It is not clear how far the extra saving step during compaction reaches.\n\n**What**\n\nThe Agent SDK lets programs run Claude Code and read back what happened in each turn, a turn being one request and Claude's response. Previously the turn's `result` text was always taken from Claude's last message. Now, if that message is an API error but the turn itself did not end in error, it is not used as `result`.\n\nTwo smaller changes come with it. When a conversation is compacted, meaning shortened so it fits, Claude Code now saves state first. Notices that a command has been taken in now go through their own callback.\n\n**Why**\n\nPrograms reading the result of a successful turn no longer get an error message where they expect Claude's answer.\n\n- Area: SDK\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}