formachines / errata

Errata / PyPI / google-genai

interaction.outputs behaviour changed in google-genai 2.34.0

In our sandbox runs up to 2026-10-31, gpt-6.1-sol wrote "outputs": [ for google-genai. It fails on 2.34.0 with ImportError (changed between 1.69.0 and 2.34.0). Use "steps": [ instead.

What to do
replace the line
Output
same on one example
Patch
incomplete: old names remain
Auto-apply
not allowed
Seen in
1 model
Worked / failed
1 / 0
Last verified
2026-10-31

What to do

Not for automatic application — after the patch the example still uses outputs, which the verified example does not: the patch covers part of the change. Show this correction to the user as a lead. Replace the old line with the new one; the rest of the code can stay.

Automatic application: not allowed — the patch gives incomplete when applied word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (behaviour changed); the checks are in proof; neither follows from the other.

How to tell this applies to your code

Old and new code

"outputs": [
"steps": [

Error on 2.34.0:

ImportError: Install a google-genai version with Interactions API support.
Sandbox proof
Scriptgoogle-genai versionResult
Code the models wrote1.69.0works
Code the models wrote2.34.0fails: ImportError
Verified example below2.34.0works
Output of the verified example2.34.0same as the original's on 1.69.0 (observed stdout of one example; not a proof of equivalent behaviour)
Patch applied word for word to the example2.34.0applied word for word, the patch leaves old names in use: it covers part of the change — after the patch the example still uses outputs, which the verified example does not: the patch covers part of the change

Verified example for google-genai 2.34.0

#!/usr/bin/env python3
"""Load a saved Gemini interaction locally; no client or network calls."""

from importlib import import_module


def get_interaction_type():
    # Accommodate SDK versions that expose interaction models differently.
    for module_name in (
        "google.genai._interactions.types",
        "google.genai.interactions.types",
        "google.genai.types",
        "google.genai._interactions.types.interaction",
        "google.genai.interactions.types.interaction",
    ):
        try:
            module = import_module(module_name)
        except ModuleNotFoundError as exc:
            if exc.name and (
                module_name == exc.name or module_name.startswith(exc.name + ".")
            ):
                continue
            raise

        interaction_type = getattr(module, "Interaction", None)
        if interaction_type is not None:
            return interaction_type

    # NOTE: No SDK export of `Interaction` could be verified for google-genai
    # 2.34.0, so fall back to reading the saved response as a plain dict
    # instead of raising ImportError.
    return None


def main():
    # Replace this dictionary with your saved Interactions API response.
    # NOTE: Per the release notes, content is now returned in `steps` instead
    # of `outputs`. The shape of each step below is assumed to match the old
    # output items; adjust it to match your actual saved response.
    saved_response = {
        "id": "saved-interaction",
        "object": "interaction",
        "created": "2026-01-01T00:00:00Z",
        "updated": "2026-01-01T00:00:01Z",
        "model": "gemini-2.5-flash",
        "role": "model",
        "status": "completed",
        "steps": [
            {
                "type": "text",
                "text": "Hello from the saved interaction!",
            }
        ],
        "usage": {
            "total_input_tokens": 5,
            "total_output_tokens": 8,
            "total_tokens": 13,
        },
    }

    Interaction = get_interaction_type()
    if Interaction is not None:
        interaction = Interaction.model_validate(saved_response)
        steps = interaction.steps
    else:
        steps = saved_response.get("steps")

    if steps:
        final_step = steps[-1]
        if isinstance(final_step, dict):
            if final_step.get("type") == "text":
                print(final_step.get("text"))
        elif getattr(final_step, "type", None) == "text":
            print(final_step.text)


if __name__ == "__main__":
    main()

Source

Update code to read response content from the steps array instead of outputs.

Release notes · Seen in: gpt-6.1-sol · First seen 2026-10-31 · Last verified 2026-10-31 · All corrections for google-genai

For agents