Give your LangGraph agent real-time web data with Apify Apify released an official LangChain integration, langchain-apify, that gives LangGraph agents access to real-time web data through 19 dedicated tools split across APIFY_CORE_TOOLS, APIFY_SEARCH_TOOLS, and APIFY_SOCIAL_TOOLS, plus an ApifyActorsTool for running any other Actor. The company also offers the Apify MCP Server at mcp.apify.com, which exposes thousands of Apify Actors as tools over the Model Context Protocol with stdio support via @apify/actors-mcp-server and Streamable HTTP, and OAuth or API token authentication. Setup requires Python 3.10+, an Apify account, and an OpenAI API key, with libraries installed via pip install langchain langchain-openai langchain-apify python-dotenv. The usefulness of a LangGraph agent workflow largely depends on the quality and scope of the tools it can access. Apify extends LangGraph agents with real-time web data. In this tutorial, you'll learn how to connect LangGraph to Apify through the official LangChain integration and via MCP. Apify support for LangGraph Apify https://apify.com/ is a marketplace of ready-to-run tools for AI. It provides tools for accessing web data and automating tasks such as web search, social media monitoring, lead generation, e-commerce data extraction, and more https://apify.com/use-cases . At the core of Apify are Actors https://apify.com/actors , serverless programs that perform specific tasks, such as scraping websites, running browser automation, or powering AI workflows. LangGraph agents can use Apify Actors in two main ways: 1. Through the official langchain-apify https://github.com/apify/langchain-apify integration. 2. Via Apify MCP Server. Official Apify LangGraph integration The Apify LangGraph integration https://docs.apify.com/integrations/langgraph provides LangChain-compatible tools that wrap specific Actors behind simplified input schemas. This way, LangGraph agents can call Actors without needing to know the underlying input schema. langchain-apify provides 19 dedicated tools https://docs.apify.com/integrations/langchain choose-the-right-tool-set across three categories: - APIFY CORE TOOLS : for running Actors and tasks, scraping URLs, and retrieving dataset items - APIFY SEARCH TOOLS : for web search, crawling, maps, YouTube, and e-commerce data - APIFY SOCIAL TOOLS : for platforms such as Instagram, LinkedIn, TikTok, Facebook, and X You can give an agent individual tools, an entire tool bundle, or use ApifyActorsTool https://docs.apify.com/integrations/langchain run-any-other-actor to run an Actor that doesn’t have a dedicated tool. Apify MCP Server with LangGraph Apify MCP Server https://mcp.apify.com/ provides a programmatic interface for AI agents to discover and use Apify tools through the Model Context Protocol. It exposes thousands of Apify Actors as tools, allowing an agent to discover and use Actors on the fly. The MCP server provides tools https://docs.apify.com/integrations/mcp for: - Actor discovery : search Apify Store and retrieve Actor details and schemas - Actor execution : run Actors and retrieve their results - Web access : call tools for web scraping, such as RAG Web Browser https://apify.com/apify/rag-web-browser and Web Fetch https://apify.com/apify/web-fetch - Storage : access datasets generated by Actor runs - Documentation : search and retrieve Apify documentation - Tasks and schedules : manage saved Actor tasks and scheduled runs The server supports stdio via @apify/actors-mcp-server https://www.npmjs.com/package/@apify/actors-mcp-server as well as Streamable HTTP. Supported authentication methods include OAuth and API token. Common setup steps Before getting started with the LangGraph + Apify integration, whether via the official integration or MCP, you need to complete a few common tasks first. Prerequisites Make sure you have: - Python 3.10+ installed locally https://www.python.org/downloads/ , with a project and an activated virtual environment https://docs.python.org/3/library/venv.html - An Apify account https://console.apify.com/sign-up - An OpenAI API key https://platform.openai.com/api-keys Basic knowledge of the following topics will also be useful: Step 1: Install the libraries In your Python project, with the virtual environment activated, run: pip install langchain langchain-openai langchain-apify python-dotenv This installs the required dependencies: - langchain https://pypi.org/project/langchain/ : For crafting LangGraph agents via LangChain - langchain-openai https://pypi.org/project/langchain-openai/ : To use OpenAI models with LangChain agents - langchain-apify https://pypi.org/project/langchain-apify/ : To connect your LangGraph agent workflow to Apify - python-dotenv https://pypi.org/project/python-dotenv/ : For loading API keys from a .env file Note : You don’t need to install langgraph https://pypi.org/project/langgraph/ separately for this example. The langchain package installs langgraph as a dependency, as its high-level API helps you build LangGraph agents https://docs.langchain.com/oss/python/langchain/overview . Step 2: Retrieve the Apify API key Both langchain-apify and the Apify MCP server can use an Apify API token https://docs.apify.com/api/v2 authentication for authentication. To get your API token: 1. Log in to Apify Console https://console.apify.com/ 2. Go to Settings API & Integrations 3. In the API tokens section, copy your token using the “copy to clipboard” button Store your API token securely. You'll need it in the next steps. Note : Apify MCP Server supports agentic payments via AGI, direct x402, or Skyfire https://github.com/apify/apify-mcp-server -agentic-payments , so that you can pay for Actor runs without an Apify API token. Step 3: Configure environment variables Your LangGraph agent workflow relies on Apify and OpenAI, so you must provide an Apify API token and an OpenAI API key. Never hardcode API keys in your source code. Store them as environment variables instead. Create a .env file in your project directory and populate it with: OPENAI API KEY="