Skip to content

Commit ef03748

Browse files
authoredFeb 21, 2025··
Merge pull request #2 from valory-xyz/development
Add build and local run functionality
2 parents af85334 + 15dd572 commit ef03748

File tree

10 files changed

+88
-87
lines changed

10 files changed

+88
-87
lines changed
 

‎.github/workflows/common_checks.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: main_workflow
33
on:
44
push:
55
branches:
6-
- development
76
- main
87
pull_request:
98

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ For now, the agent uses ETH exclusively; support for other networks (such as CEL
2929
## How It Works
3030

3131
1. **Download the Quickstart**
32-
Get started quickly by downloading the project and installing its dependencies.
32+
Please refer to the [Agent Quickstart Guide](docs/agents.md).
3333

3434
2. **Set Up Your Environment**
3535
- Fund your agent with ETH.

‎agents-fun/data/.gitkeep

Whitespace-only changes.

‎agents-fun/src/config/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ export function fetchSafeAddress(): string {
139139
const safeAddressDict =
140140
process.env.CONNECTION_CONFIGS_CONFIG_SAFE_CONTRACT_ADDRESSES;
141141
if (!safeAddressDict) {
142-
console.error(
142+
console.warn(
143143
"Safe address dictionary is not defined in the environment variables.",
144144
);
145-
process.exit(1);
145+
return "";
146146
}
147147
try {
148148
const safeAddressObj = JSON.parse(safeAddressDict);

‎agents-fun/src/utils.ts

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ export async function triggerPluginActions(
8484
undefined,
8585
);
8686
if (result) {
87+
const checkSafeAddress = runtime.getSetting("SAFE_ADDRESS");
88+
if (!checkSafeAddress) {
89+
elizaLogger.warn("SAFE_ADDRESS setting is not set");
90+
elizaLogger.warn("Token Interaction behaviour won't be executed");
91+
return false;
92+
}
8793
elizaLogger.log(
8894
`[Trigger] Tweet was successful. Executing meme interaction...`,
8995
);

‎docker-compose.yaml

-79
This file was deleted.

‎docs/agents.md

+27-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- [Set Docker permissions so you can run containers as non-root user](https://docs.docker.com/engine/install/linux-postinstall/)
1111

1212

13-
## Run you own agent
13+
## Run your own agent
1414

1515
### Get the code
1616

@@ -25,21 +25,44 @@
2525
git submodule update --init --recursive
2626
```
2727
28-
2. Create the virtual environment:
28+
2. Install dependencies:
2929
3030
```
3131
cd agents-fun-eliza
3232
pnpm install
3333
```
3434
35-
3. Build the packages:
35+
3. Define your character description in agents-fun/characters/eliza.character.json and update the system, bio and lore section as per your liking.
36+
37+
4. Build and push the agent to your docker hub :
3638
```
37-
pnpm build
39+
pnpm build:agent
3840
```
41+
## RUN USING OLAS SDK(Provides a deployed safe with contracts)
3942
4043
#### Prepare the data
4144
4245
1. Edit the character file in agents-fun/characters/eliza.character.json and update the system, bio and lore section as per your liking.
4346
2. Follow the steps mentioned in [Olas-sdk-docs](https://github.com/valory-xyz/docs/blob/main/docs/olas-sdk/index.md), to build a olas agent using [Olas SDK Starter](https://github.com/valory-xyz/olas-sdk-starter/blob/main/README.md) and the docker image of the agent.
4447
4548
For the Eliza Memeooorr agent we support agentic runs using olas-sdk. Which provides a set of tools to build and run agents, with a automatic safe account creation and management.
49+
50+
## RUN LOCALLY
51+
52+
> :warning: **Warning**
53+
> Agent won't perform token interaction behaviour unless you deploy your own safe on base network with the required contracts.
54+
55+
#### Prepare the data
56+
57+
1. Edit the character file in agents-fun/characters/eliza.character.json and update the system, bio and lore section as per your liking.
58+
2. Prepare the env
59+
```
60+
cp .env.example .env
61+
```
62+
63+
64+
3. Run the docker file built previously, with the env file:
65+
66+
```
67+
docker run -it --rm --env-file .env <IMAGE_NAME>
68+
```

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"author": "",
66
"scripts": {
77
"build": "lerna run build --stream",
8+
"build:agent": "./scripts/build.sh",
89
"start": "pnpm --filter \"agents-fun\" start --isRoot",
910
"start:with-args": "tsc && node --loader ts-node/esm src/index.ts --",
1011
"clean": "lerna clean",

‎scripts/build.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# Prompt the user to enter their Docker username
4+
read -p "Enter your Docker username: " DOCKER_USERNAME
5+
6+
# Check if the Docker username is empty
7+
if [ -z "$DOCKER_USERNAME" ]; then
8+
echo "Docker username cannot be empty."
9+
exit 1
10+
fi
11+
12+
# Ask if the user has an IPFS hash for their image
13+
read -p "Do you have an IPFS hash for your image? (y/n): " HAS_IPFS_HASH
14+
15+
if [ "$HAS_IPFS_HASH" != "y" ]; then
16+
echo "Please visit the following link to learn more about how to register and mint your agent to generate an IPFS hash for your image:"
17+
echo "https://github.com/valory-xyz/olas-sdk-starter/blob/main/README.md"
18+
echo "Once you are ready with your hash, you can come back and build again."
19+
exit 0
20+
fi
21+
22+
# Prompt the user to enter their IPFS hash
23+
read -p "Enter your IPFS hash: " IPFS_HASH
24+
25+
# Check if the IPFS hash is empty
26+
if [ -z "$IPFS_HASH" ]; then
27+
echo "IPFS hash cannot be empty."
28+
exit 1
29+
fi
30+
31+
# Navigate to the directory containing the Dockerfile
32+
cd "$(dirname "$0")/.."
33+
34+
# Build the Docker image
35+
docker buildx build --platform=linux/amd64 -t ${DOCKER_USERNAME}/oar-memeooorr_eliza:${IPFS_HASH} .
36+
37+
# Check if the build was successful
38+
if [ $? -eq 0 ]; then
39+
echo "Docker image built successfully."
40+
echo "Image Name: ${DOCKER_USERNAME}/oar-memeooorr_eliza:${IPFS_HASH}"
41+
# Ask if user will push the image to Docker Hub
42+
read -p "Would you like to push the image to Docker Hub? (y/n): " PUSH_IMAGE
43+
if [ "$PUSH_IMAGE" == "y" ]; then
44+
docker push ${DOCKER_USERNAME}/oar-memeooorr_eliza:${IPFS_HASH}
45+
echo "Image pushed to Docker Hub."
46+
fi
47+
else
48+
echo "Docker image build failed."
49+
exit 1
50+
fi

‎scripts/run.sh

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Navigate to the script's directory
44
#
5+
echo "This script is used for running the agent in olas operate environment inside a docker container"
56
echo "Reading wallet and safe address from agents folder"
67
# wallet ovt key will be present inside the /agent_key/ethereum_private_key.txt folder
78
# safe address will be present inside the /agent_key/safe_address.txt folder

0 commit comments

Comments
 (0)
Please sign in to comment.