Use any Apify Actor in LangChain and LangGraph
Install langchain-apify, set APIFY_TOKEN and wrap the Actor with ApifyActorsTool("owner/name"). The tool reads the Actor's input schema from its build, so a LangGraph agent made with create_agent can call it with valid input; tool.invoke({"run_input": {...}}) runs it directly and returns the dataset items. Checked 2026-11-12.
Route: Actor tool. Install: pip install langchain-apify
Working snippets
Each one is run against the current package before the site publishes it (with a stub Apify API, so nothing is billed). Every Actor page has the same snippet for its own Actor and input, under "In an agent framework".
Install: pip install langchain-apify
Google Maps
# Reads APIFY_TOKEN from the environment.
from langchain_apify import ApifyActorsTool
tool = ApifyActorsTool("vexaloom-labs/google-maps-business-lead-finder-with-email")
items = tool.invoke({"run_input": {
"mode": "searchPlaces",
"searchQueries": [
"coffee shops in Austin TX",
],
"maxPlacesPerSearch": 3,
"language": "en",
"extractEmailsFromWebsite": True,
"maxEmailsPerWebsite": 5,
"maxContactPagesPerWebsite": 2,
"onlySaveResults": "allPlaces",
"websiteFilter": "allPlaces",
"skipClosedPlaces": False,
}})
print(len(items), "records", items[:1])
# Give the same tool to an agent (pip install langchain langchain-openai):
# from langchain.agents import create_agent
# agent = create_agent(ChatOpenAI(model="gpt-5.4-mini"), [tool]) Install: pip install langchain-apify
# Reads APIFY_TOKEN from the environment.
from langchain_apify import ApifyActorsTool
tool = ApifyActorsTool("nimbryxo-studio/reddit-keyword-search-with-advanced-filters")
items = tool.invoke({"run_input": {
"keywords": [
"python programming",
],
"onlyNew": False,
"searchComments": False,
"excludeNsfw": False,
"keywordRequireAll": False,
"includeArchive": True,
"resolveChallenges": True,
}})
print(len(items), "records", items[:1])
# Give the same tool to an agent (pip install langchain langchain-openai):
# from langchain.agents import create_agent
# agent = create_agent(ChatOpenAI(model="gpt-5.4-mini"), [tool]) Install: pip install langchain-apify
Zillow
# Reads APIFY_TOKEN from the environment.
from langchain_apify import ApifyActorsTool
tool = ApifyActorsTool("nimbryxo-studio/zillow-for-sale-rent-and-sold-listing-extractor")
items = tool.invoke({"run_input": {
"search": "Houston, TX",
"mode": "BUY",
"maxItems": 3,
"endPage": 1,
"fsboOnly": False,
"foreclosureOnly": False,
"auctionOnly": False,
"newConstructionOnly": False,
"includePending": False,
"openHouseOnly": False,
"priceReducedOnly": False,
"scrapeDetails": False,
}})
print(len(items), "records", items[:1])
# Give the same tool to an agent (pip install langchain langchain-openai):
# from langchain.agents import create_agent
# agent = create_agent(ChatOpenAI(model="gpt-5.4-mini"), [tool]) Good to know
- langchain-apify is Python only and needs Python 3.11 or later; LangGraph agents use the same package.
- Apify recommends create_agent from the langchain package; create_react_agent from langgraph.prebuilt is deprecated since LangGraph 1.0.
- The package also ships 19 ready tools for Google Search, Maps, YouTube, Instagram, LinkedIn, X, TikTok and crawling; register only the tools an agent needs, since every tool widens the model's choice.
- To load results as documents for retrieval, use ApifyWrapper().call_actor(...) or ApifyDatasetLoader with a dataset_mapping_function.
Actors to start with
Other frameworks
- CrewAIActor tool
- LlamaIndexdocument loader
- OpenAI Agents SDKApify MCP server
- MastraApify MCP server
Troubleshooting
Why does the workflow or script stop with HTTP 408?
The synchronous endpoint waits at most 300 seconds. After that it answers 408 while the run keeps going in Apify. Lower the result limit, or start the run asynchronously, wait for it to finish and then read its dataset.
Source: Apify API: run Actor synchronously and get dataset items. This fix on its own page
What do 400, 401, 402 and 403 from the Apify API mean?
Read error.type in the response body. 400 is invalid Actor input. 401 (user-or-token-not-found) means a token reached Apify but it is wrong or revoked. 402 with x402-payment-required means no token reached Apify at all: the n8n credential or the Authorization: Bearer header is missing, and Apify is offering its pay-per-run x402 route for agents instead; any other 402 is an exhausted usage limit on the account that pays for the run. 403 is a token without permission for that Actor or storage.
Source: Apify API: authentication; Apify documentation: agentic payments with x402; Apify API: run Actor synchronously and get dataset items. This fix on its own page
Why does starting an Actor through the API return run information instead of scraped results?
The Run Actor endpoint starts the Actor and immediately returns a Run object without waiting for completion. For results stored in the default dataset, pass the response's defaultDatasetId to Get dataset items; to wait and receive output directly, use the synchronous endpoint for dataset items or a key-value store record.
Why are rows and hidden fields missing from my Apify dataset export?
The clean parameter enables both skipEmpty and skipHidden, removing empty items and fields whose names begin with #. This can produce fewer items than the requested limit; to retain those rows and fields, disable clean and ensure skipEmpty and skipHidden are also disabled.
Source: Apify Get dataset items API. This fix on its own page
Sources
- Apify docs: LangChain integration, checked 2026-11-12
- Apify docs: LangGraph integration, checked 2026-11-12
- langchain-apify on GitHub, checked 2026-11-12