Build and deploy Apify actors for web scraping and automation. Use for serverless scraping, data extraction, browser automation, and API integrations with Python.
Build serverless Apify actors for web scraping, browser automation, and data extraction using Python.
Before creating or modifying actors, verify that apify CLI is installed:
Run apify --help.
If it is not installed, you can run:
curl -fsSL https://apify.com/install-cli.sh | bash
# Or (Mac): brew install apify-cli
# Or (Windows): irm https://apify.com/install-cli.ps1 | iex
# Or: npm install -g apify-cli
When the apify CLI is installed, check that it is logged in with:
apify info # Should return your username
If it is not logged in, check if the APIFY_TOKEN environment variable is defined (if not, ask the user to generate one on https://console.apify.com/settings/integrations and then define APIFY_TOKEN with it).
Then run:
apify login -t $APIFY_TOKEN
assets/python-template/ directory to your new actor directory. The template is located at {base_dir}/assets/python-template/ where {base_dir} is the skill's base directory.uv run pre-commit install for automatic quality checksuv add package-name for each required dependencysrc/main.py (the src/__main__.py entry point is already set up).actor/input_schema.json and .actor/output_schema.json.actor/actor.json with actor metadata.actor/ACTOR.md for the marketplaceapify run to verify functionalityapify push to deploy the actor on the Apify platformCRITICAL REMINDERS:
requirements.txtpip install or uv pip installuv add to add dependenciesuv sync to install dependenciesuv run ruff format . after file changesuv run ruff check --fix . after file changesapify push output for build errors before considering deployment completeEvery actor follows this pattern:
my-actor/
βββ .actor/
β βββ actor.json # Actor metadata
β βββ input_schema.json # Input schema
β βββ output_schema.json # Output schema
β βββ ACTOR.md # PUBLIC marketplace documentation (CRITICAL)
β βββ datasets/
β βββ dataset_schema.json # Dataset schema with views
βββ src/ or package_name/ # Source code
β βββ __init__.py
β βββ __main__.py # Entry point for CLI (REQUIRED)
β βββ main.py # Main actor logic
βββ tests/ # Test files
β βββ test_*.py
βββ .dockerignore # Docker build exclusions
βββ .pre-commit-config.yaml # Pre-commit hooks
βββ Dockerfile # Container config
βββ pyproject.toml # Python project config
βββ uv.lock # Dependency lock file
βββ README.md # Development docs
See references/python-sdk.md for complete examples of:
Input schemas use JSON Schema format to define and validate actor inputs. See references/input-schema.md for:
Key principles:
Output schemas define where actors store outputs and provide templates for accessing that data. See references/output-schema.md for:
Key principles:
The .actor/ACTOR.md file is the public-facing documentation that users see in the Apify marketplace. This is your actor's main sales page and user guide.
Required sections:
See assets/python-template/.actor/ACTOR.md for a complete template.
Key principles:
When modifying an existing actor:
src/main.py.actor/input_schema.json for expected inputsuv add package-name (NEVER pip install)uv run ruff format . (MANDATORY)uv run ruff check --fix . (MANDATORY)apify run before deployingapify pushapify run to test actor locally before deployment./storage/ directory for datasets, key-value stores, and request queuesActor.log.info(), Actor.log.debug(), Actor.log.error() (see SDK references)uv run ruff format . before committinguv run ruff check --fix . before deploying.actor/actor.jsonActor.config and environment variablesmyuser in Dockerfile for container security.dockerignore to exclude unnecessary files and reduce build timeuv add and uv sync (MANDATORY)uv.lock for reproducible builds (MANDATORY)apify run before deploying to catch issues earlydataset_schema.json with views for better Apify Console UI__main__.py for local testing and developmentStandby mode allows actors to run as persistent HTTP servers, providing instant responses without cold start delays.
Perfect for:
See references/standby-mode.md for complete implementation patterns, authentication, and examples.
Detailed documentation in references/:
python-sdk.md - SDK patterns and complete code examplesstandby-mode.md - Real-time API implementationinput-schema.md - Input validation and UI configurationoutput-schema.md - Output configuration and templatesIf you need information not covered in this skill, use the WebFetch tool with https://docs.apify.com/llms.txt to access the complete official documentation.