DeepAgents CLI is an open-source command-line tool that provides AI-powered assistance for coding, research, and development tasks with persistent memory across sessions.
This free AI-powered CLI tool from LangChain enables you to create and run custom AI agents directly from your terminal, maintaining context and learned information between uses.
Features
- File System Operations: Read, write, and edit files in your project directory. The agent can analyze code, propose changes, and show diffs before applying modifications.
- Shell Command Execution: Run terminal commands with human approval gates. This lets the agent suggest and execute system operations while keeping you in control.
- Web Search Integration: Access current information through Tavily search integration. The agent can pull recent documentation or answers when working on problems.
- Persistent Memory System: Store knowledge in
~/.deepagents/AGENT_NAME/memories/that persists across sessions. The agent checks these memories before answering and saves new learnings automatically. - Visual Task Planning: Break down complex tasks into trackable todo lists. The planning tool functions as a no-op that helps keep the agent on track through context engineering.
- Multiple Agent Profiles: Create specialized agents for different projects or roles. List, switch between, or reset agents to default states as needed.
- Multi-Model Support: Works with both Anthropic Claude (Sonnet 4 is default) and OpenAI models. Choose the LLM that fits your use case and budget.
- HTTP API Requests: Make web requests to external APIs, useful for testing endpoints or gathering data during development.
Use Cases
- Automated Code Refactoring: You can ask the agent to perform project-wide changes, like adding type hints to all functions in a specific file. The agent reads the file, analyzes the code, and proposes the necessary edits.
- Enforcing API and Coding Standards: Teach the agent your project’s specific conventions. For example, you can provide it with a document outlining your API design patterns. The agent will then use this knowledge to ensure any new code it generates follows those rules.
- Onboarding to a New Project: A new agent can be fed documentation and key files from a codebase. It can then answer questions and help new developers get up to speed by explaining how different parts of the system work based on the memory you’ve given it.
- Complex Research Tasks: For tasks that require gathering information from multiple sources, the agent can search the web, save key findings to its memory, and synthesize a report, all without losing track of the initial goal.
How To Use It
1. Install the deepagents-cli package using pip.
pip install deepagents-cli2. Set Up API Keys. The CLI tool supports Anthropic’s Claude and OpenAI’s GPT models. It also uses Tavily for web searches. You’ll need to create a .env file in your project’s root directory and add your keys there.
Get Anthropic keys from console.anthropic.com, OpenAI keys from platform.openai.com, and Tavily keys from tavily.com. You need at least one LLM provider key to run the agent.
export ANTHROPIC_API_KEY=your_api_key_hereexport OPENAI_API_KEY=your_api_key_hereexport TAVILY_API_KEY=your_tavily_key_here
3. Open your terminal, navigate to your project directory, and run the command:
deepagents4. Start with a simple file modification task to see it in action. For instance:
You: Add a docstring to the main function in src/main.py5. The agent will read the file, propose the changes, and wait for you to approve them before writing anything. This approval step is a nice safety feature, though you can enable an auto-accept option for faster workflows.
6. Teach the AI agent information you want remembered:
You: Remember that our API endpoints follow this pattern:
- Use /api/v1/ prefix
- All POST requests return 201 on success
- Error responses include a "code" and "message" field
Save this as our API conventions.The agent writes this to /memories/api-conventions.md. In future sessions, it will reference this file when generating API-related code.
7. Create Specialized Agents:
deepagents --agent backend-devThis creates a new agent with its own memory directory. List all agents with deepagents --list or reset one to default state with deepagents --reset agent-name.

Pros
- Persistent memory across sessions: An AI that learns and remembers your project’s rules is far more useful than one you have to retrain in every session.
- Transparent file-based memory storage: Memory files are accessible markdown documents, not black-box databases.
- Multi-agent support: Different projects or roles can have dedicated agents with separate memories and behavior.
- Safety through approval workflow: No unexpected file changes. You review modifications before they’re applied.
- Open-source foundation: Built on LangChain’s proven architecture with active community development.
- Free to use: No subscription costs or usage limits beyond your own API key expenses.
Cons
- API key dependency: Requires separate accounts and billing for Anthropic, OpenAI, and Tavily services.
- Initial setup complexity: Configuring multiple API keys and understanding the memory system has a learning curve.
- Memory management overhead: Without careful organization, memory files can become disorganized over time.
- Python environment dependency: Requires a compatible Python version and managing dependencies.
Related Resources
- DeepAgents GitHub Repository: Official source code, issue tracking, and contribution guidelines for the DeepAgents project.
- LangChain DeepAgents Documentation: Comprehensive guides covering installation, configuration, advanced usage patterns, and API reference.
- DeepAgents Introduction Blog: Launch announcement with examples and use cases from the LangChain team.
- Deep Agents Concept Explanation: Background article explaining the architecture and theory behind deep agents versus shallow agents.
FAQs
Q: How much does it cost to run DeepAgents CLI?
A: DeepAgents itself is free and open source, but you pay for the LLM API calls you make. Claude Sonnet 4 is the default model, which at current pricing costs roughly $3 per million input tokens and $15 per million output tokens. Typical development sessions use thousands to tens of thousands of tokens, depending on file sizes and task complexity. A rough estimate: simple tasks might cost a few cents, while extended coding sessions with large files could reach a few dollars. You control costs by choosing cheaper models or limiting session length.
Q: Can I use DeepAgents CLI without paying for APIs?
A: No, you need at least one LLM provider API key (Anthropic or OpenAI) to run the agent. There’s no free tier that works without external API access. Web search through Tavily also requires a separate API key, though the agent can function without it (just without internet search capabilities).
Q: What happens if the agent makes a mistake or breaks something?
A: File edits and shell commands require approval before execution. The agent shows you exactly what it plans to do, and you type “yes” or “no.” If you enable auto-accept mode and something breaks, you’ll need to manually fix it or ask the agent to undo changes. Git version control is your safety net here. The agent doesn’t have built-in rollback capabilities beyond the approval system.
Q: Can I use DeepAgents CLI for languages other than Python?
A: Yes, completely. The CLI works with any programming language since it operates through file editing and shell commands. The agent can read, modify, and create files in JavaScript, Go, Rust, Java, or any other language. The underlying Deep Agents package is written in Python, but that doesn’t restrict what languages your projects use.
Q: How do I prevent my memory files from getting cluttered?
A: Build good organizational habits early. Use descriptive filenames, like /memories/deployment-checklist.md instead of /memories/notes.md. Create subdirectories by topic: /memories/backend/, /memories/frontend/, /memories/security/. Periodically review and consolidate memory files manually. Ask the agent, “What do you know about X?” to audit its stored knowledge. Delete or merge files that contain outdated or conflicting information.
Q: Can multiple agents share the same memory files?
A: Not by default. Each agent has its own separate memory directory. If you want agents to share knowledge, you’d need to manually copy memory files between agent directories or set up symbolic links. This isolation is intentional. It lets you maintain different contexts for different projects without cross-contamination.
Q: What’s the difference between DeepAgents and Claude Code?
A: DeepAgents was inspired by Claude Code and attempts to make those concepts general-purpose. Claude Code is a specific application built by Anthropic for coding tasks. DeepAgents CLI is an open-source implementation of a similar architecture (planning tools, memory, subagents) that you can customize for any use case, not just coding. You control the models, tools, and prompts.










