Inspiration
Everyday i do a lot of things over and over again. I also use a lot of AI autonomous agents to help me with tasks that i typically fire and forget. One of the main tool i use is LangchainJS which is a way to chain up different AI tools and building blocks together. An autonomous Merkle agent is then used to assemble all the tools and when asked to do a specific task, the agent will use the tools that are necessary from the lot. So far though the building blocks are missing for crypto tools. Hence I decided to build one easy to use framework that can utilise all the tools together.
What it does
AIFlow Autonomous Agents For ChainLink and Flow Blockchain 🚀
A feature-packed framework tool helps you build expressive and powerful APIs using LangChain and Express.js. This framework tool provides a solid foundation for creating your own custom automous agents API with a wide range of functionalities. Get started quickly and build amazing AI ChainLink and Flow Blockchain APIs with ease! 🎉
For convenience, and as this started from the Chainlink/Flow hackathon, the demo has a few tools already pre-coded for you to use for both ChainLink (price feed) and Flow (query and mutate generic ones and profile smart contract). Just call the API on one of the endpoints and ask for task to be done that use the tools in natural language and the AI agent will the do the heavy lifting for you!
e.g.
- Get top bullish news on Flow Blockchain and set my profile info on flow blockchain with the news title
- Get the price of Bitcoin in USD (from chainlink) and send it to my Flow Blockchain profile smart contract
🌈 Features
- 📦 Example implementations of common ChainLink pricefeed and Flow Blockchain - query, mutate tasks
- 📦 Implemetation of getting hot, rising, bullish, bearish,important, saved, lol news from CryptoPanic (specify flow blockchain rather than just flow for best results) e.g. what is the top bullish news on flow blockchain?
- 📦 Implemetation of coinmarketcap ranking, metadata and price (for BTCUSD I have used Chainlink PriceFeed)
- 📋 Clear and simple structure for adding new methods and new crypto tools
- 📚 Auto-generated API documentation using OpenAPI and Swagger UI
- 🚦 Rate limiting and input validation for API routes
- 📈 Logging and error handling
- 🎨 Beautiful and autogenerated frontend for testing your API
- 🚀 Easy deployment to your favorite hosting platform
- 🐳 Docker-ready for smooth deployment
How we built it
We use an express boilerplate and underlying langchain framework as an express api server. There is a playground frontend tool used also to help the demo and testing.
ChainLink Notes
- Price Feed data obtained via offchain methods (reading the smart contract) from Sepolia test
Demoed for BTCUSD.
Feel free to add more pairs and/or chains.
- The API framework is by itself good to go as an API, it is not hard to use chainlink functions then to call it.
Example would be as a bridge, where you can chainlink function call for a price feed and then automatically write down the state in Flow Blockchain demonstrating some sort of Proof Of Prompt etc.
Flow Blockchain
The sky is the limit here as any one of the common tasks have been demoed and can be expanded upon. Early experiments have been done to also write cadence code and since it's easy to use the intructional templates, it is easy to create new ones as tools for dynamic custom generation via AI.
Currently as this is only a test and as it is meant to be running autonomously, the keys need to be generated first and account funded. After this you can use the AI to Initialise the profile etc as part of the initial setup.
Work is started to look at extending this using hybrid custodial wallets etc and using AWS Nitro Enclaves to store the keys securely and use them for signing transactions.
The Power of LangchainJS
- Do not underestimate the power that is available to you via LangchainJS. You can use it to create any type of AI tool you want and then use it as a bridge to the blockchain. This is a very powerful concept and can be used to create a whole new generation of tools and applications. Also the fact that you can connect to providers such as Zapier, IFTTT, Google Assistant, Alexa, Siri, Cortana etc. means that you can create a whole new generation of AI tools and applications that can be used by anyone.
Challenges we ran into
There is not much help that is available to programatically handle the keys without using a browser wallet
Accomplishments that we're proud of
Stable enough to be used and very extensible
What we learned
Heaps of flow blockhain, cadence, wallets, blockchain structure. And chainlink.
What's next for AIFlow
It is open sourced! So very excited to see how others can help grow it to be their autonomous agents of choice. Also it is hope to use this as inspiration for the next flow or chainlink hackathon where I intend to build a UI No Code platform on top o the API framework.
Built With
- chainlink
- coinmarketcap
- cryptopanic
- ethers
- express.js
- flow
- langchainjs
- moralis
- node.js
- thirdweb
Log in or sign up for Devpost to join the conversation.