Skip to main content
The following code is for users using Encord with the US domain (https://api.us.encord.com) or on a dedicated Encord deployment in a VPC (Virtual Private Cloud).
By default, agents connect to Encord’s EU platform at https://api.encord.com. If your Encord Workspace is on the US platform (https://api.us.encord.com) or in a private VPC (Virtual Private Cloud), you need to tell your agent which Encord API domain to use. Otherwise, the agent cannot communicate with Encord. You do this by setting the ENCORD_DOMAIN environment variable, as shown below.

STEP 1: Set the ENCORD_DOMAIN Environment variable

This will be the domain to the Encord API, not the front-end app. If running locally:
If running in a Python project:

STEP 2: Set the ENCORD_SSH_KEY or ENCORD_SSH_KEY_FILE Environment variables

If running locally:
If deploying with a GCP cloud function, create a GCP secret & pass in the Key

STEP 3: Instantiate the Client from the Agent

This step is only required if your agent uses the Encord Client.
Since Encord is a separate package than Encord-Agents, when leveraging an Encord Client, you also need to use the client connected to the agent. For tasks that need the Encord client for every operation, we recommend:
If you only need the client once to do batch processing or filtering, you can fetch the existing client from the agents library: