Fall back to model_id for the logged model

Agents store their model only in model_id, so neither log_activity nor
agent_log_context bound a model key. start_agent_span already reads it.
This commit is contained in:
Alex committed 2026-09-24 13:47:46 +01:00
1 parent 9df90ab9df
commit cf9a5e9cb8
2 files changed
+6 -1

No files matched your search

+5 -1
View File
@@ -97,7 +97,11 @@ def _agent_log_keys(agent: Any, data: Optional[Dict] = None) -> Dict[str, Any]:
"agent_id": getattr(agent, "agent_id", None),
"conversation_id": getattr(agent, "conversation_id", None),
"endpoint": data.get("endpoint", ""),
"model": getattr(agent, "gpt_model", None) or getattr(agent, "model", None),
"model": (
getattr(agent, "gpt_model", None)
or getattr(agent, "model", None)
or getattr(agent, "model_id", None)
),
}
@@ -74,6 +74,7 @@ def test_model_calls_in_a_continuation_carry_the_turns_identity():
assert seen[0]["user_id"] == "user-cont"
assert seen[0]["agent_id"] == "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
assert seen[0]["endpoint"] == "stream"
assert seen[0]["model"] == "gpt-4"
assert "activity_id" not in seen[0], "a continuation is not an activity of its own"