Kids Book NFT AI Agent (ft. BNB Chain)
Create a Kids Book AI agent integrated with NFT minting function on BNB Chain
Last updated
Create a Kids Book AI agent integrated with NFT minting function on BNB Chain
Last updated
In our previous case study, we demonstrated how to create a children's book AI agent using ShellAgent with DeepSeek. Following a significant update to ShellAgent, AI agents on MyShell now support on-chain interactions including blockchain data analysis, transaction execution, and smart contract engagement.
This case study explores how we integrated NFT minting capabilities into our kids book AI agent. After the agent generates a story, users can opt to mint an NFT on BNB Chain. BNB Chain offers substantially lower transaction fees than Ethereum, making it ideal for high-volume operations like NFT minting. This integration creates a natural synergy of AI agents between multi-modal storytelling and BNB Chain's strengths.
Before getting started, you need a clear vision of how the AI agent will interact with users to accomplish its tasks, setting realistic expectations for different models handling various functions.
Below is a simplified overview of how the Kids Book NFT AI Agent works. We use DeepSeek to transform user text input into prompts that image-generation models can understand, then display both the story and images. Users can continue writing the story, start a new one, or ask DeepSeek to continue the narrative. After the story generation, users can choose whether to mint a NFT for the story on BNB Chain.
Main functions and related widgets:
Story writer: DeepSeek
Image generator: Flux
NFT image uploader (via IPFS): Metadata Uploader
NFT minting (on BNB Chain): Contract Call Encoder
Please skip this chapter and go to the next chapter if you are a veteran or you want to learn more about the processes.
There are two ways for quickstart: local upload or cloud selection.
Create a new agent from MyShell Workshop and fill in the required fields.
Choose ShellAgent Mode
Choose ShellAgent Mode - Local Upload and then upload the .json configuration below:
Right-click on the above .json link and select "Save link as..." to download the .json file
Save and publish
Save it and you may publish it if you have a creator pass.
You are all set. Enjoy your agent!
P.S. You may also read this notice if you encounter errors.
Create an agent from templates
Choose the template
Choose the template of Kids Book NFT AI Agent.
Save your configuration
Click the Save button on the top right corner of the interface
Go to the Deployment chapter
First, please visit ShellAgent.
Choose the MyShell Agent type.
Context variables are like a thread that connects everything within ShellAgent.
Add story
, reply
, and calldata
as text
Type variable.
Add image
as image
Type variable.
Add USER_WALLET
by Select System Context
variable and set it as text
Type variable.
Add nft_address
as text
Type variable and enter 0x0Cb5c79D59847ACEdCE11651d18bB968Cf236aC4
Enter some intro messages in the Text field, like Tell me a story. I will draw a picture book for you!
In the Input section, add prompt as text
Type variable and set Source as IM
.
In the Task section, add DeepSeek R1
widget.
In Input - system_prompt, select Code mode and add the prompts below.
In Input - user_prompt, select Ref mode and choose Input
/ prompt
.
In Input - hide_think, check it.
In the Task section, add Flux.1-dev
widget.
In Input - prompt, select Code mode and add the prompts below.
In the Task section, add Contract Call Encoder
widget.
In Input - abi, select Code mode and add the code below.
In Input - function_name, enter safeMint
.
In Input - args, select Code mode and add the code below.
In the Output section, add 3 new variables, edit the Variable names by Select Output, and choose the variables accordingly
Variable 1: Context/reply
-> Task/DeepSeek R1#1/reply
Variable 2: Context/image
-> Task/Flux.1-dev#1/url
Variable 3: Context/calldata
-> Task/Contract Call Encoder#1/encoded_data
In the Output section, add a new variable, edit the Variable name as Context/story
by Select Output, select Code mode and add the code below.
In the Message section, set Text and Image variables as:
Text -> (Ref mode) Context/reply
Image -> (Ref mode) Context/image
Then add 3 buttons:
Button#1: Auto write
Button#2: Restart
Button#3: Mint
After duplication, delete all the Inputs.
In the Task section, edit the DeepSeek R1
widget by replacing the prompts with:
In Input - user_prompt (inside the DeepSeek widget settings), select Ref mode and choose Context
/ Story
.
In the Output section, add a new variable, edit the Variable names as Context/story
by Select Output.
We’ve completed all necessary states at ShellAgent, now you need to add transitions to make the state machine running. The “+”
sign on the left and right side of each state node represents the flow of states. Under the Transition section of each state represents where user interaction will change the flow of states.
Le’s go there one by one:
Start
to Intro
, that’s default.
Intro
uses the type box connects to Generate
, this means that Generate
gets input from user’s input at Intro
's type box.
Generate
connects to Display
via the “+”
sign, means no additional user action is needed
At Display
state
Auto-write
button connects to Auto-write
state
Restart
button connects to Restart
state
Mint
button connects to Display
state
Type box (means users wants to keep writing the story) goes to Generate
Auto-write
connects to Display
via the “+”
sign
Restart
connects to Intro via the “+”
sign
Make sure to click the save button in ShellAgent (even we have the auto-save function).
That’s it! You’ve completed the creation of your agent in ShellAgent, congrats!
We will introduce how to deploy the MyShell Agent you've created on MyShell in the next chapter.
Create a new agent from MyShell Workshop for deployment and fill in the required fields.
Choose ShellAgent Mode and select the configuration you created in ShellAgent.
Save it and you may publish it if you have a creator pass.
Enjoy your AI agent on MyShell.
You may need to Clear Memory first to avoid errors while using.