Skip to content

Commit a741dd7

Browse files
Return send_req.model_dump() directly
1 parent 3a0b771 commit a741dd7

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

agents/a2a_langgraph_crewai/src/a2a_langgraph_crewai/langgraph_a2a_server.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@
3434
from a2a.server.events import EventQueue
3535
from a2a.server.request_handlers import DefaultRequestHandler
3636
from a2a.server.tasks import InMemoryTaskStore
37-
from a2a.types import AgentCapabilities, AgentCard, AgentSkill, MessageSendParams, SendMessageRequest
37+
from a2a.types import (
38+
AgentCapabilities,
39+
AgentCard,
40+
AgentSkill,
41+
MessageSendParams,
42+
SendMessageRequest,
43+
)
3844
from a2a.utils import new_agent_text_message
3945

4046
from .a2a_reply import send_a2a_text_message
@@ -157,12 +163,7 @@ def _jsonrpc_message_send_envelope(user_text: str) -> dict[str, Any]:
157163
id=req_id,
158164
params=MessageSendParams(**payload),
159165
)
160-
return {
161-
"jsonrpc": "2.0",
162-
"method": "message/send",
163-
"params": send_req.model_dump(mode="json", exclude_none=True),
164-
"id": req_id,
165-
}
166+
return send_req.model_dump(mode="json", exclude_none=True)
166167

167168

168169
def _jsonrpc_ok_envelope(request_id: str, assistant_text: str) -> dict[str, Any]:
@@ -294,7 +295,9 @@ async def run_and_stream():
294295
{
295296
"id": "chatcmpl-a2a-playground",
296297
"object": "chat.completion",
297-
"choices": [{"index": 0, "message": {"role": "assistant", "content": reply}}],
298+
"choices": [
299+
{"index": 0, "message": {"role": "assistant", "content": reply}}
300+
],
298301
"a2a_protocol": {
299302
"jsonrpc_request": rpc_req,
300303
"jsonrpc_response": rpc_resp,
@@ -303,7 +306,9 @@ async def run_and_stream():
303306
)
304307

305308

306-
def _build_starlette_app(agent_card: AgentCard, handler: DefaultRequestHandler) -> Starlette:
309+
def _build_starlette_app(
310+
agent_card: AgentCard, handler: DefaultRequestHandler
311+
) -> Starlette:
307312
a2a_factory = A2AStarletteApplication(
308313
agent_card=agent_card,
309314
http_handler=handler,

0 commit comments

Comments
 (0)