> 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-8.md).

# Tavily Search

Blocks for searching the web with Tavily's AI-native search API.

## Tavily Search

### What it is

Searches the web using Tavily's AI-native search API

### How it works

The block sends your query to Tavily's search endpoint and returns ranked web results, each with a relevance score and a query-relevant content snippet. You can scope the search by `topic` (general, news, or finance), `time_range`, and domain include/exclude lists, and trade cost for quality with `search_depth` (basic/fast/ultra-fast at 1 credit, advanced at 2).

Beyond the raw `results` list (also emitted one `result` at a time), the block can return an LLM-generated `answer` synthesized from the results when `include_answer` is enabled, and always emits a `context` string — the results formatted as markdown, ready to feed straight into an LLM block. Actual credit spend is read from the API's usage report and reported to the platform's cost tracking.

### Inputs

| Input                 | Description                                                                        | Type                                            | Required |
| --------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------- | -------- |
| query                 | The search query                                                                   | str                                             | Yes      |
| topic                 | Search category: general, news, or finance                                         | "general" \| "news" \| "finance"                | No       |
| search\_depth         | Depth of the search: basic, fast or ultra-fast (1 credit), or advanced (2 credits) | "basic" \| "advanced" \| "fast" \| "ultra-fast" | No       |
| max\_results          | Maximum number of results to return                                                | int                                             | No       |
| time\_range           | Only include results published within this time range                              | "day" \| "week" \| "month" \| "year"            | No       |
| include\_domains      | Domains to include in search                                                       | List\[str]                                      | No       |
| exclude\_domains      | Domains to exclude from search                                                     | List\[str]                                      | No       |
| include\_answer       | Include an LLM-generated answer to the query, based on the search results          | bool                                            | No       |
| include\_raw\_content | Include the full page content for each result                                      | bool                                            | No       |

### Outputs

| Output  | Description                                                    | Type                      |
| ------- | -------------------------------------------------------------- | ------------------------- |
| error   | Error message if the search failed                             | str                       |
| results | List of search results                                         | List\[TavilySearchResult] |
| result  | Single search result                                           | TavilySearchResult        |
| answer  | LLM-generated answer to the query, based on the search results | str                       |
| context | A formatted string of the search results ready for LLMs.       | str                       |

### Possible use case

**Research Automation**: Pull current, ranked sources on a topic and feed the `context` output directly into an LLM block for summarization or synthesis.

**Grounded Q\&A**: Enable `include_answer` to get a concise, source-backed answer for chatbots or agents that need up-to-date facts.

**News & Market Monitoring**: Set `topic` to news or finance and narrow `time_range` to recent windows to track breaking developments.

***


---

# 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-8.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.
