-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Write agent app README #75
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
PROTOCOL_PROVIDER_PRIVATE_KEY=afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890 | ||
BLOCK_NUMBER_BLOCKMETA_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuaWNlIjoidHJ5Iiwibm90aGluZyI6InRvIiwic2VlIjoiaGVyZSJ9.gsWpvMzpzd5_7IN_GU0PhNLH7wuKHl29FHkL5-i18b4 | ||
EBO_AGENT_CONFIG_FILE_PATH="./config.example.yml" | ||
EBO_AGENT_CONFIG_FILE_PATH="./config.example.yml" | ||
DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN | ||
DISCORD_CHANNEL_ID=YOUR_DISCORD_CHANNEL_ID |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Agent Monorepo | ||
|
||
The `agent` package is designed as a service that drives the EBO agent's main workflow. It initializes the relevant | ||
services in the `packages` directory that are necessary to run the agent, like `BlockNumberService` and `ProtocolProvider`. | ||
The agent interacts with the EBO smart contracts deployed on the chains specified in the `config.yml` file | ||
that you'll create during this setup process. | ||
|
||
## Setup | ||
|
||
To set up the EBO agent, follow these steps: | ||
|
||
1. **Install Dependencies**: Ensure you have `pnpm` installed, and run: | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
2. **Configure Environment Variables**: | ||
|
||
- Create a `.env` file in the root of the `agent` package. Refer to `.env.example` for the required environment variables. | ||
- Populate the file with your environment-specific settings: | ||
|
||
```bash | ||
cp .env.example .env | ||
``` | ||
|
||
**Environment Variables**: | ||
|
||
| Variable | Description | Required | | ||
| ------------------------------- | ----------------------------------------- | -------- | | ||
| `PROTOCOL_PROVIDER_PRIVATE_KEY` | Private key for the Protocol Provider | Yes | | ||
| `BLOCK_NUMBER_BLOCKMETA_TOKEN` | BlockmetaBlockNumberService bearer token | Yes | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that I'm thinking, it'd be nice to add a link or something like that so potential contributors have at least some idea on how to get this token (was something that we struggled with) Here are two of the main resources that we've used:
Mind adding some footnotes for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added ✅ |
||
| `EBO_AGENT_CONFIG_FILE_PATH` | Path to the agent YAML configuration file | Yes | | ||
| `DISCORD_BOT_TOKEN` | Your Discord bot's token | Yes | | ||
| `DISCORD_CHANNEL_ID` | Discord channel ID for notifications | Yes | | ||
|
||
3. **Configuration File**: | ||
|
||
- The agent also requires a YAML configuration file. The path to this file must be specified in the `.env` file via `EBO_AGENT_CONFIG_FILE_PATH`. | ||
- To set up the configuration, copy `config.example.yml` to `config.yml`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we should add explanatory comments inside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added comments in config.example.yml There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! I like it |
||
|
||
```bash | ||
cp config.example.yml config.yml | ||
``` | ||
|
||
- Update the `config.yml` file with your specific settings. | ||
|
||
## Available Scripts | ||
|
||
Here are the scripts you can run using `pnpm`: | ||
|
||
| Script | Description | | ||
| ------------- | ---------------------------------------------- | | ||
| `build` | Build the agent | | ||
| `check-types` | Check for type issues using TypeScript | | ||
| `clean` | Remove `dist` folder | | ||
| `format` | Check code formatting using Prettier | | ||
| `format:fix` | Automatically fix code formatting issues | | ||
| `lint` | Run ESLint to check for code quality and style | | ||
| `lint:fix` | Automatically fix ESLint errors | | ||
| `start` | Start the EBO Agent | | ||
| `test` | Run tests using Vitest | | ||
| `test:cov` | Run tests with a coverage report | | ||
|
||
### Running the Agent | ||
|
||
To start the EBO Agent, run: | ||
|
||
```bash | ||
pnpm run start | ||
``` | ||
|
||
## Running Tests | ||
|
||
The `agent` package includes a suite of Vitest and end-to-end (e2e) tests to verify the correct functioning of the agent's processes. To run the Vitest tests, execute: | ||
|
||
```bash | ||
pnpm run test | ||
``` | ||
|
||
For a coverage report, run: | ||
|
||
```bash | ||
pnpm run test:cov | ||
``` | ||
|
||
### End-to-End Testing | ||
|
||
The e2e tests simulate scenarios starting at the contract level and extending to the agent, like processing requests and handling disputes. For detailed test scenarios, refer to the files in `test/e2e/scenarios`. | ||
|
||
TODO: Add instructions on running e2e tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a
.env
file is optional, users could (and probably should but it's up to them) use env vars directly while running the agent. Let's rephrase this one just to show that's not a must to use a .env fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioned the option to use the env vars directly