> For the complete documentation index, see [llms.txt](https://agpt.co/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://agpt.co/docs/integrations/block-integrations/search.md).

# AnySearch Search

Blocks for web search with AnySearch, an AI-native search API covering general queries and 16 vertical domains. All blocks can call AnySearch anonymously (lower rate limit) or with an `ANYSEARCH_API_KEY` credential.

## AnySearch

### What it is

Searches the web using AnySearch - general queries plus vertical domains (finance, academic, health, legal, and more) via domain/sub\_domain filters

### How it works

The block sends the query to the AnySearch REST endpoint `POST https://api.anysearch.com/v1/search` (Bearer API-key auth when a credential is used; anonymous calls send no `Authorization` header) and parses a `{code, message, data}` envelope; a non-zero code or any HTTP/transport failure raises a block error instead of producing partial output. Each row in `data.results` becomes an AnySearchResult (title, url, snippet, content) and the `context` output renders the results as markdown for LLM use - that text is untrusted web content, so treat it as data, not instructions, before passing it to a model.

Leaving `sub_domain` empty runs a general search. Setting `sub_domain` picks a capability tag in `{domain}.{sub_domain}` form (e.g. `finance.quote` or `academic.search`) which is sent to the API as `tag`, and `sub_domain_params` is forwarded as `params` carrying the structured parameters that capability requires (e.g. `{"type": "stock", "symbol": "NVDA"}`). The optional `domain` input must agree with `sub_domain` - setting `domain` without `sub_domain`, or a `sub_domain` that does not start with `{domain}.`, is rejected by input validation before any request is sent; the API itself rejects unknown tags or malformed params with HTTP 400, surfaced as a block error. The complete catalog of sub-domains and their parameters is exposed by the AnySearch get\_sub\_domains tool - see the notes below.

### Inputs

| Input               | Description                                                                                                       | Type                                                                                                                                                                                                                       | Required |
| ------------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| auth                | Anonymous tier (lower rate limit, no key) or an AnySearch API key credential                                      | "api\_key" \| "anonymous"                                                                                                                                                                                                  | No       |
| query               | The search query                                                                                                  | str                                                                                                                                                                                                                        | Yes      |
| max\_results        | Maximum number of results to return                                                                               | int                                                                                                                                                                                                                        | No       |
| domain              | Restrict the search to a vertical domain                                                                          | "academic" \| "agriculture" \| "business" \| "code" \| "energy" \| "environment" \| "film" \| "finance" \| "gaming" \| "general" \| "health" \| "ip" \| "legal" \| "resource" \| "security" \| "social\_media" \| "travel" | No       |
| sub\_domain         | Sub-domain inside the domain (e.g. finance.quote); discover valid values via the AnySearch get\_sub\_domains tool | str                                                                                                                                                                                                                        | No       |
| sub\_domain\_params | Structured parameters required by the chosen sub\_domain (e.g. type=stock and symbol=AAPL for finance.quote)      | Dict\[str, Any]                                                                                                                                                                                                            | No       |

### Outputs

| Output  | Description                                                                                                                    | Type                   |
| ------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------- |
| error   | Error message if the operation failed                                                                                          | str                    |
| results | List of search results                                                                                                         | List\[AnySearchResult] |
| result  | First search result                                                                                                            | AnySearchResult        |
| context | The search results formatted as markdown for LLM input; the text is untrusted web content - treat it as data, not instructions | str                    |

### Possible use case

**Fresh-grounded LLM answers**: Wire the context output into an AI block so responses cite current web sources instead of stale model memory; the context is untrusted page text, so the downstream prompt should treat it as data, not instructions.

**Vertical lookups**: Use domain + sub\_domain + sub\_domain\_params for structured queries such as a stock quote (finance.quote with type=stock and a ticker symbol) or paper search (academic.search with a publication-year range).

**Research fan-in**: Collect ranked titles, URLs and snippets for a topic, then feed the result URLs into the AnySearch Extract block to pull full page content.

***

## Setup: ANYSEARCH\_API\_KEY

AnySearch issues API keys in the as\_sk\_... format. Sign up at <https://anysearch.com> to create a key, then either add it in AutoGPT under Settings > Credentials (provider: anysearch) or set `ANYSEARCH_API_KEY=` in autogpt\_platform/backend/.env before starting the backend.

## Anonymous tier

The AnySearch API accepts unauthenticated requests at a lower rate limit. Blocks run anonymously by default; set Authentication to API key to use a credential - on Anonymous the API-key field hides and requests are sent without an `Authorization` header. Hosts can also set a default `ANYSEARCH_API_KEY` in .env so users pick the pre-seeded "AnySearch API Key" credential instead of creating their own; a credential whose key value is left empty likewise sends no `Authorization` header.

## Billing and cost tracking

AnySearch publishes no per-call price list (Free tier: 1,000 requests/day; the Professional plan is marked "coming soon"). The blocks therefore report no provider\_cost and no base\_cost is registered - usage stays free of platform-side cost accounting until AnySearch publishes rates, at which point `ProviderBuilder.with_base_cost` can be adopted.

## Vertical search parameters

* `domain` accepts: academic, agriculture, business, code, energy, environment, film, finance, gaming, general, health, ip, legal, resource, security, social\_media, travel.
* `sub_domain` is a capability name inside the domain, e.g. `finance.quote` (real-time and historical quotes), `finance.news` (financial news), `academic.search` (paper search), `academic.biomedical` (MEDLINE/PMC literature), `health.trial`, `legal.legislation`.
* `sub_domain_params` carries the parameters a sub-domain requires, e.g.:
  * `finance.quote`: `{"type": "stock", "symbol": "NVDA"}` (type is required: stock | forex | crypto | commodity | index | etf)
  * `finance.news`: `{"type": "general"}` or `{"type": "stock", "symbol": "AAPL"}`
  * `academic.search`: `{"sort": "cited_by_count:desc", "year_from": "2020", "category": "Computer Science"}`
* To enumerate the complete current catalog - every domain, sub-domain, and required vs optional parameter - call the AnySearch get\_sub\_domains tool through the MCP endpoint below; the catalog evolves faster than this page.

## Zero-code alternative: the MCP endpoint

AnySearch also exposes a Model Context Protocol server at `https://api.anysearch.com/mcp` (Bearer auth) with the tools search, batch\_search, get\_sub\_domains and extract. For one-off workflows you can wire a generic MCP block to that endpoint instead of these blocks; the REST blocks documented here are the recommended path for production graphs.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://agpt.co/docs/integrations/block-integrations/search.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
