Overview
This guide demonstrates how to build a content writing agent from scratch using Deep Agents. The agent you build will:- Load voice and workflow rules from
AGENTS.mdand skill folders - Delegate web research to a specialized subagent with
web_search - Draft blog or social content following the loaded skill
- Generate cover or social images with Gemini and save files under the project directory
Key concepts
This tutorial covers:- Long-term memory for TODO
- Skills for TODO
- Subagents for TODO
- Filesystem backends for file read and write
- Custom tools for search and image generation
Prerequisites
API keys:- Anthropic (Claude) or other provider API key
- Google (Gemini) for image generation with
gemini-2.5-flash-image - Tavily for web search (free tier)
- LangSmith for tracing (optional)
Setup
1
Create project directory
2
Install dependencies
deepagents to a supported range in your own project (for example >=0.3.5,<0.4.0) to match the upstream example.3
Set API keys
Add configuration files
The example keeps behavior in three kinds of files: memory, skills, and subagent definitions.1
Add AGENTS.md
Create To make this agent comply with your own tone, pillars, and formatting rules, update the text in
AGENTS.md in the project root.
When you later create the agent and specify this file as part of the memory parameter, it gets loaded this into the system prompt so brand voice and research expectations apply to every run.AGENTS.md.2
Add subagents.yaml
Create a file called The file gets passed as an argument later when creating the deep agent.
subagents.yaml.
Then add the following txt which describes a researcher subagent with a Tavily-backed web_search tool, a Haiku model id, and instructions to save findings to paths you specify when delegating from the main agent:3
Add skills
Create a Next, create They instruct the agent to call the
skills/ directory. Each skill is a folder containing a SKILL.md file with YAML frontmatter (name, description) and instructions for the skill.Create skills/blog-post/SKILL.md and copy the following text into it which contains information on crating long-form posts, optimizing content for SEO, and generating cover images.skills/social-media/SKILL.md and copy the following text into it which contains information on drafting social media posts and generating accompanying imagery:researcher subagent first, write markdown under blogs/, linkedin/, or tweets/, and call generate_cover or generate_social_image for images.When you later create the agent and specify the skills folder(s), then the frontmatter of the SKILLS.md files from those skill folders get loaded this into the system prompt so the agent can use the skill when a task task matches a skill description.Build the script
Createcontent_writer.py in the project root. The following sections belong in one file, in order.
1
Add tools
The researcher subagent uses Tavily search.
Blog and social workflows use Gemini image generation.
When creating the agent later, the
load_subagents function reads subagents.yaml and resolves tool names to these decorated functions.2
Create the agent
When creating the deep agent with create_deep_agent, pass memory paths, the skills directory, image tools, subagents from YAML, and a FilesystemBackend rooted at the example directory so paths like
./AGENTS.md and ./skills/ resolve correctly.3
Add an entry point
Invoke the agent with a user message to verify the agent is working:
Run the agent
From the project directory you can invoke the agent without passing an argument or by passing the prompt as an argument:LANGSMITH_API_KEY set, you can inspect runs in LangSmith.
Output
On success, generated artifacts are written under a system temporary directory (on macOS and Linux, typically under/tmp/), not next to your project files.
SKILL.md.
Full code
Browse the complete content-builder-agent example on GitHub, including the Rich-based streaming UI.Next steps
- Edit
AGENTS.mdto change brand voice and research requirements - Add skills under
skills/<name>/SKILL.mdfor new content types - Add subagents in
subagents.yamland register tools inload_subagents - Read Subagents, Skills, and Customization for deeper configuration
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

