Fetch.ai has recently launched ASI-1 Mini, a Web3-native LLM designed for complex, autonomous workflows.

Try nowopen-new-tab-icon
article_icon
article

SQD x Fetch.ai: Powering AI Agents with Real-Time Onchain Data

The integration with SQD.ai is a significant step toward empowering our agents with structured onchain data

2025-03-193 min read min readFetch.ai

At Fetch.ai, we are building a decentralized ecosystem where AI agents operate autonomously, making informed decisions and executing tasks efficiently. The integration with SQD.ai is a significant step toward empowering our agents with structured onchain data, enabling them to:

  • Automate and optimize transactions in DeFi
  • Build sophisticated agent pipelines for complex workflows
  • Make data-driven decisions with high-quality, real-time blockchain information SQD’s infrastructure complements Fetch.ai’s agent framework by providing structured data that enhances agents' ability to interact with DeFi protocols and other blockchain-based applications.

Addressing Key Challenges with Fetch.ai & SQD-powered AI Agents

As blockchain adoption accelerates, the demand for reliable, real-time onchain data increases. Fetch.ai and SQD-powered AI agents work together to overcome challenges such as:

  • Fragmented APIs: Traditional methods of retrieving blockchain data can be slow and inconsistent.
  • Expanding Blockchain Use Cases: From real-world assets (RWA) to cross-border payments, AI agents require accurate data to function effectively.
  • Scalability & Automation: Fetch.ai agents, powered by SQD’s data, can monitor liquidity, track NFT transfers, and analyze financial products autonomously.

Unique Capabilities of SQD-Powered Fetch.ai Agents

Fetch.ai’s uAgents framework is designed for scalable, decentralized AI agents. With SQD integration, agents gain access to:

  • 200+ Blockchain Networks: Including EVM-compatible, Substrate-based, Solana, Fuel, and Tron.
  • Real-Time Data with SQD Streams: Agents receive continuous updates on transactions, swaps, and onchain events.
  • Cross-Chain Adaptability: Fetch.ai’s lightweight agent architecture, combined with SQD’s structured data, allows agents to function seamlessly across multiple networks.

How SQD AI Agents Operate in Fetch.ai’s Ecosystem

Fetch.ai agents, developed using the uagents library, operate with key functionalities such as:

  • Decentralized Deployment: Agents run locally or on platforms like agentverse.ai.
  • Discoverability: Agents register on the Fetch.ai chain, making them accessible via DeltaV.
  • Automated Messaging: Agents process structured data through defined protocols.

A typical SQD-powered Fetch.ai agent follows this workflow:

  1. Data Request Handling: The agent receives a structured query (e.g., Uniswapv3CandleRequest).
  2. Data Retrieval: Using SQD’s indexers, the agent fetches relevant onchain data.
  3. Processing & Response: The agent formats the data and responds with actionable insights.
code-icon
code-icon
from uagents import Agent, Context, Model, Field, Protocol
from uagents.setup import fund_agent_if_low
import requests
from datetime import datetime, timezone

POOL = "<POOL_ADDRESS>"
URL_ENDPOINT = "<GRAPHQL_ENDPOINT>"

def timestamp_to_iso_string(ts: int) -> str:
   return datetime.fromtimestamp(ts, tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.000Z")

def get_candles(start_timestamp: int, end_timestamp: int):
   query = f"""
   query {{
       poolHourData(
           where: {{
               poolId_eq: "{POOL}",
               date_gt: "{timestamp_to_iso_string(start_timestamp)}",
               date_lte: "{timestamp_to_iso_string(end_timestamp)}"
           }},
           limit: 10
       ) {{
           date
           open
           high
           low
           close
           volume
       }}
   }}
   """
   response = requests.post(URL_ENDPOINT, json={"query": query})
   data = response.json().get("data", {})
   return data.get("poolHourData", [])

class Uniswapv3CandleRequest(Model):
   start_timestamp: int = Field(...)
   end_timestamp: int = Field(...)

candle_protocol = Protocol(name="uniswapv3_protocol")

@candle_protocol.on_message(model=Uniswapv3CandleRequest)
def handle_candle_request(ctx: Context, sender: str, msg: Uniswapv3CandleRequest):
   candles = get_candles(msg.start_timestamp, msg.end_timestamp)
   if not candles:
       ctx.send(sender, "No candle data found.")
   else:
       formatted = [f"{c['date']}: O={c['open']} H={c['high']} L={c['low']} C={c['close']} V={c['volume']}" for c in candles]
       ctx.send(sender, "\n".join(formatted))

agent = Agent()
fund_agent_if_low(agent.wallet.address())
agent.include(candle_protocol, publish_manifest=True)

if __name__ == "__main__":
   agent.run()

Future Developments: The Road Ahead for Fetch.ai & SQD

Expanded Data Coverage Fetch.ai and SQD will continue integrating new blockchains and refining data retrieval mechanisms, enhancing the decision-making capabilities of AI agents. Real-Time Data with SQD Streams The upcoming SQD Streams feature will provide real-time blockchain data, unlocking use cases such as front-running detection, automated liquidity management, and advanced analytics. Community-Driven Innovation Developers will be able to create and deploy customized Fetch.ai agents leveraging SQD’s data infrastructure. DeltaV will facilitate seamless agent collaboration, enabling use cases like on-the-fly analytics and automated trading strategies. Accessing SQD Agents in Fetch.ai’s Ecosystem SQD-powered agents will be discoverable via DeltaV and agentverse.ai: Set the function group in DeltaV to “Public” to view all registered agents. Search for “SQD” on agentverse.ai to find community-built and official SQD-powered agents.

Conclusion

Fetch.ai’s integration with SQD.ai marks a milestone in the evolution of decentralized AI agents. By combining Fetch.ai’s autonomous agent framework with SQD’s structured blockchain data, we unlock new possibilities for DeFi, real-world assets, and beyond. Together, we are shaping the future of AI-driven automation in Web3.


More from Fetch