Skip to content

How to Use Deep Agents in Zed Editor with ACP Integration

Purpose

I wanted to use Deep Agents directly in my editor. Switching between terminal and editor while coding disrupts my flow. I heard Deep Agents supports Zed editor through something called ACP (Agent Client Protocol), so I tried setting it up.

What is ACP?

ACP stands for Agent Client Protocol. It’s a protocol that lets AI agents run inside text editors. Deep Agents provides an ACP connector that bridges your Deep Agent to editors like Zed.

The connector includes:

  • A demo coding agent using Anthropic’s Claude models
  • Built-in filesystem tools for file operations
  • Shell execution capabilities
  • LangSmith tracing support

Environment

  • macOS or Linux
  • Zed editor installed
  • uv package manager
  • Anthropic API key

How to Set It Up

Step 1: Install Prerequisites

First, I need Zed editor and uv installed. Zed is available from their website, and uv can be installed via:

Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

Step 2: Clone and Setup Deep Agents

Clone repository
git clone [email protected]:langchain-ai/deepagents.git
cd deepagents/libs/acp
uv sync

Step 3: Configure API Key

Create a .env file in the acp directory:

Create .env file
echo "ANTHROPIC_API_KEY=your-key-here" > .env

Step 4: Configure Zed

I added the agent server to Zed’s settings.json. Open Zed settings (Cmd+, on Mac) and add:

Zed settings.json
{
"agent_servers": {
"DeepAgents": {
"type": "custom",
"command": "/path/to/deepagents/libs/acp/run_demo_agent.sh"
}
}
}

Replace /path/to/deepagents with the actual path where you cloned the repository.

Step 5: Use It

After saving the settings, I restarted Zed. The agent panel should now show DeepAgents as an available agent. I can chat with it, ask it to read files, write code, and execute commands - all from within the editor.

Optional: LangSmith Tracing

If I want to trace agent runs for debugging, I can enable LangSmith by adding these to .env:

LangSmith configuration
LANGSMITH_TRACING=true
LANGSMITH_API_KEY=your-langsmith-key
LANGSMITH_PROJECT=deep-agents-acp

Creating a Custom Agent

The demo agent is just a starting point. I can create my own agent with custom tools:

custom_agent.py
import asyncio
from acp import run_agent
from deepagents import create_deep_agent
from langgraph.checkpoint.memory import MemorySaver
from deepagents_acp.server import AgentServerACP
async def get_weather(city: str) -> str:
"""Get weather for a city."""
return f"It's always sunny in {city}!"
async def main() -> None:
agent = create_deep_agent(
tools=[get_weather],
system_prompt="You are a helpful assistant",
checkpointer=MemorySaver(),
)
server = AgentServerACP(agent)
await run_agent(server)
if __name__ == "__main__":
asyncio.run(main())

The key components:

  • create_deep_agent() - Creates the agent with tools and prompt
  • MemorySaver() - Persists conversation state
  • AgentServerACP() - Wraps the agent for ACP protocol
  • run_agent() - Starts the server

Summary

In this post, I showed how to integrate Deep Agents with Zed editor using ACP. The setup involves cloning the repository, configuring the API key, and adding the agent server to Zed’s settings. I can also create custom agents with my own tools. Now I can use Deep Agents’ planning, file operations, and sub-agent capabilities directly in my editor.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments