This fixes issue #4166 where delegating to a second A2A agent fails
because the task_id from the first agent is in 'completed' state.
The fix introduces endpoint-scoped task ID storage in task.config
using a2a_task_ids_by_endpoint dictionary. This ensures that:
- Each A2A endpoint gets its own task_id
- Multi-turn conversations with the same endpoint reuse the task_id
- Sequential delegations to different endpoints use separate task_ids
Added tests to verify:
- Sequential delegation to multiple endpoints uses separate task IDs
- Multi-turn conversations with same endpoint reuse task IDs
- Endpoint-scoped task IDs are properly persisted to task.config
Co-Authored-By: João <joao@crewai.com>