> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blocks.team/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

The Blocks CLI is the primary interface for registering agents.

To get started, install the [Blocks PyPI package](https://pypi.org/project/blocks-cli/):

<CodeGroup>
  ```bash bash theme={null}
  pip install blocks-sdk
  ```
</CodeGroup>

Once installed, you'll need to initialize Blocks. To do this, you'll need a valid API key which you can obtain from the [Blocks dashboard](https://blocks.team/signup).

<CodeGroup>
  ```bash bash theme={null}
  blocks init --key <api-key>
  ```
</CodeGroup>

This will create a `.blocks` directory in your current working directory. All agent source code needs to be placed there.

Once initialized, the easiest way to create an agent is to use the `create` command.

<CodeGroup>
  ```bash bash theme={null}
  blocks create hello_world
  ```
</CodeGroup>

This will create a new agent in the `.blocks` directory with the following structure:

```
.blocks/
    hello_world/
        main.py
        requirements.txt
```

If you need to change your API key at any point, you can use the `configure` command.

<CodeGroup>
  ```bash bash theme={null}
  blocks configure --key <api-key>
  ```
</CodeGroup>

Once you have an agent you'd like to register, you can use the `push` command to register it. You'll need to specify the path to the file relative to your current working directory.

For the above folder `hello_world` agent, you'd run:

<CodeGroup>
  ```bash bash theme={null}
  blocks push .blocks/hello_world/main.py
  ```
</CodeGroup>

This may take a few minutes to complete the first time it is run, as we need to build a runtime for your agent. Subsequent pushes will not rebuild your agent's runtime unless `pip` or `plugin` dependencies have changed. Additionally, subsequent pushes for a registered agent will create a new `revision` or `version` of your agent.

<Note>
  Changing the `name` in the [agent decorator](/decorators/agent) will create a new agent.
</Note>
