Ever since I stumbled upon a LinkedIn post by the well-known growth writer Greg Isenberg, I have been fascinated by the concept of AI agents. In it, he argues:
“The next wave of startups won’t launch with marketing teams. They’ll launch with AI agents running everything 24/7 - from content to acquisition to analytics…what previously required 20 people and $2M in salary now happens automatically with $2k in agent costs.”
An enticing prospect, for sure. I started researching to better understand AI agents and how to build them, but my search turned up more questions than answers. Many resources I read, like this post, talked about how you needed to learn 15+ AI fundamentals before you can even think about building your own agent.
I was convinced there must be a better way to go about this. Through my research, I found an AI agent platform that enabled me to build my own team of agents in under five hours without being a coding wiz or AI genius. In this article, I explain what AI agents are, share the tool I used to build my own team of agents, and show you how you can do the same.
Anyone not interested in reading the full article can find a summary here. I have also created a video demo-ing the final solution here.
What are AI agents?
AI agents are like virtual assistants that handle repetitive or complex online tasks without human supervision. These agents interact with websites, apps, and online platforms like a person might, but they work much faster and more efficiently.
Chat-GPT is the best-known example of an AI agent. But, as great as Chat-GPT can be, it still requires a lot of human prompting and check-ins to effectively complete multi-step tasks. Imagine you had a team of Chat-GPTs all working in concert. Like Henry Ford’s Model T assembly line, each AI agent would tackle a single task, execute it to perfection, and then hand it off to the following agent until the whole process was complete. All you have to do is push ‘go’ and wait for the result.
How do you build an AI agent?
One site that caught my eye as I was doing my research was CrewAI, which bills itself as “The Leading Multi-Agent Platform.” I saw they were offering a course on building multi-agent systems, and given that it was free and under three hours, it seemed like a no-brainer. The most important thing I sought to learn from the course was, “What does it actually mean to build an AI agent?” It sounded cool but also super abstract and theoretical, so I wanted a clearer understanding of what it entailed. What I ended up finding, perhaps unsurprisingly, is that it was literally just implementing code.
I am reasonably tech-savvy but not a stellar programmer. I completed a coding boot camp in 2017 but did not actively apply what I learned. I have started to get back into coding over the past few months. If I attempted to build my own team of agents from scratch with no support, it could easily take me a few weeks. With the help of Chat-GPT, it took me a few hours. Let me show you how.
My project idea
I brainstormed some potential project ideas and hit on one that would be useful to me: converting my Substack articles into relevant tweets. I post weekly on Substack but rarely on X.com (formerly Twitter) as I struggle to find the right balance between being succinct and feeling like I’m posting fluff. I hoped my AI agent team could help extract the most useful snippets from my long-form content so I would have a ready-made list of tweets. There were a few key features that I wanted for the project:
-5 Tweets per Substack article
-All high-quality tweets
-The final list of tweets output to a CSV file
Building my AI agent team
While completing this project required a fair bit of iterating and back and forth with Chat-GPT, I will primarily focus on the biggest steps I took:
#1 - Install Your Dependencies and Code Editor
Anyone who has ever done coding before knows that to begin coding, you need a code editor. I use Visual Studio Code (also known as ‘VS Code’) and would highly recommend it.
In coding, dependencies are external pieces of code, libraries, frameworks, or modules that a program relies on to function correctly. Basically, “What do I need to download to ensure I can build and launch my project?” To get this, all I had to do was give Chat-GPT the following prompt, and it gave me a list of dependencies to get started:
I would like to set up CrewAI to analyze all of my Substack content and then come up with a list of relevant tweets. How should I get started?
Chat-GPT gave me a clear list of dependencies to download and I was able to download everything I needed in under ten minutes.
#2 - Download my Substack Articles and Convert Them to .txt
Substack’s ‘Export’ feature makes it easy to download all of your Substack content. The one downside is that the files are all in the ‘.html’ format, making them unusable for my project. Thankfully, with Chat-GPT, I was able to easily convert these files to the proper format and save them to my Desktop.
#3 - Creating an OpenAI API Key
I used Chat-GPT as my agent of choice for this project, which required me to generate an API key in my Open-AI account. This was as simple as going to the Open AI developer’s site, clicking on “Settings,” “API Keys,” and “Create New Secret Key.” I then added my API key to my AI agent project in a .env file as instructed by Chat-GPT.
#4 - Testing the code from Chat-GPT
If you have ever used Chat-GPT for coding, you know that with a simple prompt, it generates code for you exceptionally quickly, but the code is rarely perfect from the get-go. While there is no point in me sharing the entire code snippet (it was over 100 lines of code), one thing worth sharing is that Chat-GPT completed all the details for each AI agent. This was a huge weight off my shoulders and gave me a solid foundation to start working with.
#5 - Improving the tweet quality
After 1-2 minor tweaks, the code from Chat-GPT actually worked as intended, and I had five tweets generated per article. My issue was that the tweets were very short, used many hashtags, and were outputted in a numbered list. The numbered list made it hard for me to copy and paste the tweets. Their brevity and excessive use of hashtags made them low quality, so I adjusted the Description for my ‘generate_tweet_task’ agent to fix it. After that, it worked exceptionally well, and the tweet quality improved significantly.
#6 - Exporting the tweets to a CSV file
This step was surprisingly tricky. Chat-GPT kept recommending code snippets to try. Each produced a fresh error, which resulted in a new attempt by Chat-GPT and more errors along with it. Every attempt became progressively more convoluted and further away from the actual answer.
From an outside perspective, Chat-GPT seemed like a frustrated co-worker, banging their head against the wall and trying to force a solution instead of seeking alternatives. The issue, as far as I could tell, was that it was seeking to use one of CrewAI’s features called Tools, which added a layer of complexity to the project. To help guide Chat-GPT, I prompted it with a gentle nude:
“Can we avoid using Tools, or is it necessary? I know when we did the setup for the original file, we were running into issues when using Tools, and then switched to a no Tool setup, and things ran fine after that.”
To which it replied:
“Yes, you can avoid using Tools entirely in CrewAI, as the framework allows agents to operate without explicitly attaching tools, relying instead on the logic within their task descriptions and goals. If your earlier setup worked fine without using Tools, we can stick to that approach. Here’s how to adjust the Agent definitions to exclude Tools and still work correctly.”
After that, we were off to the races, and Chat-GPT’s new solution worked like a charm.
#7 - Ensuring the tweets were properly formatted
While step six brought me close to completion, my tweets were getting output with a slew of strange characters. I was getting tweets like:
⚠️ If your marketer is drowning you in jargon, it’s time for a reality check! A trustworthy marketer communicates clearly and effectively about their strategies. Don’t let confusing language cloud your judgment! #ClearCommunication #Marketing101
Given that my tweets are aimed at a non-robot audience, I had to find a way to remove these characters or transform them into standard characters.
This solution took a lot of trial and error, but ultimately, Chat-GPT proposed the following solution:
Let’s address this in two stages:
Explicitly decode non-UTF-8 characters.
Filter out all remaining non-alphanumeric characters (if malformed text persists).
It suggested a new set of code with a ‘clean_text’ function, and after implementing this, it worked flawlessly, and I ended up with some stellar tweets! Some examples were:
Tweet 1:
Cherry-picking data can spell disaster for startups. Highlighting your best month for CAC while ignoring long-term trends offers a skewed view. Stay vigilant and seek continuous, comprehensive data to get a realistic picture of your growth potential.
Tweet 2:
Don’t be lured in by low-cost clicks! Many alternative platforms can deliver unqualified traffic that diminishes your ROI. Before investing in TikTok or Reddit Ads, ensure you have robust, proven strategies in mainstream marketing to support your efforts.
Tweet 3:
Building a dynamic website for NYC’s Happy Hour specials has never been easier! With tools like Clay, Supabase, and Bubble.io, you can create a real-time platform that boosts user engagement and optimizes SEO effortlessly.
I created a video demo-ing the final solution here:
Conclusion
Building my first team of AI agents to transform long-form content into high-quality tweets wasn’t just a technical exercise; it was a glimpse into the future of productivity. A future where repetitive tasks are automated, creativity is amplified, and anyone, regardless of their technical expertise, can harness the power of AI to achieve their goals. Whether you’re looking to optimize your workflow, grow your business, or just experiment with cutting-edge tech, there has never been a better time to start building.
If you liked this content, please click the <3 button on Substack so I know which content to double down on.
TLDR Summary
This article explores how to build a team of AI agents capable of transforming long-form Substack articles into high-quality tweets. Using tools like CrewAI, Chat-GPT, and a coding approach that doesn't require deep technical expertise, you can create your own automated tweet generator. The process highlights the challenges and successes of building AI agents and emphasizes their potential to revolutionize productivity.
Key Takeaways and Process Breakdown:
What Are AI Agents?
Definition: AI agents act as virtual assistants, handling repetitive or complex tasks autonomously. Unlike standalone tools like Chat-GPT, AI agents can execute multi-step workflows by interacting with websites, apps, and data sources.
Key Benefit: They eliminate the need for manual prompting, working collaboratively like an assembly line to complete tasks efficiently.
Project Goal:
Convert Substack articles into high-quality tweets.
Requirements:
Generate 5 tweets per article.
Ensure all tweets are engaging and relevant.
Export the tweets to a CSV file.
Step-by-Step Process:
Step 1: Set Up Dependencies and Code Editor
Tool: VS Code.
Chat-GPT provided a comprehensive list of dependencies (e.g., CrewAI, OpenAI libraries), which were installed in under 10 minutes.
Step 2: Prepare Substack Content
Substack’s ‘Export’ feature downloaded content in .html format.
Chat-GPT helped convert these files into .txt format for easier processing.
Step 3: Generate OpenAI API Key
Using Chat-GPT as the AI backend requires an API key from OpenAI. This was configured in a .env file to ensure secure access.
Step 4: Code the AI Agents
Chat-GPT provided over 100 lines of code to set up agents. Each agent was responsible for a specific task, such as analyzing content and generating tweets.
While functional, initial outputs required refinement to improve tweet quality.
Step 5: Improve Tweet Quality
Early outputs were overly brief, hashtag-heavy, and poorly formatted. Adjusting the agent’s task description significantly enhanced the tweets, resulting in concise, engaging, and actionable messages.
Step 6: Export Tweets to a CSV File
Initially challenging, Chat-GPT struggled with the export logic due to unnecessary complexity (e.g., reliance on CrewAI’s ‘Tools’ feature).
A simplified, no-tools solution successfully exported the tweets.
Step 7: Fix Character Encoding
Tweets included garbled characters (e.g.,
⚠️
) due to encoding issues.Chat-GPT implemented a ‘clean_text’ function to decode and filter text, ensuring readable and professional tweets.
Final Output:
High-quality tweets generated by the AI agents included:
"Cherry-picking data can spell disaster for startups. Highlighting your best month for CAC while ignoring long-term trends offers a skewed view. Stay vigilant and seek continuous, comprehensive data to get a realistic picture of your growth potential."
"Building a dynamic website for NYC’s Happy Hour specials has never been easier! With tools like Clay, Supabase, and Bubble.io, you can create a real-time platform that boosts user engagement and optimizes SEO effortlessly."
Challenges and Solutions:
Challenge: Chat-GPT’s initial coding output was functional but imperfect.
Solution: Iterative refinement and proactive guidance (e.g., prompting Chat-GPT to avoid unnecessary features like Tools).
Challenge: Character encoding issues in the final tweets.
Solution: Implementation of a text-cleaning function to decode and filter text.
Lessons Learned:
Start Small: Building an AI agent doesn’t require advanced programming skills. Incremental problem-solving and leveraging tools like Chat-GPT can yield excellent results.
Iterate Often: Coding with AI assistance requires patience and multiple iterations to refine functionality.
Future Potential: AI agents can automate complex workflows, making them invaluable for creators, businesses, and individuals aiming to optimize productivity.
Conclusion:
This project demonstrates the transformative power of AI agents, highlighting their ability to automate repetitive tasks and enhance creativity.
Building AI agents is more accessible than ever, enabling individuals without extensive technical expertise to experiment and innovate. Whether optimizing workflows, scaling a business, or exploring cutting-edge technology, the time to start is now.
Key Tools Used:
CrewAI: Platform for multi-agent systems.
Chat-GPT: Provided code and debugging support.
VS Code: Code editor for development.
OpenAI API: Backend for natural language processing.
By harnessing these tools and methodologies, you can create a scalable, efficient, and impactful AI solution that converts Substack articles to high-quality tweets.
Loved this article so much it actually got me to download the substack app! Keep ‘em coming James!