The Problem I Was Trying to Solve§

Managing a brand’s social media presence is a time vampire. You have to ideate, write posts, generate visuals, schedule them, and engage with comments — all while maintaining a consistent brand voice. I run a small AI consultancy, and I was spending upwards of 15 hours per week just on LinkedIn and Twitter. I needed a way to automate this without losing the personal touch that makes social media effective.

I wanted an autonomous agent that could: (1) crawl my latest blog posts and product updates, (2) generate engaging posts in my brand voice, (3) create relevant images using text-to-image models, and (4) schedule them. But the real challenge was making sure the image prompts were contextually aware of the post content and the platform’s visual norms. Off-the-shelf social media schedulers couldn't do that. So I built my own using Agentic RAG and image prompt generation.

Tools and Setup§

I used the following stack:

  • **DeepSeek** as the main reasoning model for content generation and decision-making (my “agent brain”).
  • **Claude** (via Anthropic API) for drafting the final image prompts — I found Claude better at translating abstract concepts into vivid, platform-appropriate image descriptions.
  • **Cursor** as my IDE (its AI features helped me iterate on the agentic loop quickly).
  • **Perplexity** for real-time research (e.g., checking trending hashtags or recent news to incorporate into posts).
  • Weaviate as the vector store for RAG (I indexed my past high-performing posts, brand guidelines, and platform best practices).
  • Stable Diffusion XL (hosted on Replicate) for actual image generation.
  • LangGraph to orchestrate the agentic workflow: plan → retrieve → generate content → generate image prompt → generate image → schedule via APIs.
[Loading prompt card for DeepSeek Chat...]
[Loading prompt card for Claude...]
[Loading prompt card for Perplexity AI...]

Setup took about two days. I first defined the RAG documents: a corpus of 50 of my best posts, a brand voice document, and a one-pager on social media best practices (e.g., ideal post length, hashtag limits, image aspect ratios per platform). I chunked these documents and embedded them using DeepSeek’s embeddings API, storing in Weaviate.

Step-by-Step: What I Actually Did§

The agent works in a loop. Every morning, it:

  1. Fetches new sources: I connected it to my blog RSS feed and Google News alerts for my niche (AI/ML).
  2. Plans the day’s posts: Using DeepSeek, the agent decides which content to repurpose (e.g., a blog post excerpt) and which topics to create original posts about (e.g., a take on a trending AI paper). It also selects the platform (LinkedIn vs Twitter) based on the core audience.
  3. Retrieves context: For each planned post, the agent queries Weaviate for relevant brand voice examples and past posts with high engagement (RAG).
  4. Generates post text: DeepSeek generates 3 variants of the post. The agent scores them against the brand voice guidelines (using a small LLM-as-judge setup with DeepSeek). The best one is kept.
  5. Generates an image prompt: Here’s where Claude comes in. I pass the final post text and the platform to Claude with a system prompt that asks it to generate a detailed image prompt optimized for SDXL. The prompt includes style, composition, and subject details.
  6. Generates the image: The prompt goes to Replicate’s SDXL API. I set parameters like negative prompts (e.g., "blurry, text, watermark") and CFG scale.
  7. Schedules the post: For now, I manually approve the output via a simple web UI, but it could be fully automated. The agent uses the platform’s API (LinkedIn and Twitter) to schedule at optimal times (determined from past engagement data).

Code Samples / Prompts Used§

Here’s the prompt I use to generate image prompts from post text. Note the inclusion of platform-specific guidelines:

System: You are an expert image prompt engineer. Given a social media post and a platform (LinkedIn or Twitter), generate a single, highly detailed image prompt for Stable Diffusion XL. The prompt must include:
- Subject (clearly describe the main visual)
- Style (e.g., "photorealistic", "flat vector illustration", "digital art")
- Lighting and mood
- Color palette (if relevant)
- Composition (e.g., "close-up", "wide shot")
- Avoid text, watermarks, or complex typography

For LinkedIn: prefer professional, clean, minimalist images. For Twitter: allow more creative, abstract, or bold visuals.

