# Quick start

Copy for LLM

Learn how to create and run Actors using the Apify SDK for Python.

***

<!-- -->

<!-- -->

## Step 1: Create Actors[](#step-1-create-actors)

To create and run Actors in [Apify Console](https://docs.apify.com/platform/console), refer to the [Console documentation](https://docs.apify.com/platform/actors/development/quick-start/web-ide).

To create a new Apify Actor on your computer, you can use the [Apify CLI](https://docs.apify.com/sdk/python/cli), and select one of the [Python Actor templates](https://apify.com/templates?category=python).

For example, to create an Actor from the "Getting started with Python" template, you can use the [`apify create` command](https://docs.apify.com/sdk/python/cli/docs/reference#apify-create-actorname).

```
apify create my-first-actor --template python-start
```

This will create a new folder called `my-first-actor`, download and extract the "Getting started with Python" Actor template there, create a virtual environment in `my-first-actor/.venv`, and install the Actor dependencies in it.

![actor create command run](/sdk/python/assets/images/apify-create-24c1fe5b3ac9fe16a87f7fa00731f303.gif)

## Step 2: Run Actors[](#step-2-run-actors)

To run the Actor, you can use the [`apify run` command](https://docs.apify.com/sdk/python/cli/docs/reference#apify-run):

```
cd my-first-actor

apify run
```

This command:

* Activates the virtual environment in `.venv` (if no other virtual environment is activated yet)
* Starts the Actor with the appropriate environment variables for local running
* Configures it to use local storages from the `storage` folder

The Actor input, for example, will be in `storage/key_value_stores/default/INPUT.json`.

## Step 3: Understand Actor structure[](#step-3-understand-actor-structure)

All Python Actor templates follow the same structure.

The `.actor` directory contains the [Actor configuration](https://docs.apify.com/platform/actors/development/actor-config), such as the Actor's definition and input schema, and the Dockerfile necessary to run the Actor on the Apify platform.

The Actor's runtime dependencies are specified in the `requirements.txt` file, which follows the [standard requirements file format](https://pip.pypa.io/en/stable/reference/requirements-file-format/).

The Actor's source code is in the `src` folder. This folder contains two important files:

* `main.py` - which contains the main function of the Actor
* `__main__.py` - which is the entrypoint of the Actor package, executing the Actor's main function via [`asyncio.run()`](https://docs.python.org/3/library/asyncio-runner.html#asyncio.run).

- main.py
- \_\_main\_\_.py

```
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!')
```

```
import asyncio



from .main import main



if __name__ == '__main__':

    asyncio.run(main())
```

If you want to modify the Actor structure, you need to make sure that your Actor is executable as a module, via `python -m src`, as that is the command started by `apify run` in the Apify CLI. We recommend keeping the entrypoint for the Actor in the `src/__main__.py` file.

## Next steps[](#next-steps)

Now that you can create and run an Actor locally, explore the rest of the SDK's features and its framework integrations.

### Concepts[](#concepts)

To learn more about the features of the Apify SDK and how to use them, check out the Concepts section in the sidebar:

* [Actor lifecycle](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/actor-lifecycle.md)
* [Actor input](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/actor-input.md)
* [Storages](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/storages.md)
* [Actor events & state persistence](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/actor-events.md)
* [Proxy management](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/proxy-management.md)
* [Interacting with other Actors](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/interacting-with-other-actors.md)
* [Creating webhooks](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/webhooks.md)
* [Accessing Apify API](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/access-apify-api.md)
* [Logging](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/logging.md)
* [Actor configuration](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/actor-configuration.md)
* [Pay-per-event monetization](https://docs.apify.com/sdk/python/sdk/python/docs/concepts/pay-per-event.md)

### Guides[](#guides)

To see how you can integrate the Apify SDK with popular scraping libraries and frameworks, check out these guides:

* [Scraping with BeautifulSoup and HTTPX](https://docs.apify.com/sdk/python/sdk/python/docs/guides/beautifulsoup-httpx.md)
* [Scraping with Parsel and Impit](https://docs.apify.com/sdk/python/sdk/python/docs/guides/parsel-impit.md)
* [Browser automation with Playwright](https://docs.apify.com/sdk/python/sdk/python/docs/guides/playwright.md)
* [Browser automation with Selenium](https://docs.apify.com/sdk/python/sdk/python/docs/guides/selenium.md)
* [Building crawlers with Crawlee](https://docs.apify.com/sdk/python/sdk/python/docs/guides/crawlee.md)
* [Building crawlers with Scrapy](https://docs.apify.com/sdk/python/sdk/python/docs/guides/scrapy.md)
* [Adaptive scraping with Scrapling](https://docs.apify.com/sdk/python/sdk/python/docs/guides/scrapling.md)
* [LLM-ready scraping with Crawl4AI](https://docs.apify.com/sdk/python/sdk/python/docs/guides/crawl4ai.md)
* [Browser AI agents with Browser Use](https://docs.apify.com/sdk/python/sdk/python/docs/guides/browser-use.md)

For other aspects of Actor development, explore these guides:

* [Project management with uv](https://docs.apify.com/sdk/python/sdk/python/docs/guides/uv.md)
* [Input validation with Pydantic](https://docs.apify.com/sdk/python/sdk/python/docs/guides/input-validation.md)
* [Running a web server](https://docs.apify.com/sdk/python/sdk/python/docs/guides/running-webserver.md)
