ElizaOS DKG agent

ElizaOS is a popular open source AI agent framework which supports a native DKG integration through the DKG plugin. You can now build AI agents that store their memories on the Decentralized Knowledge Graph (DKG). This setup enables agents to share memories (creating a collective memory) and manage their knowledge transparently and verifiably.

You can watch the following video to learn how to setup a ElizaOS DKG agent, or follow the text instructions below.

ElizaOS is operational on Mac and Ubuntu devices, Windows is not yet supported

Video tutorial (~1h 15mins)

Video: How to build an AI agent with ElizaOS DKG Plugin

Classic instructions

You can use the OriginTrail Elizagraph starter kit, which includes the plugin, or using the official ElizaOS repo, where the plugin has already been integrated. The following instructions will assume you are using the Elizagraph Starter kit.

Prerequisites - make sure you have them all set up

Step-by-step

1. Clone the Elizagraph repository

git clone https://github.com/OriginTrail/elizagraph.git
cd elizagraph

2. Install dependencies and build the project

pnpm install
pnpm run build

3. Set up environment variables

Copy the .env.example file (from the Elizagraph folder in cloned repository) and rename it to .env and fill in the necessary details. The following instructions will help you populate the .env file.

  1. Node information

If you do not already have a DKG node set up, you can use a public node that the OriginTrail team set up so that everyone has an easy way to interact with the DKG.

There's one public node available for mainnet (https://positron.origin-trail.network) and one for testnet (https://v6-pegasus-node-02.origin-trail.network). All blockchains are supported on each of the nodes.

Alternatively, you could also set up and connect to your own Edge Node for further features like a graph & chatbot interface, customizable knowledge mining pipelines, private knowledge assets, and more. Check out Edge Nodes here.

Mainnet is the live blockchain for real transactions, while testnet is a risk-free testing environment.

Here's an example of how to set up a MetaMask wallet: here

  • ENVIRONMENT: Define your environment. For example, use development if you're running a local setup, testnetfor a testnet setup, or mainneta mainnet setup.

  • OT_NODE_HOSTNAME: Enter the hostname or IP address of your OriginTrail DKG node. This will be the URL of the node you set up or http://localhost if you're running it locally.

  • OT_NODE_PORT: The port used by the DKG node, typically 8900.

  • PUBLIC_KEY: The public key of the wallet you will use to publish Knowledge Assets.

  • PRIVATE_KEY: The private key corresponding to the above wallet. Ensure you keep this secure and never share it outside of the .env file.

  • BLOCKCHAIN_NAME: Specify the blockchain network you’re using. otp:2043 (NeuroWeb mainnet), base:8453 (Base mainnet), gnosis:100 (Gnosis mainnet), otp:20430 (NeuroWeb testnet), base:84532 (Base testnet), gnosis:10200 (Gnosis testnet)

In order to fund your wallet on testnet, feel free to use the Faucet in the OriginTrail Discord. There's a message pinned in the #faucet-bot channel in case some of the faucets are down. In that case, feel free to ping the core team to send you some testnet funds manually.

If you are building your agent on the NeuroWeb, you need to get NEURO first and then TRAC.

  1. LLM key

Eliza supports a wide range of LLM providers. To use one of them, create an API key and paste it into the environment file.

Here’s how to get an API key from ChatGPT.

For example, if you want to use an Open AI LLM, populate the OPENAI_API_KEY variable in the .env.

OPENAI_API_KEY= # obtain the key on https://platform.openai.com/
  1. X credentials (in case you want to use X)

Eliza uses a basic X authentication setup. Use your username, password, and email so that the application can post on the platform. If you encounter issues, we recommend you to use the TWITTER_COOKIES variable and copy the cookies from the browser.

4. Customize DKG Knowledge Asset & query templates

If you wish to do so, modify the templates in plugin-dkg/constants.ts to change the format in which your data is stored or queried.

Additionally, you can modify the interactions with the DKG in the Eliza providers, actions, and evaluators by calling different DKG.js functions, or modifying the parameters. For example, you could use a paranet for your agent. Check out the SDK docs here.

5. Run the character

Firstly, create a character in the characters folder, for example chatdkg.character.json.

You can look at existing examples in the characters folder for inspiration.

pnpm start --characters="characters/chatdkg.character.json"

Notes

Last updated

Was this helpful?