"""The A2A agent card, derived from the dependency graph and settings.""" from __future__ import annotations from a2a.types import ( AgentCapabilities, AgentCard, AgentInterface, AgentProvider, AgentSkill, ) from app.config import Settings from app.execution.deliverables import PHASE_ORDER, deliverables_in A2A_PATH = "/a2a" def build_agent_card(settings: Settings) -> AgentCard: base_url = ( settings.A2A_PUBLIC_URL or f"http://{settings.A2A_HOST}:{settings.A2A_PORT}" ).rstrip("/") phases = "; ".join( f"{phase.value}: {', '.join(kind.value for kind in deliverables_in(phase))}" for phase in PHASE_ORDER ) return AgentCard( name=settings.AGENT_NAME, description=( "Designs a cloud solution architecture with you: requirements discovery, " "grounded product selection, diagram, design recommendations, " "infrastructure-as-code and dry-run validation, packaged as a solution " f"guide. Cloud provider: {settings.CLOUD_PROVIDER}." ), version=settings.AGENT_VERSION, provider=AgentProvider( organization="Kyndryl Agent Builder", url="https://www.kyndryl.com" ), supported_interfaces=[ AgentInterface( url=f"{base_url}{A2A_PATH}", protocol_binding="JSONRPC", protocol_version="1.0", ) ], capabilities=AgentCapabilities(streaming=True, push_notifications=False), default_input_modes=["text/plain", "application/json"], default_output_modes=["text/plain", "text/markdown", "application/json"], skills=[ AgentSkill( id="solution-architecture", name="Cloud solution architecture", description=( "Interactive, multi-turn engagement. Phases and their Deliverables: " f"{phases}. Each Phase needs your approval, sent as data." ), tags=["architecture", "cloud", settings.CLOUD_PROVIDER, "terraform"], examples=[ "Design a regional event ingestion platform on Google Cloud.", "Migrate our on-premises order service to managed services.", ], input_modes=["text/plain", "application/json"], output_modes=["text/plain", "text/markdown", "application/json"], ) ], )