Fuel Your Eliza AI Agent with SQD

Introducing SQD's Newest Tool

Agents. At SQD, we believe they will shape the next era of blockchain innovation. If you pause for a moment to imagine the role these autonomous, AI-driven systems will play in the crypto economy over the coming decades, it’s not hard to see where things are headed.

Imagine a world where AI agents orchestrate most on-chain activity—analyzing markets, executing trades, and managing liquidity with real-time blockchain insights. They won’t just need data; they’ll need context to make informed decisions with confidence.

SQD is poised to be their eyes, enabling them to perceive, interpret, and act in this evolving crypto landscape. As the agentic economy takes shape, questions remain about structuring blockchain data, identifying the most valuable datasets, and defining the frameworks that will drive autonomous on-chain entities. While we don’t have all the answers yet, we’re committed to finding them.

This blog post is your first step into this journey, where we start the exploring the intersection between the AI agent framework ecosystem and SQD's data lake, and it couldn't start in a different way than with our very own ElizaOS plugin.

In this blog post we're going to explore the features available through Eliza SQD plugin and how we can use it to build a really simple natural language version of Cryo, a CLI tool to extract on-chain datasets.

What does this Plugin do?

ElizaOS extends the core functionalities of the framework through plugins. Among these extensions, two key components stand out: providers and actions.

Providers act as a continuous feed of data, running at every agent loop. Whenever an agent receives an input, its providers kick in, injecting their information directly into the agent's context. This means that every response the agent generates is always enriched with the latest data available. Actions, on the other hand, work differently. Instead of being executed on every cycle, actions are invoked only when the agent decides it needs them. Think of them as on-demand tools, functions that the agent can call whenever the situation requires it.

The SQD plugin offers two datasets to be used in the form of both providers and actions: ERC20 tranfers and Uniswap swap decoded events.

For providers, users need to statically define extraction parameters such as contract address, block ranges, sender addresses, among others. In actions, however, the agent will try to extract all the necessary parameters from the user prompt.

Our actions are also capable of exporting the extracted data. So instead of simply displaying 100,000 events for a given contract, it can, upon request, generate outputs in three different formats: JSON, CSV, and Parquet. These files can then be used for further analysis or integrated into other stages of the agent’s execution process.

SQD plugin leverages the power of an upcoming feature of the SQD SDK 2.0, stateless streams, which doesn't require any sort of indexer to fetch a large volume of on-chain data in a single request. Data is streamed directly from the SQD network to your agent.

Now that we know what the SQD plugin is capable of, lets build something with it.

Chatterbox Cryo: a CLI that you can call a friend

As mentioned above, Cryo is a fantastic CLI tool that everyone who deals with on-chain data should have under their utility belt. It makes extremely easy to extract different datasets from the EVM chains, all you need is a JSON-RPC URL. From block ranges, reorg tolerance, the formats to which the data will be extract to, Cryo offers a wide range of options that you can pick from to extract the exact data you're looking for.

Our version of Cryo would be much simpler than that for the sake of a tutorial. Our chatterbox version of the CLI tool will be able to extract ERC20 transfer and Uniswap swap events, being able to filter by contract address, sender, recipient and block ranges, in the case of tokens and pool address and block ranges for swaps. It will also be able to export the datasets to json, csv and parquet file formats.

Let's put everything together.

Setting up the environment

The first step in our journey is to set up our environment and make sure we have access to the latest version of the SQD plugin for ElizaOS. Right now, that means cloning the SQD fork of ElizaOS, which contains all the latest updates. In the near future, this will become even easier with the new plugin registry built by the ai16z team, but for now, let’s roll up our sleeves and get things set up manually.

git clone https://github.com/subsquid-labs/eliza.git

Now, let’s get our environment variables in place. This part is straightforward—just copy the .env.example file and rename it to .env and install the dependencies. Business as usual.

# Create .env file
cp .env.example .env

# Install dependencies
pnpm install

At this stage, you’ll need to choose your LLM provider. We’re rolling with OpenAI for this tutorial, but you’re free to use whichever provider fits your needs. Just remember, if you’re not using OpenAI’s API, be sure to set USE_OPENAI_EMBEDDING=false in your .env file.

