datarobot_genai.dragent.agent_card_registry
agent_card_registry
Client for the central DataRobot agent card registry.
The central registry provides a tenant-scoped list of agent cards that requires
only standard DataRobot API-token authentication (DATAROBOT_API_TOKEN).
This avoids the chicken-and-egg problem where an individual agent's card
endpoint is behind per-agent AuthN/AuthZ.
The :class:AgentCardRegistry supports batch fetching so that many
function groups sharing the same workflow can resolve all their cards in a
minimum number of HTTP round-trips instead of N+1 individual requests.
Lookups can be registered before the first fetch so that get()
automatically triggers a single batch prefetch for all pending IDs on its
first invocation — no explicit prefetch() call required.
.. note::
The registry API uses AND semantics when both deploymentIds and
externalIds parameters are provided in a single request, which would
return empty results. Therefore the registry issues separate HTTP
calls for deployment IDs and external IDs.
DataRobotRegistrySettings
Bases: DataRobotAppFrameworkBaseSettings
DataRobot connection settings for the central agent card registry.
Loads DATAROBOT_API_TOKEN and DATAROBOT_ENDPOINT from env vars
(including Runtime Parameters), .env, file secrets, or Pulumi config
using the standard :class:DataRobotAppFrameworkBaseSettings priority
chain.
Source code in datarobot_genai/dragent/agent_card_registry.py
AgentCardRegistryConfig
Bases: DataRobotAppFrameworkBaseSettings
Configuration for the agent card registry cache.
Controllable via environment variables (prefix-free, following the
standard :class:DataRobotAppFrameworkBaseSettings resolution chain).
Set AGENT_CARD_REGISTRY_CACHE_TTL=0 to disable caching entirely
(every get() triggers a fresh HTTP fetch).
Source code in datarobot_genai/dragent/agent_card_registry.py
AgentCardRegistryError
AgentCardRegistry
Batch-capable, TTL-cached client for the central agent card registry.
IDs are register()-ed synchronously at config-parse time (no I/O).
The first get() flushes all pending IDs in ≤2 HTTP calls
(one per ID type — API uses AND when both are mixed).
Subsequent get() calls hit the in-memory cache until TTL expires.
Cache TTL is controlled via AGENT_CARD_REGISTRY_CACHE_TTL env var
(default 86400s / 24h, set to 0 to disable caching).
Source code in datarobot_genai/dragent/agent_card_registry.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
register
Declare intent to look up an agent card.
Call this at config-parse/validation time so that the first
:meth:get can batch all pending IDs into a single prefetch.
Exactly one of deployment_id or external_id must be given.
Source code in datarobot_genai/dragent/agent_card_registry.py
prefetch
async
Batch-fetch and cache agent cards in a minimum number of HTTP calls.
Issues separate requests for deployment_ids and
external_ids because the API uses AND semantics when both
parameters are present in a single request.
Already-cached (non-expired) IDs are skipped.
Parameters
deployment_ids: Deployment IDs to prefetch. external_ids: External IDs to prefetch.
Source code in datarobot_genai/dragent/agent_card_registry.py
get
async
Return a single agent card, using the cache or fetching on demand.
On the first call, all IDs previously passed to :meth:register
are batch-fetched in a single prefetch (at most 2 HTTP calls).
Subsequent calls for already-cached, non-expired cards are instant.
Exactly one of deployment_id or external_id must be provided.
Raises
AgentCardRegistryError If the card cannot be found or the request fails.
Source code in datarobot_genai/dragent/agent_card_registry.py
get_default_registry
async
Return the module-level :class:AgentCardRegistry singleton.
Created lazily on first access. Credentials are resolved from
:class:DataRobotRegistrySettings at instantiation time.
Source code in datarobot_genai/dragent/agent_card_registry.py
get_default_registry_sync
Return the singleton, creating it if needed (synchronous).
Safe to call from pydantic validators and other sync contexts
(e.g. config-parse time) because :class:AgentCardRegistry.__init__
does no I/O.