# ParallelExtractTool

> **Class** in `langchain_parallel`

📖 [View in docs](https://reference.langchain.com/python/langchain-parallel/extract_tool/ParallelExtractTool)

Parallel Extract Tool.

This tool extracts clean, structured content from web pages using the
Parallel Extract API.

## Signature

```python
ParallelExtractTool()
```

## Description

**Setup:**

Install `langchain-parallel` and set environment variable
`PARALLEL_API_KEY`.

```bash
pip install -U langchain-parallel
export PARALLEL_API_KEY="your-api-key"
```

**Key init args:**

api_key: Optional[SecretStr]
    Parallel API key. If not provided, will be read from
    PARALLEL_API_KEY env var.
base_url: str
    Base URL for Parallel API. Defaults to "https://api.parallel.ai".
max_chars_per_extract: Optional[int]
    Maximum characters per extracted result.

**Instantiation:**

```python
from langchain_parallel import ParallelExtractTool

# Basic instantiation
tool = ParallelExtractTool()

# With custom API key and parameters
tool = ParallelExtractTool(
    api_key="your-api-key",
    max_chars_per_extract=5000
)
```

**Invocation:**

```python
# Extract content from URLs
result = tool.invoke({
    "urls": [
        "https://example.com/article1",
        "https://example.com/article2"
    ]
})

# Result is a list of dicts with url, title, and content
for item in result:
    print(f"Title: {item['title']}")
    print(f"URL: {item['url']}")
    print(f"Content: {item['content'][:200]}...")
```

**Response Format:**

Returns a list of dictionaries, each containing:
- url: The URL that was extracted
- title: Title of the webpage
- content: Full extracted content as markdown
- publish_date: Publish date if available (optional)

## Extends

- `BaseTool`

## Properties

- `name`
- `description`
- `args_schema`
- `api_key`
- `base_url`
- `max_chars_per_extract`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-parallel/extract_tool/ParallelExtractTool/validate_environment)

---

[View source on GitHub](https://github.com/parallel-web/langchain-parallel/blob/7946e2f5339c689b452621744a27f1a019215639/langchain_parallel/extract_tool.py#L71)