Skip to main content

Build custom annotation workflow agents for the Avala platform

Project description

avala-agents

Build custom annotation workflow agents for the Avala platform.

Installation

pip install avala-agents

Quick Start

from avala_agents import TaskAgent

agent = TaskAgent(
    api_key="avk_...",
    name="quality-checker",
    project="proj_uid",  # optional: scope to a single project
)

@agent.on("result.submitted")
def check_quality(context):
    annotations = context.result_data

    if len(annotations) == 0:
        context.reject("No annotations found")
    elif context.result_metadata.get("confidence", 1.0) < 0.5:
        context.flag("Low confidence — needs manual review")
    else:
        context.approve()

agent.run()  # blocks; polls for pending executions

Supported Events

Event Context class Description
result.submitted ResultContext An annotator submitted a result
result.accepted ResultContext A result was accepted by QC
result.rejected ResultContext A result was rejected by QC
task.completed TaskContext A task reached a terminal state

Actions

All context objects expose four action methods:

Method Description
context.approve(reason="") Accept the result / task
context.reject(reason="") Reject with an optional reason
context.flag(reason="") Flag for manual review
context.skip() Acknowledge without taking action

Configuration

Parameter Env var Default
api_key AVALA_API_KEY required
base_url AVALA_BASE_URL https://api.avala.ai/api/v1
name "default-agent"
project None (all projects)
task_types None (all types)
poll_interval 5.0 seconds

Processing a single batch (non-blocking)

count = agent.run_once()
print(f"Processed {count} execution(s)")

Error handling

from avala_agents import AgentActionError, AgentRegistrationError

try:
    agent.run()
except AgentRegistrationError as exc:
    print(f"Could not register agent: {exc}")

License

MIT

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

avala_agents-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

avala_agents-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file avala_agents-0.1.0.tar.gz.

File metadata

  • Download URL: avala_agents-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for avala_agents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 12b5ecc06d06f643a72b8fa7997ea883383ee6d59a5fe77548fb10559dfa7c47
MD5 c82d4426518a9062a0314b708a18eff3
BLAKE2b-256 86029f964efea259732515207cc45c04ffe84869df215d77fba04bfceac609b8

See more details on using hashes here.

File details

Details for the file avala_agents-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: avala_agents-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for avala_agents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed5df06ac55a1de5b7a774ea466a86d76e5e7d12a58c1259c6008b32b3731b92
MD5 1d5075c3d72995820a554dd09177c046
BLAKE2b-256 f9bce38ab9ba5cab54a742d16b1bc25975b6eb241195f38230b0c41f38419629

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