Workers

A worker is the definition of an autonomous agent — its runtime, source code, secrets, configuration, and execution constraints. Workers are reusable blueprints; each execution is a Job.

List workers

bash
GET /v1/ava/workers
NameTypeRequiredDescription
filter[status]stringNoactive | paused | deprecated
filter[runtime]stringNonodejs | python | deno | shell | wasm
qstringNoSearch workers by name.
page / per_pageintegerNoPagination. Default page=1, per_page=20.

Create a worker

bash
POST /v1/ava/workers
NameTypeRequiredDescription
namestringYesHuman-readable worker name.
runtimestringYesnodejs | python | deno | shell | wasm
descriptionstringNoWhat this worker does.
entrypointstringNoFile path within source bundle (e.g. "index.js"). Defaults to runtime convention.
source_codestringNoInline source code (for simple workers). For complex workers use source bundles via the deploy endpoint.
configobjectNoNon-secret config key/value pairs injected as environment variables.
secretsarrayNoSecret key names to inject at runtime. Values are set separately via the secrets vault.
timeout_secondsintegerNoMax execution time. Default 300, max 3600.
max_retriesintegerNoAuto-retry on failure. Default 0, max 5.
bash
curl -X POST https://api.hldgroup.org/v1/ava/workers \
  -H "x-internal-secret: <key>" \
  -H "x-tenant-id: ten_01hxyz" \
  -H "x-user-id: usr_01hxyz" \
  -H "x-platform-role: tenant-system-admin" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Incident enrichment pipeline",
    "runtime": "python",
    "description": "Pulls threat intel for new critical incidents and posts enriched summary to Slack",
    "timeout_seconds": 120,
    "max_retries": 1,
    "config": {
      "SLACK_CHANNEL": "#security-ops",
      "MIN_SEVERITY": "high"
    },
    "secrets": ["SLACK_BOT_TOKEN", "VIRUSTOTAL_API_KEY"],
    "source_code": "async def handler(input, env):\n  # ... enrichment logic"
  }'

Get a worker

bash
GET /v1/ava/workers/:id

Update a worker

bash
PATCH /v1/ava/workers/:id
NameTypeRequiredDescription
namestringNoNew display name.
descriptionstringNoUpdated description.
statusstringNoactive | paused — change without modifying code.
source_codestringNoUpdated source. New jobs will use the new version immediately.
configobjectNoMerged into existing config.
timeout_secondsintegerNoUpdated timeout.
max_retriesintegerNoUpdated retry count.
Note:Pausing a worker (status: "paused") prevents new jobs from being queued. Jobs already running will complete. Scheduled runs are skipped while paused.

Delete (deprecate) a worker

bash
DELETE /v1/ava/workers/:id

Workers are soft-deleted — status is set to deprecated. Historical jobs and logs are preserved. Deprecated workers cannot accept new jobs.

Worker source format

Node.js

javascript
// Export a handler function. AVA injects input and env.
module.exports = async function handler({ input, env }) {
  const { channel } = input
  const token = env.SLACK_BOT_TOKEN
  // ... your logic
  return { success: true, message_ts: '...' }
}

Python

python
# Define an async handler function.
async def handler(input: dict, env: dict) -> dict:
    channel = input.get("channel")
    token = env.get("SLACK_BOT_TOKEN")
    # ... your logic
    return {"success": True}