Deep agents come with a built-in system prompt inspired by Claude Code’s system prompt. The default system prompt contains detailed instructions for using the built-in planning tool, file system tools, and subagents.Each deep agent tailored to a use case should include a custom system prompt specific to that use case.
Copy
import { createDeepAgent } from "deepagents";const researchInstructions = `You are an expert researcher. Your job is to conduct thorough research, and then write a polished report.`;const agent = createDeepAgent({ systemPrompt: researchInstructions,});
You can use skills to provide your deep agent with new capabilities and expertise.
While tools tend to cover lower level functionality like native file system actions or planning, skills can contain detailed instructions on how to complete tasks, reference info, and other assets, such as templates.
These files are only loaded by the agent when the agent has determined that the skill is useful for the current prompt.
This progressive disclosure reduces the amount of tokens and context the agent has to consider upon startup.For example skills, see Deep Agent example skills.To add skills to your deep agent, pass them as an argument to create_deep_agent:
Copy
import { createDeepAgent, type FileData } from "deepagents";import { MemorySaver, Command } from "@langchain/langgraph";import { createInterface } from "node:readline/promises";import { stdin as input, stdout as output } from "node:process";const checkpointer = new MemorySaver();function createFileData(content: string): FileData { const now = new Date().toISOString(); return { content: content.split("\n"), created_at: now, modified_at: now, };}const skillsFiles: Record<string, FileData> = {};const skillUrl = "https://raw.githubusercontent.com/langchain-ai/deepagentsjs/refs/heads/main/examples/skills/langgraph-docs/SKILL.md";const response = await fetch(skillUrl);const skillContent = await response.text();skillsFiles["/skills/langgraph-docs/SKILL.md"] = createFileData(skillContent);const agent = await createDeepAgent({ checkpointer, // IMPORTANT: deepagents skill source paths are virtual (POSIX) paths relative to the backend root. skills: ["/skills/"],});const config = { configurable: { thread_id: `thread-${Date.now()}`, },};let result = await agent.invoke( { messages: [ { role: "user", content: "what is langraph? Use the langgraph-docs skill if available.", }, ], files: skillsFiles, } as any, config);
Use AGENTS.md files to provide extra context to your deep agent.You can pass one or more file paths to the memory parameter when creating your deep agent:
Copy
import { createDeepAgent, type FileData } from "deepagents";import { MemorySaver } from "@langchain/langgraph";const AGENTS_MD_URL = "https://raw.githubusercontent.com/langchain-ai/deepagents/refs/heads/master/examples/text-to-sql-agent/AGENTS.md";async function fetchText(url: string): Promise<string> { const res = await fetch(url); if (!res.ok) { throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`); } return await res.text();}const agentsMd = await fetchText(AGENTS_MD_URL);const checkpointer = new MemorySaver();function createFileData(content: string): FileData { const now = new Date().toISOString(); return { content: content.split("\n"), created_at: now, modified_at: now, };}const agent = await createDeepAgent({ memory: ["/AGENTS.md"], checkpointer: checkpointer,});const result = await agent.invoke( { messages: [ { role: "user", content: "Please tell me what's in your memory files.", }, ], // Seed the default StateBackend's in-state filesystem (virtual paths must start with "/"). files: { "/AGENTS.md": createFileData(agentsMd) }, } as any, { configurable: { thread_id: "12345" } });