S3 plugin
Use S3-compatible storage with your Eliza agent.
The Eliza S3 plugin comes by default in its plugin-node
plugin, which is widely used for its
multi-purpose tools and actions.
Installation
You can either choose to clone the Eliza starter kit and use one of their examples, or you can install the dependencies directly. We'll run through the latter.
First, install core Eliza packages, including @elizaos/plugin-node
for the S3 plugin, and a couple
other packages (for database setup, environment variables, etc.):
You'll also want to make sure you're the correct version of node (v23.3.0). For example, you can use
either nvm
or pnpm
to set it up:
Make sure you've also installed the Recall S3 adapter binary wherever you want to run the Eliza agent.
You MUST own tokens and credits to create a bucket and store data, respectively. The Recall Faucet will send you testnet tokens, which you can use to purchase credits with any of the Recall tools (SDK, CLI, etc.). The Recall Portal, for example, makes it easy to manage credits and tokens instead of handling it programmatically.
Setup
Start the adapter
Then, start the Recall S3 adapter with the following command, replacing the values with your own:
Create a bucket
You'll need an existing bucket to use the GAME plugin. You can do this with an S3-compatible tool
(since we have the adapter running already), or use the Recall CLI to create one. The
key callout is that you must set the alias
metadata to eliza-bucket
(or whatever bucket
alias you like):
Create a .env
file
Next, we'll copy the example environment file:
There are a few environment variables you'll need to set. You can choose your model provider (as defined in your Eliza character file), but we'll use OpenAI for this example.
A few callouts:
- The
S3_ACCESS_KEY_ID
,S3_SECRET_ACCESS_KEY
, andS3_ENDPOINT
should be the same as the ones you use to run therecall_s3
binary. - The
S3_BUCKET
is the aliased bucket name. Note that if the adapter is running with a private key that is not the same as the creator of the bucket, you'll need to use the expanded format<0x_wallet_address>.<bucket_name>
. The bucket usage docs describe the format in more detail, but generally, you likely just usegame-bucket
as the value. - The
S3_FORCE_PATH_STYLE
should be set totrue
if you're using a local S3 adapter, which ensures the way objects are added or retrieved matches the adapter's expectation. - Optionally, you can set the
AWS_S3_UPLOAD_PATH
to a custom object prefix.
Create helper functions
Set up database and cache
There are quite a few dependencies to import for the Eliza agent, so we'll start by setting up the utility methods for database and caching, which are required for the agent to run.
Our helpers functions will use a SQLite database to store the agent's state, and a cache to store the character's data. Later, we'll use the bootstrap plugin to create the tables in our database automatically, which is necessary to store agent memories and state.
Set up the character
First, we'll get our imports set up:
Next, we'll need to set up a character file. Eliza has many built-in character examples, and they also expose a default character that you can override.
When we initialize the character, we'll override the model provider to use OpenAI, and set the
secrets
to use the environment variables we set up earlier. These are required for the S3 plugin
to work. Also, if you don't set a model provider, it might default to a downloaded model...which
can be quite large.
Configure the agent
Now, we'll create a client to interact with the agent. We'll need the node plugin (for the S3 functionality), database, and cache.
Then, we need to create the agent runtime, passing the values we set up earlier, and then register the agent with the client.
Lastly, we'll need to create a function to run the agent. Here, we'll insert a simple example of writing a hardcoded object to the S3 adapter.
Run the agent
Now, we can finally run the agent by calling the main
function! Depending on your setup, you may
need to run the agent with something like ts-node
or tsx
, e.g., npx tsx index.ts
.
This will log the configured agent information, and the we'll see our object uploaded to the S3 adapter. Afterwards, the client will start and be available for API requests.
We can then use the Recall CLI or other S3-compatible tool to view the object in our bucket! Lastly, if you want to interact with the agent, the direct client we started is running on port 3000 (by default).
For example, we can send a simple message to the uuid of the agent (logged above as
b850bc30-45f8-0041-a00a-83df46d8555d
):
And the model will respond with something like:
Although interacting with these APIs does not explicitly use our bucket upload logic, it'd be straightforward to enhance this setup to persist agent state or relevant interactions (e.g., user-provided files) within Recall.