From 416c2665a782e814929c06ca450dbdb017660234 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:02:58 +0000 Subject: [PATCH] fix: Rebuild AgentResponse model in multi-turn A2A flows to support skill IDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In multi-turn A2A conversations, the AgentResponse model was only rebuilt in _execute_task_with_a2a() but not in subsequent turns handled by _handle_agent_response_and_continue(). This meant that if the LLM returned a skill ID on a later turn, it would fail validation. This commit rebuilds the model in _handle_agent_response_and_continue() using extract_agent_identifiers_from_cards() to include both endpoints and skill IDs, ensuring all turns support skill ID resolution. Co-Authored-By: João --- lib/crewai/src/crewai/a2a/wrapper.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/crewai/src/crewai/a2a/wrapper.py b/lib/crewai/src/crewai/a2a/wrapper.py index a2c606a32..7e897532d 100644 --- a/lib/crewai/src/crewai/a2a/wrapper.py +++ b/lib/crewai/src/crewai/a2a/wrapper.py @@ -386,6 +386,9 @@ def _handle_agent_response_and_continue( if "agent_card" in a2a_result and agent_id not in agent_cards_dict: agent_cards_dict[agent_id] = a2a_result["agent_card"] + agent_identifiers = extract_agent_identifiers_from_cards(a2a_agents, agent_cards_dict) + agent_response_model = create_agent_response_model(agent_identifiers) + task.description = _augment_prompt_with_a2a( a2a_agents=a2a_agents, task_description=original_task_description,