Skip to main content

AsyncClient

The asynchronous client for interacting with the Avala API using async/await syntax.
from avala import AsyncClient

client = AsyncClient(api_key="your-api-key")

Initialization

api_key
str | None
default:"None"
Your Avala API key. If not provided, the client will attempt to read from the AVALA_API_KEY environment variable.
base_url
str | None
default:"None"
The base URL for the Avala API. If not provided, uses the default production API endpoint.
timeout
float
default:"30.0"
Request timeout in seconds.
max_retries
int
default:"2"
Maximum number of retry attempts for failed requests.

Resource Properties

The client provides access to all API resources through the following properties:
agents
AsyncAgents
Access to the Agents API resource (async version).
annotation_issues
AsyncAnnotationIssues
Access to the Annotation Issues API resource (async version).
auto_label_jobs
AsyncAutoLabelJobs
Access to the Auto Label Jobs API resource (async version).
consensus
AsyncConsensus
Access to the Consensus API resource (async version).
datasets
AsyncDatasets
Access to the Datasets API resource (async version).
exports
AsyncExports
Access to the Exports API resource (async version).
fleet
AsyncFleet
Access to the Fleet API resource (async version).
inference_providers
AsyncInferenceProviders
Access to the Inference Providers API resource (async version).
organizations
AsyncOrganizations
Access to the Organizations API resource (async version).
projects
AsyncProjects
Access to the Projects API resource (async version).
quality_targets
AsyncQualityTargets
Access to the Quality Targets API resource (async version).
slices
AsyncSlices
Access to the Slices API resource (async version).
storage_configs
AsyncStorageConfigs
Access to the Storage Configs API resource (async version).
tasks
AsyncTasks
Access to the Tasks API resource (async version).
webhooks
AsyncWebhooks
Access to the Webhooks API resource (async version).
webhook_deliveries
AsyncWebhookDeliveries
Access to the Webhook Deliveries API resource (async version).

Methods

rate_limit_info

@property
def rate_limit_info(self) -> dict[str, str | None]
Returns rate limit headers from the last API response.
rate_limit_info
dict[str, str | None]
Dictionary containing rate limit information from the most recent API response.

close

async def close(self) -> None
Closes the HTTP transport and releases resources. Should be called when you’re done using the client.
client = AsyncClient(api_key="your-api-key")
try:
    # Use the client
    datasets = await client.datasets.list()
finally:
    await client.close()

Async Context Manager

The AsyncClient can be used as an async context manager, which automatically handles cleanup:
async with AsyncClient(api_key="your-api-key") as client:
    datasets = await client.datasets.list()
    # client.close() is called automatically

Build docs developers (and LLMs) love