Skip to content

Fix: Handled AgentCardBuilder field inconsistencies #2099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

SyedMohamedHyder
Copy link

@SyedMohamedHyder SyedMohamedHyder commented Jul 22, 2025

Summary of Changes

This PR makes a few small improvements to the experimental Agent Card Builder feature:

  • Updated references to AgentCard and AgentSkill fields to use snake_case instead of camelCase, in line with the project's conventions.
  • Updated the doc_url field, which is not defined in the AgentCard model to documentation_url.
  • Adjusted related unit tests to reflect these updates.

Rationale

Although this feature is still experimental, these changes help improve consistency and clarity:

  1. Follows Model Conventions
    The models currently allow camelCase access only for backwards compatibility and issue a deprecation warning when used. These aliases are planned to be removed in version 0.3.0. Updating to snake_case ensures the code aligns with the intended usage and avoids deprecation warnings. Below is the corresponding code from a2a-sdk.
    def __getattr__(self, name: str) -> Any:
        """Allow getting attributes via their camelCase alias."""
        # Get the map and find the corresponding snake_case field name.
        field_name = type(self)._get_alias_map().get(name)  # noqa: SLF001

        if field_name:
            # An alias was used, issue a warning.
            warnings.warn(
                (
                    f"Accessing field '{name}' via its camelCase alias is deprecated and will be removed in version 0.3.0 "
                    f"Use the snake_case name '{field_name}' instead."
                ),
                DeprecationWarning,
                stacklevel=2,
            )

            # If an alias was used, retrieve the actual snake_case attribute.
            return getattr(self, field_name)

        # If it's not a known alias, it's a genuine missing attribute.
        raise AttributeError(
            f"'{type(self).__name__}' object has no attribute '{name}'"
        )
  1. Avoids Potential Issues
    Since doc_url isn’t a valid field on AgentCard, replacing it with documentation_url helps prevent confusion and ensures only supported fields are used.

I have also updated the unit tests to ensure they correctly reflect the current model structure and remain reliable over time.

These are relatively minor changes, but I hope they help keep the codebase clean and aligned with the project's direction. Feedback is always welcome.

@ankursharmas
Copy link
Collaborator

@seanzhou1023 Please help review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants