Skip to main content
Custom agents let you plug your own HTTPS endpoints into Encord and trigger them in the Label Editor, or as part of your Workflow.

Custom Agents in the Agents Catalog

Only HTTPS endpoints are supported for Custom Agents.
To register a Custom Agent using the Agents Catalog:
  1. Go to Agents in the left-hand navigation.
  2. In the Agents catalog tab, select the Custom agent tile.
  1. Fill in the form:
    • Give the agent a clear name and description.
    • Provide the public HTTPS endpoint that Encord should call.
    • Enter possible decisions that the agent can return (for example, “approve” or “reject”). These decisions are represented as pathways in the Workflow. If your agent does not return decisions, you can leave this field blank.
  2. Save the configuration to register the Custom Agent.

Setting Up Custom Agents

For end-to-end examples (including example payloads and code), visit our Agents documentation here.
Before you can register a Custom Agent, you must create and host the HTTPS endpoint that acts as your agent. At a high level, your backend should:
  • Accept a JSON payload from Encord describing the current project, data item, and frame.
  • Use the Encord SDK or API (and any external models you choose) to perform work.
  • Write results back to Encord (for example, updating labels or classifications).
  • Return a successful HTTP status code so the editor knows the request completed.
Once saved, the agent appears in the Enabled tab of the Agents section.

Testing Custom Agent Endpoints

You can test your custom agent endpoint directly from the Encord platform to verify it’s working correctly before using it in production.
After registering your Custom Agent, you can test its endpoint:
  1. Navigate to your agent in the Enabled tab.
  2. Click the Test tab in the agent details page.
  3. Configure the test payload with sample data (project hash, data hash, and frame number).
  4. Click Test agent to send a request to your endpoint.
The test sends requests directly from your browser to your endpoint. Your agent must allow CORS requests from the Encord domain (e.g., https://app.encord.com) for testing to work. If your agent restricts access by source IP, you must allow your current IP address for testing.
A successful test from your browser does not guarantee that Encord’s servers can reach your endpoint. Ensure your endpoint is accessible from Encord’s infrastructure for production use.

Using Custom Agents

The Agent is triggered:
  • In the Label Editor: On demand by the Tasker while annotating or reviewing a task. See here for more information.
  • From your Workflow: On tasks that pass through the Workflow node. Custom agents are triggered in the same way as other Agents. Click here to learn more.

Custom Workflow Agents - Manual

If your custom agent should be triggered manually, open the Advanced tab in the Agent node configuration to set them up. Tasks in this Agent stage do not proceed through the workflow unless the agent is triggered manually. When setting up an agent as “advanced”, you do not directly assign a custom agent. Instead, you are hosting a service that picks up tasks from the Workflow stage, performs an action, and then progresses the task to the next stage.

Examples

Use the Encord SDK to configure your Advanced Custom Agent. 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

Repeatable Ontology Feature Requirements

Some agent templates support repeatable Ontology feature requirements, which allow you to assign multiple ontology features to a single role. This is useful for agents that need to operate across several classes simultaneously, for example, a merge-object-classes agent that combines multiple source classes into one.

Selecting features for a repeatable requirement

When an agent template declares a requirement as repeatable, the configuration form displays a multi-select tree picker instead of the standard single-select picker.
The multi-select tree picker only appears for requirements that the agent template has marked as repeatable. Requirements that are not repeatable continue to use the standard single-select behavior.
  • Select as many Ontology features as the requirement allows by clicking each feature in the tree picker.
  • The form enforces a minimum number of selections. You cannot submit the form until you have selected at least the required number of features. If you select too few, the form displays the message: “Please select at least N features”.
  • If the template defines a maximum number of selections, the picker prevents you from selecting additional features once the maximum is reached.

How selected features appear in the agent detail view

After you save the agent, the detail view groups all features selected for a repeatable requirement under a single label. For example, if you selected ClassA and ClassB for a role called Source Object Classes, the detail view displays: Source Object Classes: ClassA ClassB

Ontology compatibility and repeatable requirements

When you select an ontology during agent creation, Encord automatically filters out ontologies that do not contain enough eligible features to satisfy the minimum selection count for any repeatable requirement. Only ontologies with a sufficient number of matching features appear in the Ontology selector.

End-to-End Agent Examples

We provide end-to-end examples of custom agent implementation using Jupyter Notebooks here.