From 19f3f3210f901b4a8382a1fab3a772c7b7e11a0b Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 6 May 2026 16:15:20 -0700 Subject: [PATCH] feat(agent_session_endpoints): align /v2 wire schemas with Cursor SDK * SessionCreate: drop body.agent_id since route is nested under /v2/agents/{agent_id}/sessions. * ConversationMessage: rename event_type/payload -> type/data so SSE stream + /conversation share the same wire shape (DB column unchanged). --- litellm/proxy/agent_session_endpoints/schemas.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/agent_session_endpoints/schemas.py b/litellm/proxy/agent_session_endpoints/schemas.py index 31e202e8afd..961a575eee0 100644 --- a/litellm/proxy/agent_session_endpoints/schemas.py +++ b/litellm/proxy/agent_session_endpoints/schemas.py @@ -75,7 +75,14 @@ class AgentResponse(BaseModel): class SessionCreate(BaseModel): - agent_id: str + """Body for ``POST /v2/agents/{agent_id}/sessions``. + + The parent ``agent_id`` is taken from the URL path — it does NOT + appear in the request body. This matches Cursor's nested route + shape and keeps the body to caller-supplied per-session overrides + only. + """ + repos: Optional[List[RepoSpec]] = None env_vars: Optional[Dict[str, str]] = None max_session_minutes: Optional[int] = Field( @@ -171,8 +178,11 @@ class NextRunResponse(BaseModel): class ConversationMessage(BaseModel): run_id: str seq: int - event_type: str - payload: Dict[str, Any] + # Wire shape matches the SSE event frame (``type``/``data``) and + # Cursor's public API. The DB column on AgentRunEvent stays + # ``event_type``/``payload`` — see ``serialization.event_row_to_message``. + type: str + data: Dict[str, Any] created_at: Optional[str] = None