> For the complete documentation index, see [llms.txt](https://ai.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai.ortusbooks.com/advanced/reference/built-in-functions/aiwebsearchasync.md).

# aiWebSearchAsync

Asynchronous variant of `aiWebSearch()` that returns a `BoxFuture`.

## Syntax

```javascript
aiWebSearchAsync( query, options = {} )
```

## Parameters

| Parameter | Type   | Required | Description                     |
| --------- | ------ | -------- | ------------------------------- |
| `query`   | string | Yes      | Search query text               |
| `options` | struct | No       | Same options as `aiWebSearch()` |

## Returns

A `BoxFuture` that resolves to the same normalized results array returned by `aiWebSearch()`.

## Execution Model

`aiWebSearchAsync()` returns a `BoxFuture` so searches can run without blocking the current request thread.

## Examples

### Basic async usage

```javascript
future = aiWebSearchAsync( "BoxLang release notes" )
results = future.get()
```

### Promise-style chaining

```javascript
aiWebSearchAsync( "AI agent security" )
    .then( results => {
        println( "Found #results.len()# results" )
        return results
    } )
    .catch( err => {
        println( "Search failed: #err.message ?: err#" )
    } )
```

### Parallel async searches

```javascript
braveFuture = aiWebSearchAsync( "BoxLang AI", { provider: "brave" } )
exaFuture = aiWebSearchAsync( "BoxLang AI", { provider: "exa", type: "neural" } )

braveResults = braveFuture.get()
exaResults = exaFuture.get()
```

## Notes

* Input options and provider behavior match `aiWebSearch()`.
* Failures resolve as future errors; handle with `try/catch` around `.get()` or `.catch()` in chain mode.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai.ortusbooks.com/advanced/reference/built-in-functions/aiwebsearchasync.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
