Your First AI Agent on Supra
In this guide, you’ll learn how to build and run your first Supra AI Agent, an interactive agent that communicates with the Supra Network and capable of:
Creating a new account on Supra Network.
Fetching your account balance.
Funding your account via faucet
Retrieving transaction details by transaction hash
Retrieving your transaction history
Fetching on‑chain resource data of your account.
Why Choose Supra for AI Agents?
Supra’s vertically integrated infrastructure, plus tight coupling of OpenBlocks.ai at its core, creates the most complete environment for AI Agents to flourish in a multi-chain DeFi world.
With real-time data through Supra’s built-in Oracles, native automation, cross-chain communication, and seamless execution all in one stack, Supra will allow your AI Agent to operate at peak intelligence and speed. Supra is the first platform where strategy becomes execution without friction.
In a world of fragmented tools, Supra delivers the one thing AI Agents truly need: a unified infrastructure to execute your intent at the speed of light.
Prerequisites
Before getting started, make sure you have the following installed:
Node.js
Project Setup
$ npx tsx agent.ts
*** Welcome to SupraOnChainAgent ***
Initializing Supra Client...
Connected to network with chain ID: _ChainId { value: 6 }
Loaded existing account from account.json
Your Supra Account Address: 0x26b58df6a3716bc16de96d6aa5fa60c1cf12e0854e8983b4a6d0a4a9548c218d
Available commands:
- 'what is the balance of my account' : Fetch account info & balance
- 'please fund my account' : Fund account via faucet
- 'show me transaction details for <TX_HASH>': Fetch transaction details
- 'what is my transaction history' : Retrieve transaction history
- 'show my account resources' : Fetch resource data
- 'help' : Show this help message
- 'exit' : Quit the agent
SupraOnChainAgent>
The agent will carry out the corresponding blockchain operations using the Supra-L1-SDK.
Interacting with the Agent
Fetching the Wallet Balance
Supra OnChain Agent> what is the balance of my account
--- Account Info ---
Address : 0x26b58df6a3716bc16de96d6aa5fa60c1cf12e0854e8983b4a6d0a4a9548c218d
Sequence Number : 0n
Authentication Key: 0x26b58df6a3716bc16de96d6aa5fa60c1cf12e0854e8983b4a6d0a4a9548c218d
Balance : 1000000000
---------------------
Fetching Transaction details based on its TXN Hash.
Supra OnChain Agent> show me transaction details for 0x0eddc65189edae437e326908f9039f046801eec8db8a08e5b01b0a75b7dfd46a
--- Transaction Details ---
{
"txHash": "0x0eddc65189edae437e326908f9039f046801eec8db8a08e5b01b0a75b7dfd46a",
"sender": "0x6f12b0fe05ba8796c0455981c88c99a11539ef205723a1740fc7dd72cb98520f",
"sequenceNumber": 1553378,
"maxGasAmount": 500000,
"gasUnitPrice": 100,
"gasUsed": 35,
"transactionCost": 3500,
"txExpirationTimestamp": 1747814148000000,
"txConfirmationTime": 1747813849978867,
"status": "Success",
"events": [
{
"guid": {
"creation_number": "0",
"account_address": "0x0"
},
"sequence_number": "0",
"type": "0x1::coin::CoinWithdraw",
"data": {
"account": "0x6f12b0fe05ba8796c0455981c88c99a11539ef205723a1740fc7dd72cb98520f",
"amount": "518227",
"coin_type": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_usdc::TestUSDC"
}
}
Looking for Resources in your account
Supra OnChain Agent> show my account resources
--- Account Resources ---
{
"resource": [
[
"0x0000000000000000000000000000000000000000000000000000000000000001::account::Account",
{
"address": "0000000000000000000000000000000000000000000000000000000000000001",
"module": "account",
"name": "Account",
"type_args": []
}
],
[
"0x0000000000000000000000000000000000000000000000000000000000000001::coin::CoinStore<0000000000000000000000000000000000000000000000000000000000000001::supra_coin::SupraCoin>",
{
"address": "0000000000000000000000000000000000000000000000000000000000000001",
"module": "coin",
"name": "CoinStore",
"type_args": [
{
"struct": {
"address": "0000000000000000000000000000000000000000000000000000000000000001",
"module": "supra_coin",
"name": "SupraCoin",
"type_args": []
}
}
]
}
]
],
"cursor": "0026b58df6a3716bc16de96d6aa5fa60c1cf12e0854e8983b4a6d0a4a9548c218d6801000000000000000000000000000000000000000000000000000000000000000104636f696e09436f696e53746f7265010700000000000000000000000000000000000000000000000000000000000000010a73757072615f636f696e095375707261436f696e0000"
}
-------------------------
Conclusion
Congratulations on building your first Supra Agent! This guide serves as a starting point in your journey into the Supra ecosystem.
Want to create more AI Agents on Supra?
Our Agents Hub is live with multiple AI Agent templates to help you get started.

Link to Agents Hub
Last updated