Metadata-Version: 2.5
Name: render-lab-tasks-firecrawl
Version: 0.1.0
Summary: firecrawl tasks for Render Workflows
Project-URL: Repository, https://github.com/render-lab/render-tasks-python
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: httpx<0.29,>=0.28
Requires-Dist: render-lab-tasks-core<0.2,>=0.1.1
Requires-Dist: render-lab-triggers<0.2,>=0.1.0
Requires-Dist: render==1.0.1
Description-Content-Type: text/markdown

# render-lab-tasks-firecrawl

Unreleased Python port: **12 registered tasks** from
[render-lab/render-tasks](https://github.com/render-lab/render-tasks/tree/45f9c2d44bd28e01ae9813e0d2ff56ee6c533816/packages/tasks-firecrawl).
Python 3.12+, Render SDK 1.0.1. Requires core 0.1.1 or later.

From the repository root:

```sh
uv sync --all-packages --locked
```

Import `render_lab_tasks_firecrawl.tasks` to register tasks. The package root is inert.
Compose the exported `app` with `Workflows.from_workflows`; call tasks through
`ctx.run`. Every operation also exports `*_impl(ctx, input, *, deps=None)` for
injection. `Client(http, env)` accepts a caller-owned HTTPX client, and
`Deps(firecrawl=client)` injects it. Default dependencies open and close the HTTP
client per invocation; credentials are read lazily at use. No HTTP retries or
background vendor polling occur; `retry.py` owns the durable retry policies.

## Task surface

| Registered task | Python export |
| --- | --- |
| `firecrawl.awaitBatchScrape` | `await_batch_scrape` |
| `firecrawl.awaitCrawl` | `await_crawl` |
| `firecrawl.awaitExtract` | `await_extract` |
| `firecrawl.cancelBatchScrape` | `cancel_batch_scrape` |
| `firecrawl.cancelCrawl` | `cancel_crawl` |
| `firecrawl.getJobResults` | `get_job_results` |
| `firecrawl.map` | `map` |
| `firecrawl.scrape` | `scrape` |
| `firecrawl.search` | `search` |
| `firecrawl.startBatchScrape` | `start_batch_scrape` |
| `firecrawl.startCrawl` | `start_crawl` |
| `firecrawl.startExtract` | `start_extract` |

Typed JSON inputs and results are in `types.py`. Task names and JSON field names
match the pinned source; Python function names use snake_case.

## Environment

| Variable | Requirement |
| --- | --- |
| `FIRECRAWL_API_KEY` | Required at first API call. |

## Behavior and limits

Uses Firecrawl v2. Each await makes one status check per durable attempt. Crawl and batch cancellation normalize 404. Returned content budgets use JavaScript UTF-16 character counts. Cursor requests are restricted to HTTPS api.firecrawl.dev before attaching credentials (ADR-0010). The inherited getJobResults maxResults slice can discard excess documents in a vendor page; use a page-sized maximum until cursor preservation is verified. Unknown extract statuses currently follow the source completion mapping; vendor status changes need live verification.

## Verification

All registered tasks have hermetic contract fixtures executed independently against
the pinned TS implementation. SDK-backed tasks also have explicit HTTP request
fixtures. See `tests/test_batch3_contracts.py` and `tests/test_batch3_edges.py`.
These are not live vendor results.

Vendor webhooks subpaths and other registration-free TS exports are outside this
batch unless explicitly listed above. Full registered-task coverage does not
imply all supporting exports are ported.

Pending scopes, test resources, replay, and hosted checks are in the
[live-testing backlog](https://github.com/render-lab/render-tasks-python/issues/1)
and [verification tracker](../../docs/verification-tracker.md).

## Webhook adapter

`render_lab_tasks_firecrawl.webhooks.firecrawl_adapter(on_event, ...)` returns a
registration-free adapter for `render_lab_triggers`. The callback receives the
verified event and returns `{"task": "namespace.task", "args": [event]}` or `None`.
The signing credential `FIRECRAWL_WEBHOOK_SECRET` is read inside verification unless
provided explicitly. Importing this module does not register tasks. Signature
checks use the raw body; live delivery remains in the testing backlog.

## Installation

```sh
pip install render-lab-tasks-firecrawl==0.1.0
```
