datarobot_genai.dragent.plugins.auth_a2a_client
auth_a2a_client
AgentCardAware
Bases: Protocol
Protocol for auth providers that need the agent card before authenticate().
:class:_AuthenticatedA2ABaseClient checks for this via isinstance
and calls :meth:set_agent_card automatically after card resolution.
Source code in datarobot_genai/dragent/plugins/auth_a2a_client.py
set_agent_card
A2ADiscoveryAuthMixin
Bases: ABC
Mixin for auth providers that need different credentials for agent card discovery.
Without this mixin, _AuthenticatedA2ABaseClient calls authenticate() for
both discovery and call phases. Implement authenticate_for_discovery() to
supply separate headers for the agent card GET.
Source code in datarobot_genai/dragent/plugins/auth_a2a_client.py
authenticate_for_discovery
abstractmethod
async
Return HTTP headers for the agent card GET request.
Returns
dict[str, str] Header name → value pairs to attach to the agent card HTTP request.
Source code in datarobot_genai/dragent/plugins/auth_a2a_client.py
A2ACredentialServiceWithDisabledCache
Bases: A2ACredentialService
A2ACredentialService with disabled cache.
The caching implementation of NAT A2ACredentialService is problematic. If the token is cached, the cached token is not keyed on specific claims. The side effect is that once the first token is cached, all following requests with different token claims will reuse the first cached token. This is not an expected caching behavior. This class override _authenticate method by getting rid of using its own caching.
Source code in datarobot_genai/dragent/plugins/auth_a2a_client.py
AgentCardRegistryLookup
Bases: BaseModel
Identifies an agent card in the central DataRobot agent card registry.
Exactly one of deployment_id, external_id or workload_id must be
specified. The registry is queried using standard DataRobot API-token
authentication (DATAROBOT_API_TOKEN), which avoids the chicken-and-egg
problem where the agent's own card endpoint requires per-agent AuthN/AuthZ.
With Okta cross-application access, request-time lookups use the caller's
Okta token instead.
Example YAML::
registry:
deployment_id: "64a1b2c3d4e5f6a7b8c9d0e1"
An agent served by the Workload API runtime is keyed by its workload ID instead::
registry:
workload_id: "64a1b2c3d4e5f6a7b8c9d0e2"
Source code in datarobot_genai/dragent/plugins/auth_a2a_client.py
AuthenticatedA2AClientConfig
Bases: A2AClientConfig
A2A client config with separate discovery and call-phase auth.
Supports two modes for agent card resolution:
Direct fetch (existing behaviour) — set url to the agent's base URL
and the card is fetched from {url}/.well-known/agent-card.json::
function_groups:
my_agent:
_type: authenticated_a2a_client
url: "http://agent.example.com:8080"
auth_provider: my_auth
Central registry lookup — set registry with one of deployment_id,
external_id or workload_id. The card is fetched from the DataRobot
central agent card registry using DATAROBOT_API_TOKEN (the caller's Okta
token with cross-application access), and the agent's RPC
URL is derived from the card's advertised url::
function_groups:
my_agent:
_type: authenticated_a2a_client
registry:
deployment_id: "64a1b2c3d4e5f6a7b8c9d0e1"
auth_provider: okta_auth
The two modes are mutually exclusive.
Source code in datarobot_genai/dragent/plugins/auth_a2a_client.py
AuthenticatedA2AClientFunctionGroup
Bases: A2AClientFunctionGroup
Uses :class:_AuthenticatedA2ABaseClient so both A2A phases are authenticated.
Source code in datarobot_genai/dragent/plugins/auth_a2a_client.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
add_function
Intercept function registration to wrap fn with error handling.
In degraded mode (registry lookup failed), replaces fn entirely
with one that raises the stored error — so _wrap_a2a_function
catches it and returns an actionable message to the LLM.
This avoids coupling to NAT's client method signatures or protocols.
Source code in datarobot_genai/dragent/plugins/auth_a2a_client.py
authenticated_a2a_client
async
authenticated_a2a_client(config: AuthenticatedA2AClientConfig, _builder: Builder) -> AsyncGenerator[Any, None]
NAT factory for :class:AuthenticatedA2AClientFunctionGroup.