Skip to content

fetch

Class info

🛈 DocStrings

Fetch agent data from the ACP registry.

fetch_agent async

fetch_agent(agent_id: str) -> RegistryAgent | None

Fetch a single agent by ID from the registry or built-in agents.

Source code in src/aclientp/registry/fetch.py
async def fetch_agent(agent_id: str) -> RegistryAgent | None:
    """Fetch a single agent by ID from the registry or built-in agents."""
    if agent := _builtin_agent(agent_id):
        return agent
    agents = await list_agents()
    return next((a for a in agents if a.id == agent_id), None)

fetch_registry async

fetch_registry() -> Registry

Fetch the ACP registry data.

Source code in src/aclientp/registry/fetch.py
async def fetch_registry() -> Registry:
    """Fetch the ACP registry data."""
    return await anyenv.get_json(
        REGISTRY_URL,
        headers={"User-Agent": "Mozilla/5.0"},
        return_type=Registry,
        cache=True,
    )

list_agents async

list_agents() -> list[RegistryAgent]

List all agents from the ACP registry, including built-in agents.

Source code in src/aclientp/registry/fetch.py
async def list_agents() -> list[RegistryAgent]:
    """List all agents from the ACP registry, including built-in agents."""
    registry = await fetch_registry()
    return _merge_builtin_agents(registry.agents)