Skip to content
advanced 30 min

Content Generation Agent with Image Creation

Automate your content pipeline — from research to blog post to cover image

contentwritingsubagentsimages

The Problem

Content creation at scale — blog posts, social media, images — requires coordinating research, writing, image generation, and brand consistency. Manual workflows are slow and inconsistent.

The Solution

Deep Agents' file-based configuration (AGENTS.md for brand voice, skills/ for content templates) creates a content pipeline. Sub-agents handle research, the main agent writes content following brand guidelines, and custom tools generate images via Gemini.

Working Code

content_builder_agent.py
from deepagents import create_deep_agent
from deepagents.backends import FilesystemBackend
from langchain_core.tools import tool
@tool
def generate_cover(prompt: str, slug: str) -> str:
"""Generate a cover image for a blog post."""
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-2.5-flash-image",
contents=[prompt],
)
for part in response.parts:
if part.inline_data is not None:
image = part.as_image()
image.save(f"blogs/{slug}/hero.png")
return f"Image saved to blogs/{slug}/hero.png"
return "No image generated"
agent = create_deep_agent(
memory=["./AGENTS.md"],
skills=["./skills/"],
tools=[generate_cover],
subagents=[{"name": "researcher", "description": "Research topics", "tools": [web_search]}],
backend=FilesystemBackend(root_dir="."),
)

Step by Step

1

Define brand voice (AGENTS.md)

Create an AGENTS.md file that describes your brand voice, writing style, target audience, and content rules. The agent reads this at startup and follows it for every piece of content.

2

Create content skills

Add markdown skill files in `skills/` for different content types: blog posts, social media threads, newsletters. Each skill defines structure, tone, and formatting rules.

3

Add image generation tools

Create custom tools using the `@tool` decorator for image generation via Gemini, DALL-E, or other providers. The agent calls these tools automatically when creating visual content.

4

Configure research sub-agents

Add sub-agents for research tasks — web search, competitor analysis, trend monitoring. They gather information that the main content agent uses for writing.

5

Generate content

Invoke the agent with a content brief. It will research the topic, write the content following your brand guidelines, generate a cover image, and save everything to disk.

Ready to build this?

Get started with Vstorm's open-source tools — production-tested, fully documented, and free.

Get Started

Ready to build your first production AI agent?

Open-source tools, battle-tested patterns, zero boilerplate. Configure your stack and ship in minutes — not months.