S3 plugin
Easy drop in for S3-compatible Recall storage with the GAME framework.
The GAME S3 plugin allows you to store and retrieve arbitrary data with your agent. It requires you run the Recall S3 adapter, which exposes an API that can be configured to work with GAME.
Installation
You can either choose to clone the GAME repository and use one of their examples, or you can install the dependencies directly. We'll run through the latter.
First, install the core GAME package, along with the S3 plugin and dotenv
for reading our
environment variables:
Make sure you have installed the Recall S3 adapter binary wherever you want to run the GAME 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 the respective tooling. The Recall Portal also 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 game-bucket
(or whatever bucket alias
you like):
Create a .env
file
Create a .env
file in the root of your project and add the following environment variables,
matching those from the previous steps:
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.
Set up your agent
Now, you're ready to create your agent. The first step is to get your imports and environment variables set up:
Next, we'll create a new instance of the GameAgent
class, passing in the API key and the S3
plugin:
Run the agent
We'll keep it simple and just upload and download a file in our agent loop, and then exit.
Then, add tasks to the agent to upload and download a file.
Inspect agent outputs
Running the agent will log the following to the console:
You should see the file uploaded to the S3 bucket, and then downloaded to your local file system as
./test.txt
. You'll also notice you can navigate to the signed URL in your browser and see the file
there, too!
If you use any of the Recall tools, you'll be able to see the file in the bucket as well.