Retrieve an agent by external id

async AsyncCogniteClient.agents.retrieve(
external_ids: str | SequenceNotStr[str],
ignore_unknown_ids: bool = False,
) Agent | AgentList | None

Retrieve one or more agents by external ID.

Parameters:
  • external_ids (str | SequenceNotStr[str]) – The external id of the agent(s) to retrieve.

  • ignore_unknown_ids (bool) – Whether to ignore unknown IDs. Defaults to False.

Returns:

The requested agent or agent list. None is returned if ignore_unknown_ids is True and the external ID is not found.

Return type:

Agent | AgentList | None

Examples

Retrieve an agent by external id:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.agents.retrieve(external_ids="my_agent")

Retrieve multiple agents:

>>> res = client.agents.retrieve(external_ids=["my_agent_1", "my_agent_2"])