{"_id":"deepagentsjs","_rev":"2-56d2daa6c896694ffd2fdccda0c63194","name":"deepagentsjs","dist-tags":{"latest":"0.0.0"},"versions":{"0.0.0":{"name":"deepagentsjs","version":"0.0.0","keywords":["ai","agents","langgraph","langchain","typescript","llm"],"author":{"name":"LangChain"},"license":"MIT","_id":"deepagentsjs@0.0.0","maintainers":[{"name":"basproul","email":"braceasproul@gmail.com"}],"homepage":"https://github.com/langchain-ai/deepagentsjs#readme","bugs":{"url":"https://github.com/langchain-ai/deepagentsjs/issues"},"dist":{"shasum":"eddf8f95925a848ea4c53f4029505e686a9c9fbe","tarball":"https://registry.npmjs.org/deepagentsjs/-/deepagentsjs-0.0.0.tgz","fileCount":19,"integrity":"sha512-t6+oQYJJLUe1HGXbUGCqRciBMLzvSEGMr1fNhUM1Dg588MjBBRn1Wr0mLA2FCuVANS7Wd1D9xvfouqhNp7BAOQ==","signatures":[{"sig":"MEYCIQDDXjoqBjdDtBqi9VFZy47X3wEvLlN7AQz5p/hgkjB+xwIhAKs2Oh2Ig1lLecXWZMrCVW2+BhdgMOXtVk1zN8O8escT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":82867},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"6e85f3d7e2fb81600f0439bad2d47634bcac86c2","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts examples/**/*.ts","test":"echo \"Error: no test specified\" && exit 0","build":"yarn clean && tsc","clean":"rm -rf dist dist-examples || true","start":"node dist/index.js","format":"prettier --write \"src/**/*.{ts,js,json,md}\" \"examples/**/*.{ts,js,json,md}\"","lint:fix":"eslint src/**/*.ts examples/**/*.ts --fix","typecheck":"tsc --noEmit","build:watch":"tsc --watch","format:check":"prettier --check \"src/**/*.{ts,js,json,md}\" \"examples/**/*.{ts,js,json,md}\"","build:examples":"yarn clean && tsc -p examples.tsconfig.json","prepublishOnly":"yarn build"},"_npmUser":{"name":"basproul","email":"braceasproul@gmail.com"},"repository":{"url":"git+https://github.com/langchain-ai/deepagentsjs.git","type":"git"},"_npmVersion":"10.5.2","description":"Deep Agents - a library for building controllable AI agents with LangGraph","directories":{},"resolutions":{"@langchain/core":">=0.3.0","@langchain/langgraph":">=0.2.53"},"_nodeVersion":"22.16.0","dependencies":{"zod":"^3.25.32","@langchain/core":"^0.3.66","@langchain/anthropic":"^0.3.25","@langchain/langgraph":"^0.4.2"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.22","devDependencies":{"dotenv":"^17.2.1","eslint":"^9.19.0","globals":"^15.0.0","prettier":"^3.6.2","@eslint/js":"^9.19.0","typescript":"^5","@types/node":"^22.13.5","@eslint/eslintrc":"^3.1.0","@langchain/tavily":"^0.1.4","typescript-eslint":"^8.22.0","eslint-plugin-import":"^2.27.5","@tsconfig/recommended":"^1.0.8","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-no-instanceof":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/deepagentsjs_0.0.0_1755004491153_0.5395386187643465","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2025-08-12T13:14:51.152Z","modified":"2026-01-20T17:59:45.768Z","0.0.0":"2025-08-12T13:14:51.339Z"},"bugs":{"url":"https://github.com/langchain-ai/deepagentsjs/issues"},"author":{"name":"LangChain"},"license":"MIT","homepage":"https://github.com/langchain-ai/deepagentsjs#readme","keywords":["ai","agents","langgraph","langchain","typescript","llm"],"repository":{"url":"git+https://github.com/langchain-ai/deepagentsjs.git","type":"git"},"description":"Deep Agents - a library for building controllable AI agents with LangGraph","maintainers":[{"name":"basproul","email":"braceasproul@gmail.com"}],"readme":"# 🧠🤖Deep Agents\n\nUsing an LLM to call tools in a loop is the simplest form of an agent. This architecture, however, can yield agents that are \"shallow\" and fail to plan and act over longer, more complex tasks. Applications like \"Deep Research\", \"Manus\", and \"Claude Code\" have gotten around this limitation by implementing a combination of four things: a planning tool, sub agents, access to a file system, and a detailed prompt.\n\n`deepagents` is a TypeScript package that implements these in a general purpose way so that you can easily create a Deep Agent for your application.\n\n> ![TIP]\n> Looking for the Python version of this package? See [here: hwchase17/deepagents](https://github.com/hwchase17/deepagents)\n\n**Acknowledgements**: This project was primarily inspired by Claude Code, and initially was largely an attempt to see what made Claude Code general purpose, and make it even more so.\n\n## Installation\n\n```bash\nyarn add deepagentsjs\n```\n\n## Usage\n\n(To run the example below, you will need to install tavily: `yarn add @langchain/tavily`)\n\n```typescript\nimport { TavilySearch } from \"@langchain/tavily\";\nimport { createDeepAgent } from \"deepagentsjs\";\n\n// Search tool to use to do research\nconst internetSearch = new TavilySearch({\n  maxResults: 5,\n  tavilyApiKey: process.env.TAVILY_API_KEY,\n});\n\n// Prompt prefix to steer the agent to be an expert researcher\nconst researchInstructions = `You are an expert researcher. Your job is to conduct thorough research, and then write a polished report.\n\nYou have access to a few tools.\n\n## \\`internet_search\\`\n\nUse this to run an internet search for a given query. You can specify the number of results, the topic, and whether raw content should be included.\n`;\n\n// Create the agent\nconst agent = createDeepAgent({\n  tools: [internetSearch],\n  instructions: researchInstructions,\n});\n\n// Invoke the agent\nconst result = await agent.invoke({\n  messages: [{ role: \"user\", content: \"what is langgraph?\" }]\n});\n```\n\nSee `examples/research-agent.ts` for a more complex example.\n\nThe agent created with `createDeepAgent` is just a LangGraph graph - so you can interact with it (streaming, human-in-the-loop, memory, studio) in the same way you would any LangGraph agent.\n\n## Creating a custom deep agent\n\nThere are three parameters you can pass to `createDeepAgent` to create your own custom deep agent.\n\n### tools (Required)\n\nThe first argument to `createDeepAgent` is tools. This should be a list of LangChain tools. The agent (and any subagents) will have access to these tools.\n\n### instructions (Required)\n\nThe second argument to `createDeepAgent` is instructions. This will serve as part of the prompt of the deep agent. Note that there is a built in system prompt as well, so this is not the entire prompt the agent will see.\n\n### subagents (Optional)\n\nA keyword-only argument to `createDeepAgent` is subagents. This can be used to specify any custom subagents this deep agent will have access to. You can read more about why you would want to use subagents [here](https://langchain-ai.github.io/deepagents/subagents/)\n\n`subagents` should be a list of objects, where each object follows this schema:\n\n```typescript\ninterface SubAgent {\n  name: string;\n  description: string;\n  prompt: string;\n  tools?: string[];\n}\n```\n\n- **name**: This is the name of the subagent, and how the main agent will call the subagent\n- **description**: This is the description of the subagent that is shown to the main agent\n- **prompt**: This is the prompt used for the subagent\n- **tools**: This is the list of tools that the subagent has access to. By default will have access to all tools passed in, as well as all built-in tools.\n\nTo use it looks like:\n\n```typescript\nconst researchSubAgent = {\n  name: \"research-agent\",\n  description: \"Used to research more in depth questions\",\n  prompt: subResearchPrompt,\n};\n\nconst subagents = [researchSubAgent];\n\nconst agent = createDeepAgent({\n  tools,\n  instructions: prompt,\n  subagents\n});\n```\n\n### model (Optional)\n\nBy default, `deepagents` will use \"claude-sonnet-4-20250514\". If you want to use a different model, you can pass a LangChain model object.\n\n## Deep Agent Details\n\nThe below components are built into `deepagents` and helps make it work for deep tasks off-the-shelf.\n\n### System Prompt\n\n`deepagents` comes with a built-in system prompt. This is relatively detailed prompt that is heavily based on and inspired by attempts to replicate Claude Code's system prompt. It was made more general purpose than Claude Code's system prompt. This contains detailed instructions for how to use the built-in planning tool, file system tools, and sub agents. Note that part of this system prompt can be customized\n\nWithout this default system prompt - the agent would not be nearly as successful at going as it is. The importance of prompting for creating a \"deep\" agent cannot be understated.\n\n### Planning Tool\n\n`deepagents` comes with a built-in planning tool. This planning tool is very simple and is based on ClaudeCode's TodoWrite tool. This tool doesn't actually do anything - it is just a way for the agent to come up with a plan, and then have that in the context to help keep it on track.\n\n### File System Tools\n\n`deepagents` comes with four built-in file system tools: `ls`, `edit_file`, `read_file`, `write_file`. These do not actually use a file system - rather, they mock out a file system using LangGraph's State object. This means you can easily run many of these agents on the same machine without worrying that they will edit the same underlying files.\n\nRight now the \"file system\" will only be one level deep (no sub directories).\n\nThese files can be passed in (and also retrieved) by using the `files` key in the LangGraph State object.\n\n```typescript\nconst agent = createDeepAgent({ ... });\n\nconst result = await agent.invoke({\n  messages: [...],\n  // Pass in files to the agent using this key\n  // files: {\"foo.txt\": \"foo\", ...}\n});\n\n// Access any files afterwards like this\nresult.files;\n```\n\n### Sub Agents\n\n`deepagents` comes with the built-in ability to call sub agents (based on Claude Code). It has access to a general-purpose subagent at all times - this is a subagent with the same instructions as the main agent and all the tools that is has access to. You can also specify custom sub agents with their own instructions and tools.\n\nSub agents are useful for \"context quarantine\" (to help not pollute the overall context of the main agent) as well as custom instructions.\n","readmeFilename":"README.md"}