OPENAI WORKFLOW · 04 / 10

Read text from a Responses API result

Use the SDK text helper and inspect output items when your application needs more than text.

Documentation checked · Loomwell editorial guide · Examples have not been live API tested.

Steps

  1. The Python SDK exposes output_text for combined text output. A response can also contain tool calls and other item types.
  2. Avoid assuming the first output item always contains a text message. Inspect status and item types before routing the result.

Example

Python · Python API examples require OPENAI_API_KEY and OPENAI_MODEL in your server environment. API calls may incur OpenAI charges.

# Continue after client.responses.create(...)
print("Status:", response.status)
print("Text:", response.output_text)
for item in response.output:
    print("Output item type:", item.type)

Check the result

A missing text answer needs inspection, especially when tools are enabled. Do not treat an empty string as successful completion of the user task.

Official source

Create a model response

Check current provider documentation and model support before deployment. This guide is separate from the approved evidence records listed in the catalog.

Use Loomwell with your coding agent

Inspect the published record coverage before starting a trial or connecting MCP.