datarobot_genai.dragent.frontends.a2a
a2a
A2A server helpers for DataRobot-hosted agents.
This module owns the A2A protocol layer: agent card construction, OAuth2
security scheme assembly, Cross-Application Access capability extensions,
and endpoint URL resolution. The FastAPI framework glue lives in
:mod:~datarobot_genai.dragent.frontends.fastapi.
DRAgentA2AStarletteApplication
Bases: A2AStarletteApplication
A2A server that selects redacted vs extended cards on the public GET route.
Source code in datarobot_genai/dragent/frontends/a2a.py
DRAgentA2AFrontEndPluginWorker
Bases: A2AFrontEndPluginWorker
A2A worker with identity-keyed public cards and an authenticated extended card.
Source code in datarobot_genai/dragent/frontends/a2a.py
create_a2a_server
create_a2a_server(agent_card: AgentCard, agent_executor: NATWorkflowAgentExecutor) -> DRAgentA2AStarletteApplication
Create an A2A server with identity-keyed public and extended agent cards.
The public GET /.well-known/agent-card.json route serves a redacted card
to anonymous callers and the full card when gateway identity headers are
present. extended_agent_card is also wired for
agent/getAuthenticatedExtendedCard clients.
Source code in datarobot_genai/dragent/frontends/a2a.py
get_a2a_endpoint_url
Construct the A2A endpoint URL for the running server.
In a DataRobot deployment (MLOPS_DEPLOYMENT_ID is set), uses the
deployment's direct-access URL built from DATAROBOT_PUBLIC_API_ENDPOINT
/ DATAROBOT_ENDPOINT. Otherwise falls back to the local
http://{host}:{port}/a2a/ URL.
Source code in datarobot_genai/dragent/frontends/a2a.py
resolve_oauth_endpoints
async
Resolve (authorization_url, token_url) from an OAuth2ResourceServerConfig.
Uses OIDC discovery when discovery_url is set, otherwise derives from issuer_url.
Source code in datarobot_genai/dragent/frontends/a2a.py
build_oauth_flow_from_server_auth
async
build_oauth_flow_from_server_auth(server_auth: OAuth2ResourceServerConfig) -> tuple[AuthorizationCodeOAuthFlow, list[str]]
Build the authorization_code OAuth2 flow and scopes from a NAT server_auth config.
Source code in datarobot_genai/dragent/frontends/a2a.py
build_oauth_flow_from_cross_app_access
build_oauth_flow_from_cross_app_access(config: CrossApplicationAccessConfig) -> tuple[ClientCredentialsOAuthFlow, list[str]]
Build the client_credentials flow and scopes from a CrossApplicationAccessConfig.
Extracts the OpenAPI-standard fields (token_url, scopes) only.
Cross-Application Access extension parameters are handled separately by
:func:build_cross_app_capability_extension and MUST NOT appear here.
Source code in datarobot_genai/dragent/frontends/a2a.py
build_cross_app_capability_extension
Build the Cross-Application Access extension entry for capabilities.extensions.
Only extension-bound fields go in params; token_url and scopes
are intentionally omitted — they belong to OpenAPI securitySchemes.
Source code in datarobot_genai/dragent/frontends/a2a.py
build_internal_identity_extension
Build the internal identity extension for the current runtime, or None in local dev.
In a deployment container (MLOPS_DEPLOYMENT_ID) the params carry
deployment_id; in a workload container (WORKLOAD_ID) they carry
workload_id. Returns None when neither identity is present.
Source code in datarobot_genai/dragent/frontends/a2a.py
build_external_identity_extension
Build the external identity extension for catalog discovery.
Source code in datarobot_genai/dragent/frontends/a2a.py
build_security_schemes
async
build_security_schemes(frontend_config: A2AFrontEndConfig, cross_app_access: CrossApplicationAccessConfig | None) -> tuple[dict[str, SecurityScheme] | None, list[dict[str, list[str]]] | None]
Assemble A2A security schemes, merging up to two auth sources.
server_auth→ authorization_code flow.cross_app_access→ client_credentials flow.
Returns (security_schemes, security_requirements), both None
when neither source is configured.
Source code in datarobot_genai/dragent/frontends/a2a.py
create_agent_card
async
create_agent_card(frontend_config: A2AFrontEndConfig, cross_app_access: CrossApplicationAccessConfig | None, skills: list[AgentSkill], external: DRAgentA2AExternalConfig | None = None) -> AgentCard
Build an :class:~a2a.types.AgentCard for a DataRobot-hosted A2A agent.
When skills is empty, a single default skill is generated from
frontend_config.name / frontend_config.description.
Source code in datarobot_genai/dragent/frontends/a2a.py
redact_agent_card
Return a public-safe view of an agent card.
Strips advertised skills and removes internal/external identity extensions while preserving auth and cross-application-access metadata needed for anonymous discovery.