Skip to main content
Use the Encord SDK to configure your per-task triggered Custom Agents. The Agent executes the configured SDK script for all tasks that are routed through the Agent stage in your Workflow.
The General Example script shows how to configure a Workflow Agent with the name Agent 1 and with a pathway called continue to Review.
Agent nodes can be used in conjunction with bundles to efficiently handle bulk actions
Ensure that you:
  • Replace <private_key_path> with the path to your private key.
  • Replace <project_hash> with the hash of your Project.
  • Insert your custom logic where the comment instructs you to do so.
General Example
See our end-to-end guide for Pre-Classification using GPT 4o for more detailed information.
The Pre-Classification script uses GPT 4o mini to route images to different annotation stages depending on what it is contained in the image. The Pre-Classification script applies to the following Workflow.
Agent nodes can be used in conjunction with bundles to efficiently handle bulk actions
In the following script:
  • Replace <private_key_path> with the hash of your private key.
  • Replace <project_hash> with the hash of your Project.
  • Replace Agent 1 with the name of your Agent stage.
This guide makes the following assumptions:
  • You have a model that takes video frames as an input and provides bounding box coordinates and confidence scores as an output.
  • You have installed the encord-agents library using the following command:
The Pre-Labeling Script selects a random class from the Ontology, generates random bounding box labels, and applies random confidence scores for video frames before advancing the videos to the annotation stage (Annotate 1). Below is an example of a Workflow where the Pre-Labeling agent can be effectively utilized.
To authenticate, you must set either of following environment variables in the environment that you plan to run your agents.
  • ENCORD_SSH_KEY: Containing the raw private key file content
  • ENCORD_SSH_KEY_FILE: Containing the absolute path to the private key file
In the following script:
  • Replace <project_hash> with the hash of your Project.
  • Replace the mock model with your own model, and adapt the rest of the script according to your needs.
  • If you choose to give your python file a different name, ensure you replace all references to prelabel_video.py with your new file name.
prelabel_video.py