---
title: "Container Use for Locally Sandboxed, Background Agents in Zed"
description: "Container Use, an open source MCP tool, gives coding agents isolated sandboxes by pairing Dagger containers with Git worktrees, so background agents can work in parallel on the same repo without touching local files."
url: "https://swe.quest/articles/container-use-for-locally-sandboxed-background-agents-in-zed-256d62989b0aa880"
canonical: "https://zed.dev/blog/container-use-background-agents"
source: "Zed"
published: "2025-07-30"
difficulty: "medium"
kind: "How-to"
reading_minutes: 3
tags: ["ai-agents","ai-coding","sandboxing","containers","developer-tools"]
---

# Container Use for Locally Sandboxed, Background Agents in Zed

A post on [Zed](https://swe.quest/sources/zed.md), published 2025-07-30, 3 min read, How-to. Original: [https://zed.dev/blog/container-use-background-agents](https://zed.dev/blog/container-use-background-agents)

## Summary

Container Use, an open source MCP tool, gives coding agents isolated sandboxes by pairing Dagger containers with Git worktrees, so background agents can work in parallel on the same repo without touching local files. Each agent task gets a randomly named environment that can be inspected with \`container-use list\`, \`watch\`, \`log\`, \`diff\` and \`terminal\`, with service tunnels to localhost. The recommended Zed setup uses two custom Agent Panel profiles: a \`foreground\` profile with all built-in Zed tools enabled and a \`container-use\` profile with only Container Use tools enabled, so foreground and background agents don't collide.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)

## Prerequisites

- git worktrees
- containers basics ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- AI coding agents ([easy posts on AI for coding](https://swe.quest/tags/ai-coding.md?difficulty=easy))

## Keywords

Container Use, Zed, Dagger, Git worktree, MCP, Claude 4

## Related posts

- [Building AI Teams: How Docker Sandboxes and Docker Agent Transform Development](https://swe.quest/articles/building-ai-teams-how-docker-sandboxes-and-docker-agent-transform-development-50a60f5e32d42807.md): Docker · 2026-03-11 · Medium · 9 min read · AI agents, Sandboxing & isolation, Containers, AI for coding, Virtualization
  Docker Agent defines teams of specialized AI agents in YAML, where a root "product manager" agent delegates to designer, engineer, QA and fixer sub-agents, each with its own model, instructions and toolsets (filesystem, shell, think, todo, memory, MCP).
- [Running AI agents in GitHub Actions with Docker Sandboxes](https://swe.quest/articles/running-ai-agents-in-github-actions-with-docker-sandboxes-9cf9181798d75585.md): Docker · 2026-08-21 · Medium · 7 min read · AI agents, Sandboxing & isolation, CI/CD, Virtualization, AI for coding
  GitHub Agentic Workflows (gh-aw 0.82.9) supports Docker Sandboxes (sbx) as an agent runtime, so a CI coding agent gets root, sudo and unrestricted shell inside a disposable microVM with its own kernel and private Docker daemon.
- [Why AI Agents Need Isolation](https://swe.quest/articles/why-ai-agents-need-isolation-2e7b1a6342af3236.md): Docker · 2026-07-01 · Easy · 9 min read · Sandboxing & isolation, AI agents, Virtualization, Containers, AI for coding
  AI coding agents that run commands, install packages and handle credentials should execute behind an isolation boundary rather than directly on the developer's host.
- [Open SWE: An Open-Source Framework for Internal Coding Agents](https://swe.quest/articles/open-swe-an-open-source-framework-for-internal-coding-agents-1b0f7521a5a00040.md): LangChain · 2026-10-13 · Medium · 8 min read · AI agents, AI for coding, Open source, Sandboxing & isolation
  Open SWE is an MIT-licensed framework for internal coding agents, built on Deep Agents and LangGraph.
- [Highlights from AWS re:Invent: Supercharging Kiro with Docker Sandboxes and MCP Catalog](https://swe.quest/articles/highlights-from-aws-re-invent-supercharging-kiro-with-docker-sandboxes-and-mcp-a18d4753910b06e8.md): Docker · 2025-12-12 · Medium · 7 min read · AI agents, Sandboxing & isolation, Containers, AI for coding
  Docker Sandboxes run coding agents like AWS's Kiro inside isolated containers that see only the project directory and none of the host's credentials, while the Docker MCP Toolkit supplies tools through a gateway that injects secrets only into the specific MCP server that needs them.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
