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.7.tar.gz
(43.9 kB
view details)
Built Distribution
File details
Details for the file encord_agents-0.1.7.tar.gz
.
File metadata
- Download URL: encord_agents-0.1.7.tar.gz
- Upload date:
- Size: 43.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.6 Linux/6.8.0-1020-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8794793862c50641289d5655d7da0085363ff752761c82608a930492fa845c57 |
|
MD5 | 13d9603dbcd34807d1610dcd6fe0388d |
|
BLAKE2b-256 | 7e35de1e0844651e9d040b3b2021cf8926861b87845edfa88992d223934d69b7 |
File details
Details for the file encord_agents-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: encord_agents-0.1.7-py3-none-any.whl
- Upload date:
- Size: 56.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.6 Linux/6.8.0-1020-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31c5dcb0bfcb0419bded46d905a0d0a4089b50b331ec72253120dcf9d7556cb3 |
|
MD5 | 3e4dd2431e30d661fae75c861bc4947b |
|
BLAKE2b-256 | fe9cbb6d21f49ae7f01ff68a464947698284be098912dfc798811e110f45ca8d |