langchain-spidra integrates Spidra into LangChain in two ways:
- Document loader.
SpidraLoaderpulls web content as LangChainDocumentobjects, ready to feed into a vector store or retrieval chain. - Agent tools.
SpidraScrape,SpidraCrawl, andSpidraBatchScrapeareBaseToolclasses you can bind to any LangChain agent so it can browse the web on its own.
Installation
Get your API key from app.spidra.io under Settings > API Keys.
Set it as an environment variable so you never hardcode it.
Document loader
SpidraLoader implements LangChain’s BaseLoader interface and returns a list of Document objects, each with page_content and metadata.
Scrape a page
The default mode. Returns raw markdown, which is ideal for RAG indexing where you want clean, unmodified content:AI extraction
Add aprompt to run AI extraction. You get back a single document containing the structured result instead of raw markdown:
Crawl a site
Setmode="crawl" to crawl an entire site. Returns one document per discovered page, which is exactly what you want for indexing a docs site or knowledge base:
Omitting
transform_instruction returns raw markdown per page with no AI processing and no token charges. Pass it only when you need AI extraction on each crawled page.Batch scrape
Setmode="batch" to scrape many URLs in parallel. Returns one document per completed URL:
Use with a vector store
The most common use case: crawl a site and build a searchable knowledge base.Lazy loading
For large crawls, uselazy_load() to process documents as they arrive instead of waiting for everything to finish:
Loader parameters
Agent tools
Each Spidra capability is available as a standaloneBaseTool you can bind to an agent.
Available tools
Standalone usage
Error handling: the tools never raise. On failure they return the error as a plain string, so the agent can read what went wrong and adjust. When calling a tool yourself, check the type before indexing into the result:
Bind to an agent
Tool parameters
SpidraScrape
SpidraCrawl
SpidraBatchScrape
Source
The package is open-source at github.com/spidra-io/spidra-langchain. Bug reports and contributions welcome.Python SDK
Use the Spidra Python SDK directly without LangChain.
Node.js SDK
Official Node.js SDK for JavaScript and TypeScript projects.

