Prerequisites
- An environment with Python 3.11 and Node.js 22 installed.
- Blocks account and API key.
If you’d like to use Blocks with other providers such as GitLab or Bitbucket, please reach out: dev@blocks.team.
Initialize Blocks
.blocks directory in the current working directory.Create a Ralph Loop Code Automation
The easiest way to create an agent is to use the This will create a new agent in the 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
create command..blocks directory with the following structure: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.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:
pip packages.

