Project information



Building a 100% Automated Social Media Page Using Agentic Workflow: A Technical Overview


In this article, we dive into the creation of a fully automated pipeline for BeyondTech, showcasing the integration of agentic systems for efficient workflow management. This project leverages advanced state-of-the-art LLMs, leveraging the agentic workflow techniques to streamline content creation and distribution processes. Below, we provide a step-by-step explanation of the system architecture, highlighting the roles and responsibilities of each agent within the pipeline.

BeyondTech aims to push the boundaries of technology, necessitating a highly efficient and automated content management system. To achieve this, we designed an agentic system comprising specialized AI agents, each responsible for distinct tasks. The following sections outline the components and workflow of this automated pipeline.

System Architecture


The automated pipeline is divided into five primary components, each managed by a dedicated agent:

1. AI News Research Agent
2. Marketing Specialist Agent- Blog Writer
3. Marketing Specialist Agent- Graphic Designer
4. Proofreading Agent
5. Instagram Posting Agent


1. AI News Research Agent

Responsibilities:

  • Fetch the latest news articles relevant to BeyondTech's niche.
  • Summarize the content to provide concise and informative insights.

Technical Implementation:

The model chosen for this task was Perplexity, due to its high search engine capabilities and sourcing. To retrieve up-to-date news, we used a simple open-source news API. The URLs of relevant news articles were stored in a database designed to check for duplicates. Perplexity utilizes its advanced capabilities as a language model to summarize and source the documents whenever a new link gets posted into the database.

                    
                        // Initialize database connection
                        database.connect('news_articles.db')
                        
                        // Fetch latest news articles
                        newsArticles = fetchNews(apiKey, query, fromDate, toDate)
                        
                        // Loop through articles
                        for article in newsArticles:
                            if isNewArticle(database, article.url):
                                // Store URL if new
                                storeUrl(database, article.url)
                                // Summarize article content
                                summary = summarizeArticle(perplexityModel, article.content)
                                // Save summary
                                saveSummary(summary)
                        
                
The Perplexity model was not instructed with custom prompt, but rather limited the token length to 2000.



2. Marketing Specialist - Blog Writer

Responsibilities:

  • Generate blog posts based on summaries from the AI News Research Agent.
  • Create engaging Instagram captions from the blog post content.

Technical Implementation:

This agent obtains the summary generated by the AI News Research Agent, then drafts the caption that will be used for the Instagram post. The model used to generate this response was GPT-4, given the SOTA status of text-generation and reliable low error rate. The custom instruction given to this agent was the following:

                
                // Custom instruction for generating Instagram captions
                instruction = """
                As a digital marketing specialist, create an Instagram caption about the following artificial intelligence concept. Keep it informative and cover all points. Ensure the content is visually appealing and includes an inspirational message. Suggest relevant hashtags, especially regarding the company or the topic: [#Hashtag1, #Hashtag2, #Hashtag3].

                Since it will be directly inserted as caption without edits, do not include any other irrelevant texts.
                Here's the article that I want you to turn into an instagram caption: {{2.choices[].message.content}}. Insert a short headline with an emoji and {{1.`0`}}, followed by the concept article, and then closing conclusion. Maximum 2000 characters.
                """

                // Summaries from AI News Researcher
                summaries = getSummaries()

                // Generate Instagram caption using GPT-4
                caption = generateInstagramCaption(gpt4Model, summaries, instruction)

                // Save or post caption
                saveCaption(caption)
                
            

3. Marketing Specialist - Graphic Designer

Responsibilities:

  • Create visually appealing images based on captions from the blog writer.
  • Ensure images are designed to maximize audience retention and attention.

Technical Implementation:

This agent utilizes GPT-4o and DALL-E 3. It takes the caption created by the blog writer and describes an image that will best match in terms of audience retention and attention grab. The description of the image is then used as a prompt for DALL-E 3 to generate the image.

                
                // Custom instruction for generating image descriptions
                instruction = """
                As a graphic designer, describe an image that will best match the following Instagram caption in terms of audience retention and attention grab. Ensure the image is visually appealing and relevant to the caption. Provide a detailed description that can be used as a prompt for an image generation model.
                Here's the caption: {{caption}}
                """

                // Captions from Marketing Specialist - Blog Writer
                captions = getCaptions()

                // Generate image description using GPT-4o
                imageDescription = generateImageDescription(gpt4Model, captions, instruction)

                // Generate image using DALL-E 3
                image = generateImage(dalleModel, imageDescription)

                // Save or use image
                saveImage(image)
                
            

4. Proofreading and Verification Agent

Responsibilities:

  • Proofread and edit captions and image descriptions for grammar, clarity, and coherence.
  • Verify content to ensure it adheres to specified guardrails and limitations.
  • Check for toxic language and irregular image generation issues, including text typography.

Technical Implementation:

This agent utilizes GPT-4o with custom instructions to act as a proofreader and verifier. It checks for guardrails, toxic language, irregular image generation, and other specified limitations for the captions and image descriptions produced by the Blog Writer and Graphic Designer agents.

                
                // Custom instruction for proofreading and verification
                instruction = """
                As a proofreader and verifier, check the following text for grammar, clarity, and coherence. Ensure it adheres to specified guardrails, does not contain toxic language, and verifies the appropriateness of image generation instructions including text typography.
                Here's the text: {{text}}
                """

                // Captions and image descriptions from previous agents
                textsToVerify = getTextsToVerify()

                // Proofread and verify using GPT-4
                verifiedTexts = proofreadAndVerify(gpt4Model, textsToVerify, instruction)

                // Save or use verified texts
                saveVerifiedTexts(verifiedTexts)
                
            

5. Instagram Posting Agent

Responsibilities:

  • Automate the posting of verified content on Instagram.
  • Schedule posts for optimal engagement.

Technical Implementation:

This agent uses a script to automatically post content every day at a given time (8:30am EST). It takes the image and the caption and posts it on an Instagram page called BeyondTech.

                
                // Schedule post every day at 8:30am EST
                schedule.every().day.at("08:30").do(postToInstagram, image, caption)

                // Function to post to Instagram
                def postToInstagram(image, caption):
                    instagramAPI.post(image, caption)
                
            

The creation of a 100% automated pipeline for BeyondTech demonstrates the power and efficiency of agentic systems. By leveraging specialized AI agents for distinct tasks, we achieve a seamless and efficient content creation and distribution process. This system not only enhances productivity but also ensures that BeyondTech remains at the forefront of technological innovation.