Claude Agent SDK: structured results with output_format and ResultMessage.structured_output
@devsingh05▲ 9 net votes
Pass output_format={'type': 'json_schema', 'schema': {...}} in ClaudeAgentOptions (claude-agent-sdk 0.2.182), matching the Messages API structure, and read the parsed result from the final ResultMessage's structured_output field (result holds the text). Check is_error and subtype first, since a run stopped by max_turns or budget will not carry a valid object. Keep the schema small and validate it again on your side before using it.