From dc3917384935b56c98f67c4eea0ee60a06833108 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 6 May 2026 16:15:32 -0700 Subject: [PATCH] feat(agent_session_endpoints): serialize event rows with type/data wire fields Renames event_type/payload -> type/data when projecting an AgentRunEvent row into a ConversationMessage so the /conversation endpoint output matches the SSE event frame and Cursor's API. --- litellm/proxy/agent_session_endpoints/serialization.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/agent_session_endpoints/serialization.py b/litellm/proxy/agent_session_endpoints/serialization.py index 368d4d74b96..0fe5e86eeb1 100644 --- a/litellm/proxy/agent_session_endpoints/serialization.py +++ b/litellm/proxy/agent_session_endpoints/serialization.py @@ -98,10 +98,14 @@ def run_row_to_response(row: Any) -> RunResponse: def event_row_to_message(row: Any) -> ConversationMessage: + # NOTE: the DB column is ``event_type``/``payload`` but the wire + # shape we surface to SDK consumers is ``type``/``data`` (matches + # Cursor's API + the SSE event frame in run_endpoints._sse_event_data). + # Rename here so /conversation and the SSE stream agree. return ConversationMessage( run_id=row.run_id, seq=row.seq, - event_type=row.event_type, - payload=_as_dict(row.payload) or {}, + type=row.event_type, + data=_as_dict(row.payload) or {}, created_at=_iso(row.created_at), )