From aec091314fe12baf7287907cabce4b6f893a2a74 Mon Sep 17 00:00:00 2001 From: claude-sandbox bot Date: Wed, 2 Dec 2026 20:13:17 +0000 Subject: [PATCH 1/2] docs: Langflow Diffbot integration plan Automated change by claude-sandbox (agent: claude, mode: audit, run: 7d64b58c-fecd-4869-98e1-0103582672c5). --- docs/plans/langflow-integration.md | 297 ++++++++++++++++++++++++++ docs/plans/langflow-research-notes.md | 62 ++++++ 2 files changed, 359 insertions(+) create mode 100644 docs/plans/langflow-integration.md create mode 100644 docs/plans/langflow-research-notes.md diff --git a/docs/plans/langflow-integration.md b/docs/plans/langflow-integration.md new file mode 100644 index 0000000..4a939cb --- /dev/null +++ b/docs/plans/langflow-integration.md @@ -0,0 +1,297 @@ +# Langflow integration for Diffbot: plan + +> **Status:** plan only. Written 2026-12-02. **Audience:** the implementer (πŸ› ) and Andrew (πŸ…°). +> This PR adds no code, no scaffold, no package, and no published artifacts. Nothing here has been posted to `langflow-ai/langflow`, PyPI, or the Langflow Store. +> Sources, raw findings, and pages that could not be opened: [langflow-research-notes.md](./langflow-research-notes.md). + +Legend: πŸ…° Andrew must act or approve Β· πŸ›  implementer Β· πŸ…Ή Jerome (only where a Diffbot API fact needs confirming) + +--- + +## 0. TL;DR + +- **Ship a Diffbot-owned Langflow Extension Bundle on PyPI.** Working name `lfx-diffbot`, bundle name `diffbot`. It ships an `extension.json` manifest and registers the `langflow.extensions` entry point. Langflow 1.13 documents this as the normal third-party path: `lfx extension init` β†’ `validate` β†’ `dev` β†’ publish to PyPI β†’ users run `uv pip install lfx-diffbot` and restart. No core PR is needed to ship. +- **The package layout copies Langflow's own standalone bundles** (`src/bundles/exa`, which is `lfx-exa`). Saved flows then reference `ext:diffbot:@official`. If Langflow later hosts the bundle upstream under the same bundle name, existing flows keep working. +- **v0.1 = the 9 read-only, synchronous n8n operations as 9 focused components in one `diffbot` bundle.** Each component works on the canvas and in Agent **Tool Mode**. Org, Person, and News search build DQL from structured fields with escaping. Raw DQL is the power-user escape hatch. +- **Reuse the official SDK** (`diffbot`, async `DiffbotAsync`) for Web Search, Extract, DQL, and Ask. **Prerequisite:** a focused `enhance()` / `DiffbotAsync.enhance()` addition in this repo (no broader coverage work). The DQL query builders live in the integration, not the SDK. +- **Auth:** a required `SecretStrInput` bound to a Langflow **Global Variable** of type Credential. Env sourcing goes through `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=DIFFBOT_API_TOKEN`. Never use `resolve_token()` or `~/.diffbot/credentials` on a Langflow server. +- **Upstream PR to `langflow-ai/langflow` comes later, needs Andrew's explicit go, and is optional.** It would be a branded SVG icon, a `SIDEBAR_BUNDLES` entry, and a docs and bundle-list entry. Do not use the Langflow Store as a distribution channel. +- **Gate:** Andrew creates the repo (proposed `diffbot/lfx-diffbot`) and confirms the name. Until then, milestone 1 (SDK `enhance()`) can proceed in this repo. + +--- + +## 1. Langflow requirements (as of 2026-12-02) + +Current stable: **Langflow 1.13.5 / lfx 1.13.5** (PyPI, uploaded 2026-12-01). Docs show 1.13.x as current and 1.14.x as "Next" (unreleased). `BUNDLE_API_VERSION` = `1`. + +### 1.1 Sources actually opened + +| # | Title | URL | +| --- | --- | --- | +| 1 | Contribute bundles | https://docs.langflow.org/contributing-bundles | +| 2 | Contribute components | https://docs.langflow.org/contributing-components | +| 3 | Contribute component tests | https://docs.langflow.org/contributing-component-tests | +| 4 | Create custom Python components | https://docs.langflow.org/components-custom-components | +| 5 | Bundle list (1.13.0) | https://docs.langflow.org/extensions-bundle-list | +| 6 | Build your first extension | https://docs.langflow.org/extensions-quickstart | +| 7 | Manifest reference | https://docs.langflow.org/extensions-manifest | +| 8 | Global variables | https://docs.langflow.org/configuration-global-variables | +| 9 | API keys and authentication | https://docs.langflow.org/api-keys-and-authentication | +| 10 | Environment variables | https://docs.langflow.org/environment-variables | +| 11 | Agents | https://docs.langflow.org/agents | +| 12 | Configure tools for agents (1.13.x) | https://docs.langflow.org/agents-tools | +| 13 | Configure tools for agents (1.14.x, Next) | https://docs.langflow.org/next/agents-tools | +| 14 | `BUNDLE_API.md` | https://github.com/langflow-ai/langflow/blob/main/BUNDLE_API.md | +| 15 | `CONTRIBUTING.md` | https://github.com/langflow-ai/langflow/blob/main/CONTRIBUTING.md | +| 16 | `src/bundles/PORTING.md` | https://github.com/langflow-ai/langflow/blob/main/src/bundles/PORTING.md | +| 17 | `lfx-bundles` README | https://github.com/langflow-ai/langflow/blob/main/src/bundles/lfx-bundles/README.md | +| 18 | `lfx-exa` `pyproject.toml`, `extension.json`, component, and tests | https://github.com/langflow-ai/langflow/tree/main/src/bundles/exa | +| 19 | Tavily component (`lfx-bundles`) | https://github.com/langflow-ai/langflow/blob/main/src/bundles/lfx-bundles/src/lfx_bundles/tavily/tavily_search.py | +| 20 | `styleUtils.ts` (`SIDEBAR_BUNDLES`) and `lazyIconImports.ts` | https://github.com/langflow-ai/langflow/blob/main/src/frontend/src/utils/styleUtils.ts | +| 21 | Store API router | https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/api/v1/store.py | +| 22 | PyPI JSON for `lfx-bundles`, `lfx-exa`, `lfx-firecrawl`, `lfx`, `langflow`, and other `lfx-*` packages | https://pypi.org/pypi/lfx-bundles/json (and so on) | +| 23 | Third-party example: `langflow-fxmacrodata` | https://github.com/fxmacrodata/langflow-fxmacrodata | + +### 1.2 Requirements that shape the design + +- **Component API:** subclass `Component` (`lfx.custom.custom_component.component`). Use inputs from `lfx.io` (`SecretStrInput`, `MessageTextInput`, `IntInput`, `DropdownInput`, `BoolInput`, and so on), `Output`, and the schema types `Data` / `DataFrame` / `Message` (14). Use only symbols listed in `BUNDLE_API.md`: anything else "may move or break between releases" (6). +- **Stability rules:** keep class names and `name` stable. Don't remove fields or outputs; deprecate them or mark components `legacy = True` instead (2). Saved flows key on `ext::@` (7, 14). +- **Prefer async methods** (2). +- **Tool Mode:** add `tool_mode=True` to at least one supported input (`MessageTextInput`, `MultilineInput`, `DropdownInput`, `DataInput`, `DataFrameInput`, `PromptInput`). The user enables Tool Mode in the header and connects the Tool/Toolset output to the Agent's **Tools** port. "Each tool can have multiple actions." Users can edit an action's **Description** and **Slug** and toggle **Enabled**, but **Name** "cannot be changed" (11, 12). +- **Manifest:** `extension.json` (or `[tool.langflow.extension]`) has `id` (convention `lfx-`), SemVer `version`, `name`, `lfx.compat: ["1"]`, and **at most one** bundle (`name` in snake_case, `path` relative). Unknown fields are rejected. There is **no manifest icon field** for bundles (7). +- **Discovery:** an installed distribution with a manifest registers at the `@official` slot. `LANGFLOW_COMPONENTS_PATH` directories register at `@extra`. When bundle names collide, "manifest always wins" (`installed > seed > lfx_bundles > dev > inline`) (14). +- **Python:** `lfx` / `lfx-bundles` require `>=3.10`. This SDK supports `>=3.9`, so it is compatible. +- **Default install (1.12+/1.13):** `uv pip install langflow` installs a curated set of standalones (amazon, anthropic, azure, cohere, datastax, docling, google, ibm, microsoft, ollama, openai, openai-compatible, oracle, slack, toolguard, vllm). Search and extract peers are opt-in: `lfx-bundles[tavily]`, `lfx-bundles[serpapi]`, `lfx-exa`, `lfx-firecrawl`. Users then restart Langflow (5). Diffbot is not listed. +- **Credentials:** component API keys are not Langflow API keys. Store them as Global Variables, either Generic or Credential (both encrypted; Credential is masked). Variables can come from the environment via `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT` and are imported as Credential type, per user. `LANGFLOW_REMOVE_API_KEYS=True` strips keys from stored flow data (8, 9). +- **Upstream contribution:** fork the repo and open the PR against the **active `release-X.Y.Z` branch, not `main`**. Use semantic-commit PR titles (15). Component docs go in `docs/docs/Components/…mdx`. Custom icons need SVG + JSX + `index.tsx`, an entry in `lazyIconImports.ts`, and an entry in `SIDEBAR_BUNDLES` (1, 20). Licensing: the docs don't state a contributor licence requirement. Langflow and all `lfx-*` packages are MIT (22). + +### 1.3 What changed recently (docs vs repo; repo is ground truth) + +- [x] **Bundle location.** `contributing-bundles` still says to add `src/lfx/src/lfx/components//`. On `main`, provider code lives in `src/bundles//` (standalone `lfx-`) or `src/bundles/lfx-bundles/src/lfx_bundles//` (metapackage). `src/lfx/src/lfx/components/tavily/` and `…/exa/` now contain only `__init__.py` shims. +- [x] **Adding to `lfx-bundles`:** "Providers are moved here by `scripts/migrate/consolidate_bundles.py` … Do not hand-edit the extras block" (17). No documented path exists for a brand-new third-party provider to land there by PR. +- [x] **Flow ID format** is `ext::@official` (single colon segments), not `ext::@official`. +- [x] **Test location.** `contributing-component-tests` says `src/backend/tests/unit/components//` with `ComponentTestBase*`. Standalone bundles (for example `src/bundles/exa/tests/test_exa_search_component.py`) use plain pytest that patches the vendor client, with tests shipped next to the bundle. +- [x] **Peer components subclass `Component`** (Tavily, Exa). The docs example subclasses `LCToolComponent`. +- [x] **`lfx extension list` does not enumerate manifest-less `lfx-bundles` providers** (14), although the bundle-list page says to use it to confirm installs. A manifest-shipping `lfx-diffbot` *would* show up. +- [x] **Pin floors drift ahead of stable.** The latest `lfx-exa` 0.2.1 / `lfx-firecrawl` 0.2.1 on PyPI require `lfx>=1.14.0.dev0`, while stable is 1.13.5. The repo's `pyproject.toml` says `lfx>=1.13.0.dev0`. We should pin `lfx>=1.13,<2` and test against stable. +- [x] **Tool output naming** is inconsistent in the docs ("Tool" vs "Toolset"). It's the same port. +- [x] **`LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`** is documented on the Global variables page, not on the Environment variables page. +- [x] **`https://docs.langflow.org/extensions`** (linked from every `lfx-*` PyPI page) returns 404. The working pages are `extensions-quickstart`, `extensions-manifest`, and `extensions-bundle-list`. + +--- + +## 2. Scope + +### 2.1 First ship (v0.1): 9 read-only, synchronous, single-request operations + +| Component (bundle `diffbot`) | Diffbot endpoint | SDK today | +| --- | --- | --- | +| **Diffbot Web Search** | `GET llm.diffbot.com/api/v1/web_search` (`text`, `size`, `snippetLength`, `maxTokens`; Bearer) | `web_search()` βœ… | +| **Diffbot Extract** | `GET api.diffbot.com/v3/{analyze\|article\|product\|discussion\|job\|image\|video\|list\|event}` (`url`, `timeout`); Markdown via `analyze` + `mode=llm` | `extract(url, api, fmt)` βœ… | +| **Diffbot Organization Search** | `POST kg.diffbot.com/kg/v3/dql`, `type:Organization` built from name, homepage, industry, city/country, employee/revenue ranges, public/private | `dql()` βœ… + builder (integration) | +| **Diffbot Organization Enhance** | `GET kg/v3/enhance?type=Organization&name=&url=&location=&size=&threshold=` | ❌ no wrapper | +| **Diffbot Person Search** | DQL `type:Person` from name, employer, title, city/country | `dql()` βœ… + builder | +| **Diffbot Person Enhance** | `GET kg/v3/enhance?type=Person&name=&employer=&title=&email=&url=&location=` | ❌ no wrapper | +| **Diffbot News Search** | DQL `type:Article` from mentions, text, title, publisher, language, since/until | `dql()` βœ… + builder | +| **Diffbot KG Query (DQL)** | `POST kg/v3/dql` with raw query, `size`, `from` | `dql(query, size=, from_=)` βœ… | +| **Diffbot LLM Ask** | `POST llm.diffbot.com/rag/v1/chat/completions` (`diffbot-small-xl`, SSE, optional `response_format` json_schema) | `ask()` / `ask_json()` βœ… | + +Verified in this checkout (`diffbot` 3.4.1): `Diffbot` / `DiffbotAsync` expose `extract`, `ask`, `ask_json`, `web_search`, `dql`, `dql_parallel`, `crawl*`, `account`, `verify_token`, `entities`, `nlp`, ontology helpers, and a public `request()` that uses the client's retry policy and timeout. No `enhance` exists anywhere in `src/diffbot/`. There are no structured DQL builders. + +All 9 are read-only. They suit canvas flows (Data/DataFrame/Message outputs) and Agent Tool Mode. + +### 2.2 Deferred, with reasons + +| Capability | Why deferred | +| --- | --- | +| Crawl (`crawl*`) | Async, multi-minute job lifecycle. A blocking component times out, and Langflow has no job-polling idiom for third-party bundles. Revisit with Langflow triggers (`BaseTriggerComponent`) or as a separate "start/get job" pair. | +| Bulk Enhance | Async job plus polling, the same problem as crawl. | +| Account / usage as an op | Not a workflow step. `verify_token()` may be used internally for a "test connection" affordance later. | +| Ontology fetch as a step | Metadata, not data. The builders may embed field enums at build time instead. | +| NLP / entities | Not in the n8n v0.1 surface. Keep parity first. | +| Streaming Ask tokens into the Playground | v0.1 collects the SSE stream into one `Message`. Token streaming is a v0.2 nicety once we confirm how lfx exposes streaming for non-model components. | +| A single "Diffbot Toolkit" component (Exa-style one node β†’ many actions) | Attractive for agents, but it is a second surface to maintain. Decide after v0.1 usage (open question Q7). | +| Model provider (`providers[]`) registration for Diffbot LLM | The manifest supports it, but it is a different contract (`model_class`, catalog loader). Ask as a component is enough for v0.1. | + +--- + +## 3. Dependency decision: reuse the `diffbot` SDK + +**Decision: depend on `diffbot>=,<4` and use `DiffbotAsync`.** Do not hand-roll HTTP for operations the SDK already covers. + +Why: + +- Langflow lets bundles declare runtime dependencies in `pyproject.toml`. Every peer does this (`exa-py`, `firecrawl-py`, `google-search-results`). n8n's no-dependency constraint does not apply here. +- The SDK already handles the details we'd otherwise duplicate: Bearer vs `token=` auth per host, `snippetLength=FULL` β†’ `rerank=none`, Markdown extract via `mode=llm`, DQL JSON body, SSE parsing and tool-call-leak checks in `ask`, `json_schema_format`, retries, typed errors. +- Langflow says to prefer async (2). `DiffbotAsync` mirrors every method we need. +- Footprint is small: `httpx` (already an lfx dependency), `click`, `rich` (already an lfx dependency). + +Gaps and how to close them: + +| Gap | Decision | +| --- | --- | +| **Enhance (Org, Person)** | **Prerequisite milestone M1:** add a focused `enhance()` to `Diffbot` and `DiffbotAsync` in this repo, covering only the synchronous single-entity `GET /kg/v3/enhance` (type, name, url, location, employer, title, email, size, threshold, plus pass-through extras). Add tests and docs (README example + `tests/test_readme_examples.py` per `CLAUDE.md`), then ship through the usual RC. This fits the policy "expand SDK coverage only when a real integration needs it": two v0.1 operations need it. No bulk enhance. **Fallback** if Andrew declines: the integration calls `DiffbotAsync.request("GET", f"{kg_base}/kg/v3/enhance", params=…)`, the public, retrying transport, so there's still no raw `httpx`. | +| **Structured DQL builders + escaping** | **Live in the integration** (a small `dql_builder` module with its own unit tests). The field-to-DQL mapping is a UX choice specific to this integration, and n8n has its own TypeScript copy. Promote it to the SDK later only if a second Python consumer needs it. | +| **Token resolution** | Pass the token explicitly: `DiffbotAsync(token=)`. **Never** call `resolve_token()` in a component. Its fallback reads `DIFFBOT_API_TOKEN` and `~/.diffbot/credentials` from the *server* process, which leaks one operator's token to every Langflow user. | +| **User-Agent attribution** | The SDK sends `diffbot-python/`. Whether Diffbot wants a `lfx-diffbot/` suffix for usage attribution is open question Q8. If yes, it's a tiny SDK option (also M1), not a fork. | + +--- + +## 4. Component design + +### 4.1 Bundle vs one multi-operation component + +**Recommendation: one `diffbot` bundle with 9 focused components**, not one component with an operation dropdown. + +- Langflow peers split by operation: Tavily has Search + Extract, Firecrawl has Crawl/Map/Scrape/Search, and MrScraper has Account/Scraper/Web Search (17, 20). +- In Tool Mode, a component's `tool_mode=True` inputs become the action's arguments, and the Description/Slug shown to the agent is per action (12). A dropdown-driven mega-component would give the agent one tool with a union of irrelevant arguments. The n8n design hit the same problem and also split by resource and operation. +- Stability rules (2) make reshaping a mega-component's fields costly later. Separate classes can each evolve or go `legacy` on their own. +- The manifest allows only one bundle per distribution (7). One `diffbot` bundle with 9 classes fits exactly. + +### 4.2 Layout (mirrors `src/bundles/exa` and the PORTING.md recipe) + +- Distribution `lfx-diffbot` β†’ import package `lfx_diffbot` β†’ `src/lfx_diffbot/extension.json` (`id: lfx-diffbot`, `name: Diffbot`, `lfx.compat: ["1"]`, `bundles: [{name: diffbot, path: components/diffbot}]`). +- `src/lfx_diffbot/components/diffbot/`: one file per component (`web_search.py`, `extract.py`, `org_search.py`, `org_enhance.py`, `person_search.py`, `person_enhance.py`, `news_search.py`, `dql_query.py`, `llm_ask.py`), plus a shared `_client.py` (build `DiffbotAsync` from the token and map SDK errors to user-readable messages) and `_dql.py` (builders and escaping). +- `pyproject.toml`: hatchling. Dependencies `lfx>=1.13,<2` and `diffbot>=X.Y,<4`. Entry point `[project.entry-points."langflow.extensions"] lfx-diffbot = "lfx_diffbot"`. The wheel includes `extension.json` and `components/**/*.py` (PORTING.md Β§1a warns the bundle is skipped otherwise). `requires-python >=3.10`. +- Class names are permanent IDs: `DiffbotWebSearch`, `DiffbotExtract`, `DiffbotOrganizationSearch`, `DiffbotOrganizationEnhance`, `DiffbotPersonSearch`, `DiffbotPersonEnhance`, `DiffbotNewsSearch`, `DiffbotDqlQuery`, `DiffbotLlmAsk`. + +### 4.3 Auth and credentials + +- Every component has `SecretStrInput(name="api_key", display_name="Diffbot API Token", required=True)`, the same pattern as Tavily (19). `info` text points users to Settings β†’ Global Variables. +- **Recommended setup (README):** create a Global Variable named `DIFFBOT_API_TOKEN`, type **Credential**, and use *Apply To Fields* on "Diffbot API Token". For server or Docker deployments, set `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=DIFFBOT_API_TOKEN` with `DIFFBOT_API_TOKEN` in the container env. Langflow imports it per user as a Credential (8). +- Recommend `LANGFLOW_REMOVE_API_KEYS=True` for shared instances. Tell users to omit keys when exporting flows (9). +- The token is never a `tool_mode` input, so it is never model-visible. +- *To verify in M2:* whether a `SecretStrInput` can default to a global variable name (`load_from_db`-style) through the public BUNDLE_API. The docs don't say. Also whether an upstream PR could add `DIFFBOT_API_TOKEN` to Langflow's auto-imported variable list (`constants.py`, per (8)). That list is upstream-only. + +### 4.4 Inputs, outputs, Tool Mode + +- **Tool-mode inputs** (the agent-facing arguments) are only the natural-language ones. Web Search: `query`. Extract: `url` and optionally the `page_type` dropdown. Org/Person/News search: name/employer/title/text/mentions and a few dropdowns. Enhance: name/url/employer. Ask: `prompt`. Numeric knobs (`size`, `threshold`, `max_tokens`, `timeout`) are `advanced=True` and not tool-mode, to keep agent schemas small. +- **Descriptions are the agent's routing signal** (11). Write them per component, and make them concrete about what Diffbot is better at. Example: "Look up a company in the Diffbot Knowledge Graph by name or website. Returns firmographics." The **DQL Query** description says it expects valid DQL and is for experts. The README recommends leaving it out of agent toolsets, since models write poor DQL. +- **Outputs:** + - Search, Enhance, and DQL produce `Data` (list) and `DataFrame` outputs, as Tavily does. + - Extract produces `Data` plus a `Message` with the Markdown body. + - Ask produces a `Message` (text). With a JSON schema set, it produces `Data`. + - Output methods are `async def` and use `DiffbotAsync` (2). *Verify in M2* that async output methods work under the current `test_latest_version` harness and in Tool Mode. Tavily's methods are sync, so peers don't prove this. +- **Errors:** map `diffbot.errors` to a clear `ValueError` / status message ("Diffbot returned 401: check the Diffbot API Token global variable"). Never echo the token. + +### 4.5 Structured search β†’ DQL (injection-safe) + +- Free-text values become quoted DQL string literals with `\` and `"` escaped. They are never concatenated as raw clauses. Newlines are rejected or normalised. +- Enumerated fields (industry, country, language, public/private, employee/revenue buckets) come from `DropdownInput` with a fixed option list and are validated against it before use. +- Numbers come from `IntInput` and are range-checked. Dates (`since`/`until`) are parsed as ISO-8601 and re-serialised. +- Exact DQL field names (for example `industries`, `location.country.name`, `nbEmployeesMin`, `pageUrl`, `publisher`) are copied from the n8n v0.1 implementation. πŸ…Ή confirms them only if the n8n source and the current ontology disagree. +- Unit tests include hostile inputs: `foo" OR type:Person`, backslashes, unicode, empty. + +### 4.6 Icons + +- **v0.1 (out of tree):** `icon` is a Lucide icon name string (2), for example `"search"`, `"file-text"`, `"building-2"`, `"user"`, `"newspaper"`, `"database"`, `"message-square"`. A branded Diffbot SVG needs SVG + JSX + `index.tsx` in `src/frontend/src/icons/`, an entry in `lazyIconImports.ts`, and a `SIDEBAR_BUNDLES` entry, all in the Langflow core repo (1, 20). The manifest has no icon field (7). +- **Later (M5, Andrew-gated):** an upstream PR adding `Diffbot` to `lazyIconImports.ts` and `{ display_name: "Diffbot", name: "diffbot", icon: "Diffbot" }` to `SIDEBAR_BUNDLES`. Components then switch `icon = "Diffbot"`. Only the `icon` attribute changes, so this is non-breaking. + +### 4.7 Testing + +- **Unit tests (always, offline):** pytest with `DiffbotAsync` patched at the component module, as `lfx-exa`'s tests patch `Exa`. Use `httpx.MockTransport` where SDK-level behaviour matters. Coverage: + - Every component builds (`to_frontend_node()`), and inputs/outputs and `tool_mode` flags are as designed. + - Every output returns non-`None` with mocks. This mirrors Langflow's `test_latest_version` rule that "an output that opens a network connection fails the test" (3). + - DQL builder and escaping table tests. + - Error mapping, and confirmation that the token is never logged. +- **Manifest test:** `lfx extension validate src/lfx_diffbot` in CI (6). This is a static check; do not use `--execute-imports` in CI. +- **Install smoke test (CI, not every push if slow):** build the wheel, install it into a fresh venv with `langflow==1.13.*`, and assert the bundle is discovered (`lfx extension list --format json` contains `diffbot`). +- **Live tests (manual / scheduled, opt-in):** a few calls with a repo secret `DIFFBOT_API_TOKEN`, as in this repo's `live-tests.yml`. Never on PRs from forks. +- **If upstreamed later:** port to `ComponentTestBaseWithoutClient` under the path Langflow assigns, with the `component_class`, `default_kwargs`, and `file_names_mapping` fixtures. Use `skipped_outputs` only where mocking is impractical (3). + +### 4.8 CI (GitHub Actions in the Diffbot-owned repo) + +- `tests.yml` on push and PR: `uv sync --frozen`, ruff, pyright (matching this repo), and pytest on Python 3.10–3.13 against `lfx` 1.13.x. A weekly job runs against the latest `lfx` and the `langflow` pre-release to catch BUNDLE_API drift. +- No full Langflow test suite. The mocks, `extension validate`, and one install smoke test are enough. + +### 4.9 Docs + +- README covering: + - Install: `uv pip install lfx-diffbot`, then restart Langflow. Also Docker (`pip install` in a derived image, or a `LANGFLOW_COMPONENTS_PATH` mount for prototypes). + - Token setup via a Global Variable, the env var, and `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`. + - One section per component. + - **Tool Mode** walkthrough: enable it, connect the Toolset to Agent Tools, edit tool actions, and disable DQL. + - A **starter flow JSON**: Chat Input β†’ Agent with Diffbot Web Search + Extract + Organization Enhance tools β†’ Chat Output. + - Troubleshooting: `lfx extension list`, and `bundle-shadowed` if two copies are installed. +- Link the README from this repo's README only after the first final release (separate PR, Andrew's call). +- If upstreamed: a `docs/docs/Components/bundles-diffbot.mdx` page and a bundle-list entry, following Langflow's docs PR process (2). + +### 4.10 Release and publish + +- Diffbot's usual `release.yml`, copied from this repo: tag-triggered, PyPI **trusted publishing (OIDC)** with no stored token, and a `workflow_dispatch` dry run. +- **RCs:** `0.1.0rc0` β†’ tag `v0.1.0rc0` β†’ PyPI pre-release (`uv pip install --pre lfx-diffbot` or `==0.1.0rc0`) plus a GitHub pre-release. **Final `0.1.0` only after Andrew's go.** +- Version sync check: `pyproject.toml` version == `extension.json` `version` == tag. Add a CI step, because Langflow reads the manifest version separately. +- SemVer: 0.x until the component IDs and fields settle. After 1.0, removing or renaming a field or class is a major bump. Follow the deprecate-don't-remove rule (2). +- Author `Diffbot `. MIT licence, matching this repo and the Langflow ecosystem (confirm, Q2). No paid listing tiers. + +--- + +## 5. Peer comparison (Langflow 1.13) + +| Peer | Package (opt-in) | Shape | HTTP / SDK | Auth input | Icon | Notes | +| --- | --- | --- | --- | --- | --- | --- | +| **Tavily** | `lfx-bundles[tavily]` | 2 components: Search, Extract | raw `httpx`, sync | `SecretStrInput api_key` | custom `TavilyIcon` in core | Data + DataFrame outputs; `query` is the tool-mode input | +| **Exa** | `lfx-exa` (standalone, Langflow-authored) | 1 **toolkit** component β†’ `Tool` output with `search` + `get_contents` actions | `exa-py` SDK | secret input; legacy `metaphor_api_key` kept hidden for old flows | custom `Exa` in core | Tests patch the SDK client; best reference for layout | +| **Firecrawl** | `lfx-firecrawl` (standalone) | 4 components: Crawl, Map, Scrape, Search | `firecrawl-py` SDK | secret input | custom in core | Ships crawl as a blocking component; we defer crawl instead | +| **SerpAPI** | `lfx-bundles[serpapi]` | search component(s) | `google-search-results` | secret input | `SerpSearch` in core | Component count not verified | +| **MrScraper** (closer analogue) | `lfx-bundles[mrscraper]` | 3: Account, Scraper API (HTML/Markdown), Web Search | vendor SDK 0.6.x | secret token | β€” | Vendor-driven redesign removed 7 legacy components: a reminder to get v0.1 IDs right | +| **Serply / SerpingAPI** | `lfx-serply`, `lfx-serpingapi` (standalone) | search | `httpx` only | secret input | β€” | Small standalone `lfx-*` packages, all Langflow-authored | +| **Third-party, out of tree** | e.g. `langflow-fxmacrodata` (source install) | extension bundle | own client | password field backed by a global secret; "credentials are never model-visible tool parameters" | not documented | Shows the Diffbot-owned path in practice | + +Takeaways: split by operation (most peers do). Depend on the vendor SDK (Exa, Firecrawl, SerpAPI, MrScraper do). Use a secret input bound to a global variable. Branded icons only come with a core PR. Every `lfx-*` package we checked on PyPI (exa, firecrawl, duckduckgo, serply, serpingapi, paddle, confluent, nextplaid, empiriolabs, bundles) is authored by Langflow (`contact@langflow.org`). That is why the `lfx-` name for a Diffbot-published package is open question Q2. + +--- + +## 6. Distribution: where the components live + +**Recommendation: (3) a Diffbot-owned extension package on PyPI, laid out exactly like (2).** + +| Option | Verdict | Why | +| --- | --- | --- | +| **3. Diffbot-owned package on PyPI** with `extension.json` and the `langflow.extensions` entry point | βœ… **Primary** | Officially documented for anyone (6): "Build with `python -m build` … `twine upload` … Users install with `pip install lfx-my-extension`." No core PR, no Langflow release coupling, and Diffbot controls fixes and releases. It registers at `@official`, the same slot as Langflow's own bundles, so flows are portable to (2) later. Use the manifest-shipping form, not the manifest-less `lfx.bundles` entry point: `lfx.bundles` is the metapackage mechanism, is invisible to `lfx extension list`, and loses to any manifest package (14). | +| **2. Standalone `lfx-diffbot` hosted in `langflow-ai/langflow` `src/bundles/`** | Later, optional | Gives the official bundle list, a custom icon, and `langflow[bundles]` inclusion. But all 28 standalone bundles live in Langflow's `src/bundles/`, and every `lfx-*` package we checked on PyPI is Langflow-authored and published. Langflow would own releases. There's no documented intake process for new vendors. And it needs an outward PR (Andrew's go). If it happens, keep the bundle name `diffbot`: with "manifest always wins", Diffbot's package and an upstream one would collide as `bundle-shadowed`, so the plan must be **one or the other** (Q5). | +| **1. Upstream into `lfx-bundles`** (`src/lfx_bundles/diffbot/`) | ❌ Not now | Providers are "moved here by `consolidate_bundles.py`"; hand edits are discouraged (17). This tier is for "providers that do not warrant standalone distribution", and Langflow controls the release cadence. The legacy path in `contributing-bundles` (`src/lfx/src/lfx/components//`) is stale (Β§1.3). | +| **4. Custom components only** (`LANGFLOW_COMPONENTS_PATH`, Docker `-v` mount) | Prototype only | Good for M2's spike and for users who can't pip-install. But it registers at `@extra` (different flow IDs from the shipped package), has no dependency management, and has no upgrade path. Document it as a fallback in the README. | +| **5. Langflow Store** (`POST /api/v1/store/components/`, Store API key) | ❌ No | The endpoints exist in `store.py`, but they share individual component *code* with no dependency install and no `@official` identity. That's not the bundle list, and the docs we opened don't present the Store as a provider distribution path. Submitting would also be an outward post needing Andrew's go. | + +**Where the code lives before a repo exists:** do not assume `diffbot/lfx-diffbot` exists. πŸ…° creates it (name per Q2) and configures PyPI trusted publishing. Until then: + +- M1 (SDK `enhance()`) happens in this repo. +- The M2 spike runs locally against a `LANGFLOW_COMPONENTS_PATH` directory, and its findings go back into this plan. +- No integration code lands in `diffbot-python`. Its `release.yml` tags `v*` for the SDK, and mixing two packages would complicate releases. + +--- + +## 7. Phased milestones + +| # | Milestone | Who | Exit criteria | +| --- | --- | --- | --- | +| **M0** | Decisions on Β§8 questions: distribution path, name, v0.1 slice, SDK prerequisite | πŸ…° | Answers recorded in this doc | +| **M1** | **SDK gap-fill:** `Diffbot.enhance()` / `DiffbotAsync.enhance()` (single-entity, sync GET only); README example + `tests/test_readme_examples.py`; optional UA suffix (Q8) | πŸ›  PR in `diffbot-python`; πŸ…° merges; πŸ…° go for RC (`3.5.0rc0`) then final | `diffbot` release on PyPI with `enhance` | +| **M2** | **Spike** (no publish): two components (Web Search, Extract) under `LANGFLOW_COMPONENTS_PATH` on Langflow 1.13.5. Confirm async outputs, Tool Mode action naming, global-variable binding, and `lfx extension validate` / `dev` with a draft manifest | πŸ›  locally | Findings appended to research notes; Β§4 amended if needed | +| **M3** | **Repo + scaffold:** create `diffbot/`, enable Actions, PyPI trusted publisher (pending publisher for a new project), branch protection | πŸ…° creates; πŸ›  scaffolds via PR | `tests.yml` green on empty components; `extension validate` passes | +| **M4** | **v0.1 components:** all 9 (or the Q3 slice), DQL builders + injection tests, README, starter flow | πŸ›  PRs; πŸ…° reviews + merges (no bot merges) | Unit + install-smoke CI green; manual Tool Mode check recorded | +| **M5** | **RC:** `v0.1.0rc0` β†’ PyPI pre-release; smoke test on Langflow 1.13.x (pip + Docker); fix β†’ `rc1`… | πŸ›  prepares; πŸ…° go to tag | RC installs and works in a clean Langflow | +| **M6** | **Final 0.1.0** | πŸ…° go; πŸ›  tags | Published; README linked from SDK README (separate PR) | +| **M7** | *(Optional, gated)* Upstream: issue first, then PR to `langflow-ai/langflow` targeting the active `release-X.Y.Z` branch, adding the Diffbot icon + `SIDEBAR_BUNDLES` entry + bundle-list/docs entry (and, only if Langflow asks, hosting under `src/bundles/diffbot`) | πŸ…° **explicit go required** before any post; πŸ›  drafts | Langflow maintainers' decision | +| β€” | DQL field names / Enhance params disagree with the n8n source or ontology | πŸ…Ή only if triggered | Confirmed field list | + +--- + +## 8. Open questions for Andrew + +1. **Primary distribution path:** approve the Diffbot-owned package (Β§6), with upstream hosting as a later option, or pursue the upstream `src/bundles/diffbot` / `lfx-bundles` route first? +2. **Name, repo, and author:** PyPI `lfx-diffbot` (follows the manifest `id` convention, but every `lfx-*` we checked is Langflow-published, so the prefix may read as "official Langflow") or `langflow-diffbot` (manifest `id` can still be `lfx-diffbot`)? Repo `diffbot/lfx-diffbot`? Author `Diffbot `, MIT? +3. **v0.1 scope:** all 9 operations, or a thinner slice first (Web Search + Extract + Org Enhance, then the rest in 0.2)? +4. **SDK prerequisite:** OK to add a focused `enhance()` to `diffbot` (M1)? Or should the integration use `DiffbotAsync.request()` for Enhance and leave the SDK untouched? +5. **Upstream authorization:** when this plan is accepted, is an issue or PR on `langflow-ai/langflow` authorized (icon + sidebar + docs)? This needs explicit go. If Langflow offers to host `lfx-diffbot` itself, do we hand over publishing or keep it? +6. **Minimum Langflow version:** support 1.13.x only (`lfx>=1.13,<2`), or try 1.12.x (Bundle API 1 exists there, per third-party examples)? +7. **Toolkit component:** also ship an Exa-style "Diffbot Toolkit" (one node exposing several agent actions) in 0.2? +8. **Attribution:** do we want a distinct User-Agent (for example `lfx-diffbot/0.1 diffbot-python/3.5`) for usage analytics? If so, add a UA option in M1. +9. **Docs listing:** after final release, should we ask Langflow to list Diffbot on the bundle-list page even if hosting stays with Diffbot? This is an outward post, gated on Q5. + +--- + +## 9. Recommended first milestone + +**M0 + M1:** Andrew answers Q1–Q4. The implementer then opens a small PR in this repo adding `enhance()` to `Diffbot` and `DiffbotAsync`. It covers single-entity `GET /kg/v3/enhance` for Organization and Person, with mocked tests, a README example, and a matching `tests/test_readme_examples.py` case. It ships as an RC after Andrew's go. This unblocks two of the nine operations, needs no new repo and no outward post, and is useful on its own. The M2 spike can run alongside it, locally, against `LANGFLOW_COMPONENTS_PATH`. diff --git a/docs/plans/langflow-research-notes.md b/docs/plans/langflow-research-notes.md new file mode 100644 index 0000000..bd5a715 --- /dev/null +++ b/docs/plans/langflow-research-notes.md @@ -0,0 +1,62 @@ +# Langflow integration: research notes + +> Companion to [langflow-integration.md](./langflow-integration.md). Collected 2026-12-02. These are raw findings, citations, and things that didn't belong in the plan. "βœ… opened" means the page or file was fetched during this run. Paraphrases are marked; quotes are verbatim from the fetched content. + +## 1. Pages and files opened + +| Source | URL | Status | Key findings | +| --- | --- | --- | --- | +| Contribute bundles | https://docs.langflow.org/contributing-bundles | βœ… (1.13.x) | Old layout `src/lfx/src/lfx/components/`. Icon: SVG + `Icon.jsx` (must spread `{...props}`) + `index.tsx` (uses `useDarkStore`); register in `src/frontend/src/icons/lazyIconImports.ts`; add `{display_name, name, icon}` to `SIDEBAR_BUNDLES` in `src/frontend/src/utils/styleUtils.ts`; set component `icon`. Example subclasses `LCToolComponent`. Build: `make install_frontend && make build_frontend && make install_backend && uv run langflow run --port 7860`. No PR, test, licence, or `lfx-bundles` guidance on the page. Icon folder casing is inconsistent on the page (`DarthVader` vs `darth_vader`). | +| Contribute components | https://docs.langflow.org/contributing-components | βœ… | `from lfx.custom.custom_component.component import Component` (`langflow.custom` still works since 1.7). Class attributes `display_name`, `description`, `documentation`, `icon` (Lucide name string, e.g. `"file-text"`), `priority`, `name`. Keep class name and `name` stable; mark old `legacy = True`; deprecate fields rather than removing them. "Prefer asynchronous methods." Use `aiofile` / `anyio.Path` for files. Docs PR example `docs/docs/Components/components-data.mdx`. PR description should cover what, why, impact, and migration. No licensing statement. | +| Contribute component tests | https://docs.langflow.org/contributing-component-tests | βœ… | Tests go in `src/backend/tests/unit/components//test_.py`, class `Test`, no standalone functions. Base classes `ComponentTestBaseWithClient` / `ComponentTestBaseWithoutClient` from `tests.base` (`src/backend/tests/unit/base.py`). Fixtures `component_class`, `default_kwargs`, `file_names_mapping` (may be empty for new components). `test_latest_version` runs every output offline: "an output that opens a network connection fails the test". Mock it, or use the `skipped_outputs` fixture `{output: reason}`. | +| Custom components | https://docs.langflow.org/components-custom-components | βœ… | Category folders with `__init__.py`; at most 2 levels deep; folder name = menu category. Docker: `-e LANGFLOW_COMPONENTS_PATH=/app/custom_components` plus a `-v` mount. `tool_mode=True` on inputs. No guidance on extra pip deps. `SecretStrInput` not mentioned here. | +| Bundle list | https://docs.langflow.org/extensions-bundle-list | βœ… ("reflects the bundles included with Langflow 1.13.0") | Default curated standalones: amazon, anthropic, azure, cohere, datastax, docling, google, ibm, microsoft, ollama, openai, openai-compatible, oracle, slack, toolguard, vllm. Opt-in: `uv pip install "lfx-bundles[]"`, `uv pip install lfx-`, `uv pip install "langflow[bundles]"`, then restart. tavily and serpapi are `lfx-bundles` extras; exa and firecrawl are standalones. IDs are `ext::@official`. Diffbot is not listed. | +| Build your first extension | https://docs.langflow.org/extensions-quickstart | βœ… (1.13.x) | `lfx extension init my-extension` β†’ `lfx extension validate .` (static; `--execute-imports` only for trusted sources) β†’ `lfx extension dev .` (registers at `@official`) β†’ `lfx extension list --format json` β†’ reload via palette or `lfx extension reload --bundle my_bundle` (local dev "Mode A" only) β†’ `python -m build` + `twine upload dist/*` β†’ users `pip install lfx-my-extension` and `langflow run`. Code should only use the `BUNDLE_API.md` surface. Doesn't say whether the `lfx-` prefix is required or whether third parties may use it. | +| Manifest reference | https://docs.langflow.org/extensions-manifest | βœ… (1.13.x) | Fields: `id` (convention `lfx-`, lowercase-hyphenated, 2–64), `version` (SemVer), `name`, `description`, `lfx.compat` (only `"1"`), `bundles` (≀1; `name` snake_case; `path` relative), `providers`, `capabilities` (`requiresCredentials` default false), `integrations`, `$schema`. Unknown fields rejected. No bundle icon field (only `providers[].metadata.icon`). Error codes include `multi-bundle-deferred-in-this-milestone`, `version-constraint-unsatisfied`, `bundle-path-not-found`. | +| Global variables | https://docs.langflow.org/configuration-global-variables | βœ… | Generic vs Credential, "Langflow encrypts both"; Credential is masked. Apply To Fields. `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=WATSONX_PROJECT_ID,WATSONX_API_KEY` (comma-separated or JSON list); imported as Credential; must exist in the runtime env. Auto-generated globals for names in `constants.py` (e.g. `OPENAI_API_KEY`). `LANGFLOW_STORE_ENVIRONMENT_VARIABLES` (with `LANGFLOW_VARIABLE_STORE=db`) imports for all users at startup and per user at sign-in. Kubernetes secrets option. Session ID fields don't accept Credential variables. Binding is via the Globe icon on text inputs; no code-level mechanism (`load_from_db`) documented. | +| API keys and authentication | https://docs.langflow.org/api-keys-and-authentication | βœ… | Component API keys "aren't Langflow API keys or general application credentials". Store them in global variables or import them from the env. "Langflow only stores the encrypted key value or a secure reference". Deleting a global doesn't revoke the key. `LANGFLOW_REMOVE_API_KEYS=True` omits "API keys and tokens from flow data". | +| Environment variables | https://docs.langflow.org/environment-variables | βœ… (1.13.x) | `LANGFLOW_COMPONENTS_PATH`: "Path to a directory containing custom components". `LANGFLOW_BUNDLE_URLS`: "A list of URLs from which to load custom bundles", supports GitHub URLs, loads *flows* with `LANGFLOW_AUTO_LOGIN=True`. This appears to be the older flow-bundle feature, not extension bundles (not investigated further). `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT` is not on this page. No Store variables. | +| Agents | https://docs.langflow.org/agents | βœ… | Tool Mode from the header menu "makes a component into a tool by modifying the component's inputs". Connect Toolset to the Agent's **Tools** port. A tool description "tells the agent what the tool can do". MCP Tools component for MCP servers. | +| Configure tools for agents | https://docs.langflow.org/agents-tools | βœ… (1.13.x) | Edit tool actions: **Enabled**, **Name** ("cannot be changed"), **Description** (editable), **Slug** (editable snake_case, e.g. `fetch_content`). `tool_mode=True` supported on `DataInput`, `DataFrameInput`, `PromptInput`, `MessageTextInput`, `MultilineInput`, `DropdownInput`. "each tool can have multiple actions (functions) that the agent can call." The docs alternate between "Tool" and "Toolset" output. | +| Configure tools (Next) | https://docs.langflow.org/next/agents-tools | βœ… (1.14.x, "unreleased documentation") | No redirect. Same content as 1.13.x. | +| Extensions index | https://docs.langflow.org/extensions | ❌ 404 | Linked as "Documentation" from every `lfx-*` PyPI page. | +| `BUNDLE_API.md` | https://github.com/langflow-ai/langflow/blob/main/BUNDLE_API.md | βœ… (908 lines) | `BUNDLE_API_VERSION` = 1 in `lfx.extension.manifest`. Surface: `Component`; `lfx.io` inputs including `SecretStrInput`, `ConnectionRefInput`; `Output`; `Data` / `DataFrame` / `Message`; `import_mod`. Slots: `official` (installed pip distributions and seed dirs) and `extra` (`LANGFLOW_COMPONENTS_PATH`). Entry points `langflow.extensions` (manifest) and `lfx.bundles` (manifest-less, each subdir = bundle). Precedence `installed > seed > lfx_bundles > dev > inline`, "manifest always wins", collisions produce `bundle-shadowed`. `lfx extension list` does not enumerate manifest-less providers. No third-party publishing policy stated. | +| `CONTRIBUTING.md` | https://github.com/langflow-ai/langflow/blob/main/CONTRIBUTING.md | βœ… | "Open a GitHub pull request against the active `release-X.Y.Z` release candidate branch. Do not target `main`." Semantic commit PR titles. Links to the bundle, component, test, and template guides. | +| `src/bundles/PORTING.md` | https://github.com/langflow-ai/langflow/blob/main/src/bundles/PORTING.md | βœ… (first ~150 lines) | Standalone layout `src/bundles//{README.md,pyproject.toml,src/lfx_/{__init__.py,extension.json,components//…}}`. DuckDuckGo is the reference. `scripts/migrate/port_bundle.py` automates porting. Pin `lfx>=,<2`. Wheel must include `extension.json` and components or "skip the bundle". Platform-gated deps should be lazily imported. `id` uses a hyphen and the bundle name an underscore: "don't mix them up". | +| `lfx-bundles` README | https://github.com/langflow-ai/langflow/blob/main/src/bundles/lfx-bundles/README.md | βœ… | "Providers are moved here by `scripts/migrate/consolidate_bundles.py` … **Do not** hand-edit the extras block". Folder names lowercase snake_case, 2–64 chars. Starter projects live in `/starter_projects/`. | +| `lfx-exa` source | https://github.com/langflow-ai/langflow/tree/main/src/bundles/exa | βœ… | `pyproject.toml`: `lfx>=1.13.0.dev0,<2.0.0`, `exa-py>=1.14,<3`, `langchain-core`; entry point `lfx-exa = "lfx_exa"`; hatchling 1.31.0; MIT; author Langflow. `extension.json`: `id lfx-exa`, `compat ["1"]`, bundle `exa` at `components/exa`. Component `ExaSearchToolkit(Component)` with icon `ExaSearch` and output `Output(name="tools", method="build_toolkit")` returning a `Tool` with inner `search` / `get_contents` functions. Tests: plain pytest, patch `lfx_exa.components.exa.exa_search.Exa`, "No network access is required." | +| Tavily component | https://github.com/langflow-ai/langflow/blob/main/src/bundles/lfx-bundles/src/lfx_bundles/tavily/tavily_search.py | βœ… | `TavilySearchComponent(Component)`, `icon = "TavilyIcon"`, `SecretStrInput(name="api_key", required=True)`, `MessageTextInput(query, tool_mode=True)`, advanced dropdowns and ints, outputs Data list + `DataFrame`. **Sync** methods using `httpx`. The folder also contains `tavily_extract.py`. | +| Frontend registries | https://github.com/langflow-ai/langflow/blob/main/src/frontend/src/utils/styleUtils.ts and `src/frontend/src/icons/lazyIconImports.ts` | βœ… | `SIDEBAR_BUNDLES` at line ~423 includes `{display_name:"Exa",name:"exa",icon:"Exa"}`, Firecrawl (`FirecrawlCrawlApi`), SerpApi (`SerpSearch`), Tavily (`TavilyIcon`). Icon alias map lists `FirecrawlCrawlApi/MapApi/ScrapeApi/SearchApi` (so 4 Firecrawl components). No Diffbot entry. | +| Store router | https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/api/v1/store.py | βœ… (route list only) | `GET /check/`, `GET /check/api_key`, `POST /components/` (201), `PATCH /components/{id}`, `GET /components/`, `GET /components/{id}`, `GET /tags`, `GET/POST /users/likes…`. No current docs page about the Store was opened. | +| Repo tree | https://api.github.com/repos/langflow-ai/langflow/contents/src/bundles | βœ… | 28 standalone bundle dirs (amazon, anthropic, arxiv, azure, cohere, confluent, datastax, docling, duckduckgo, empiriolabs, exa, firecrawl, google, ibm, microsoft, nextplaid, ollama, openai-compatible, openai, oracle, paddle, serpingapi, serply, slack, toolguard, valkey, vllm) plus `lfx-bundles`, `NIGHTLY.md`, `PORTING.md`. `src/bundles/lfx-bundles/src/lfx_bundles/` has about 70 providers including tavily, serpapi, searchapi, spider, scrapegraph, apify, agentql, mrscraper, perplexity, wikipedia. `src/lfx/src/lfx/components/{tavily,exa}` contain only `__init__.py`. | +| PyPI JSON | `https://pypi.org/pypi//json` | βœ… | `langflow` 1.13.5 (2026-12-01): deps pin the 16 curated `lfx-*`; the `bundles` extra adds `lfx-bundles[all-no-torch]`, arxiv, confluent, duckduckgo, empiriolabs, exa, firecrawl, nextplaid, paddle, serpingapi, serply, valkey. `lfx` 1.13.5. `lfx-bundles` 1.3.15 (2026-12-02), MIT, Python `>=3.10,<3.16`. `lfx-exa` 0.2.1 and `lfx-firecrawl` 0.2.1 (2026-10-21) require `lfx>=1.14.0.dev0` (newer than stable 1.13.5). All `lfx-*` checked have author `Langflow `. **`lfx-diffbot`: 404, name unclaimed.** The PyPI HTML pages for `lfx-exa` / `lfx-firecrawl` failed to render (JS required); the JSON API worked. | +| Third-party example | https://github.com/fxmacrodata/langflow-fxmacrodata | βœ… | Out-of-tree bundle `lfx_fxmacrodata` with a `langflow.extensions` entry point and packaged `extension.json`; "lfx 1.12.1+ and Bundle API 1"; source install only (no PyPI). Credentials via "the component's password field backed by a Langflow global secret"; "Credentials are never model-visible tool parameters"; "Exported component nodes leave the API-key input empty". Validates with `lfx extension validate … --execute-imports` + pytest. | +| Search result (not opened) | https://github.com/ASCIT31/langflow-darkmoon/pull/1 | ⚠️ search snippet only | Claims to repackage a `LANGFLOW_COMPONENTS_PATH` dir as `lfx-darkmoon`, the "officially supported distribution route for third-party providers", shipping "extension.json + component sources + icon". Unverified, and especially unverified whether an out-of-tree icon actually renders. | + +## 2. Diffbot SDK facts (this checkout, `diffbot` 3.4.1) + +- `pyproject.toml`: `name = "diffbot"`, `version = "3.4.1"`, `requires-python = ">=3.9"`, deps `httpx>=0.27`, `click>=8.1`, `rich>=13`. +- `Diffbot.__init__(token, *, timeout=30.0, retry, api_base, kg_base, llm_base, nlp_base, …_url overrides, transport)` raises `ValidationError` on an empty token. `DiffbotAsync` mirrors it. +- Public `request(method, url, *, params, headers, json, …, retryable=True, stream=False)` goes through the retry policy and raises on non-2xx. This is the Enhance fallback. +- Methods: `extract` (default `api="analyze"`, `fmt="markdown"`), `ask` (iterator of text chunks), `ask_json(messages, schema)`, `crawl*`, `dql(query, size=10, from_=0, format="json", …)`, `dql_parallel`, ontology helpers, `web_search(text, num_resultsβ†’size, max_tokensβ†’maxTokens, snippet_lengthβ†’snippetLength; FULL β‡’ rerank=none)`, `account`, `verify_token`, `entities`, `nlp`. +- `grep -ri enhance src/diffbot` only finds a comment in `types.py` ("DQL / Enhance-bulk export formats"). There is **no Enhance wrapper**. +- `resolve_token()` order: explicit β†’ `DIFFBOT_API_TOKEN` β†’ `~/.diffbot/credentials`. Unsuitable for multi-user servers. +- `release.yml`: tag `v*` β†’ verify β†’ sdist/wheel + binaries β†’ PyPI trusted publishing (OIDC) β†’ GitHub release. RCs use a PEP 440 prerelease version and matching tag; the GitHub release is marked prerelease. `workflow_dispatch` is a dry run. +- User-Agent is fixed as `diffbot-python/`; there's no constructor option to extend it. + +## 3. Discrepancies against the task's starting notes + +- The starting notes said bundles register as `ext::@official`. The docs and `BUNDLE_API.md` say `ext::@official`. +- The starting notes said `src/lfx_bundles//`. The full repo path is `src/bundles/lfx-bundles/src/lfx_bundles//`. Standalones are under `src/bundles//`. +- The starting notes didn't mention that upstream PRs target `release-X.Y.Z`, not `main`. +- The starting notes treated Store sharing as an API. Confirmed: endpoints exist in `store.py`. No evidence that it's a provider distribution path. + +## 4. Things not verified (carry into the M2 spike) + +- Whether async `def` output methods pass `test_latest_version`-style checks and work in Tool Mode on 1.13.5. Tavily is sync, and Exa's toolkit method is sync. +- Whether an out-of-tree extension can ship and render a custom SVG icon without a core frontend change. The manifest has no icon field, and the docs only describe the in-tree registry. +- Whether a `SecretStrInput` default can reference a global variable by name through the public API. +- How Tool Mode names and slugs actions for a component with two outputs (for example Data + DataFrame), and whether to set one output as the tool output. +- Whether Langflow has an intake process for new vendor-hosted standalones under `src/bundles/`. Nothing is documented. +- Whether Langflow objects to third parties using the `lfx-` PyPI prefix. Nothing is documented either way; the manifest docs call `lfx-` a "convention". +- SerpAPI component count; MrScraper and Firecrawl auth input names (assumed secret inputs, not opened). From 97214ddec0136e7f7a1131f7c146ccf53570ace4 Mon Sep 17 00:00:00 2001 From: claude-sandbox bot Date: Wed, 2 Dec 2026 21:24:52 +0000 Subject: [PATCH 2/2] You are making a focused change for a pull request. The sandbox harne... Automated change by claude-sandbox (agent: claude, mode: audit, run: 120c2b69-702c-402e-8d7d-5c86bc41ef09). --- docs/plans/langflow-integration.md | 107 ++++++++++++++------------ docs/plans/langflow-research-notes.md | 17 +++- 2 files changed, 71 insertions(+), 53 deletions(-) diff --git a/docs/plans/langflow-integration.md b/docs/plans/langflow-integration.md index 4a939cb..24845e8 100644 --- a/docs/plans/langflow-integration.md +++ b/docs/plans/langflow-integration.md @@ -3,6 +3,7 @@ > **Status:** plan only. Written 2026-12-02. **Audience:** the implementer (πŸ› ) and Andrew (πŸ…°). > This PR adds no code, no scaffold, no package, and no published artifacts. Nothing here has been posted to `langflow-ai/langflow`, PyPI, or the Langflow Store. > Sources, raw findings, and pages that could not be opened: [langflow-research-notes.md](./langflow-research-notes.md). +> **Revised 2026-12-02** after Andrew's decisions (see Β§0.1): v0.1 is 7 components (no Enhance), no SDK change, and the package name is `lfx-diffbot`. Legend: πŸ…° Andrew must act or approve Β· πŸ›  implementer Β· πŸ…Ή Jerome (only where a Diffbot API fact needs confirming) @@ -10,13 +11,22 @@ Legend: πŸ…° Andrew must act or approve Β· πŸ›  implementer Β· πŸ…Ή Jerome (only ## 0. TL;DR -- **Ship a Diffbot-owned Langflow Extension Bundle on PyPI.** Working name `lfx-diffbot`, bundle name `diffbot`. It ships an `extension.json` manifest and registers the `langflow.extensions` entry point. Langflow 1.13 documents this as the normal third-party path: `lfx extension init` β†’ `validate` β†’ `dev` β†’ publish to PyPI β†’ users run `uv pip install lfx-diffbot` and restart. No core PR is needed to ship. +- **Ship a Diffbot-owned Langflow Extension Bundle on PyPI.** Package `lfx-diffbot` (decided), bundle name `diffbot`, published by Diffbot from `diffbot/lfx-diffbot`. It ships an `extension.json` manifest and registers the `langflow.extensions` entry point. Langflow 1.13 documents this as the normal third-party path: `lfx extension init` β†’ `validate` β†’ `dev` β†’ publish to PyPI β†’ users run `uv pip install lfx-diffbot` and restart. No core PR is needed to ship. - **The package layout copies Langflow's own standalone bundles** (`src/bundles/exa`, which is `lfx-exa`). Saved flows then reference `ext:diffbot:@official`. If Langflow later hosts the bundle upstream under the same bundle name, existing flows keep working. -- **v0.1 = the 9 read-only, synchronous n8n operations as 9 focused components in one `diffbot` bundle.** Each component works on the canvas and in Agent **Tool Mode**. Org, Person, and News search build DQL from structured fields with escaping. Raw DQL is the power-user escape hatch. -- **Reuse the official SDK** (`diffbot`, async `DiffbotAsync`) for Web Search, Extract, DQL, and Ask. **Prerequisite:** a focused `enhance()` / `DiffbotAsync.enhance()` addition in this repo (no broader coverage work). The DQL query builders live in the integration, not the SDK. +- **v0.1 = 7 read-only, synchronous components in one `diffbot` bundle:** Web Search, Page Extract, Organization Search, Person Search, News Search, KG DQL Query, LLM Ask. This is the n8n v0.1 surface minus Org/Person Enhance (decided). Each component works on the canvas and in Agent **Tool Mode**. Org, Person, and News search build DQL from structured fields with escaping. Raw DQL is the power-user escape hatch. +- **Reuse the official SDK as-is** (`diffbot` 3.4.x, async `DiffbotAsync`). All 7 operations are covered today by `web_search`, `extract`, `dql`, and `ask` / `ask_json`. **No SDK change is needed.** The structured DQL query builders live in the integration. - **Auth:** a required `SecretStrInput` bound to a Langflow **Global Variable** of type Credential. Env sourcing goes through `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=DIFFBOT_API_TOKEN`. Never use `resolve_token()` or `~/.diffbot/credentials` on a Langflow server. - **Upstream PR to `langflow-ai/langflow` comes later, needs Andrew's explicit go, and is optional.** It would be a branded SVG icon, a `SIDEBAR_BUNDLES` entry, and a docs and bundle-list entry. Do not use the Langflow Store as a distribution channel. -- **Gate:** Andrew creates the repo (proposed `diffbot/lfx-diffbot`) and confirms the name. Until then, milestone 1 (SDK `enhance()`) can proceed in this repo. +- **Gate:** Andrew creates `diffbot/lfx-diffbot` (it does not exist yet) and sets up PyPI trusted publishing. Until then, the M1 spike runs locally against `LANGFLOW_COMPONENTS_PATH`, and its findings go back into this plan. + +### 0.1 Decisions recorded (Andrew, 2026-12-02) + +| Decision | Detail | Reason / evidence | +| --- | --- | --- | +| **Drop Org Enhance and Person Enhance from v0.1** | Ship 7 components: Web Search, Page Extract, Org Search, Person Search, News Search, KG DQL Query, LLM Ask. Revisit only if users ask for enrichment. | Matches Jerome's Nov 17 view that Enhance is "bloat for the LLM" and Dify's scope. No SDK change needed. | +| **Package name `lfx-diffbot`**, published by Diffbot | Author `Diffbot `. Source repo `diffbot/lfx-diffbot` (πŸ…° to create). Manifest `id` `lfx-diffbot`, bundle name `diffbot`. | Langflow's extensions quickstart uses `lfx-`, and the manifest reference calls it the convention (6, 7). The `lfx-` prefix is not reserved for Langflow: `lfx-exa` is published by Langflow itself, but vendors publish their own (`lfx-keenable` by Keenable, `lfx-olostep` by Olostep, `lfx-boldrouter` by BoldRouter) (22). | + +The naming decision means Diffbot publishes the package itself, which is distribution option 3 in Β§6. Andrew confirms this in M0. --- @@ -49,7 +59,7 @@ Current stable: **Langflow 1.13.5 / lfx 1.13.5** (PyPI, uploaded 2026-12-01). Do | 19 | Tavily component (`lfx-bundles`) | https://github.com/langflow-ai/langflow/blob/main/src/bundles/lfx-bundles/src/lfx_bundles/tavily/tavily_search.py | | 20 | `styleUtils.ts` (`SIDEBAR_BUNDLES`) and `lazyIconImports.ts` | https://github.com/langflow-ai/langflow/blob/main/src/frontend/src/utils/styleUtils.ts | | 21 | Store API router | https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/api/v1/store.py | -| 22 | PyPI JSON for `lfx-bundles`, `lfx-exa`, `lfx-firecrawl`, `lfx`, `langflow`, and other `lfx-*` packages | https://pypi.org/pypi/lfx-bundles/json (and so on) | +| 22 | PyPI JSON for `lfx-bundles`, `lfx-exa`, `lfx-firecrawl`, `lfx`, `langflow`, and other `lfx-*` packages, including vendor-published `lfx-keenable`, `lfx-olostep`, `lfx-boldrouter` | https://pypi.org/project/lfx-exa/ (JSON: https://pypi.org/pypi/lfx-exa/json, and so on) | | 23 | Third-party example: `langflow-fxmacrodata` | https://github.com/fxmacrodata/langflow-fxmacrodata | ### 1.2 Requirements that shape the design @@ -82,29 +92,28 @@ Current stable: **Langflow 1.13.5 / lfx 1.13.5** (PyPI, uploaded 2026-12-01). Do ## 2. Scope -### 2.1 First ship (v0.1): 9 read-only, synchronous, single-request operations +### 2.1 First ship (v0.1): 7 read-only, synchronous, single-request operations | Component (bundle `diffbot`) | Diffbot endpoint | SDK today | | --- | --- | --- | | **Diffbot Web Search** | `GET llm.diffbot.com/api/v1/web_search` (`text`, `size`, `snippetLength`, `maxTokens`; Bearer) | `web_search()` βœ… | | **Diffbot Extract** | `GET api.diffbot.com/v3/{analyze\|article\|product\|discussion\|job\|image\|video\|list\|event}` (`url`, `timeout`); Markdown via `analyze` + `mode=llm` | `extract(url, api, fmt)` βœ… | | **Diffbot Organization Search** | `POST kg.diffbot.com/kg/v3/dql`, `type:Organization` built from name, homepage, industry, city/country, employee/revenue ranges, public/private | `dql()` βœ… + builder (integration) | -| **Diffbot Organization Enhance** | `GET kg/v3/enhance?type=Organization&name=&url=&location=&size=&threshold=` | ❌ no wrapper | | **Diffbot Person Search** | DQL `type:Person` from name, employer, title, city/country | `dql()` βœ… + builder | -| **Diffbot Person Enhance** | `GET kg/v3/enhance?type=Person&name=&employer=&title=&email=&url=&location=` | ❌ no wrapper | | **Diffbot News Search** | DQL `type:Article` from mentions, text, title, publisher, language, since/until | `dql()` βœ… + builder | | **Diffbot KG Query (DQL)** | `POST kg/v3/dql` with raw query, `size`, `from` | `dql(query, size=, from_=)` βœ… | | **Diffbot LLM Ask** | `POST llm.diffbot.com/rag/v1/chat/completions` (`diffbot-small-xl`, SSE, optional `response_format` json_schema) | `ask()` / `ask_json()` βœ… | -Verified in this checkout (`diffbot` 3.4.1): `Diffbot` / `DiffbotAsync` expose `extract`, `ask`, `ask_json`, `web_search`, `dql`, `dql_parallel`, `crawl*`, `account`, `verify_token`, `entities`, `nlp`, ontology helpers, and a public `request()` that uses the client's retry policy and timeout. No `enhance` exists anywhere in `src/diffbot/`. There are no structured DQL builders. +Verified in this checkout (`diffbot` 3.4.1): `Diffbot` / `DiffbotAsync` expose `extract`, `ask`, `ask_json`, `web_search`, `dql`, `dql_parallel`, `crawl*`, `account`, `verify_token`, `entities`, `nlp`, ontology helpers, and a public `request()` that uses the client's retry policy and timeout. There are no structured DQL builders. There is no `enhance` wrapper either, which no longer matters because v0.1 has no Enhance component. -All 9 are read-only. They suit canvas flows (Data/DataFrame/Message outputs) and Agent Tool Mode. +All 7 are read-only. They suit canvas flows (Data/DataFrame/Message outputs) and Agent Tool Mode. ### 2.2 Deferred, with reasons | Capability | Why deferred | | --- | --- | | Crawl (`crawl*`) | Async, multi-minute job lifecycle. A blocking component times out, and Langflow has no job-polling idiom for third-party bundles. Revisit with Langflow triggers (`BaseTriggerComponent`) or as a separate "start/get job" pair. | +| Organization Enhance, Person Enhance | **Dropped from v0.1 by Andrew (2026-12-02).** Jerome (Nov 17) considers Enhance "bloat for the LLM", and it is outside Dify's scope. Org/Person Search already find entities by name or website. Revisit only if users ask for enrichment. If it comes back, it would need either an SDK `enhance()` or a call through `DiffbotAsync.request()`; decide then. | | Bulk Enhance | Async job plus polling, the same problem as crawl. | | Account / usage as an op | Not a workflow step. `verify_token()` may be used internally for a "test connection" affordance later. | | Ontology fetch as a step | Metadata, not data. The builders may embed field enums at build time instead. | @@ -117,7 +126,7 @@ All 9 are read-only. They suit canvas flows (Data/DataFrame/Message outputs) and ## 3. Dependency decision: reuse the `diffbot` SDK -**Decision: depend on `diffbot>=,<4` and use `DiffbotAsync`.** Do not hand-roll HTTP for operations the SDK already covers. +**Decision: depend on `diffbot>=3.4.1,<4` and use `DiffbotAsync`.** Do not hand-roll HTTP. The SDK already covers every v0.1 operation, so the integration needs no SDK release. Why: @@ -130,10 +139,9 @@ Gaps and how to close them: | Gap | Decision | | --- | --- | -| **Enhance (Org, Person)** | **Prerequisite milestone M1:** add a focused `enhance()` to `Diffbot` and `DiffbotAsync` in this repo, covering only the synchronous single-entity `GET /kg/v3/enhance` (type, name, url, location, employer, title, email, size, threshold, plus pass-through extras). Add tests and docs (README example + `tests/test_readme_examples.py` per `CLAUDE.md`), then ship through the usual RC. This fits the policy "expand SDK coverage only when a real integration needs it": two v0.1 operations need it. No bulk enhance. **Fallback** if Andrew declines: the integration calls `DiffbotAsync.request("GET", f"{kg_base}/kg/v3/enhance", params=…)`, the public, retrying transport, so there's still no raw `httpx`. | | **Structured DQL builders + escaping** | **Live in the integration** (a small `dql_builder` module with its own unit tests). The field-to-DQL mapping is a UX choice specific to this integration, and n8n has its own TypeScript copy. Promote it to the SDK later only if a second Python consumer needs it. | | **Token resolution** | Pass the token explicitly: `DiffbotAsync(token=)`. **Never** call `resolve_token()` in a component. Its fallback reads `DIFFBOT_API_TOKEN` and `~/.diffbot/credentials` from the *server* process, which leaks one operator's token to every Langflow user. | -| **User-Agent attribution** | The SDK sends `diffbot-python/`. Whether Diffbot wants a `lfx-diffbot/` suffix for usage attribution is open question Q8. If yes, it's a tiny SDK option (also M1), not a fork. | +| **User-Agent attribution** | The SDK sends `diffbot-python/`, and v0.1 ships with that. Whether Diffbot wants a `lfx-diffbot/` suffix for usage attribution is open question Q8. If yes, it's a small, separate SDK option that doesn't block v0.1. | --- @@ -141,19 +149,19 @@ Gaps and how to close them: ### 4.1 Bundle vs one multi-operation component -**Recommendation: one `diffbot` bundle with 9 focused components**, not one component with an operation dropdown. +**Recommendation: one `diffbot` bundle with 7 focused components**, not one component with an operation dropdown. - Langflow peers split by operation: Tavily has Search + Extract, Firecrawl has Crawl/Map/Scrape/Search, and MrScraper has Account/Scraper/Web Search (17, 20). - In Tool Mode, a component's `tool_mode=True` inputs become the action's arguments, and the Description/Slug shown to the agent is per action (12). A dropdown-driven mega-component would give the agent one tool with a union of irrelevant arguments. The n8n design hit the same problem and also split by resource and operation. - Stability rules (2) make reshaping a mega-component's fields costly later. Separate classes can each evolve or go `legacy` on their own. -- The manifest allows only one bundle per distribution (7). One `diffbot` bundle with 9 classes fits exactly. +- The manifest allows only one bundle per distribution (7). One `diffbot` bundle with 7 classes fits exactly. ### 4.2 Layout (mirrors `src/bundles/exa` and the PORTING.md recipe) - Distribution `lfx-diffbot` β†’ import package `lfx_diffbot` β†’ `src/lfx_diffbot/extension.json` (`id: lfx-diffbot`, `name: Diffbot`, `lfx.compat: ["1"]`, `bundles: [{name: diffbot, path: components/diffbot}]`). -- `src/lfx_diffbot/components/diffbot/`: one file per component (`web_search.py`, `extract.py`, `org_search.py`, `org_enhance.py`, `person_search.py`, `person_enhance.py`, `news_search.py`, `dql_query.py`, `llm_ask.py`), plus a shared `_client.py` (build `DiffbotAsync` from the token and map SDK errors to user-readable messages) and `_dql.py` (builders and escaping). -- `pyproject.toml`: hatchling. Dependencies `lfx>=1.13,<2` and `diffbot>=X.Y,<4`. Entry point `[project.entry-points."langflow.extensions"] lfx-diffbot = "lfx_diffbot"`. The wheel includes `extension.json` and `components/**/*.py` (PORTING.md Β§1a warns the bundle is skipped otherwise). `requires-python >=3.10`. -- Class names are permanent IDs: `DiffbotWebSearch`, `DiffbotExtract`, `DiffbotOrganizationSearch`, `DiffbotOrganizationEnhance`, `DiffbotPersonSearch`, `DiffbotPersonEnhance`, `DiffbotNewsSearch`, `DiffbotDqlQuery`, `DiffbotLlmAsk`. +- `src/lfx_diffbot/components/diffbot/`: one file per component (`web_search.py`, `extract.py`, `org_search.py`, `person_search.py`, `news_search.py`, `dql_query.py`, `llm_ask.py`), plus a shared `_client.py` (build `DiffbotAsync` from the token and map SDK errors to user-readable messages) and `_dql.py` (builders and escaping). +- `pyproject.toml`: hatchling. Dependencies `lfx>=1.13,<2` and `diffbot>=3.4.1,<4`. Authors `Diffbot `. Entry point `[project.entry-points."langflow.extensions"] lfx-diffbot = "lfx_diffbot"`. The wheel includes `extension.json` and `components/**/*.py` (PORTING.md Β§1a warns the bundle is skipped otherwise). `requires-python >=3.10`. +- Class names are permanent IDs: `DiffbotWebSearch`, `DiffbotExtract`, `DiffbotOrganizationSearch`, `DiffbotPersonSearch`, `DiffbotNewsSearch`, `DiffbotDqlQuery`, `DiffbotLlmAsk`. If Enhance returns later, it gets new classes (`DiffbotOrganizationEnhance`, `DiffbotPersonEnhance`), and none of these change. ### 4.3 Auth and credentials @@ -161,17 +169,17 @@ Gaps and how to close them: - **Recommended setup (README):** create a Global Variable named `DIFFBOT_API_TOKEN`, type **Credential**, and use *Apply To Fields* on "Diffbot API Token". For server or Docker deployments, set `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=DIFFBOT_API_TOKEN` with `DIFFBOT_API_TOKEN` in the container env. Langflow imports it per user as a Credential (8). - Recommend `LANGFLOW_REMOVE_API_KEYS=True` for shared instances. Tell users to omit keys when exporting flows (9). - The token is never a `tool_mode` input, so it is never model-visible. -- *To verify in M2:* whether a `SecretStrInput` can default to a global variable name (`load_from_db`-style) through the public BUNDLE_API. The docs don't say. Also whether an upstream PR could add `DIFFBOT_API_TOKEN` to Langflow's auto-imported variable list (`constants.py`, per (8)). That list is upstream-only. +- *To verify in the M1 spike:* whether a `SecretStrInput` can default to a global variable name (`load_from_db`-style) through the public BUNDLE_API. The docs don't say. Also whether an upstream PR could add `DIFFBOT_API_TOKEN` to Langflow's auto-imported variable list (`constants.py`, per (8)). That list is upstream-only. ### 4.4 Inputs, outputs, Tool Mode -- **Tool-mode inputs** (the agent-facing arguments) are only the natural-language ones. Web Search: `query`. Extract: `url` and optionally the `page_type` dropdown. Org/Person/News search: name/employer/title/text/mentions and a few dropdowns. Enhance: name/url/employer. Ask: `prompt`. Numeric knobs (`size`, `threshold`, `max_tokens`, `timeout`) are `advanced=True` and not tool-mode, to keep agent schemas small. -- **Descriptions are the agent's routing signal** (11). Write them per component, and make them concrete about what Diffbot is better at. Example: "Look up a company in the Diffbot Knowledge Graph by name or website. Returns firmographics." The **DQL Query** description says it expects valid DQL and is for experts. The README recommends leaving it out of agent toolsets, since models write poor DQL. +- **Tool-mode inputs** (the agent-facing arguments) are only the natural-language ones. Web Search: `query`. Extract: `url` and optionally the `page_type` dropdown. Org/Person/News search: name/homepage/employer/title/text/mentions and a few dropdowns. Ask: `prompt`. Numeric knobs (`size`, `from`, `max_tokens`, `timeout`) are `advanced=True` and not tool-mode, to keep agent schemas small. +- **Descriptions are the agent's routing signal** (11). Write them per component, and make them concrete about what Diffbot is better at. Example: "Find companies in the Diffbot Knowledge Graph by name, website, industry, location, or size. Returns firmographics." The **DQL Query** description says it expects valid DQL and is for experts. The README recommends leaving it out of agent toolsets, since models write poor DQL. - **Outputs:** - - Search, Enhance, and DQL produce `Data` (list) and `DataFrame` outputs, as Tavily does. + - Search and DQL produce `Data` (list) and `DataFrame` outputs, as Tavily does. - Extract produces `Data` plus a `Message` with the Markdown body. - Ask produces a `Message` (text). With a JSON schema set, it produces `Data`. - - Output methods are `async def` and use `DiffbotAsync` (2). *Verify in M2* that async output methods work under the current `test_latest_version` harness and in Tool Mode. Tavily's methods are sync, so peers don't prove this. + - Output methods are `async def` and use `DiffbotAsync` (2). *Verify in the M1 spike* that async output methods work under the current `test_latest_version` harness and in Tool Mode. Tavily's methods are sync, so peers don't prove this. - **Errors:** map `diffbot.errors` to a clear `ValueError` / status message ("Diffbot returned 401: check the Diffbot API Token global variable"). Never echo the token. ### 4.5 Structured search β†’ DQL (injection-safe) @@ -185,7 +193,7 @@ Gaps and how to close them: ### 4.6 Icons - **v0.1 (out of tree):** `icon` is a Lucide icon name string (2), for example `"search"`, `"file-text"`, `"building-2"`, `"user"`, `"newspaper"`, `"database"`, `"message-square"`. A branded Diffbot SVG needs SVG + JSX + `index.tsx` in `src/frontend/src/icons/`, an entry in `lazyIconImports.ts`, and a `SIDEBAR_BUNDLES` entry, all in the Langflow core repo (1, 20). The manifest has no icon field (7). -- **Later (M5, Andrew-gated):** an upstream PR adding `Diffbot` to `lazyIconImports.ts` and `{ display_name: "Diffbot", name: "diffbot", icon: "Diffbot" }` to `SIDEBAR_BUNDLES`. Components then switch `icon = "Diffbot"`. Only the `icon` attribute changes, so this is non-breaking. +- **Later (M6, Andrew-gated):** an upstream PR adding `Diffbot` to `lazyIconImports.ts` and `{ display_name: "Diffbot", name: "diffbot", icon: "Diffbot" }` to `SIDEBAR_BUNDLES`. Components then switch `icon = "Diffbot"`. Only the `icon` attribute changes, so this is non-breaking. ### 4.7 Testing @@ -211,7 +219,7 @@ Gaps and how to close them: - Token setup via a Global Variable, the env var, and `LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT`. - One section per component. - **Tool Mode** walkthrough: enable it, connect the Toolset to Agent Tools, edit tool actions, and disable DQL. - - A **starter flow JSON**: Chat Input β†’ Agent with Diffbot Web Search + Extract + Organization Enhance tools β†’ Chat Output. + - A **starter flow JSON**: Chat Input β†’ Agent with Diffbot Web Search + Extract + Organization Search tools β†’ Chat Output. - Troubleshooting: `lfx extension list`, and `bundle-shadowed` if two copies are installed. - Link the README from this repo's README only after the first final release (separate PR, Andrew's call). - If upstreamed: a `docs/docs/Components/bundles-diffbot.mdx` page and a bundle-list entry, following Langflow's docs PR process (2). @@ -222,7 +230,7 @@ Gaps and how to close them: - **RCs:** `0.1.0rc0` β†’ tag `v0.1.0rc0` β†’ PyPI pre-release (`uv pip install --pre lfx-diffbot` or `==0.1.0rc0`) plus a GitHub pre-release. **Final `0.1.0` only after Andrew's go.** - Version sync check: `pyproject.toml` version == `extension.json` `version` == tag. Add a CI step, because Langflow reads the manifest version separately. - SemVer: 0.x until the component IDs and fields settle. After 1.0, removing or renaming a field or class is a major bump. Follow the deprecate-don't-remove rule (2). -- Author `Diffbot `. MIT licence, matching this repo and the Langflow ecosystem (confirm, Q2). No paid listing tiers. +- Package `lfx-diffbot`, author `Diffbot ` (decided). Published from `diffbot/lfx-diffbot`. MIT licence, matching this repo and the Langflow ecosystem (confirm, Q2). No paid listing tiers. --- @@ -235,29 +243,30 @@ Gaps and how to close them: | **Firecrawl** | `lfx-firecrawl` (standalone) | 4 components: Crawl, Map, Scrape, Search | `firecrawl-py` SDK | secret input | custom in core | Ships crawl as a blocking component; we defer crawl instead | | **SerpAPI** | `lfx-bundles[serpapi]` | search component(s) | `google-search-results` | secret input | `SerpSearch` in core | Component count not verified | | **MrScraper** (closer analogue) | `lfx-bundles[mrscraper]` | 3: Account, Scraper API (HTML/Markdown), Web Search | vendor SDK 0.6.x | secret token | β€” | Vendor-driven redesign removed 7 legacy components: a reminder to get v0.1 IDs right | -| **Serply / SerpingAPI** | `lfx-serply`, `lfx-serpingapi` (standalone) | search | `httpx` only | secret input | β€” | Small standalone `lfx-*` packages, all Langflow-authored | +| **Serply / SerpingAPI** | `lfx-serply`, `lfx-serpingapi` (standalone) | search | `httpx` only | secret input | β€” | Small standalone `lfx-*` packages, Langflow-authored | +| **Vendor-published `lfx-*`** | `lfx-keenable` (Keenable, repo `keenableai/lfx-keenable`), `lfx-olostep` (Olostep, repo `olostep-api/lfx-olostep`), `lfx-boldrouter` (BoldRouter) | extension bundles | own clients | not inspected | not inspected | **Closest model for Diffbot:** vendor-owned repo, vendor-published `lfx-` on PyPI. Only PyPI metadata checked. | | **Third-party, out of tree** | e.g. `langflow-fxmacrodata` (source install) | extension bundle | own client | password field backed by a global secret; "credentials are never model-visible tool parameters" | not documented | Shows the Diffbot-owned path in practice | -Takeaways: split by operation (most peers do). Depend on the vendor SDK (Exa, Firecrawl, SerpAPI, MrScraper do). Use a secret input bound to a global variable. Branded icons only come with a core PR. Every `lfx-*` package we checked on PyPI (exa, firecrawl, duckduckgo, serply, serpingapi, paddle, confluent, nextplaid, empiriolabs, bundles) is authored by Langflow (`contact@langflow.org`). That is why the `lfx-` name for a Diffbot-published package is open question Q2. +Takeaways: split by operation (most peers do). Depend on the vendor SDK (Exa, Firecrawl, SerpAPI, MrScraper do). Use a secret input bound to a global variable. Branded icons only come with a core PR. The `lfx-` prefix is shared: Langflow publishes the packages in its own repo (exa, firecrawl, duckduckgo, serply, and others, author `contact@langflow.org`), and vendors publish their own (keenable, olostep, boldrouter). That supports the decided name `lfx-diffbot`. --- ## 6. Distribution: where the components live -**Recommendation: (3) a Diffbot-owned extension package on PyPI, laid out exactly like (2).** +**Recommendation: (3) a Diffbot-owned extension package on PyPI, laid out exactly like (2).** The naming decision (Β§0.1) puts this into practice: `lfx-diffbot`, published by Diffbot from `diffbot/lfx-diffbot`. | Option | Verdict | Why | | --- | --- | --- | -| **3. Diffbot-owned package on PyPI** with `extension.json` and the `langflow.extensions` entry point | βœ… **Primary** | Officially documented for anyone (6): "Build with `python -m build` … `twine upload` … Users install with `pip install lfx-my-extension`." No core PR, no Langflow release coupling, and Diffbot controls fixes and releases. It registers at `@official`, the same slot as Langflow's own bundles, so flows are portable to (2) later. Use the manifest-shipping form, not the manifest-less `lfx.bundles` entry point: `lfx.bundles` is the metapackage mechanism, is invisible to `lfx extension list`, and loses to any manifest package (14). | -| **2. Standalone `lfx-diffbot` hosted in `langflow-ai/langflow` `src/bundles/`** | Later, optional | Gives the official bundle list, a custom icon, and `langflow[bundles]` inclusion. But all 28 standalone bundles live in Langflow's `src/bundles/`, and every `lfx-*` package we checked on PyPI is Langflow-authored and published. Langflow would own releases. There's no documented intake process for new vendors. And it needs an outward PR (Andrew's go). If it happens, keep the bundle name `diffbot`: with "manifest always wins", Diffbot's package and an upstream one would collide as `bundle-shadowed`, so the plan must be **one or the other** (Q5). | +| **3. Diffbot-owned package on PyPI** with `extension.json` and the `langflow.extensions` entry point | βœ… **Primary** | Officially documented for anyone (6): "Build with `python -m build` … `twine upload` … Users install with `pip install lfx-my-extension`." Vendors already do this under the `lfx-` prefix (`lfx-keenable`, `lfx-olostep`, `lfx-boldrouter`). No core PR, no Langflow release coupling, and Diffbot controls fixes and releases. It registers at `@official`, the same slot as Langflow's own bundles, so flows are portable to (2) later. Use the manifest-shipping form, not the manifest-less `lfx.bundles` entry point: `lfx.bundles` is the metapackage mechanism, is invisible to `lfx extension list`, and loses to any manifest package (14). | +| **2. Standalone `lfx-diffbot` hosted in `langflow-ai/langflow` `src/bundles/`** | Later, optional | Gives the official bundle list, a custom icon, and `langflow[bundles]` inclusion. But the 28 standalones in Langflow's `src/bundles/` are Langflow-authored and published, so Langflow would own releases. There's no documented intake process for new vendors. And it needs an outward PR (Andrew's go). If it happens, keep the bundle name `diffbot`: with "manifest always wins", Diffbot's package and an upstream one would collide as `bundle-shadowed`, so the plan must be **one or the other** (Q5). | | **1. Upstream into `lfx-bundles`** (`src/lfx_bundles/diffbot/`) | ❌ Not now | Providers are "moved here by `consolidate_bundles.py`"; hand edits are discouraged (17). This tier is for "providers that do not warrant standalone distribution", and Langflow controls the release cadence. The legacy path in `contributing-bundles` (`src/lfx/src/lfx/components//`) is stale (Β§1.3). | -| **4. Custom components only** (`LANGFLOW_COMPONENTS_PATH`, Docker `-v` mount) | Prototype only | Good for M2's spike and for users who can't pip-install. But it registers at `@extra` (different flow IDs from the shipped package), has no dependency management, and has no upgrade path. Document it as a fallback in the README. | +| **4. Custom components only** (`LANGFLOW_COMPONENTS_PATH`, Docker `-v` mount) | Prototype only | Good for the M1 spike and for users who can't pip-install. But it registers at `@extra` (different flow IDs from the shipped package), has no dependency management, and has no upgrade path. Document it as a fallback in the README. | | **5. Langflow Store** (`POST /api/v1/store/components/`, Store API key) | ❌ No | The endpoints exist in `store.py`, but they share individual component *code* with no dependency install and no `@official` identity. That's not the bundle list, and the docs we opened don't present the Store as a provider distribution path. Submitting would also be an outward post needing Andrew's go. | -**Where the code lives before a repo exists:** do not assume `diffbot/lfx-diffbot` exists. πŸ…° creates it (name per Q2) and configures PyPI trusted publishing. Until then: +**Where the code lives before the repo exists:** `diffbot/lfx-diffbot` is the decided repo, but it does not exist yet. πŸ…° creates it and configures PyPI trusted publishing. Until then: -- M1 (SDK `enhance()`) happens in this repo. -- The M2 spike runs locally against a `LANGFLOW_COMPONENTS_PATH` directory, and its findings go back into this plan. +- No SDK work is needed. v0.1 has no `diffbot-python` prerequisite. +- The M1 spike runs locally against a `LANGFLOW_COMPONENTS_PATH` directory, and its findings go back into this plan. - No integration code lands in `diffbot-python`. Its `release.yml` tags `v*` for the SDK, and mixing two packages would complicate releases. --- @@ -266,32 +275,32 @@ Takeaways: split by operation (most peers do). Depend on the vendor SDK (Exa, Fi | # | Milestone | Who | Exit criteria | | --- | --- | --- | --- | -| **M0** | Decisions on Β§8 questions: distribution path, name, v0.1 slice, SDK prerequisite | πŸ…° | Answers recorded in this doc | -| **M1** | **SDK gap-fill:** `Diffbot.enhance()` / `DiffbotAsync.enhance()` (single-entity, sync GET only); README example + `tests/test_readme_examples.py`; optional UA suffix (Q8) | πŸ›  PR in `diffbot-python`; πŸ…° merges; πŸ…° go for RC (`3.5.0rc0`) then final | `diffbot` release on PyPI with `enhance` | -| **M2** | **Spike** (no publish): two components (Web Search, Extract) under `LANGFLOW_COMPONENTS_PATH` on Langflow 1.13.5. Confirm async outputs, Tool Mode action naming, global-variable binding, and `lfx extension validate` / `dev` with a draft manifest | πŸ›  locally | Findings appended to research notes; Β§4 amended if needed | -| **M3** | **Repo + scaffold:** create `diffbot/`, enable Actions, PyPI trusted publisher (pending publisher for a new project), branch protection | πŸ…° creates; πŸ›  scaffolds via PR | `tests.yml` green on empty components; `extension validate` passes | -| **M4** | **v0.1 components:** all 9 (or the Q3 slice), DQL builders + injection tests, README, starter flow | πŸ›  PRs; πŸ…° reviews + merges (no bot merges) | Unit + install-smoke CI green; manual Tool Mode check recorded | -| **M5** | **RC:** `v0.1.0rc0` β†’ PyPI pre-release; smoke test on Langflow 1.13.x (pip + Docker); fix β†’ `rc1`… | πŸ›  prepares; πŸ…° go to tag | RC installs and works in a clean Langflow | -| **M6** | **Final 0.1.0** | πŸ…° go; πŸ›  tags | Published; README linked from SDK README (separate PR) | -| **M7** | *(Optional, gated)* Upstream: issue first, then PR to `langflow-ai/langflow` targeting the active `release-X.Y.Z` branch, adding the Diffbot icon + `SIDEBAR_BUNDLES` entry + bundle-list/docs entry (and, only if Langflow asks, hosting under `src/bundles/diffbot`) | πŸ…° **explicit go required** before any post; πŸ›  drafts | Langflow maintainers' decision | -| β€” | DQL field names / Enhance params disagree with the n8n source or ontology | πŸ…Ή only if triggered | Confirmed field list | +| **M0** | Remaining Β§8 decisions: confirm distribution path (Q1), upstream authorization (Q5), minimum Langflow version (Q6). Scope, name, and the no-SDK-prerequisite question are already decided (Β§0.1). | πŸ…° | Answers recorded in this doc | +| **M1** | **Spike** (no publish): two components (Web Search, Extract) under `LANGFLOW_COMPONENTS_PATH` on Langflow 1.13.5. Confirm async outputs, Tool Mode action naming, global-variable binding, and `lfx extension validate` / `dev` with a draft `lfx-diffbot` manifest | πŸ›  locally | Findings appended to research notes; Β§4 amended if needed | +| **M2** | **Repo + scaffold:** create `diffbot/lfx-diffbot`, enable Actions, PyPI trusted publisher (pending publisher for the new `lfx-diffbot` project), branch protection | πŸ…° creates; πŸ›  scaffolds via PR | `tests.yml` green on empty components; `extension validate` passes | +| **M3** | **v0.1 components:** the 7 components, DQL builders + injection tests, README, starter flow | πŸ›  PRs; πŸ…° reviews + merges (no bot merges) | Unit + install-smoke CI green; manual Tool Mode check recorded | +| **M4** | **RC:** `v0.1.0rc0` β†’ PyPI pre-release; smoke test on Langflow 1.13.x (pip + Docker); fix β†’ `rc1`… | πŸ›  prepares; πŸ…° go to tag | RC installs and works in a clean Langflow | +| **M5** | **Final 0.1.0** | πŸ…° go; πŸ›  tags | Published; README linked from SDK README (separate PR) | +| **M6** | *(Optional, gated)* Upstream: issue first, then PR to `langflow-ai/langflow` targeting the active `release-X.Y.Z` branch, adding the Diffbot icon + `SIDEBAR_BUNDLES` entry + bundle-list/docs entry (and, only if Langflow asks, hosting under `src/bundles/diffbot`) | πŸ…° **explicit go required** before any post; πŸ›  drafts | Langflow maintainers' decision | +| β€” | DQL field names disagree with the n8n source or ontology | πŸ…Ή only if triggered | Confirmed field list | --- ## 8. Open questions for Andrew 1. **Primary distribution path:** approve the Diffbot-owned package (Β§6), with upstream hosting as a later option, or pursue the upstream `src/bundles/diffbot` / `lfx-bundles` route first? -2. **Name, repo, and author:** PyPI `lfx-diffbot` (follows the manifest `id` convention, but every `lfx-*` we checked is Langflow-published, so the prefix may read as "official Langflow") or `langflow-diffbot` (manifest `id` can still be `lfx-diffbot`)? Repo `diffbot/lfx-diffbot`? Author `Diffbot `, MIT? -3. **v0.1 scope:** all 9 operations, or a thinner slice first (Web Search + Extract + Org Enhance, then the rest in 0.2)? -4. **SDK prerequisite:** OK to add a focused `enhance()` to `diffbot` (M1)? Or should the integration use `DiffbotAsync.request()` for Enhance and leave the SDK untouched? + *Implied by the naming decision (Diffbot publishes `lfx-diffbot`); confirm in M0.* +2. ~~**Name, repo, and author.**~~ **Closed 2026-12-02:** `lfx-diffbot`, published by Diffbot (`Diffbot `) from `diffbot/lfx-diffbot`. Still open: confirm MIT licence. +3. ~~**v0.1 scope.**~~ **Closed 2026-12-02:** 7 components, no Org/Person Enhance (Β§0.1). +4. ~~**SDK prerequisite (`enhance()`).**~~ **Closed 2026-12-02:** not needed. Enhance is out of v0.1, and the SDK covers the other operations. 5. **Upstream authorization:** when this plan is accepted, is an issue or PR on `langflow-ai/langflow` authorized (icon + sidebar + docs)? This needs explicit go. If Langflow offers to host `lfx-diffbot` itself, do we hand over publishing or keep it? 6. **Minimum Langflow version:** support 1.13.x only (`lfx>=1.13,<2`), or try 1.12.x (Bundle API 1 exists there, per third-party examples)? 7. **Toolkit component:** also ship an Exa-style "Diffbot Toolkit" (one node exposing several agent actions) in 0.2? -8. **Attribution:** do we want a distinct User-Agent (for example `lfx-diffbot/0.1 diffbot-python/3.5`) for usage analytics? If so, add a UA option in M1. +8. **Attribution:** do we want a distinct User-Agent (for example `lfx-diffbot/0.1 diffbot-python/3.4`) for usage analytics? If so, it would be a small separate SDK option after v0.1. It doesn't block v0.1. 9. **Docs listing:** after final release, should we ask Langflow to list Diffbot on the bundle-list page even if hosting stays with Diffbot? This is an outward post, gated on Q5. --- ## 9. Recommended first milestone -**M0 + M1:** Andrew answers Q1–Q4. The implementer then opens a small PR in this repo adding `enhance()` to `Diffbot` and `DiffbotAsync`. It covers single-entity `GET /kg/v3/enhance` for Organization and Person, with mocked tests, a README example, and a matching `tests/test_readme_examples.py` case. It ships as an RC after Andrew's go. This unblocks two of the nine operations, needs no new repo and no outward post, and is useful on its own. The M2 spike can run alongside it, locally, against `LANGFLOW_COMPONENTS_PATH`. +**M0 + M1:** Andrew confirms Q1, Q5, and Q6. The implementer runs the local spike: Web Search and Extract as custom components under `LANGFLOW_COMPONENTS_PATH` on Langflow 1.13.5, using `DiffbotAsync` from the released `diffbot` 3.4.x. The spike confirms async outputs, Tool Mode action naming, Global Variable binding, and that a draft `lfx-diffbot` manifest passes `lfx extension validate`. Findings go into the research notes and Β§4. This needs no new repo, no SDK change, and no outward post. Meanwhile πŸ…° creates `diffbot/lfx-diffbot` so M2 can start as soon as the spike lands. diff --git a/docs/plans/langflow-research-notes.md b/docs/plans/langflow-research-notes.md index bd5a715..5b8d292 100644 --- a/docs/plans/langflow-research-notes.md +++ b/docs/plans/langflow-research-notes.md @@ -1,6 +1,8 @@ # Langflow integration: research notes > Companion to [langflow-integration.md](./langflow-integration.md). Collected 2026-12-02. These are raw findings, citations, and things that didn't belong in the plan. "βœ… opened" means the page or file was fetched during this run. Paraphrases are marked; quotes are verbatim from the fetched content. +> +> **Revised 2026-12-02:** Andrew dropped Org/Person Enhance from v0.1 (now 7 components, no SDK change) and chose the package name `lfx-diffbot`, published by Diffbot from `diffbot/lfx-diffbot`. The evidence for the name is in Β§1 (PyPI row) and Β§5. ## 1. Pages and files opened @@ -29,7 +31,7 @@ | Frontend registries | https://github.com/langflow-ai/langflow/blob/main/src/frontend/src/utils/styleUtils.ts and `src/frontend/src/icons/lazyIconImports.ts` | βœ… | `SIDEBAR_BUNDLES` at line ~423 includes `{display_name:"Exa",name:"exa",icon:"Exa"}`, Firecrawl (`FirecrawlCrawlApi`), SerpApi (`SerpSearch`), Tavily (`TavilyIcon`). Icon alias map lists `FirecrawlCrawlApi/MapApi/ScrapeApi/SearchApi` (so 4 Firecrawl components). No Diffbot entry. | | Store router | https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/api/v1/store.py | βœ… (route list only) | `GET /check/`, `GET /check/api_key`, `POST /components/` (201), `PATCH /components/{id}`, `GET /components/`, `GET /components/{id}`, `GET /tags`, `GET/POST /users/likes…`. No current docs page about the Store was opened. | | Repo tree | https://api.github.com/repos/langflow-ai/langflow/contents/src/bundles | βœ… | 28 standalone bundle dirs (amazon, anthropic, arxiv, azure, cohere, confluent, datastax, docling, duckduckgo, empiriolabs, exa, firecrawl, google, ibm, microsoft, nextplaid, ollama, openai-compatible, openai, oracle, paddle, serpingapi, serply, slack, toolguard, valkey, vllm) plus `lfx-bundles`, `NIGHTLY.md`, `PORTING.md`. `src/bundles/lfx-bundles/src/lfx_bundles/` has about 70 providers including tavily, serpapi, searchapi, spider, scrapegraph, apify, agentql, mrscraper, perplexity, wikipedia. `src/lfx/src/lfx/components/{tavily,exa}` contain only `__init__.py`. | -| PyPI JSON | `https://pypi.org/pypi//json` | βœ… | `langflow` 1.13.5 (2026-12-01): deps pin the 16 curated `lfx-*`; the `bundles` extra adds `lfx-bundles[all-no-torch]`, arxiv, confluent, duckduckgo, empiriolabs, exa, firecrawl, nextplaid, paddle, serpingapi, serply, valkey. `lfx` 1.13.5. `lfx-bundles` 1.3.15 (2026-12-02), MIT, Python `>=3.10,<3.16`. `lfx-exa` 0.2.1 and `lfx-firecrawl` 0.2.1 (2026-10-21) require `lfx>=1.14.0.dev0` (newer than stable 1.13.5). All `lfx-*` checked have author `Langflow `. **`lfx-diffbot`: 404, name unclaimed.** The PyPI HTML pages for `lfx-exa` / `lfx-firecrawl` failed to render (JS required); the JSON API worked. | +| PyPI JSON | `https://pypi.org/pypi//json` | βœ… | `langflow` 1.13.5 (2026-12-01): deps pin the 16 curated `lfx-*`; the `bundles` extra adds `lfx-bundles[all-no-torch]`, arxiv, confluent, duckduckgo, empiriolabs, exa, firecrawl, nextplaid, paddle, serpingapi, serply, valkey. `lfx` 1.13.5. `lfx-bundles` 1.3.15 (2026-12-02), MIT, Python `>=3.10,<3.16`. `lfx-exa` 0.2.1 and `lfx-firecrawl` 0.2.1 (2026-10-21) require `lfx>=1.14.0.dev0` (newer than stable 1.13.5). All Langflow-repo `lfx-*` packages checked have author `Langflow `. **Vendor-published `lfx-*` packages also exist:** `lfx-keenable` 0.1.2 (author `Keenable `, repo `github.com/keenableai/lfx-keenable`), `lfx-olostep` 0.1.0 (author `Olostep`, repo `github.com/olostep-api/lfx-olostep`), `lfx-boldrouter` 0.1.0 (author `BoldRouter `). **`lfx-diffbot`: 404, name unclaimed** as of 2026-12-02. The PyPI HTML pages for `lfx-exa` / `lfx-firecrawl` failed to render (JS required); the JSON API worked. | | Third-party example | https://github.com/fxmacrodata/langflow-fxmacrodata | βœ… | Out-of-tree bundle `lfx_fxmacrodata` with a `langflow.extensions` entry point and packaged `extension.json`; "lfx 1.12.1+ and Bundle API 1"; source install only (no PyPI). Credentials via "the component's password field backed by a Langflow global secret"; "Credentials are never model-visible tool parameters"; "Exported component nodes leave the API-key input empty". Validates with `lfx extension validate … --execute-imports` + pytest. | | Search result (not opened) | https://github.com/ASCIT31/langflow-darkmoon/pull/1 | ⚠️ search snippet only | Claims to repackage a `LANGFLOW_COMPONENTS_PATH` dir as `lfx-darkmoon`, the "officially supported distribution route for third-party providers", shipping "extension.json + component sources + icon". Unverified, and especially unverified whether an out-of-tree icon actually renders. | @@ -37,9 +39,9 @@ - `pyproject.toml`: `name = "diffbot"`, `version = "3.4.1"`, `requires-python = ">=3.9"`, deps `httpx>=0.27`, `click>=8.1`, `rich>=13`. - `Diffbot.__init__(token, *, timeout=30.0, retry, api_base, kg_base, llm_base, nlp_base, …_url overrides, transport)` raises `ValidationError` on an empty token. `DiffbotAsync` mirrors it. -- Public `request(method, url, *, params, headers, json, …, retryable=True, stream=False)` goes through the retry policy and raises on non-2xx. This is the Enhance fallback. +- Public `request(method, url, *, params, headers, json, …, retryable=True, stream=False)` goes through the retry policy and raises on non-2xx. Not needed for v0.1. It would only matter if Enhance came back without an SDK wrapper. - Methods: `extract` (default `api="analyze"`, `fmt="markdown"`), `ask` (iterator of text chunks), `ask_json(messages, schema)`, `crawl*`, `dql(query, size=10, from_=0, format="json", …)`, `dql_parallel`, ontology helpers, `web_search(text, num_resultsβ†’size, max_tokensβ†’maxTokens, snippet_lengthβ†’snippetLength; FULL β‡’ rerank=none)`, `account`, `verify_token`, `entities`, `nlp`. -- `grep -ri enhance src/diffbot` only finds a comment in `types.py` ("DQL / Enhance-bulk export formats"). There is **no Enhance wrapper**. +- `grep -ri enhance src/diffbot` only finds a comment in `types.py` ("DQL / Enhance-bulk export formats"). There is **no Enhance wrapper**. Since Enhance is out of v0.1 (Andrew, 2026-12-02), this is no longer a gap. All 7 v0.1 operations map to `web_search`, `extract`, `dql`, and `ask` / `ask_json`. - `resolve_token()` order: explicit β†’ `DIFFBOT_API_TOKEN` β†’ `~/.diffbot/credentials`. Unsuitable for multi-user servers. - `release.yml`: tag `v*` β†’ verify β†’ sdist/wheel + binaries β†’ PyPI trusted publishing (OIDC) β†’ GitHub release. RCs use a PEP 440 prerelease version and matching tag; the GitHub release is marked prerelease. `workflow_dispatch` is a dry run. - User-Agent is fixed as `diffbot-python/`; there's no constructor option to extend it. @@ -58,5 +60,12 @@ - Whether a `SecretStrInput` default can reference a global variable by name through the public API. - How Tool Mode names and slugs actions for a component with two outputs (for example Data + DataFrame), and whether to set one output as the tool output. - Whether Langflow has an intake process for new vendor-hosted standalones under `src/bundles/`. Nothing is documented. -- Whether Langflow objects to third parties using the `lfx-` PyPI prefix. Nothing is documented either way; the manifest docs call `lfx-` a "convention". +- ~~Whether third parties may use the `lfx-` PyPI prefix.~~ Resolved: vendors already publish under it (keenable, olostep, boldrouter), and the quickstart and manifest docs present `lfx-` as the convention. Langflow has published no explicit policy. - SerpAPI component count; MrScraper and Firecrawl auth input names (assumed secret inputs, not opened). + +## 5. Decisions log + +| Date | Decision | Source / evidence | +| --- | --- | --- | +| 2026-12-02 | Drop Organization Enhance and Person Enhance from v0.1. Ship 7 components: Web Search, Page Extract, Org Search, Person Search, News Search, KG DQL Query, LLM Ask. Revisit only if users ask for enrichment. | Andrew. Reason given: matches Jerome's Nov 17 view that Enhance is "bloat for the LLM" and Dify's scope; no SDK change needed. | +| 2026-12-02 | Package `lfx-diffbot`, published by Diffbot (`Diffbot `) from repo `diffbot/lfx-diffbot` (repo still to be created by Andrew). | Andrew. Evidence: `lfx-exa` is published by Langflow itself (https://pypi.org/project/lfx-exa/). Vendors publish `lfx-keenable`, `lfx-olostep`, `lfx-boldrouter` (PyPI JSON metadata checked 2026-12-02). Langflow's extensions quickstart (https://docs.langflow.org/extensions-quickstart) uses `lfx-`. |