Skip to main content

Module discovery

Module discovery 

Source
Expand description

Agent card discovery with HTTP caching.

A2A agents publish their AgentCard at a well-known URL. This module provides helpers to fetch and parse the card.

The default discovery path is /.well-known/agent-card.json appended to the agent’s base URL.

Per spec §8.6, CachingCardResolver caches the card as RFC 9111 describes: it reuses a stored card while it is fresh (max-age, Expires, Age) and revalidates a stale one with If-None-Match / If-Modified-Since. The free functions fetch once and cache nothing.

Structs§

CachingCardResolver
A caching agent card resolver: a private HTTP cache (RFC 9111) of one agent card (spec §8.6.2: clients SHOULD honor RFC 9111 when fetching Agent Cards).
CardCache
A cache of agent cards for many agents: one CachingCardResolver per card URL, each with this cache’s settings.
CardFetchOptions
What a card fetch sends and how long it may take.

Constants§

AGENT_CARD_PATH
The standard well-known path for agent card discovery.
DEFAULT_MAX_ENTRIES
The default bound on the URLs a CardCache keeps.

Functions§

fetch_card_from_url
Fetches the AgentCard from an absolute URL.
fetch_card_from_url_with_options
fetch_card_from_url with the headers and budget in options.
resolve_agent_card
Fetches the AgentCard from the standard well-known path.
resolve_agent_card_with_options
resolve_agent_card with the headers and budget in options.
resolve_agent_card_with_path
Fetches the AgentCard from a custom path.