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

# useSyncAgent

Hook to get the sync agent from the TownsSyncProvider.

You can use it to interact with the sync agent for more advanced usage.

Throws an error if no sync agent is set in the TownsSyncProvider.

## Imports

```ts theme={null}
import { useSyncAgent } from '@towns-protocol/react-sdk'
```

## Definition

```ts theme={null}
function useSyncAgent(): SyncAgent
```

**Source:** [useSyncAgent](https://github.com/towns-protocol/towns/blob/main/packages/react-sdk/src/useSyncAgent.tsx)

## Return Type

The sync agent in use, set in TownsSyncProvider.

```ts theme={null}
SyncAgent
```