Since we are using OpenAI, we’ll go ahead and drop our API key into the .env, making sure everything is wired up correctly before moving forward. The rest of variables can remain untouched for now.

# .env file
OPENAI_API_KEY=sk-***-***...

For now, the SQD plugin only support a single chain at a time, so you will need to provide two other variables in the .env file, the Portal and RPC URL to the desired chains. In our case, we're going to use the Arbitrum, but you can check here all the supported chains.

SQD_PORTAL_URL=https://portal.sqd.dev/datasets/arbitrum-one

# Used to fetch basic token information like decimals and symbol
SQD_RPC_URL=https://arbitrum.llamarpc.com 

Bringing the CLI to life

Now that our environment is set up, it’s time to bring our agent to life. We'll create a new character file under the characters/ folder, and call it cryo.character.json.

touch characters/cryo.character.json

To make things even easier, you can copy the full character file from this link.

One key detail to pay attention to in this file is the section where we define the available plugins. This is where we explicitly list the SQD plugin, granting our agent access to the on-chain data capabilities mentioned previously. Without this step, our agent wouldn’t be able to tap into SQD’s data lake, so make sure everything is in place.

{
    ...
    "plugins": ["@elizaos/plugin-sqd"]
    ...
}

Running the agent

After wiring all those pieces together, we're ready to test our agent and get it to answer some questions about on-chain data. Lets run the agent using the command below:

pnpm run dev --characters="characters/cryo.character.json"

From a browser window, navigate to http://localhost:5173 and select our Cryo character.

Pasted image 20250210173533

Showtime! Let’s put our Cryo agent to the test and see what it can really do. First, let’s start by asking it about token transfers.

Find all the transfer for the token OxFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 between the blocks 304090475 and 304091475 where the sender is 0x2284a22A6abdDd6c6ed25B57182aAa4b0ab6dA51
Pasted image 20250210185857

Notice how we can omit a few parameters and we're still able to retrieve the events we're interested in. The only mandatory parameter in the prompt is the start block, so you need to express in some way at what block height the plugin should start fetching the data. All the other parameters are not required.

Find all the transfer for the token
OxFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 between the blocks
290_000_000 and 290_000_001
Pasted image 20250210174853

Can it really dump events into files?

Dump the transfers of the token 0x82aF49447D8a07e3bd95BDOd56f35241523fBab1
between the block 230_000_000 and 230_100_000 to a json
Pasted image 20250210190507

And just like that, we have a JSON file with 100,000 blocks of WETH transfers on Arbitrum in less than 10 seconds. Mind-blowing.

What about Uniswap events? We got you covered there as well.

Find the swap events of the pool 0xC6962004f452bE9203591991D15f6b388e09E8D0
between 300_000_000 and 300_000_100
Pasted image 20250210193100

Expanding the example

Our chattier version of Cryo is just the beginning. What we’ve built so far is a solid foundation, but there’s so much more we can do to push this agent further. We can expand its scope with the following improvements:

  • Multi-chain support: Enable queries across multiple chains within a single request.
  • Multiple contracts per prompt: Allow users to fetch data from multiple contracts at once.
  • Improved query experience: Support token symbols instead of requiring contract addresses.
  • Expanded datasets: Provide a broader range of decoded data.

The example agent that we build can be extended in order to offer a better user experience, such as defining a map of token symbol to token address or expand to all the chains out there. So user can query token transfers directly through token's symbol. But also expand to support multiple contracts and multiple tokens.

What's next for SQD and AI agents?

While access to a large volume of decoded transactions is valuable for AI agents, the real challenge lies in delivering meaningful information, not just raw data. Instead of overwhelming agents with noise, we're focused on finding the signals that truly matter for decision-making, strategy, and automation, ensuring agents have the most relevant bits of information to choose the best path forward.

This is just the beginning. As we continue to explore the evolving landscape of AI agents, we’ll refine and iterate on how to bridge the gap between raw on-chain activity and actionable intelligence for autonomous agents.

We'd love to hear from you if you’re an agent developer passionate about on-chain data and AI-driven automation. Whether you have feedback, ideas, or just want to chat about the future of AI agents in crypto, reach out to us through our Telegram channel, we’re always up for a conversation. Let’s build the agentic economy together.