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

# LangChain

> Use Geekflare in LangChain agents with the langchain-geekflare package, with tools for search, web scraping, brand data, screenshots, and website diagnostics.

The `langchain-geekflare` package gives LangChain agents Geekflare as a set of tools: web and Google SERP search, page scraping to Markdown or structured JSON, page metadata, brand identity, screenshots, URL-to-PDF, and website diagnostics. It's built on the official [Python SDK](https://pypi.org/project/geekflare-api/) and requires Python 3.10+.

## Install

```bash theme={null}
pip install -U langchain-geekflare
```

## Set your API key

Get an API key at [dash.geekflare.com](https://dash.geekflare.com) and set it as an environment variable:

```bash theme={null}
export GEEKFLARE_API_KEY="YOUR_API_KEY"
```

Replace `YOUR_API_KEY` with your Geekflare API key. You can also pass the key directly to any tool with `geekflare_api_key="YOUR_API_KEY"`.

## Tools

Every tool supports `invoke` and async `ainvoke`, and returns the API's JSON response as a dict. API errors (an invalid key, no credits, or an unreachable site) are returned to the agent as an error message instead of raising an exception.

| Class | Tool name | Purpose |
| :- | :- | :- |
| `GeekflareSearch` | `geekflare_search` | Web, news, and image search. Set `serp=True` for the full Google results page (AI Overview, People Also Ask) by `location` country code or `city`. Also supports `include_domains`, `exclude_domains`, `time`, `scrape`, and `grounded_answer`. |
| `GeekflareScrape` | `geekflare_scrape` | A page as `markdown` (default), `markdown-llm`, `text`, `html`, or `json`, using `formats`. Use `template="product"` or `template="contact"` for structured data. Also supports `render_js`, `wait_time`, and `device`. |
| `GeekflareMetaScrape` | `geekflare_meta_scrape` | Title, description, canonical URL, Open Graph, and Twitter Card metadata. |
| `GeekflareBrand` | `geekflare_brand` | Logos, colors, fonts, and social profiles. `mode="enriched"` adds company intelligence. |
| `GeekflareScreenshot` | `geekflare_screenshot` | A hosted image URL. Supports `full_page`, `device`, `type`, `selector`, and `theme`. |
| `GeekflareUrlToPdf` | `geekflare_url_to_pdf` | A hosted PDF URL. Supports `paper_format` and `orientation`. |
| `GeekflareSiteStatus` | `geekflare_site_status` | Check whether a site is up. |
| `GeekflareDnsRecords` | `geekflare_dns_records` | DNS records. Use `types` to pick record types. |
| `GeekflareDnsSec` | `geekflare_dnssec` | DNSSEC configuration. |
| `GeekflareTlsScan` | `geekflare_tls_scan` | TLS protocol support and certificate details. |
| `GeekflareRedirectCheck` | `geekflare_redirect_check` | The full redirect chain of a URL. |
| `GeekflareBrokenLinks` | `geekflare_broken_links` | Broken links on a page. |
| `GeekflareLoadTime` | `geekflare_load_time` | Page load time. |
| `GeekflareMixedContent` | `geekflare_mixed_content` | HTTP resources loaded on HTTPS pages. |
| `GeekflareLighthouse` | `geekflare_lighthouse` | Lighthouse audit. Supports `device`. Slower than the other tools. |

## Use a tool directly

```python theme={null}
from langchain_geekflare import GeekflareSearch, GeekflareScrape

search = GeekflareSearch()
search.invoke({"query": "latest stable python release", "limit": 5})
search.invoke({"query": "best project management software", "serp": True,
               "city": "London,England,United Kingdom"})

GeekflareScrape().invoke({"url": "https://example.com", "formats": ["markdown"]})
```

## Use tools in an agent

```python theme={null}
from langchain.agents import create_agent
from langchain_geekflare import GeekflareSearch, GeekflareScrape, GeekflareTlsScan, GeekflareDnsRecords

agent = create_agent(
    model="anthropic:claude-sonnet-5-5",
    tools=[GeekflareSearch(), GeekflareScrape(), GeekflareTlsScan(), GeekflareDnsRecords()],
)
agent.invoke({"messages": [{"role": "user", "content": "Is the TLS setup on example.com healthy?"}]})
```

## Notes

* Each call spends credits from your Geekflare account. See [Credit Consumption](/api-credit-mapping) and [pricing](https://geekflare.com/pricing/).
* Geekflare works with public pages only.

## Links

> **[PyPI](https://pypi.org/project/langchain-geekflare/)**
>
> `langchain-geekflare` on PyPI.

> **[GitHub](https://github.com/geekflare/langchain-geekflare)**
>
> Source code (MIT license).

> **[Python SDK](https://pypi.org/project/geekflare-api/)**
>
> The official SDK this package is built on.

> **[MCP Server](/mcp/overview)**
>
> Connect Geekflare to AI clients through MCP.


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