Skip to main content
The Avala class is the main entry point for interacting with the Avala API. It provides access to all API resources and manages authentication and configuration.

Constructor

import { Avala } from '@avala-ai/sdk';

const avala = new Avala(config?);
config
AvalaConfig
Configuration options for the client. If not provided, the client will attempt to read the AVALA_API_KEY environment variable.

Example

import { Avala } from '@avala-ai/sdk';

// Using explicit API key
const avala = new Avala({
  apiKey: 'your-api-key',
  timeout: 60000 // 60 seconds
});

// Using environment variable
const avala = new Avala();

Properties

The Avala client provides access to the following resource groups:
datasets
DatasetsResource
Manage datasets and dataset items. See Datasets API.
projects
ProjectsResource
Manage annotation projects. See Projects API.
exports
ExportsResource
Create and manage data exports. See Exports API.
tasks
TasksResource
Manage annotation tasks. See Tasks API.
storageConfigs
StorageConfigsResource
Configure cloud storage integrations. See Storage Configs API.
agents
AgentsResource
Manage AI agents and agent executions. See Agents API.
annotationIssues
AnnotationIssuesResource
Track and manage annotation quality issues. See Annotation Issues API.
inferenceProviders
InferenceProvidersResource
Configure inference providers for auto-labeling. See Inference Providers API.
autoLabelJobs
AutoLabelJobsResource
Create and monitor auto-labeling jobs. See Auto Label Jobs API.
qualityTargets
QualityTargetsResource
Set and monitor data quality targets. See Quality Targets API.
consensus
ConsensusResource
Compute and analyze annotation consensus. See Consensus API.
webhooks
WebhooksResource
Configure webhook subscriptions. See Webhooks API.
webhookDeliveries
WebhookDeliveriesResource
View webhook delivery history. See Webhooks API.
organizations
OrganizationsResource
Manage organizations, teams, and members. See Organizations API.
slices
SlicesResource
Create and manage data slices. See Slices API.
fleet
FleetResource
Manage fleet devices, recordings, and events. See Fleet API.
rateLimitInfo
RateLimitInfo
Rate limit information from the last API request.

Rate limiting

The Avala API implements rate limiting to ensure fair usage. After each request, you can check the current rate limit status:
const avala = new Avala();

// Make a request
await avala.datasets.list();

// Check rate limit info
const rateLimitInfo = avala.rateLimitInfo;
console.log(`Remaining: ${rateLimitInfo.remaining}/${rateLimitInfo.limit}`);
console.log(`Resets at: ${rateLimitInfo.reset}`);
When you exceed the rate limit, the SDK will throw a RateLimitError with details about when you can retry.

Error handling

The SDK throws typed errors for different error conditions:
import { 
  Avala, 
  AuthenticationError, 
  NotFoundError, 
  RateLimitError,
  ValidationError,
  ServerError 
} from '@avala-ai/sdk';

const avala = new Avala();

try {
  await avala.datasets.get('dataset-id');
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof NotFoundError) {
    console.error('Dataset not found');
  } else if (error instanceof RateLimitError) {
    console.error(`Rate limited. Retry after ${error.retryAfter} seconds`);
  } else if (error instanceof ValidationError) {
    console.error('Invalid request parameters');
  } else if (error instanceof ServerError) {
    console.error('Server error occurred');
  }
}

Build docs developers (and LLMs) love