-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Please read this first
- Have you read the docs?Agents SDK docs
- Have you searched for related issues? Others may have faced similar issues.
Describe the bug
On the history event that is emitted, the status of messages emitted by 'assistant' always says 'in_progress'. I believe the status must say 'completed' once the audio stream is None.
See example of log:
{
"item_id": "item_C3uQ0hZGu3ANx0kuSfadm",
"previous_item_id": "",
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "Greet the caller and ask how you can help!",
"id": null,
"audio": null,
"transcript": null
}
],
"status": "in_progress"
},
{
"item_id": "item_C3uQ0ycMymMXvPMNEE7K3",
"previous_item_id": null,
"type": "message",
"role": "assistant",
"status": "in_progress",
"content": [
{
"type": "audio",
"audio": null,
"transcript": "Hi there! Thanks for calling We Haul Raleigh. How can I help you today?",
"id": null,
"text": null
}
]
},
{
"item_id": "item_C3uQ9XTvjc9tobD9fv9Xw",
"previous_item_id": "item_C3uQ0ycMymMXvPMNEE7K3",
"type": "message",
"role": "user",
"content": [
{
"type": "input_audio",
"audio": null,
"transcript": "Where are you located?",
"id": null,
"text": null
}
],
"status": "completed"
},
{
"item_id": "item_C3uQB1RgzHWRYhJ2NjTQf",
"previous_item_id": null,
"type": "message",
"role": "assistant",
"status": "in_progress",
"content": [
{
"type": "audio",
"audio": null,
"transcript": "We’re located in Raleigh, NC, on Little Brier Creek Lane.",
"id": null,
"text": null
}
]
},
{
"item_id": "item_C3uQJDk9M2Wxz8cKc25O7",
"previous_item_id": "item_C3uQB1RgzHWRYhJ2NjTQf",
"type": "message",
"role": "user",
"content": [
{
"type": "input_audio",
"audio": null,
"transcript": "What do you charge?",
"id": null,
"text": null
}
],
"status": "completed"
},
{
"item_id": "item_C3uQMPUJwIUK3TU01Kp7y",
"previous_item_id": null,
"type": "message",
"role": "assistant",
"status": "in_progress",
"content": [
{
"type": "audio",
"audio": null,
"transcript": "Our fees start at $125 per load. The final price depends on factors like distance, item types, and stairs. You can contact Derek with details for an exact estimate.",
"id": null,
"text": null
}
]
}
]
For items:
item_C3uQMPUJwIUK3TU01Kp7y, item_C3uQB1RgzHWRYhJ2NjTQf, item_C3uQ0ycMymMXvPMNEE7K3, the status should say 'completed'.
Debug information
-
Agents SDK version: (e.g.
v0.0.3
): openai-agents==0.2.3 -
Python version (e.g. Python 3.10): python 3.12
Repro steps
Use this raw_log(..) method
import json
import logging
def _to_plain(obj):
if isinstance(obj, (str, int, float, bool)) or obj is None:
return obj
if isinstance(obj, dict):
return {k: _to_plain(v) for k, v in obj.items()}
if isinstance(obj, (list, tuple)):
return [_to_plain(x) for x in obj]
# Pydantic v2
if hasattr(obj, "model_dump"):
try:
return obj.model_dump()
except Exception:
pass
# Pydantic v1
if hasattr(obj, "dict"):
try:
return obj.dict()
except Exception:
pass
if hasattr(obj, "__dict__"):
try:
return {k: _to_plain(v) for k, v in vars(obj).items()}
except Exception:
pass
return str(obj)
def raw_log(history):
serializable_history = _to_plain(history)
try:
pretty = json.dumps(serializable_history, indent=2, ensure_ascii=False, default=str)
except Exception:
pretty = str(serializable_history)
logging.info("history(json)=\n%s", pretty)
and in the main runner file,
elif event.type == "history_updated":
raw_log(event)
Expected behavior
A clear and concise description of what you expected to happen.