> For the complete documentation index, see [llms.txt](https://docs.zerve.ai/zerve-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zerve.ai/zerve-docs/notebooks/blocks.md).

# Blocks

The types of block you can use in a project, and what you can do with them.

A **block** is a single step in a project, such as a piece of Python or a SQL query. Blocks are connected: each one can use the results of the blocks before it.

## Block types

| Block                                                                     | What it's for                                                 | Notebook | Canvas |
| ------------------------------------------------------------------------- | ------------------------------------------------------------- | -------- | ------ |
| [Python](/zerve-docs/notebooks/blocks/python.md)                          | Python code                                                   | Yes      | Yes    |
| [SQL query](/zerve-docs/notebooks/blocks/sql-query.md)                    | Querying a data connection, or a dataframe from another block | Yes      | Yes    |
| [R](/zerve-docs/notebooks/blocks/r.md)                                    | R code                                                        | Yes      | Yes    |
| [Markdown](/zerve-docs/notebooks/blocks/markdown.md)                      | Notes and documentation                                       | Yes      | Yes    |
| [GenAI](/zerve-docs/notebooks/blocks/genai.md)                            | Sending a prompt to an AI model                               | Yes      | Yes    |
| [UI blocks (input and output)](/zerve-docs/notebooks/blocks/ui-blocks.md) | Building a simple app from your project                       | Yes      | Yes    |
| [Aggregator](/zerve-docs/notebooks/blocks/aggregator.md)                  | Collecting the results of a Fleet                             | Yes      | Yes    |
| [Logic gate](/zerve-docs/notebooks/blocks/logic-gate.md)                  | Running the next blocks only when a condition is met          | No       | Yes    |
| [R Markdown](/zerve-docs/notebooks/blocks/r-markdown.md)                  | R code with narrative, published as a report. Being retired.  | No       | Yes    |

The canvas view also has **API Controller**, **API Route** and **SageMaker endpoint** blocks, for building deployments. See [APIs](/zerve-docs/ship-your-work/apis.md#building-apis-in-the-canvas).

## Adding a block

| To                                        | Windows         | Mac       |
| ----------------------------------------- | --------------- | --------- |
| Add a block connected to the active block | Alt + N         | ⌥ + N     |
| Choose the type of the new block first    | Shift + Alt + N | ⇧ + ⌥ + N |

## Running blocks

Each block's run menu offers:

| Option                            | What it does                                                                               |
| --------------------------------- | ------------------------------------------------------------------------------------------ |
| **Run this block**                | Runs the block. If it has already run and nothing has changed, its saved results are used. |
| **Run up to here**                | Runs every block before this one, then this one                                            |
| **Run from here**                 | Runs this block, then every block after it                                                 |
| **Force run** (each of the above) | Runs again even if the saved results are up to date                                        |

While a block is running, the same button stops it. See [Keyboard shortcuts](/zerve-docs/notebooks/keyboard-shortcuts.md#blocks-execution) for the shortcut for each option.

## Other block options

The block toolbar includes:

| Option                    | Details                                                                                                                                              |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Compute settings**      | Choose the compute the block runs on. See [Compute types](/zerve-docs/compute/compute-types.md).                                                     |
| **Comments**              | Discuss the block with your team. See [Collaboration and comments](/zerve-docs/notebooks/collaboration-and-comments.md).                             |
| **Lint code**             | Tidy a Python block's code                                                                                                                           |
| **Split block**           | Split a Python or R block into two, at the cursor                                                                                                    |
| **Copy block link**       | Copy a link to the block                                                                                                                             |
| **Clear output**          | Remove the block's saved output                                                                                                                      |
| **Lock block**            | Stop the block from being changed or run. See [Block-level security](/zerve-docs/notebooks/block-level-security.md).                                 |
| **Code & Variables mode** | See the block's inputs, outputs and variables in full. See [Variables, outputs and caching](/zerve-docs/notebooks/variables-outputs-and-caching.md). |
| **Delete**                | Remove the block                                                                                                                                     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zerve.ai/zerve-docs/notebooks/blocks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
