# Build an executor bot

This page will go over some concepts which are important when building an EES executor bot, whether it be for profit or to ensure processing of jobs related to your own application. A comprehensive guide is in the works.

## Execution module specific logic

Execution modules determine crucial information such as:

* when the job can be executed
* who can execute the job
* how much the execution fee will be
* the execution fee token

All of these are necessary to avoid failed or unprofitable transactions. Since each execution module contains its own rules, it is important to implement custom logic to each of those you wish to support.

## Off-chain computation

All information necessary to determine if a job is profitable and can be executed is stored inside the job's execution module. Execution module data is stored as `Param` structs inside the `params` mapping. To avoid unnecessary RPC calls it can be advantageous to query the state once and update it locally by listening for events.

## Listen for events

Events emitted from the `JobRegistry` contract will tell when a job is created, executed or deleted. It is also beneficial to listen for execution module specific events such as if the fee function has changed.

## Parallelisation

Since all jobs are stored in the public `jobs` array, execution can easy be parallelised. The array can simply be split into even sections that each executor bot takes care of.

## Executing in batches

The `executeBatch` function of the `Coordinator` contract enables you to execute multiple jobs in a single transaction. The transaction will not revert even if one or more single job executions revert. This protects you from having your whole batch reverted because someone executed a single job from that batch faster than you. It also helps you save gas fees and makes transaction nonce management easier.

## Correct for execution tax

An executor *always* has to pay execution tax per execution. It is therefore crucial to implement into your calculations to know when a job is profitable to execute or not. The specific amount is stored on-chain and should be queried in intervals or listen for events to see if this changes.

## Strict gas price monitoring

Strict gas price monitoring is crucial to implementing a profitable executor bot. The profit you can make on executing a specific job is primarily depending on the current gas price together with how large the received execution fee is. Having live gas monitoring will give you an edge over other executor bots.

## Stay online

As an active executor, you will be designated for rounds once in a while. It is important to stay online and look out for when this happens, since failing to check-in via the `executeBatch` function on the `Coordinator` contract will result in slashing.


---

# 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.ees.xyz/guides/build-an-executor-bot.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.
