A framework for producing custom agents for the Encord ecosystem.
Project description
Documentation | Try it Now | Blog | Join our Community
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:
- ⚡ Easy: Multiple template agents to be adapted and hosted via GCP, own infra, or cloud.
- ⏩ Convenient: The library conveniently loads data via the Encord SDK upon request.
- 👨💻 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.
- 🤏 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:
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
Release history Release notifications | RSS feed
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.1.11.tar.gz
(47.3 kB
view details)
Built Distribution
File details
Details for the file encord_agents-0.1.11.tar.gz
.
File metadata
- Download URL: encord_agents-0.1.11.tar.gz
- Upload date:
- Size: 47.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.6 Linux/6.8.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 685b35ac10090d6ef919056d590aa5df81a52115ce3fbd7b43769f7fd1e994e6 |
|
MD5 | 5b9e43654caeba234f22ed6a9013f5de |
|
BLAKE2b-256 | 9d158199d69c5eda69c5b2819362fd1d81db547a024d936f74d0cf1a634e9d32 |
File details
Details for the file encord_agents-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: encord_agents-0.1.11-py3-none-any.whl
- Upload date:
- Size: 62.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.6 Linux/6.8.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5c4876132dfff62ce5097d7b83ba6e18fb6e25bd259234685ceeb6dbf4860c6 |
|
MD5 | bba3c6e0b5681b80c15d8fd4b98e05df |
|
BLAKE2b-256 | 6a27432dba36ec4db7c7db90324fbb6b1399c536e1e7245e72568e6a357c5ec3 |