Apify
Apify is a cloud platform for web scraping and data extraction,which provides anecosystem of more than a thousandready-made apps calledActors for various scraping, crawling, and extraction use cases.
This integration enables you run Actors on theApify
platform and load their results into LangChain to feed your vectorindexes with documents and data from the web, e.g. to generate answers from websites with documentation,blogs, or knowledge bases.
Installation and Setup
- Install the LangChain Apify package for Python with:
pip install langchain-apify
- Get yourApify API token and either set it asan environment variable (
APIFY_API_TOKEN
) or pass it asapify_api_token
in the constructor.
Tool
You can use theApifyActorsTool
to use Apify Actors with agents.
from langchain_apifyimport ApifyActorsTool
Seethis notebook for example usage and a full example of a tool-calling agent with LangGraph in theApify LangGraph agent Actor template.
For more information on how to use this tool, visitthe Apify integration documentation.
Wrapper
You can use theApifyWrapper
to run Actors on the Apify platform.
from langchain_apifyimport ApifyWrapper
For more information on how to use this wrapper, seethe Apify integration documentation.
Document loader
You can also use ourApifyDatasetLoader
to get data from Apify dataset.
from langchain_apifyimport ApifyDatasetLoader
For a more detailed walkthrough of this loader, seethis notebook.
Source code for this integration can be found in theLangChain Apify repository.