# Language Primitives

## **Blocks**

Blocks are the fundamental units of the DOVU Template Language. Each block defines a specific stage or action within the workflow. Let’s break down the key components:

* **Role:** Specifies the actor responsible for executing the block (e.g., `:supplier`, `:verifier`).
* **Type:** Defines the nature of the block, such as `:data` for data submission or `:approval` for decision-making steps.
* **Key:** Maps the block to a specific schema or process, ensuring consistency and traceability.
* **Tag:** Optionally links the block to third-party integrations, like Guardian, for enhanced functionality.

Example:

```
{
    :role :supplier
    :type :data
    :key :create-project
    :tag :create_ecological_project
}
```

This block:

* Assigns the `:supplier` role.
* Requires data submission (`:data`).
* References the `create-project` schema.
* Links to a specific Guardian policy using the `:tag` attribute.

***

## **Filters and Require States**

{% hint style="danger" %}
When working with third-party systems, occasionally one needs to wait until the system is a correct state before continuing, these specific keys allow for scanning for state before consuming the next stage of a given workflow.
{% endhint %}

Filters and require states enhance block functionality by defining dependencies and prerequisites. For example:

* **Require States:** Ensure that a block cannot proceed unless a specific condition is met (e.g., `:status :approved`).
* **Filters:** Narrow down the scope of data or actions based on predefined criteria, such as `:tag` or `:key` values.

These mechanisms ensure that workflows progress logically and efficiently, maintaining data integrity and reducing errors — while reducing complexity for developers.

***

## **Hooks**

Hooks allow developers to attach side-effects to specific blocks, enabling additional functionality. Common use cases include:

* **Audit Trails:** Automatically record actions for compliance and transparency.
* **Asset Provenance:** Trigger events to generate and store metadata for issued credits.

After a approval has happened, we know that we need to use a third-party integration hook to find some data to store in our system, we provide wait and we try figures so that we can have more than one attempt to capture the data required.

### Example:

```
{
    :role :verifier
    :type :approval
    :key :approve-claim
    :hooks [
        {
            :action :audit_trail
            :async {
                :wait 5
                :retries 10
            }
            :field :uuid
        }
    ]
}
```

***

## **Integration with Core Systems**

The template language integrates seamlessly with DOVU’s core workflow engine and third-party systems. Current integrations include:

* **Guardian:** Manage policy imports and approvals.
* **Data Validation:** Ensure submitted data conforms to predefined schemas.
* **Credit Warehouse:** Query and store issued credits for downstream usage.

As the system evolves, we plan to add:

* **Drag-and-Drop Configuration:** A visual interface for creating templates.
* **Dynamic Schema Updates:** Real-time schema modifications without disrupting workflows.
* **Cross-System Integration:** Expand support for IoT, AI, and other advanced systems.
* **General Issuance:** Example for mapping any issuance of RWA, Supply chain, or regulatory process.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dovu.earth/template-language/language-primitives.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
