> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sdvm.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Async

> AsyncAuditor, AsyncFixer and AsyncRefinery expose the same run method for asyncio code.

Every client has an async twin with the same constructor and the same `run` method, awaited.

```python wrap theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
import asyncio
import os

from sdvm import AsyncFixer
from sdvm.types import TextSample


async def main():
    fixer = AsyncFixer(api_key=os.environ["SDVM_API_KEY"])
    result = await fixer.run([TextSample(text="she sels sea shells by the sea shor")])
    for item in result:
        print(item.text)
    # she sells sea shells by the sea shore


asyncio.run(main())
```

`AsyncAuditor` and `AsyncRefinery` work the same way: `await client.run(data)`.

## Batching concurrently

Requests take up to 100 samples. To process a larger dataset, split it into chunks and run them concurrently, keeping the rate limit of 100 requests per minute in mind.

```python theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
import asyncio


async def fix_all(fixer, samples, chunk=100):
    chunks = [samples[i:i + chunk] for i in range(0, len(samples), chunk)]
    results = await asyncio.gather(*(fixer.run(c) for c in chunks))
    return [s for batch in results for s in batch]
```

`AsyncAuditor.aggregate` is the same local, deterministic function as `Auditor.aggregate`; it is not a coroutine.
