Skip to main content

A framework for producing custom agents for the Encord ecosystem.

Project description

Documentation | Try it Now | Blog | Join our Community

Encord logo

Easily build agents for the Encord ecosystem. With just few lines of code, you can take automation to the next level.

python -m pip install encord-agents

Key features:

  1. Easy: Multiple template agents to be adapted and hosted via GCP, own infra, or cloud.
  2. Convenient: The library conveniently loads data via the Encord SDK upon request.
  3. 👨‍💻 Focused: With essential resources readily available, you can focus on what matters. Create agents with pre-existing (or custom) dependencies for loading labels and data.
  4. 🤏 Slim: the library is slim at it's core and should not conflict with the dependencies of most projects.

💡 For the full documentation and end-to-end examples, please see here.

Here are some use-cases:

Decision tree for which agent to use

Here's how to build an Agent:

from uuid import UUID
from encord.objects.ontology_labels_impl import LabelRowV2
from encord_agents.tasks import Runner

runner = Runner(project_hash="<your_project_hash>")


@runner.stage("<your_agent_stage_uuid>")
def by_file_name(lr: LabelRowV2) -> UUID | None:
    # Assuming the data_title is of the format "%d.jpg"
    # and in the range [0; 100]
    priority = int(lr.data_title.split(".")[0]) / 100
    lr.set_priority(priority=priority)
    return "<your_pathway_uuid>"


if __name__ == "__main__":
    runner.run()

You can also inject dependencies:

from typing_extensions import Annotated

from encord.objects import LabelRowV2
from encord_agents.tasks import Runner, Depends

runner = Runner(project_hash="<your_project_hash>")

def my_custom_dependency(label_row: LabelRowV2) -> dict:
    # e.g., look up additional data in own db
    return db.query("whatever")

@runner.stage(stage="<my_stage_name>")
def by_custom_data(
    custom_data: Annotated[dict, Depends(my_custom_dependency)]
) -> str:
    # `custom_data` automatically injected here.
    # ... do your thing
    # then, return name of task pathway.


if __name__ == "__main__":
    runner.run()

Please visit our 📖 Documentation for a complete reference to how to use the agents library.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

encord_agents-0.2.9.tar.gz (13.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

encord_agents-0.2.9-py3-none-any.whl (73.3 kB view details)

Uploaded Python 3

File details

Details for the file encord_agents-0.2.9.tar.gz.

File metadata

  • Download URL: encord_agents-0.2.9.tar.gz
  • Upload date:
  • Size: 13.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for encord_agents-0.2.9.tar.gz
Algorithm Hash digest
SHA256 cef546afd5c0fe7abd5cf35bbecd309e816194707cab960f354429d63219239a
MD5 ff81e912d19ec2d867bc9dde405c4097
BLAKE2b-256 aba27e756ab094225f367f887080982f6aabc329ac69164818a3c33e4acc08aa

See more details on using hashes here.

File details

Details for the file encord_agents-0.2.9-py3-none-any.whl.

File metadata

File hashes

Hashes for encord_agents-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 64a31e2301f5034f47fb3329fcb780078a65d7eaf9c050ed179f38d0f552cb9c
MD5 15f6489e127f2607583bd99da4a5ddf2
BLAKE2b-256 3b96374ac867e8a9a0c75c6866dd3ded8560bc4692cb864b0fb9af5d01b405fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page