Skip to content

Commit be28218

Browse files
committed
feat(agent): add the feature to run agent locally
1 parent 4eaf954 commit be28218

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

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
);

docs/agents.md

+22-1
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

@@ -38,10 +38,31 @@
3838
```
3939
pnpm build:agent
4040
```
41+
## RUN USING OLAS SDK(Provides a deployed safe with contracts)
4142
4243
#### Prepare the data
4344
4445
1. Edit the character file in agents-fun/characters/eliza.character.json and update the system, bio and lore section as per your liking.
4546
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.
4647
4748
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+
```

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)