apify
Apify SDK for Python
What it is and what it does
Apify SDK is the official Python framework for building Actors—serverless programs that run on the Apify platform or locally. It wraps your code in an async context manager that handles initialization, teardown, error recovery, and platform lifecycle events automatically. The SDK provides built-in access to storage (datasets, key-value stores, request queues), proxy routing, platform events, and the full Apify API through a preconfigured client.
You write a simple async function inside `async with Actor:`, and the SDK handles everything else: reading validated input, writing results to storage, reacting to platform signals, and managing Actor execution state. It works with any Python library you already use—web scrapers like Crawlee or Scrapy, browser automation tools like Playwright, AI frameworks, or custom code. The SDK is designed to let you focus on your business logic while Apify handles deployment, scaling, monitoring, and pay-per-event billing.
Use it for:
- Build and deploy web scrapers and crawlers that run on the Apify platform with automatic scaling and monitoring.
- Create browser automation workflows using Playwright or Selenium, packaged as serverless Actors for cloud execution.
- Host AI agents or LLM-powered applications as Actors, with templates for LangGraph, CrewAI, and PydanticAI.
- Run web servers or HTTP APIs inside Actors to expose scrapers or other services as live endpoints.
- Deploy MCP (Model Context Protocol) servers as Actors to make tools available to any MCP client.
- Automate repetitive tasks with scheduled Actor runs, webhooks, and inter-Actor communication.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Apify SDK for Python is the official framework for building and running Apify Actors—serverless programs that handle web scraping, browser automation, AI agents, and other cloud-deployed tasks with built-in lifecycle management, storage access, and platform integration.
Yes. The SDK is actively maintained, has no known vulnerabilities, uses a permissive license, and requires only Python 3.11+. Install it if you plan to build Actors on the Apify platform or want a framework that bundles serverless lifecycle management, storage, and proxy handling. Skip it if you only need to consume the Apify API from existing code—use apify-client instead, which comes bundled with this SDK.
Install
apify on PyPI
pip
pip install apifyuv
uv add apifypoetry
poetry add apifyInstalling apify
Before you install
Low install friction with a pure-wheel distribution. Actively maintained with a release 7 days ago and a commit history through 2026-08-14. Requires Python 3.11 or higher, which aligns with current language support.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for both open-source and proprietary projects.
Quickstart
pip install apify
from apify import Actor
async def main() -> None:
async with Actor:
actor_input = await Actor.get_input()
Actor.log.info('Actor input: %s', actor_input)
await Actor.set_value('OUTPUT', 'Hello, world!')
Requires Python 3.11 or higher. Async context manager pattern is mandatory for Actor lifecycle management.
Verify before relying
- Whether the 11 runtime dependencies (apify-client, crawlee, pydantic, cryptography, websockets, etc.) are all required for basic usage or if some are optional.
- Performance characteristics and scaling limits when running locally versus on the Apify platform.
- Detailed compatibility matrix with popular scraping libraries (Scrapy, Crawlee, Playwright, Selenium) mentioned in the description.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 11 — apify-client, crawlee, cachetools, cryptography, impit, lazy-object-proxy, more-itertools, pydantic, typing-extensions, websockets, yarl |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 273,121/month — #8,205 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: apify-4.0.1-py3-none-any.whl
Keywords: apify, sdk, automation, chrome, crawlee, crawler, headless, scraper, scraping
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
apify-clientA Python client library for the Apify REST API…
permissive · top 5,000 on PyPI
apify-sharedApify Shared Python is a deprecated package…
permissive · top 5,000 on PyPI
scrapfly-sdkPython SDK for the Scrapfly web scraping…
permissive · top 15,000 on PyPI
scrapingbeePython SDK wrapper for ScrapingBee's web…
permissive · top 15,000 on PyPI
daprDapr SDK for Python provides client libraries…
permissive · top 15,000 on PyPI
pykkaPykka is a Python implementation of the actor…
permissive · top 15,000 on PyPI
scrapy-playwrightIntegrates Playwright browser automation into…
permissive · top 5,000 on PyPI
SparkSpark is an async-first actor framework for…
permissive · top 15,000 on PyPI
apify-fingerprint-datapointsProvides a dataset of browser fingerprint…
permissive · top 5,000 on PyPI
pytest-playwright-asyncioA pytest plugin that integrates Playwright…
permissive · top 15,000 on PyPI