# asyncregistration.py
def init_async_hooks(hooks: AsyncHooks):
    # Native async hook (best performance)
    hooks.register_before_request_hook(MyAsyncAuthHook())

    # Adapted sync hook (runs in thread pool)
    from .adapters import SyncToAsyncBeforeRequestAdapter
    from .my_sync_hook import MySyncLoggingHook
    hooks.register_before_request_hook(
        SyncToAsyncBeforeRequestAdapter(MySyncLoggingHook())
    )
```

## Adapters Reference

The SDK provides bidirectional adapters in `adapters.py`:

| Adapter | Purpose |
|---------|---------|
| `SyncToAsyncBeforeRequestAdapter` | Run sync `BeforeRequestHook` in async context |
| `SyncToAsyncAfterSuccessAdapter` | Run sync `AfterSuccessHook` in async context |
| `SyncToAsyncAfterErrorAdapter` | Run sync `AfterErrorHook` in async context |
| `AsyncToSyncBeforeRequestAdapter` | Run async hook in sync context (creates event loop) |
| `AsyncToSyncAfterSuccessAdapter` | Run async hook in sync context |
| `AsyncToSyncAfterErrorAdapter` | Run async hook in sync context |

<Callout title="Async-to-Sync Warning" type="warning">
  Async-to-sync adapters create a new event loop per invocation via `asyncio.run()`. This is inefficient and should be avoided in production. Prefer native sync hooks for sync contexts.
</Callout>