Skip to content

Python: A2AAgent should default name/description from AgentCard when not explicitly provided #4630

@florian-ivadolabs

Description

@florian-ivadolabs

Summary

When constructing an A2AAgent with an agent_card, the name and description parameters must be explicitly passed even though the AgentCard already contains this information. This creates unnecessary duplication:

# Current - redundant
agent = A2AAgent(agent_card=card, name=card.name, description=card.description)

# Proposed - card provides defaults
agent = A2AAgent(agent_card=card)

Current Behavior

In A2AAgent.__init__(), name and description default to None and are passed directly to BaseAgent.__init__(). The agent_card is only used for transport setup (creating the HTTP client). If name/description are not explicitly provided, they remain None on the agent instance - even though the card has them.

Proposed Change

When agent_card is provided and name/description are not explicitly set, A2AAgent.__init__() should fall back to agent_card.name and agent_card.description:

def __init__(self, *, name=None, description=None, agent_card=None, ...):
    if agent_card is not None:
        name = name or agent_card.name
        description = description or agent_card.description
    super().__init__(name=name, description=description, ...)

This is backward compatible - explicit values still take precedence.

Motivation

When using A2AAgent as a participant in GroupChat orchestrations, the agent's name and description are essential for routing decisions. It's natural to expect that passing an AgentCard (which already carries these fields) would be sufficient.

Metadata

Metadata

Assignees

Labels

a2aIssue relates to A2Apython

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions