Skip to main content
Register and manage AI agents that react to platform events such as result submissions, task completions, and dataset changes.
Agents receive events via a callback URL (push) or can poll for pending executions. Each agent is scoped to an organization and optionally to a specific project or set of task types.

List Agents

GET /api/v1/agents/
Returns all agent registrations visible to the authenticated user, ordered by most recent first.

Parameters

NameTypeRequiredDescription
cursorstringNoCursor for pagination (query parameter)
limitintegerNoNumber of results per page (query parameter)

Request

curl "https://api.avala.ai/api/v1/agents/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY"

Response

{
  "next": null,
  "previous": null,
  "results": [
    {
      "uid": "b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f",
      "name": "QC Review Agent",
      "description": "Automatically reviews annotation results for quality",
      "events": ["result.submitted"],
      "callback_url": "https://my-agent.example.com/webhook",
      "is_active": true,
      "project": "770a9600-a40d-63f6-c938-668877660000",
      "task_types": ["bounding_box", "polygon"],
      "created_at": "2025-03-15T10:00:00Z",
      "updated_at": "2025-03-15T10:00:00Z"
    }
  ]
}

Fields

FieldTypeDescription
uidstring (UUID)Unique identifier for the agent registration
namestringDisplay name of the agent
descriptionstringHuman-readable description of what the agent does
eventsarrayList of event types this agent subscribes to
callback_urlstringHTTPS URL where events are delivered (push mode)
is_activebooleanWhether the agent is currently enabled
projectstring (UUID) | nullProject this agent is scoped to, or null for org-wide
task_typesarrayTask types this agent handles (empty means all types)
created_atstring (datetime)ISO 8601 timestamp of when the agent was registered
updated_atstring (datetime)ISO 8601 timestamp of the last update

Register Agent

POST /api/v1/agents/
Registers a new agent. Registration is idempotent — if an agent with the same name already exists in the organization, it will be updated instead of creating a duplicate. The secret field is returned only when a new agent is created. Store it securely — it cannot be retrieved later.

Parameters

NameTypeRequiredDescription
namestringYesAgent name (must be unique within the organization)
descriptionstringNoHuman-readable description
eventsarrayYesEvent types to subscribe to (see Event Types)
callback_urlstringNoHTTPS URL for event delivery (push mode)
is_activebooleanNoWhether the agent is enabled (default: true)
projectstring (UUID)NoScope the agent to a specific project
task_typesarrayNoLimit to specific task types (default: all)

Request

curl -X POST "https://api.avala.ai/api/v1/agents/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "QC Review Agent",
    "description": "Automatically reviews annotation results for quality",
    "events": ["result.submitted"],
    "callback_url": "https://my-agent.example.com/webhook",
    "project": "770a9600-a40d-63f6-c938-668877660000",
    "task_types": ["bounding_box", "polygon"]
  }'

Response

{
  "uid": "b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f",
  "name": "QC Review Agent",
  "description": "Automatically reviews annotation results for quality",
  "events": ["result.submitted"],
  "callback_url": "https://my-agent.example.com/webhook",
  "secret": "a7f3b9c1e2d4f6a8b0c2d4e6f8a0b2c4d6e8f0a2",
  "is_active": true,
  "project": "770a9600-a40d-63f6-c938-668877660000",
  "task_types": ["bounding_box", "polygon"],
  "created_at": "2025-03-15T10:00:00Z",
  "updated_at": "2025-03-15T10:00:00Z"
}
The secret is only returned once, at creation time. Store it securely. Use it to verify callback signatures from Avala. If you POST with the name of an existing agent, the agent is updated and the secret is not re-returned. To rotate the secret, delete the agent and re-create it.

Get Agent

GET /api/v1/agents/{uid}/
Returns detailed information about a specific agent, including execution statistics.

Parameters

NameTypeRequiredDescription
uidstring (UUID)YesAgent registration UID (path parameter)

Request

curl "https://api.avala.ai/api/v1/agents/b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY"

Response

{
  "uid": "b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f",
  "name": "QC Review Agent",
  "description": "Automatically reviews annotation results for quality",
  "events": ["result.submitted"],
  "callback_url": "https://my-agent.example.com/webhook",
  "is_active": true,
  "project": "770a9600-a40d-63f6-c938-668877660000",
  "task_types": ["bounding_box", "polygon"],
  "execution_stats": {
    "completed": 142,
    "pending": 3,
    "failed": 1
  },
  "created_at": "2025-03-15T10:00:00Z",
  "updated_at": "2025-03-15T10:00:00Z"
}

Fields

All fields from List Agents plus:
FieldTypeDescription
execution_statsobjectMap of execution status to count (e.g., {"completed": 142, "pending": 3})

Update Agent

PUT /api/v1/agents/{uid}/
Updates an existing agent registration. You can also use PATCH for partial updates.

Parameters

NameTypeRequiredDescription
uidstring (UUID)YesAgent registration UID (path parameter)
namestringYes (PUT)Agent name
descriptionstringNoHuman-readable description
eventsarrayYes (PUT)Event types to subscribe to
callback_urlstringNoHTTPS URL for event delivery
is_activebooleanNoWhether the agent is enabled
projectstring (UUID)NoProject to scope the agent to
task_typesarrayNoTask types to handle

Request

curl -X PATCH "https://api.avala.ai/api/v1/agents/b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "is_active": false
  }'

Response

{
  "uid": "b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f",
  "name": "QC Review Agent",
  "description": "Automatically reviews annotation results for quality",
  "events": ["result.submitted"],
  "callback_url": "https://my-agent.example.com/webhook",
  "is_active": false,
  "project": "770a9600-a40d-63f6-c938-668877660000",
  "task_types": ["bounding_box", "polygon"],
  "created_at": "2025-03-15T10:00:00Z",
  "updated_at": "2025-03-15T12:30:00Z"
}

Delete Agent

DELETE /api/v1/agents/{uid}/
Permanently deletes an agent registration and all its execution history.

Parameters

NameTypeRequiredDescription
uidstring (UUID)YesAgent registration UID (path parameter)

Request

curl -X DELETE "https://api.avala.ai/api/v1/agents/b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY"

Response

Returns 204 No Content on success.

List Executions

GET /api/v1/agents/{uid}/executions/
Returns execution records for a specific agent, ordered by most recent first.

Parameters

NameTypeRequiredDescription
uidstring (UUID)YesAgent registration UID (path parameter)
statusstringNoFilter by execution status (query parameter)
cursorstringNoCursor for pagination (query parameter)
limitintegerNoNumber of results per page (query parameter)

Request

curl "https://api.avala.ai/api/v1/agents/b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f/executions/?status=pending" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY"

Response

{
  "next": null,
  "previous": null,
  "results": [
    {
      "uid": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
      "registration": "b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f",
      "event_type": "result.submitted",
      "task": "880b0700-d51e-74a7-d049-779988770000",
      "result": "990c1800-b62f-85a8-e150-880099881111",
      "status": "pending",
      "action": null,
      "event_payload": {
        "event": "result.submitted",
        "result_uid": "990c1800-b62f-85a8-e150-880099881111"
      },
      "response_payload": null,
      "error_message": null,
      "started_at": "2025-03-15T14:00:00Z",
      "completed_at": null,
      "created_at": "2025-03-15T14:00:00Z",
      "updated_at": "2025-03-15T14:00:00Z"
    }
  ]
}

Execution Fields

FieldTypeDescription
uidstring (UUID)Unique identifier for the execution
registrationstring (UUID)UID of the agent registration
event_typestringEvent that triggered this execution
taskstring (UUID) | nullAssociated task UID, if applicable
resultstring (UUID) | nullAssociated result UID, if applicable
statusstringExecution status (see Execution Statuses)
actionstring | nullAction taken by the agent (see Agent Actions)
event_payloadobjectEvent data sent to the agent
response_payloadobject | nullResponse data from the agent
error_messagestring | nullError message if the execution failed
started_atstring (datetime) | nullWhen execution started
completed_atstring (datetime) | nullWhen execution completed
created_atstring (datetime)ISO 8601 timestamp of creation
updated_atstring (datetime)ISO 8601 timestamp of the last update

Submit Action

POST /api/v1/agent-actions/
Submits an agent’s decision for a pending execution. This is used by polling-mode agents to report their action after processing an event.

Parameters

NameTypeRequiredDescription
executionstring (UUID)YesUID of the execution to respond to
actionstringYesDecision: approve, reject, flag, or skip
reasonstringNoHuman-readable reason for the decision (max 2048 characters)
metadataobjectNoAdditional structured data (max 64 KB)

Request

curl -X POST "https://api.avala.ai/api/v1/agent-actions/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "execution": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
    "action": "approve",
    "reason": "All annotations meet quality threshold"
  }'

Response

{
  "detail": "Action recorded.",
  "execution_uid": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
  "action": "approve"
}

Test Agent

POST /api/v1/agents/{uid}/test/
Sends a test ping event to the agent. If the agent has a callback URL, the event is delivered asynchronously. Use this to verify connectivity.

Parameters

NameTypeRequiredDescription
uidstring (UUID)YesAgent registration UID (path parameter)

Request

curl -X POST "https://api.avala.ai/api/v1/agents/b3a1d7c0-4e2f-4b8a-9c6d-1a2b3c4d5e6f/test/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY"

Response

{
  "detail": "Test event queued.",
  "execution_uid": "e5f6a7b8-c9d0-1e2f-3a4b-5c6d7e8f9a01",
  "has_callback": true
}

Event Types

EventDescription
dataset.createdA new dataset was created
dataset.updatedAn existing dataset was updated
dataset.deletedA dataset was deleted
export.completedAn export job completed successfully
export.failedAn export job failed
task.completedA task was marked as complete
result.submittedAn annotation result was submitted
result.acceptedAn annotation result was accepted
result.rejectedAn annotation result was rejected

Execution Statuses

StatusDescription
pendingExecution created, waiting for agent to process
runningAgent is currently processing the event
completedAgent has submitted an action
failedExecution failed (callback error or internal failure)
timed_outAgent did not respond within the 10-minute timeout

Agent Actions

ActionDescription
approveAccept the annotation result
rejectReject the annotation result
flagFlag the result for human review
skipSkip this execution without taking action

Error Responses

Validation Error (400)

{
  "events": ["Invalid events: invalid.event"],
  "callback_url": ["callback_url must use HTTPS."]
}
Returned when the request body contains invalid events or a non-HTTPS callback URL.

Unauthorized (401)

{
  "detail": "Invalid API key."
}
Returned when the X-Avala-Api-Key header is missing or contains an invalid key.

Permission Denied (403)

{
  "detail": "You do not have permission to perform this action."
}
Returned when the authenticated user does not have access to the requested agent.

Not Found (404)

{
  "detail": "Not found."
}
Returned when the specified agent UID does not exist or is not accessible to the user.