Post: "Just published a deep dive on prompt engineering for code generation. Key insight: LLMs produce better code when you specify the programming paradigm (e.g., functional vs OOP) in the prompt."
Platform: LinkedIn

Image prompt:

And the resulting prompt from Claude:

A close-up photograph of a laptop screen displaying a split code editor. On the left, a functional program in Haskell; on the right, an object-oriented program in Java. A human hand is holding a stylus pointing at the screen. Soft, warm lighting from a desk lamp. The background is a blurred modern office with plants. Photorealistic, 8K, shallow depth of field. Minimalist composition, no text overlay.

I also use a RAG retrieval snippet in LangGraph:

import weaviate
client = weaviate.Client("http://localhost:8080")

query = "brand voice for casual LinkedIn posts"
result = client.query.get(
    class_name="Document",
    properties=["text", "title"]
).with_near_text({"concepts": [query]}).with_limit(5).do()

What Worked Well§

The Claude + SDXL combo for image generation was surprisingly effective. Claude’s prompts translated into images that matched the post’s tone 80% of the time. For example, a post about a serious AI ethics concern generated a moody, high-contrast image with abstract nodes, while a post about a product launch generated a bright, clean product shot. The RAG component ensured my brand voice stayed consistent — the agent didn’t drift into slang or overly formal language.

Another win was the automated quality scoring using DeepSeek as a judge. It correctly rejected posts that were too salesy or lacked a hook. I also liked the flexible scheduling — the agent would avoid posting during known low-engagement hours.

What Failed and Why§

The biggest failure was image prompt overspecification. Initially, I asked Claude to generate prompts with exact camera settings (f-stop, ISO) and references to specific artists. SDXL largely ignored those details, producing generic outputs. I had to simplify prompts to style + subject + lighting only. That improved hit rate.

Another failure was hashtag generation. I had the agent generate hashtags based on trending topics from Perplexity, but many were too long or unrelated to the post. I ended up hardcoding a list of 10 core hashtags per platform and letting the agent pick 3-5 from that list based on similarity (using embeddings).

Also, the agent sometimes generated multiple posts on the same topic because it would fetch the same RSS item twice. I added a deduplication step using a simple hash of the source URL.

Results and Takeaways§

Over a test period of two weeks, the agent posted 14 times (7 per platform). Average engagement (likes + comments) was 30% higher than my manually curated posts from the previous month. The images were praised in DMs — one even went viral on LinkedIn with 500+ reactions. However, I still had to intervene about 2 times per week to fix misaligned tone or wrong image-concept pairs.

The biggest time saver was the ideation and drafting process: I only spent ~1 hour per week curating the outputs instead of 15 hours writing from scratch. The agent also helped me experiment with more visual content, which I previously avoided due to the effort of finding images.

Key Takeaways:

  • Combining Agentic RAG (for brand context) with specialized LLMs for different tasks (DeepSeek for reasoning, Claude for prompts) yields more coherent automation.
  • Image prompt engineering for generative AI is a distinct skill — offloading it to a model (Claude) works well if you constrain the output format.
  • Always have a human-in-the-loop for quality assurance, especially for tone and factual accuracy.
  • Pre-built vector stores of your high-performing content are essential to maintain voice consistency across generative outputs.

Try It Yourself§

If you want to replicate this, here’s a minimal checklist:

  1. Set up a vector database (Weaviate, Pinecone, or Qdrant) with at least 20-30 examples of your past content.
  2. Choose an LLM orchestrator (LangGraph, CrewAI, or just simple Python with API calls).
  3. Get API keys for DeepSeek, Claude (optional), and an image generation service (Replicate, Stability AI).
  4. Write system prompts for each stage — post generation, image prompt generation, and quality scoring.
  5. Integrate with scheduling APIs (Buffer, Hootsuite, or direct LinkedIn/Twitter APIs).

I’ve open-sourced the core agentic loop on GitHub (link in bio). Start small: automate just one platform and one content type (e.g., repurposing blog posts). Expand from there. The key learning: don’t over-automate the creative judgment — let the LLM handle ideation but keep a human in the loop for final approval until you’ve tuned the guardrails enough.

Good luck, and let me know how it goes.