Skip to main content

Prerequisites

If you’d like to use Blocks with other providers such as GitLab or Bitbucket, please reach out: dev@blocks.team.
1

Install Blocks

2

Initialize Blocks

We’ll verify your API key and create a .blocks directory in the current working directory.
3

Create a Ralph Loop Code Automation

The easiest way to create an agent is to use the create command.
This will create a new agent in the .blocks directory with the following structure:
Below is an example you can copy to get started. It runs a “Ralph” loop on every pull request: a coding agent watches a CI workflow, and if it’s failing, it diagnoses the root cause, makes the smallest fix on a dedicated branch, and keeps iterating until CI is green.
Declare your Python dependencies in a requirements.txt and any MCP servers or CLI tools in a package.json alongside main.py. Adding these files automatically installs the dependencies when the agent image is built.
4

Register an agent

Agents are registered with the push command; specify the filename relative to your current working directory. All agents defined the file will be registered, however you can only register one file at a time.
Image builds may take up to 10 minutes. They only happen once — subsequent pushes reuse the cached image unless your npm or pip dependencies change.

Project Structure

The .blocks directory is where agent source code is defined. A typical project structure looks like the following:
Dependencies are isolated to each agent, and there are no restrictions for supported pip packages.

Version Control

Ideally, your agents will be checked into some git provider for version control and storage, just like any other source code. We do preserve the state of registered agents, but do not implement git for version control. However, this is something we can add if requested.

Where do I get an API key?

API keys are created and managed in the dashboard.