﻿# OpenHands structured tool output should be reparsed after reload

OpenHands response_schema adds validated fields to a tool call; after restoring a conversation, recover them with parse methods because the in-memory structured_output property is not serialized.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-openhands-structured-output-reparse/
Language: en

## Locate the structured fields in the tool call

An agent completes a repository assessment and supplies typed findings alongside its final message. OpenHands' [structured-output guide](https://docs.openhands.dev/sdk/guides/structured-output) attaches a Pydantic model or JSON Schema through a tool's `response_schema`. The fields augment what the model must supply when calling that tool. They are not an arbitrary JSON fragment extracted afterward from a natural-language answer.

## Keep tool arguments and execution results distinct

The augmented tool keeps its own arguments. For example, a finishing tool still has its message while also accepting the assessment fields. The [custom-tools guide](https://docs.openhands.dev/sdk/guides/custom-tools) distinguishes Action inputs, Observation results and Executor logic. That separation matters when naming the artifact: validated assessment fields supplied by the model are not automatically observations produced by a test runner. A well-formed finding can still be factually unsupported.

## Reparse the recorded call after persistence

The guide recommends `parse_last_response()` for the latest matching call or `parse_response(action)` for a specific one. The former returns `None` when the tool has not been called. The transient `action.structured_output` value is not serialized and returns as `None` after a persistence round trip. The [persistence guide](https://docs.openhands.dev/sdk/guides/convo-persistence) restores event history; the parse methods re-read that call so structured fields can be recovered from the saved evidence.

## Define fields within the supported boundary

Reserved names and collisions with existing tool argument names are rejected when the tool resolves. A schema belongs to an individual tool rather than a specification resolving to a tool set. Keep the assessment schema focused and do not reuse the finishing tool's message field for a different purpose. If several calls can occur, select the intended action explicitly instead of accidentally reading a later assessment as the result of an earlier revision.

## Verify structure and meaning separately

Check a saved-and-reloaded sample through the parse method, then compare the findings with the relevant source and executed checks. The [response-contract guide](/journal/learn-openrouter-response-contract/) distinguishes structural acceptance from useful output; [tool observations](/journal/learn-codex-tool-observation/) tie claims to actual results. Report an absent call separately from an empty valid assessment. Successful parsing establishes the declared shape, while review establishes whether those fields describe the repository correctly.
