Skip to content
Deep Agents

Content Generation Agent with Deep Agents

Build an AI content generation agent that researches topics, writes blog posts and social media content with consistent brand voice — using Deep Agents.

contentblogsocial mediawriting

Working Code

Deep Agents
from deepagents import create_deep_agent
from langchain_core.tools import tool
@tool
def web_search(query: str) -> str:
"""Research a topic before writing content."""
from tavily import TavilyClient
client = TavilyClient()
results = client.search(query, max_results=3)
return "\n\n".join(r["content"] for r in results["results"])
@tool
def save_content(filename: str, content: str) -> str:
"""Save generated content to a file."""
Path(f"output/{filename}").write_text(content)
return f"Saved to output/{filename}"
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-5-20250929",
tools=[web_search, save_content],
system_prompt="You are a content writer. Research the topic first, then write engaging content. Save the final output using save_content.",
)
result = agent.invoke({
"messages": [("user", "Write a blog post about the benefits of AI agents in customer service")]
})
print(result["messages"][-1].content)

Step by Step

1

Install dependencies

Install Deep Agents and the required tools for this use case.

2

Define your tools

Create the domain-specific tool functions your agent will use to interact with external services.

3

Create the agent and run

Initialize the Deep Agents agent with your tools, set the system prompt, and execute a query.

Ready to build with Deep Agents?

Generate a production-ready project with Deep Agents pre-configured — FastAPI + Next.js, auth, streaming, and more.

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.