From 6859099a0874cc9030cc87b970b980960ffef242 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Mon, 27 Apr 2026 08:53:47 -0700 Subject: [PATCH] fix: pass agent_card to DefaultRequestHandler (a2a-sdk 1.x requirement) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a2a-sdk 1.x added agent_card as a required argument to DefaultRequestHandler.__init__. main.py constructed it with only agent_executor + task_store, so every workspace startup that reached the handler init step crashed with: TypeError: DefaultRequestHandlerV2.__init__() missing 1 required positional argument: 'agent_card' This is the 6th a2a-sdk migration find from the v0 → v1 transition (see reference_a2a_sdk_v0_to_v1_migration memory). Pattern is the same: SDK exposes a new required arg, our call site needs to pass the existing object we already construct upstream. Why the import-only smoke gates didn't catch this: it's a call-time constructor error inside `async def main()`, not a module load error. The runtime-pin-compat smoke imports main_sync but doesn't invoke main() against a real config. Worth filing a follow-up to extend the smoke to a "construct + dispose" cycle. Co-Authored-By: Claude Opus 4.7 (1M context) --- workspace/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/workspace/main.py b/workspace/main.py index f861a411..c90dd4ce 100644 --- a/workspace/main.py +++ b/workspace/main.py @@ -233,6 +233,13 @@ async def main(): # pragma: no cover handler = DefaultRequestHandler( agent_executor=executor, task_store=InMemoryTaskStore(), + # a2a-sdk 1.x added agent_card as a required positional/keyword + # argument — it's used internally for capability dispatch (e.g. + # routing tasks/get historyLength based on the card's protocol + # version). Pass the same agent_card we registered with the + # platform so the handler's capability surface matches what the + # AgentCard advertises. + agent_card=agent_card, ) # v1: replace A2AStarletteApplication with Starlette route factory