页面简介
Give cognee clean Markdown pages: Keenable is the web-fetch backend behind cognee's URL ingestion and scheduled scraper.
正文摘录
Fetch backend From version 1.5.0, cognee can fetch URLs through Keenable, so pages enter its graph memory as clean Markdown. Pass a URL to remember() or add(), and cognee asks Keenable for the page as Markdown instead of crawling the HTML itself. The rest of the pipeline (chunking, embeddings, entity extraction, recall) doesn’t change. → View the change on GitHub · cognee’s URL-ingestion guide Install Install cognee The Keenable backend is part of cognee, so there’s no Keenable package to add: pip install "cognee>=1.5.0" Set the key export KEENABLE_API_KEY="keen_..." cognee needs the key. It picks Keenable only if KEENABLE_API_KEY is set, and it calls the keyed /v1/fetch endpoint. If the key is missing, cognee uses a different backend instead of calling Keenable without a key. Create a key at app.keenable.ai/console. Check the precedence cognee chooses a fetch backend from the environment, in this order: Tavily, if TAVILY_API_KEY is set Keenable, if KEENABLE_API_KEY is set The built-in crawler If both keys are set, cognee uses Tavily. To route URL ingestion through Keenable, unset TAVILY_API_KEY or select the backend explicitly. Use Give cognee a URL Pass the URL to remember(), then query what cognee learned: import cognee await cognee.remember("https://docs.example.com/pricing") await cognee.recall("what does the enterprise tier cost?") remember() fetches the page through Keenable, ingests the Markdown, and builds the graph. recall() answers from the graph without fetching the page again. Fetch the current version of a page By default Keenable returns its indexed copy of a page when it has one, and fetches the page from the source when it doesn’t. To fetch every page from the source, turn on live fetching: export KEENABLE_LIVE_FETCH="true" With live fetching on, every request goes to the source page. Leave it off when the indexed copy is recent enough and you want the faster cached path. A fetch from the source is billed as fetch.live. See what each call costs. Select the backend explicitly If you call cognee’s fetch layer directly, pass the backend as a parameter. The environment precedence doesn’t apply: from cognee.tasks.web_scraper import fetch_page_content pages = await fetch_page_content(urls, preferred_tool="keenable") Narrow the page with an extraction prompt KeenableConfig carries the per-call options. prompt makes Keenable return only the part of the page you ask for instead of the whole document: from cognee.tasks.web_scraper import fetch_page_content from cognee.tasks.web_scraper.config import KeenableConfig cfg = KeenableConfig(live=True, prompt="Extract the pricing table and plan limits only.") pages = await fetch_page_content(url, preferred_tool="keenable", keenable_config=cfg) Track a page over time cognee’s scheduled scraper runs through the same fetch path (it needs apscheduler): from cognee.tasks.web_scraper import cron_web_scraper_task from cognee.tasks.web_scraper.config import KeenableConfig await cron_web_scraper_task( url=["https://docs.example.com/changelog"], schedule="0 6 * * *", job_name="daily_changelog", keenable_config=KeenableConfig(live=True), tavily_api_key=None, # defaults to TAVILY_API_KEY, which would win ) Each run writes WebPage nodes into the graph, linked is_part_of to a WebSite. The ScrapingJob links to the WebSite with is_scraping. Every page carries a SHA-256 content_hash, so the job can tell whether a page changed between runs. Unlike remember(), this path indexes the nodes directly and skips chunking and entity extraction. Fetch behavior cognee sends GET /v1/fetch?url=... with X-API-Key, plus live=true and prompt=... when set, and keeps the content field of the response. Up to 5 URLs are in flight at once (KeenableConfig.concurrency), with a 30-second timeout per request (timeout, 1 to 120). If a URL fails, cognee logs a warning, skips it and continues with the rest of the batch. If every URL fails, cognee raises the first error instead of returning an empty result, so a bad key shows up as an authentication error. Warnings identify a failed URL by its position in the batch and the exception class, never by the URL, so credentials in query strings can’t leak into logs. Configuration SettingEnvironment variableKeenableConfig fieldDefaultAPI keyKEENABLE_API_KEYapi_keynone (required)Base URLKEENABLE_BASE_URLbase_urlhttps://api.keenable.aiLive fetchKEENABLE_LIVE_FETCHlivefalseExtraction promptNonepromptnone (max 2000 chars)ConcurrencyNoneconcurrency5Timeout (s)Nonetimeout30 The environment variables cover the memory path (remember(), add()). The KeenableConfig fields cover direct calls to fetch_page_content, web_scraper_task and cron_web_scraper_task, and override the environment for that call. Related pages Fetch quickstartTurn any URL into clean markdown your model can read, or get only the part a prompt asks for. Try it with no API key. Code, cost per call and gotchas.LlamaIndexGive LlamaIndex agents web search and page fetch with KeenableToolSpec. Results come back as documents with source URLs, and no API key is needed.HaystackAdd web search and page fetch to Haystack pipelines with the KeenableWebSearch and KeenableFetcher components. They work without an API key.GPT ResearcherGive GPT Researcher keyless web search with the gpt-researcher-keenable retriever plugin. Install it and set RETRIEVER=keenable, with no code changes.