When a model's text answer holds several JSON objects, Agno's parse_response_model_str merges them field by field: list fields collect items and other fields keep the last value. The list branch extended whatever was already stored, so an earlier fragment that gave the field a string, a number, None or an object raised AttributeError from inside the parser. Agent and team runs call this parser for an output_schema when the model returns a string, and models often write a draft value before the real list.
The parser now starts a fresh list whenever the stored value isn't one:
from typing import List
from pydantic import BaseModel
from agno.utils.string import parse_response_model_str
class Todo(BaseModel):
items: List[str]
content = '{"items": "draft"}\n{"items": ["buy milk", "ship release"]}'
parse_response_model_str(content, Todo)
# Before: AttributeError 'str' object has no attribute 'extend'
# Now: Todo(items=['buy milk', 'ship release'])See the cookbook, and learn more about structured output in the documentation.
Frequently asked questions
The model returned more than one JSON object, and an earlier one set a list field to a string. Agno merged the objects by extending the stored value, which fails on a string. Agno now starts a fresh list in that case and returns the parsed model.
When the full text fails to parse, parse_response_model_str reads each JSON object in turn. List fields collect the items from every object, and every other field keeps the latest value.





