Files
crewAI/lib
Devin AI d141078e72 fix: Allow A2A agents to be identified by skill ID in addition to endpoint URL
This commit fixes issue #3897 where the LLM would return a skill.id
(e.g., 'Research') instead of the full endpoint URL, causing a
Pydantic validation error.

Changes:
- Added resolve_agent_identifier() function to map skill IDs to endpoints
- Added extract_agent_identifiers_from_cards() to collect both endpoints and skill IDs
- Modified _execute_task_with_a2a() to rebuild AgentResponse model after fetching AgentCards
- Updated _delegate_to_a2a() to use resolver for identifier resolution
- Updated _augment_prompt_with_a2a() to explicitly instruct LLM about both identifier types
- Added comprehensive unit tests for resolve_agent_identifier()
- Added integration tests replicating the exact issue from #3897

The fix allows the dynamic Pydantic model to accept both endpoint URLs
and skill IDs in the Literal constraint, then resolves skill IDs to
their canonical endpoints before delegation. This maintains backward
compatibility while fixing the validation error.

Fixes #3897

Co-Authored-By: João <joao@crewai.com>
2025-11-12 17:51:48 +00:00
..