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)
- Google (Gemini) for image generation with
gemini-2.5-flash-image - Tavily for web search (free tier)
- LangSmith for tracing (optional)
Setup
Install dependencies
tsx to run content_writer.ts. The --input-type=module flag applies only to --eval, --print, or stdin, not to a script file path.Install @langchain/anthropic so LangChain can load the default Claude model that createDeepAgent uses.Add configuration files
The example keeps behavior in three kinds of files: memory, skills, and subagent definitions.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.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.ts in the project root. The following sections belong in one file, in order.
Add tools
The researcher uses Tavily search. Blog and social workflows use the Google Generative AI SDK for image generation.
Create the agent
When creating the deep agent with createDeepAgent, pass memory paths, the skills directory, image tools, an inline subagent definition, and a FilesystemBackend rooted at the example directory so paths like
./AGENTS.md and ./skills/ resolve correctly.Run the agent
From the project directory:LANGSMITH_API_KEY set, you can inspect runs in LangSmith.
Output
On success, the agent writes artifacts under the project root (the example directory), for example: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.

