Compass Virtuals SDK
The Compass Virtuals SDK is a powerful framework that revolutionizes how agents interact with DeFi. This SDK allows all developers on Virtuals to create AI agents that can autonomously interact with DeFi, opening a completely new set of possibilities for Virtuals agents, without needing to grapple with Solidity, bytecode, or scattered documentation.
Check out the Compass Virtuals SDK on Pypi here
Read to full blogpost here
Getting Started
Follow the steps below to get your agents up and running with the Compass Virtuals SDK:
Install the SDK
Configure Your Environment
Create a .env
file with:
You can get an rpc url from a provider like Anker, or check your Metamask settings to see which node it talks to.
Run the Sample Agent
Now you can run our simple agent provided in our package.
Your agent will:
- Fetch its wallet address
- Query on-chain pricing data
- Build and execute transactions (if funds are available)
Building Your Own Agent
The SDK is packed with tools to help you build the agent of your dreams. Here’s an example of what simple agent code looks like:
Note that each of the classes that we provide for suggested WorkerConfig’s contains an id
, worker_description
, get_state_fn
, and action_space
. You can change any of these as you like. The action_space
is the only really crucial part.
If you would like to pick and choose which tools you use with which agents, then as well as all tools being listed in the respectiveaction_space
, each tool is set as a method on the helper classes. For example, you can get the game_sdk Function
instance for checking on-chain balances from compass.virtuals_sdk.api_wrapper.Others.generic_balance_get
.
Was this page helpful?