Crypto-Enabled LLMs & Web3 AI Agents

Last night I created a GPT that can make crypto/web3 transactions.

I was able to build a demo in just a couple hours, using Open AI and Syndicate's new Transaction Cloud APIs. (It might get even easier with OpenAI's new announcements on Monday.) It only took a few lines of code and less than 15 minutes to integrate Syndicate (and thus web3). Just simple HTTP REST API calls—no custom backend for keys, transactions, wallets, or gas was needed. 🤯

You can play with it (and check out the repo) here. It's a game where the GPT is hiding from you a secret word. If you correctly guess it, the GPT will send you an NFT as a prize onchain.

AI Agents That Can Transact

Most people still view AI and crypto/web3 as separate things, but they address different layers of the software/internet stack and can be integrated in powerful ways. To date, how that could happen has been more conceptual or behind-the-scenes (e.g., analysis on ZKPs, verifying training data, data marketplaces)—not something people could feel, touch, or experience for themselves. But recent advancements now make these new-to-world "AI x crypto/web3" experiences possible, today.

AI that can autonomously transact with people, businesses, or other AI is a big idea space. Most people think of "AI agents" in terms of tasks, jobs, or work. But the ability for AI to pay for things, hold things of value, exchange value, or create things of value—on behalf of itself or others—is how AI gets true agency.

Historically, it's been difficult to build AI systems and apps. And similarly, it’s still hard to build in crypto/web3. Unless you have a lot expertise in all of the nuances of every layer of the stack (e.g., blockchains, smart contracts, RPCs, Viem, Ethers, keys, gas, nonces, reorgs, retries, monitoring, and so on), a demo like this would have taken days or weeks to build.

But with simple HTTP REST APIs from Open AI and Syndicate that provide developers with higher levels of abstraction and better/easier DX, I was able to build this demo in one evening. Imagine the possibilities. What could highly capable teams do in weeks or months? AI that gives gifts? AI that creates and sells art? AI that negotiates and makes deals with each other for consumers or businesses? The design space is near infinite.

How I Built This

1/ Deployed a GPT template

I deployed a base Next.js GPT app to Vercel using its integration with OpenAI and an AI template like this one. I updated the template with my OpenAI developer keys to get the basic GPT chatbot experience working. (Note: This will be 10x easier with GPT Builder announced on Monday.)

2/ Tuned the GPT prompt

I then provided the GPT with game context to play 20 questions according to a number of rules with the user. Interestingly, this is where 70%+ of the work was: fine tuning the prompts as well as parameters like temperature and max_tokens to get the desired output from the LLM. (It'll also be much easier/better with GPT Builder and GPT-4 Turbo.)

3/ Added game logic

After trying to embed all of the game logic in the prompt itself, the LLM would often "hallucinate," get confused, or be vulnerable to clever players.

Should have expected my co-founder Will to break this :)
Should have expected my co-founder Will to break this :)

To fix this, I decided to extract some of the game logic and explicitly code it into the server-side route—like whether the game had been won or the player ran out of questions. This was where about 20% of the work was.

This will also get even easier with OpenAI's new announcements around its GPT Builder.

4/ Added transaction logic

Once the app knew a player had won the game, I added the logic for sending the NFT as a prize and messaging to the player that the prize had been sent to their address. This was pretty easy and was where about 5% of the work was. With OpenAI's new GPT Builder and function calling via Actions, this might be possible with even less (or no) lines of code.

5/ Integrated Syndicate's Transaction Cloud API

Finally, I used Syndicate's Transaction Cloud API and specifically the send transaction and get transaction request endpoints to do all the heavy-lifting with web3, so I didn't need to set up any key, wallet, gas, or transaction infrastructure on my end for the app. Just a few lines of code, simple HTTP REST APIs, and I was done. This part took less than 10 minutes (!!). Now the GPT was able to send an NFT as a prize to players.

Where It Could Go Next

There were a few things that I would have liked to do with this demo if I had more time:

  • Add the ability for the GPT to pick a new word and players to to reset the game

  • Send a NFT on any network they want (e.g., Ethereum, Optimism, Polygon, Base, Arbitrum, etc.) via Syndicate's Transaction Cloud API by adding NFT contracts to each chain and simply modifying the chainId

  • Customize the each NFT's image and metadata based on the player's experience via Syndicate's update metadata and upload media APIs

  • Create an NFT for each player with metadata that updates based on the number of games played, won, and winning words via Syndicate's update metadata API—which could then be used to create leaderboards, communities, and social experiences (e.g., everyone who won with the word "sailboat" would be connected with each other).

  • So much more...

Additionally, this surfaced a whole bunch of new, more ambitious ideas that could be built:

  • More games with crypto-enabled LLMs, with teams and/or LLMs that play against each other

  • Collaborative projects that use LLMs to generate onchain assets, communities, or stories

  • LLMs used to create personalized assets or experiences onchain

  • Onchain social networks that use LLMs to understand and connect people

  • The list goes on...

The Next Wave of Web3

The next wave of web3 is coming, and it's going to be enabled by step function improvements in DX that unlock new-to-world user interactions, experiences, and applications. The next wave of web3 will also seamlessly integrate with existing technologies and revolutions like AI and spatial computing, via simple HTTP REST APIs like what Syndicate and others are currently building.

If any of this has interested you, reach out via DM. I'm also thinking about organizing a hackathon-like event with some friends in web3 to build interesting new-to-world things on Syndicate's APIs, so if you're interested in that, add your info to this form here, and I’ll be in touch soon.

Subscribe to ian @syndicateio
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.