Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2026 06:44 PM
Following up on this, there is an open PR for this issue that details what is going on:
https://github.com/databricks/app-templates/pull/256
I added this code to utils.py
def to_runner_input(request: ResponsesAgentRequest) -> list[dict]:
"""Normalize Responses history into items Runner.items_to_messages accepts.
Chat UIs echo prior assistant messages as type=message with output_text parts
and no id (and Pydantic dump adds status=None). The Agents SDK Chat Completions
converter rejects that shape. Keep function_call / function_call_output as-is so
tool history still round-trips; do not run to_chat_completions_input here.
"""
messages: list[dict] = []
for item in request.input:
dumped = item.model_dump(exclude_none=True)
if (
dumped.get("type") == "message"
and dumped.get("role") == "assistant"
and "id" not in dumped
):
dumped["id"] = str(uuid4())
messages.append(dumped)
return messagesThen use the function to normalize messages to Chat Completions API schema with an id attribute for assistant messages:
# messages = [i.model_dump() for i in request.input]
messages = to_runner_input(request)
result = Runner.run_streamed(agent, input=messages)
Summary Apps built from the agent-openai-agents-sdk template fail on the second and later prompts with: agents.exceptions.UserError: Unhandled item type or structure: {'status': None, ...