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

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
