Thank you so much for logging into this tutorial. My name is Ali and I am the head of DevRel at Warden Protocol. Today in this video I'll be talking about the Warden Agent Kit. The Warden Agent Kit provides developers with tools to create agents with minimal knowledge of Solidity. It simplifies the agent creation process by allowing the integration of custom business logic through Solidity smart contracts.
Warden Agent Kit includes a ready-to-use Solidity contract template that automates on-chain transactions based on specific conditions. These templates can also be expanded for advanced use cases, including the integration of predictive models. To make it accessible to web DOS developers, Warden Agent Kit is built with TypeScript, allowing for seamless integration with familiar tools and workflows. It supports LangChain integration, allowing developers to leverage LangChain's extensive toolset to create and manage agents. All LangChain tools can be integrated, further expanding the capabilities of agents created with the kit.
Understanding these components is crucial because each one serves specific purposes in your agent development process. Starting with the central module. This is the foundation of everything, available under Warden Protocol Agent Kit core, which can be found as an NPM package. In this central module, think of it as the engine that drives all of your agents' operations. This provides a system of actions.
This is where all blockchain integrations are defined. Each action is carefully typed and validated, ensuring you always know what data you're working with. So we have, for example, get balance to check asset balances, get price to check current market prices, send token to execute transfers, create space to manage agent workspaces, and many other operations as you can see here. The other central part of Warden Agent Kit is the LangChain extension. The LangChain extension, which can also be downloaded from the NPM package site.
What makes this extension special is how it transforms Warden actions into LangChain tools. This means your agent can understand commands in natural language, make intelligent decisions about market conditions, and explain its actions in understandable terms. The last part we include is the integration with X. This module extends your agent's capabilities to social media, allowing you to post updates allowing you to post updates , monitor market sentiment , monitor market sentiment , interact with the community, and share analytics, among other things. These integrations are particularly powerful when combining blockchain and social data.
The most interesting thing about this is that you can use LangChain's extensive list of providers and integrate them with your agent, thereby improving its capabilities. In the next part of the tutorial, we will perform a simple exercise to create a CLI agent. Okay, in the next part of the tutorial, we're going to clone the kit. If we look at this agent kit, we will find an examples folder where there is a template that we have created. This is a simple CLI agent that allows you to interact with the Warden chain.
Let's take a look at the code. Alright, let's start exploring the code. This is a simple tour of the CLI agent simple tour of the CLI agent . As you can see, the code begins by importing the dependencies needed to create the CLI chatbot. This includes key ports such as Warden Agent Kit for web3 functionalities.
Then we have the Warden Agent Toolkit, intended for LangChain components. And we also have other variables like dot environment to manage environment variables. The first function we will analyze is the agent initialization function. This does three things. First, create an OpenAI instance using a GPT chat model.
Which is the one defined here. Next, we set up a private key using the environment variables. And we use this private key for web3 transactions. The next thing you'll see here is the toolkit and memory management system . This also does a couple of things.
First, create a toolkit with web3 capabilities. Next, set up memories to keep the conversation history. It also configures the agent with a unique thread ID, which we will use later. And the last thing this function implements is the creation of the react agent. This also does a couple of things.
First, create a react agent by combining the language model and tools. The second thing it does is include memory for the persistence of the conversation. And the third is to configure a message modifier for consistent agent behavior. The next thing we will analyze is the implementation of the chatbot. We'll do a couple of things here.
First, we will prepare the read interface for the command-line interactions that we will see in the live example. Next, we will perform an interactive loop to enable the user chat. And the last thing we do here is the chat loop processing. This is responsible for continuously accepting user responses until "exit" is typed user responses until "exit" is typed . Then, we process each input through the agent, making sure to transmit the responses to the user.
In the end, we have a couple of different support functions, such as response handling and error handling. With response management, we handle different types of responses, display them in a formatted way to facilitate reading, and maintain the flow of the conversation. And with error handling, we ensure that the orchestration of the entire application flow occurs correctly, we implement appropriate error management processes, and we guarantee a clean exit in the event of errors. Yes, and that's all. And now we can try to run this function.
Very good. Let's see our agent in action; we can invoke it simply using npm start. Well, the prerequisite for this, of course, is that you need to install the npm packages using npm install, and you can find instructions about this in the readme file. Once you start the agent, we can see that it is working and is asking us for an instruction. Uh, I'm not really sure what kind of instructions are available for this agent.
So my first question for him will be: what kind of stock do you allow? And, since this is done using LangChain, it can actually understand natural language and translate it into actionable elements for us. As you can see, the answer tells us a couple of things. We can, of course, manage spaces, manage keys, key strings, balances, check prices, etc. All the different things that are available natively with the Warden protocol .
Let's try a couple of things. The first thing I'm going to do is start managing my spaces. I want to know how many spaces I have. And as you can see, um, I have three spaces that I've created. I'm going to move this aside, sorry.
Very good. As you can see, I have three spaces available. And what I'm going to do is create a new space. And let's see if that space will appear here. OK.
The new space has been created and I'm going to ask you again: how many spaces do I have? And hopefully, it should return a new space. That's how it is. Um, now, I previously had three spaces and now I have like four spaces under my control. So yes, this is a simple example of spaces.
We can do other things, such as view the available keys. So, um, how many keys are there? Oh, maybe we'll list all the keys in the space ID, say the new space we created. And hopefully it should be zero, right? Because we haven't created any key there yet.
But if we ask how many keys I have in the space ID, let's say 18. Um, it has keys that were created previously. So we have these two keys that we created. Okay , let's see what else I can do. And we should get a couple of options again.
Let's choose from that. Send tokens and then we need, um, a couple of things: the recipient's address , the amount, and the key ID. So, let's say we put the address like this, the amount of 0.01 ETH, and let's say the key is 18. Okay.
This is basically the space ID that we created. Good. So yes, the transaction is successful and we were able to successfully send some test ETH successfully send some test ETH . Incredible. Thank you so much for tuning in to this video.
We hope you have learned something new. If you have any questions, please write to us on Discord or contact us at developers@wardenprotocol.org. Thank you so much. We're excited to see what you build with the Warden Agent Kit.
Cheers.
Automatic transcript — names and jargon may be misspelled.