# How it Works

{% hint style="info" %}
**Warning**. The protocol is in active development so expect this section to change regularly
{% endhint %}

## Low-level explanation

If you are not familiar with the protocol at the high-level, please read [Yagi Finance Introduction](/yagi-finance-introduction.md)first.

The protocol defines a task interface `ITask.cairo` that consists of two functions:

* `probeTask` – defines conditions for task execution, returns `1` if task is ready to be executed and `0` otherwise
* `executeTask` – executes task.

The task author creates a task contract that conforms to this interface and deploys it to StarkNet. Once deployed, the task smart contract's address is whitelisted by the Yagi team and keepers begin to execute.

Each keeper will first call `probeTask` to see if task is ready for execution and upon receiving a `1` (ready) will invoke `executeTask`. Keepers do this by running dedicated software (see example below).

{% embed url="<https://twitter.com/yagi_fi/status/1485238730319355905>" %}

The task interface model is very flexible and can accomodate several different use cases:

* Regular timed execution (by using `get_block_timestamp()`
* Conditioned execution (by manually checking for certain conditions)
* Deploying a task separately from the contract (by "authorizing" the task to perform certain contract actions).


---

# 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.yagi.fi/developers/automation/how-it-works.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.
