This step is only required if your Task 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:
Copy
@app.post("/my-agent")def my_agent(user_client: Anntotated[EncordUserClient, Depends(dep_user_client)]): # use agent to get project, dataset, etc
If you only need the client once to do batch processing or filtering, you can fetch the existing client from the agents library:
Copy
from encord_agents.core.utils import get_user_clientencord_user_client = get_user_client()