> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-9/async-patterns.md).

# Async patterns

Async patterns — concurrency, gather, semaphore-bounded parallelism.

## Concurrent evaluations

```python
import asyncio
from layerlens import AsyncStratix

async def run_one(client, model_key, benchmark_key):
 model = await client.models.get_by_key(model_key)
 bm = await client.benchmarks.get_by_key(benchmark_key)
 e = await client.evaluations.create(model=model, benchmark=bm)
 return await client.evaluations.wait_for_completion(e)

async def main():
 client = AsyncStratix()
 results = await asyncio.gather(*[run_one(client, m, "mmlu") for m in ["openai/gpt-4o", "anthropic/claude-opus-4-7"]])
 for r in results: print(r.accuracy)

asyncio.run(main())
```

## Semaphore-bounded

When running many concurrent jobs, bound concurrency:

```python
sem = asyncio.Semaphore(5)
async def bounded(coro):
 async with sem: return await coro
```

## See also

* [Concept: Async vs sync](/6.-build-wire-your-code/async-vs-sync-workflow.md)
* [Cookbook: sync vs async](/more-in-this-section-9/sync-async-clients.md)
