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

# Web

> The components that read the web: web.scrape, web.search and their providers, Firecrawl and Tavily.

The web family reaches pages outside the workflow. `web.scrape` turns one page into a message and `web.search` turns a
query into a list of results. Neither makes a request itself: each takes a provider on its own input, and the provider
calls an external service with an API key.

```mermaid theme={null}
graph LR
    Firecrawl[web.scrape.firecrawl] -.->|scraper| Scrape[web.scrape]
    Tavily[web.search.tavily] -.->|search| Search[web.search]
    Scrape --> Page[content]
    Search --> Results[results]
```

| Consumer and its input | Interface | Provider that serves it | Vendor API |
| :- | :- | :- | :- |
| `web.scrape` (`scraper`) | `web.scrape` | `web.scrape.firecrawl` | Firecrawl |
| `web.search` (`search`) | `web.search` | `web.search.tavily` | Tavily |

Each provider input is required. A definition with nothing wired to it fails [its
check](https://docs.blobhub.io/blob-types/workflow/operations/check-definition.md) with ``Port `scraper` (category: `provider_input`) is
required``, or the same for `search`. If the connection is missing when the step runs anyway, the step posts a
`component.error` event, `Provider "scraper" is not connected` (`"search"` for a search), and takes its `failure` route.

A provider joins a consumer through a connection written from the consumer: its `source` is the consumer, with
`source_port` `provider_input`, and its `target` is the provider, with `target_port` `provider_reference`. Its `route`
is the name of the consumer's provider input: `scraper` for a `web.scrape`, `search` for a `web.search`. The consumer
finds its provider by that route, so a connection with any other route leaves the input unconnected and the step posts
`Provider "<route>" is not connected`.

## `web.scrape`

Fetches one page and returns its main content as Markdown.

| Route | Category | Value | Notes |
| :- | :- | :- | :- |
| `url` | Data input | `message` | Required. The text of the message is the address of the page. |
| `content` | Data output | `message` | Required. The page as one message. |
| `scraper` | Provider input | `web.scrape` | Required. A `web.scrape.firecrawl`. |
| `success` | Flow output | — | The page was scraped. |
| `failure` | Flow output | — | The request failed or Firecrawl did not report success. |

The `content` message has the role `scraper` and one `text` block holding the page's Markdown. Its `metadata` is the
page metadata Firecrawl returns, with `sourceURL` renamed `url`. The step posts `Content scraped successfully`. On
`failure`, the step posts a `component.error` event with the error and `content` is not written.

## `web.search`

Runs a search query and returns the results as a list of messages.

| Route | Category | Value | Notes |
| :- | :- | :- | :- |
| `query` | Data input | `message` | Required. The text of the message is the query. |
| `topic` | Data input | `text`, default `general` | The topic sent to Tavily with the query. |
| `results` | Data output | `messages` | Required. One message per result. |
| `search` | Provider input | `web.search` | Required. A `web.search.tavily`. |
| `success` | Flow output | — | At least one result came back. |
| `failure` | Flow output | — | The request failed, or the search returned no results. |

Each result is a message with the role `search`. Its one `text` block holds the result's `content`, and its `metadata`
holds the other fields Tavily returns for the result, such as its address and title. The step posts a `component.output`
event with the number of results and the time Tavily took. A search with no results takes `failure`, not `success` with
an empty list.

## `web.scrape.firecrawl`

The provider for `web.scrape`. It posts to Firecrawl's scrape endpoint, `https://api.firecrawl.dev/v1/scrape`, with the
key as a bearer token. It asks for the `markdown` format and only the main content of the page, waits 30000 ms for the
page, sets a 60000 ms timeout for Firecrawl, asks for a non-mobile page from the US with the language `en-US`, drops
base64 images, and skips TLS verification of the page. It waits at most 5 seconds to connect and 90 seconds for a reply.

| Route | Category | Value | Notes |
| :- | :- | :- | :- |
| `credential` | Data input | `credential` (`api_key`) | Required. A Firecrawl API key ([credential value](https://docs.blobhub.io/blob-types/workflow/workflows/data-types.md#credential), [creating one](https://docs.blobhub.io/general/credentials.md)). |

## `web.search.tavily`

The provider for `web.search`. It posts to Tavily's search endpoint, `https://api.tavily.com/search`, with the key, the
query and the `topic`, and asks for the `advanced` search depth. It waits at most 5 seconds to connect and 60 seconds
for a reply.

| Route | Category | Value | Notes |
| :- | :- | :- | :- |
| `credential` | Data input | `credential` (`api_key`) | Required. A Tavily API key ([credential value](https://docs.blobhub.io/blob-types/workflow/workflows/data-types.md#credential), [creating one](https://docs.blobhub.io/general/credentials.md)). |

A provider whose `credential` names an alias that does not exist posts a `component.error` event, `"<alias>" credential
alias not found`, and the consumer takes `failure`.

### Example: a competitor brief for Brightwell Logistics

Brightwell Logistics researches a rival before a bid. A `web.search` with the query `Corvel Freight carrier network
2026` returns the results. A `web.scrape` then reads the page whose address is in a result's `metadata`. One
`web.scrape.firecrawl` and one `web.search.tavily` serve the flow, with the credentials `firecrawl-prod` and
`tavily-prod`. The scraped Markdown goes to a `genai.chat` that writes the brief.

The search half of the flow, wired to its provider, looks like this. `tavily-prod` is an `api_key` credential of the
organization.

```json theme={null}
{
  "components": [
    {"id": "find_rival", "category": "processor", "type": "web.search", "name": "Find rival",
     "position": {"x": 200, "y": 0},
     "ports": [
       {"category": "data_input", "route": "query",
        "value": {"type": "message", "message": {"role": "user", "content": [
          {"type": "text", "text": "Corvel Freight carrier network 2026"}]}}},
       {"category": "data_input", "route": "topic", "value": {"type": "text", "text": "news"}}
     ]},
    {"id": "tavily", "category": "provider", "type": "web.search.tavily", "name": "Tavily",
     "position": {"x": 200, "y": 200},
     "ports": [
       {"category": "data_input", "route": "credential", "value": {"type": "credential", "alias": "tavily-prod"}}
     ]}
  ],
  "connections": [
    {"id": "c1", "source_id": "find_rival", "target_id": "tavily", "route": "search",
     "source_port": "provider_input", "target_port": "provider_reference"}
  ]
}
```

The flow connections that start `Find rival` and follow its `success` and `failure` routes, and the `results` output
wired to a data component, are left out.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.