Apify SDK

June 19, 2026 ยท View on GitHub

npm version Downloads Chat on discord Build Status

apify is the official SDK for building Apify Actors in JavaScript and TypeScript. It handles the Actor lifecycle, storage access, platform events, proxy configuration, and more.

Quick Start

This short tutorial will set you up to start using Apify SDK in a minute or two. If you want to learn more, proceed to the Apify Platform guide that will take you step by step through running your Actor on Apify's platform.

Apify SDK requires Node.js 16 or later. Add Apify SDK to any Node.js project by running:

npm install apify

To initialize your Actor and to stop it use the Actor.init() and Actor.exit() functions. You also may use Actor.main() function for cases with multiple crawlers in one context.

import { Actor } from 'apify';

await Actor.init();

const input = (await Actor.getInput()) ?? {};
await Actor.setValue('OUTPUT', {
    message: 'Hello from Apify SDK!',
    input,
});

await Actor.exit();

You can also install the crawlee module, as it now provides the crawlers that were previously exported by Apify SDK. If you don't plan to use crawlers in your Actors, then you don't need to install it. Keep in mind that neither playwright nor puppeteer are bundled with crawlee in order to reduce install size and allow greater flexibility. That's why we manually install it with NPM. You can choose one, both, or neither. For more information and example please check documentation.

What are Actors?

Actors are serverless programs that can do almost anything. From simple scripts and web scrapers to complex automation workflows, AI agents, or even always-on services that expose HTTP endpoints.

They can run either locally or on the Apify platform, where you can scale their execution, monitor runs, schedule tasks, integrate them with other services, or even publish and monetize them. If you're new to Apify, learn more about the platform in the Apify documentation.

For more context, read the Actor whitepaper.

What you can build

Almost any Node.js project can become an Actor, including projects for:

  • Web scraping and crawling - The SDK works seamlessly with Crawlee, which makes Apify a natural place to deploy and scale your crawlers. Start from a ready-made Cheerio template.
  • Browser automation - Drive a real browser with Playwright, Puppeteer, or Selenium to automate tasks, fill in forms, or test web apps.
  • AI agents - Host agents built with your framework of choice. Ready-made Actor templates cover LangChain, LangGraph, BeeAI, and Mastra.
  • MCP servers - Deploy an MCP server as an Actor and make its tools available to any MCP client. See the MCP server and MCP proxy templates.
  • Web servers and APIs - Run a web server inside an Actor to serve HTTP requests, for example to expose your scraper as a live API. See the Standby templates.

Whatever you build, the Apify SDK doesn't lock you into a particular framework. Bring the libraries you already use, and let Apify run your project in the cloud.

Support

If you find any bug or issue with the Apify SDK, please submit an issue on GitHub. For questions, you can ask on Stack Overflow or contact support@apify.com

Upgrading

Visit the Upgrading Guide to find out what changes you might want to make, and, if you encounter any issues, join our Discord server for help!

Contributing

Your code contributions are welcome, and you'll be praised to eternity! If you have any ideas for improvements, either submit an issue or create a pull request. For contribution guidelines and the code of conduct, see CONTRIBUTING.md.

License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.

Acknowledgments

Many thanks to Chema Balsas for giving up the apify package name on NPM and renaming his project to jsdocify.