I wrote a full explanation of each part of Merchant AI here

Inspiration

I've been building AI Agents for over a year now, since it was all the hype last year. What I've noticed is that people sometimes misunderstand the job of an AI Agent. It's not that they need to be able to do everything, but rather, know what to do when they're instructed that they're to do it... if they think they should. And that's completely dependant on the human creating the Agent. I wanted to see if I could do a complete Idea -> Publishing concept for a Publishing house, and I guess the answer is yes!

What it does

Merchant AI integrates various modules to automate the entire process of coloring book publication. It gathers real-time data, analyzes trends, and uses these insights to guide the creation of new books, optimizing every step from idea to the final product.

How we built it

There are (thus far) FOUR agents I've built, each with the ability to infer AI, and complete tasks based on configurations I've taught them:

Market Trend Analysis python seer.py

The All-seer (see-er?) will gather the last 5 years of trend data for 'coloring books', and also any autosuggestions from google API using prefix 'coloring books for', which yields 'coloring books for kids', 'coloring books for adults', etc. Uses ARIMA to predict forecast for next month, using current month as base point, and sorts suggestions based on likelihood that a product will be more in demand, getting the data ready for @Oracle.

Will run once a day (or once a minute, but this would be redundant)

Demographic Insights and Theme Preparation python manager.py --id oracle

Will start processing the many different themes each customer demographic yielded from trend analysis, and prepares it for @Minstrel, who will flesh out the configuration of a publication job and optimize it for demographics mentioned.

Competitive Pricing Strategy python manager.py --id bookkeeper

Will search for all products that appear when each demographic queries the product, finding most optimum price, so that it is competitive. Will balance out & clean data giving different weights to products that have low/NO reviews/ratings, versus popular products that are going viral. Updates configuration with competitive price and tags in @Minstrel.

Content Configuration python manager.py --id minstrel

The final step before the illustrator majestico, Picasso, does his thing. Minstrel will simply organize the existing configuration in a way @Picasso can understand and process.

Illustration, Edits & Quality Control python picasso.py

Picasso will infer an image model to get the coloring picture relevant to the current job. Then, it will download that image as a PNG. Just a PNG? Nope! It will then use potrace to do some amazing image manipulation and convert the PNG paths to an SVG! Why? Because instead of spending GPU hours upscaling these images, we can convert to SVG and automatically denoise the unfortunate AI image, until its resolution is no longer a problem, and can once again be converted back to a PNG, which is the format our PDF will accept.

Then, @Picasso will create a KDP compliant COVER (Front & Back) and internal pages (keeping every 2nd page empty, we don't want the markers to bleed through the page, do we?)

Once the book is finished, @Picasso will monitor to see if there are any more jobs to start processing.

Publishing and Distribution python publisher.py

Wow! The book is completely finished! What now? Time to publish to the STORE! Yes, the store.

Feedback Integration python supporter.py

Customer support. What happens when someone buys a book, and hates it? We let them review it, and then when they submit a review, @Supporter relays these new findings BACK to @Oracle, informing them of the rating, review, feedback and theme of the book reviewed, so that in the next job, @Oracle may learn a thing or two. This completes the initial imlementation of the feedback loop.

Merchant AI is an end-to-end publishing house. It is burning my Macbook pro battery, oh well.

P.S. All these agents/workers will run non-stop, and start working as soon as the environemnt they're monitoring has a new job for them to do, and the pipeline will always lead to @Oracle learning more and more about how to prepare a perfect Coloring book!

Each agent plays a critical role in streamlining the process from idea to the final product, automating many of the tasks that would otherwise need to be done manually. They all act individually, waiting for their "colleagues" to finish the tasks they've been assigned. When there is something to be done, the agents are ready to figure out the problem.

As a one-man team, I utilized a combination of APIs, web scraping tools, and direct integrations with platforms like SerpAPI to gather necessary data, GPT4 for design suggestions. Machine learning models and NLP were employed for trend analysis, and top of the line image inference model (Midjourney) helped in the automated creation of book designs, & python pdf manipulation for layouts. Will have built web interface to display the process of these agents, so Next.js for front-end (lightweight) and Python for everything agent.

Challenges we ran into

It's really, really, really difficult to work with PDFs!!!!! Especially if there's a specific dimension you're required to export, but in the end I made it work. The AI/Agent work itself is so new, that there is hardly any pre-made solutions for us devs to revel over, or rather, no solutions that break for no reason, so we're usually left to our own devices, and those devices are quite sufficient most of the time, or so I've learned.

Accomplishments that we're proud of

It's 9:13pm and the first book is fully produced. Now it's time to build the marketplace that will act as a platform from which the AI shall learn about its predictions and if they were accurate!

What we learned

There is a great difference between a hackathon project that works and can be built in 24 hours, VS a scalable BUSINESS that doesn't rely on a 2019 Macbook pro and hopes it doesn't overheat. I usually find myself building scalable solutions, so it was fun to finally "build something that doesn't scale"!

What's next for Merchant AI

I'm going to extract the trend analysis AI, and actually make this agent software scalable not only for "coloring books", but any kind of product online shop owners may have. Instead of agents that are at the ready, see how webhooks would fare in the world of actionable trend automation!

How I run Merchant Agent-verse

For each session, do this

source ~/.bash_profile && source bookie_env/bin/activate

Run all of these, simulatenously in this order

python picasso.py
python manager.py --id minstrel
python manager.py --id oracle
python manager.py --id bookkeeper

then python seer.py

Built With

Share this project:

Updates