In AI-driven improvement, coding brokers have grow to be indispensable collaborators. These autonomous or semi-autonomous instruments can write, take a look at, and refactor code, dramatically accelerating improvement cycles. Nevertheless, because the variety of brokers engaged on a single codebase grows, so do the challenges: dependency conflicts, state leakage between brokers, and the issue of monitoring every agent’s actions. The container-use undertaking from Dagger addresses these challenges by providing containerized environments tailor-made for coding brokers. By isolating every agent in its container, builders can run a number of brokers concurrently with out interference, examine their actions in real-time, and intervene immediately when obligatory.
Historically, when a coding agent executes duties, resembling putting in dependencies, operating construct scripts, or launching servers, it does so inside the developer’s native surroundings. This strategy rapidly results in conflicts: one agent could improve a shared library that breaks one other agent’s workflow, or an errant script could depart behind artifacts that obscure subsequent runs. Containerization elegantly solves these points by encapsulating every agent’s surroundings. Moderately than babysitting brokers one after the other, you’ll be able to spin up fully recent environments, experiment safely, and discard failures immediately, all whereas sustaining visibility into precisely what every agent executed.
Furthermore, as a result of containers might be managed by acquainted instruments, Docker, git, and normal CLI utilities, container-use integrates seamlessly into present workflows. As a substitute of locking right into a proprietary answer, groups can leverage their most well-liked tech stack, whether or not meaning Python digital environments, Node.js toolchains, or system-level packages. The consequence is a versatile structure that empowers builders to harness the complete potential of coding brokers, with out sacrificing management or transparency.
Set up and Setup
Getting began with container-use is simple. The undertaking supplies a Go-based CLI software, ‘cu’, which you construct and set up through a easy ‘make’ command. By default, the construct targets your present platform, however cross-compilation is supported by normal ‘TARGETPLATFORM’ surroundings variables.
# Construct the CLI software
make
# (Optionally available) Set up into your PATH
make set up && hash -rAfter operating these instructions, the ‘cu’ binary turns into out there in your shell, able to launch containerized classes for any MCP-compatible agent. If you have to compile for a unique structure, say, ARM64 for a Raspberry Pi, merely prefix the construct with the goal platform:
TARGETPLATFORM=linux/arm64 makeThis flexibility ensures that whether or not you’re creating on macOS, Home windows Subsystem for Linux, or any taste of Linux, you’ll be able to generate an environment-specific binary with ease.
Integrating with Your Favourite Brokers
One in all container-use’s strengths is its compatibility with any agent that speaks the Mannequin Context Protocol (MCP). The undertaking supplies instance integrations for standard instruments like Claude Code, Cursor, GitHub Copilot, and Goose. Integration usually entails including ‘container-use’ as an MCP server in your agent’s configuration and enabling it:
Claude Code makes use of an NPM helper to register the server. You possibly can merge Dagger’s beneficial directions into your ‘CLAUDE.md’ in order that operating ‘claude’ mechanically spawns brokers in remoted containers:
npx @anthropic-ai/claude-code mcp add container-use -- $(which cu) stdio
curl -o CLAUDE.md https://uncooked.githubusercontent.com/dagger/container-use/primary/guidelines/agent.mdGoose, a browser-based agent framework, reads from ‘~/.config/goose/config.yaml’. Including a ‘container-use’ part there directs Goose to launch every shopping agent inside its personal container:
extensions:
container-use:
title: container-use
sort: stdio
enabled: true
cmd: cu
args:
- stdio
envs: {}Cursor, the AI code assistant, might be hooked by dropping a rule file into your undertaking. With ‘curl’ you fetch the beneficial rule and place it in ‘.cursor/guidelines/container-use.mdc’.
VSCode and GitHub Copilot customers can replace their ‘settings.json’ and ‘.github/copilot-instructions.md’ respectively, pointing to the ‘cu’ command because the MCP server. Copilot then executes its code completions contained in the encapsulated surroundings. Kilo Code integrates by a JSON-based settings file, letting you specify the ‘cu’ command and any required arguments beneath ‘mcpServers’. Every of those integrations ensures that, no matter which assistant you select, your brokers function of their sandbox, thereby eradicating the danger of cross-contamination and simplifying cleanup after every run.
Arms-On Examples
For example how container-use can revolutionize your improvement workflow, the Dagger repository contains a number of ready-to-run examples. These display typical use instances and spotlight the software’s flexibility:
- Hey World: On this minimal instance, an agent scaffolds a easy HTTP server, say, utilizing Flask or Node’s ‘http’ module, and launches it inside its container. You possibly can hit ‘localhost’ in your browser to verify that the code generated by the agent runs as anticipated, fully remoted out of your host system.
- Parallel Growth: Right here, two brokers spin up distinct variations of the identical app, one utilizing Flask and one other utilizing FastAPI, every in its personal container and on separate ports. This situation demonstrates consider a number of approaches aspect by aspect with out worrying about port collisions or dependency conflicts.
- Safety Scanning: On this pipeline, an agent performs routine upkeep, updating weak dependencies, rerunning the construct to make sure nothing broke, and producing a patch file that captures all adjustments. The whole course of unfolds in a throwaway container, leaving your repository in its authentic state except you resolve to merge the patches.
Operating these examples is so simple as piping the instance file into your agent command. For example, with Claude Code:
cat examples/hello_world.md | claudeOr with Goose:
goose run -i examples/hello_world.md -sAfter execution, you’ll see every agent commit its work to a devoted git department that represents its container. Inspecting these branches through ‘git checkout’ helps you to evaluate, take a look at, or merge adjustments in your phrases.
One widespread concern when delegating duties to brokers is realizing what they did, not simply what they declare. container-use addresses this by a unified logging interface. While you begin a session, the software information each command, output, and file become your repository’s ‘.git’ historical past beneath a particular distant referred to as ‘container-use’. You possibly can observe alongside because the container spins up, the agent runs instructions, and the surroundings evolves.
If an agent encounters an error or goes off monitor, you don’t have to observe logs in a separate window. A easy command brings up an interactive view:
This stay view exhibits you which of them container department is energetic, the most recent outputs, and even provides you the choice to drop into the agent’s shell. From there, you’ll be able to debug manually: examine surroundings variables, run your individual instructions, or edit recordsdata on the fly. This direct intervention functionality ensures that brokers stay collaborators relatively than inscrutable black packing containers.
Whereas the default container photographs offered by container-use cowl many node, Python, and system-level use instances, you may need specialised wants, say, customized compilers or proprietary libraries. Happily, you’ll be able to management the Dockerfile that underpins every container. By putting a ‘Containerfile’ (or ‘Dockerfile’) on the root of your undertaking, the ‘cu’ CLI will construct a tailored picture earlier than launching the agent. This strategy lets you pre-install system packages, clone non-public repositories, or configure complicated toolchains, all with out affecting your host surroundings.
A typical customized Dockerfile would possibly begin from an official base, add OS-level packages, set surroundings variables, and set up language-specific dependencies:
FROM ubuntu:22.04
RUN apt-get replace && apt-get set up -y git build-essential
WORKDIR /workspace
COPY necessities.txt .
RUN pip set up -r necessities.txtWhen you’ve outlined your container, any agent you invoke will function inside that context by default, inheriting all of the pre-configured instruments and libraries you want.
In conclusion, as AI brokers undertake more and more complicated improvement duties, the necessity for strong isolation and transparency grows in parallel. container-use from Dagger gives a practical answer: containerized environments that guarantee reliability, reproducibility, and real-time visibility. By constructing on normal instruments, together with Docker, Git, and shell scripts, and providing seamless integrations with standard MCP-compatible brokers, it lowers the barrier to secure, scalable, multi-agent workflows.
Sana Hassan, a consulting intern at Marktechpost and dual-degree scholar at IIT Madras, is captivated with making use of know-how and AI to deal with real-world challenges. With a eager curiosity in fixing sensible issues, he brings a recent perspective to the intersection of AI and real-life options.
