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

# AsyncToolChecker

> Track long-running actions triggered by tool execution

`AsyncToolChecker` wraps action-status polling logic.

## Constructor

```ts theme={null}
new AsyncToolChecker({ coreApiProvider })
```

## Methods

### `check`

```ts theme={null}
check({ toolName, protocol, descriptor }): Promise<AwaitActionResult>
```

Performs one status check.

```ts theme={null}
const result = await checker.check({
  toolName: 'swap',
  protocol: 'lifi',
  descriptor: { txHash: '0x...' },
})

if (result.isError) {
  console.error(result.error)
} else {
  console.log(result.response.pollStatus)
}
```

### `subscribe`

```ts theme={null}
subscribe(
  params,
  {
    onStatusChange,
    onError,
  },
  {
    interval,
    retryThreshold,
    maxRetries,
    maxDuration,
  },
): { unsubscribe(): void }
```

Config units are seconds.

```ts theme={null}
const sub = checker.subscribe(
  {
    toolName: 'bridge',
    protocol: 'lifi',
    descriptor: { txHash: '0x...' },
  },
  {
    onStatusChange: ({ current }) => console.log(current.pollStatus),
    onError: (error) => console.error(error),
  },
  {
    interval: 5,
    retryThreshold: 30,
    maxRetries: 5,
    maxDuration: 600,
  },
)

sub.unsubscribe()
```
