VOOZH about

URL: https://thenewstack.io/ai-dev-tools-how-to-containerize-agents-using-dagger/

⇱ AI Dev Tools: How To Containerize Agents Using Dagger - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2025-02-20 06:30:58
AI Dev Tools: How To Containerize Agents Using Dagger
AI Agents / CI/CD / Containers

AI Dev Tools: How To Containerize Agents Using Dagger

Meet the new primitive. The creator of Docker strongly advocates for the containerization of AI agents, for sanity's sake. Here's how.
Feb 20th, 2025 6:30am by Joab Jackson
👁 Featued image for: AI Dev Tools: How To Containerize Agents Using Dagger
A highlight image from Solomon Hykes’ presentation.

We’ll need to standardize the process of building AI agents, so why not look to the container ecosystem for inspiration?

This was the takeaway from a talk by Docker creator and CEO of Dagger, Solomon Hykes, who spoke at Sourcegraph’s AI Tools Night meetup, held last week at the San Francisco Cloudflare headquarters.

“There should be a software ecosystem where we could reuse each other’s stuff,” Hykes said. “We propose Dagger as an ecosystem.”

Dagger is an open source engine runtime for software builds. Contributing DevOps engineers have created thousands of modules, or dags, for their own container build processes.

Dagger builds an immutable container chock full of specialized logic, and the design can easily be applied to building large language model-based agents, Hykes argued.

“All these startups selling you fancy infrastructure … well, basically, that is open source now,” he said.

And to demonstrate how easily containers make things go, Hykes built a simple AI agent, and in turn, built a cURL clone, using only three function calls.

We’ve Seen This Movie Before

The Docker container was successful in no small part because it tamed the rapidly growing complexity of building web applications, Hykes recalled. Break the app into reusable components and containerize them for easy replication. Docker brought reusability and scalability.

“I propose we do the same thing for agents,” Hykes suggested. “Put those brains in a jar, then have some control over what they connect to.”

Adding the ability for external system calls into LLMs has been a major groundbreaker, and has quickly become an essential element to building an AI agent. They provide the protocol for an LLM to call an additional function if needed to complete a task.

As the number of agents proliferate, and the tasks they execute grow more complex, managing these agents will soon be become unwieldy.

Dags All The Way Down

LLMs work just like a good immutable software build system, Hykes observed. They are bounded to an immutable state. You add data to the context window, and a function is executed.

Dagger has a new predicate called LLM, which is basically an empty state with GPT-4o loaded in (though it can use other models).

With either the Dagger shell or programmatically, you then can chain multiple operations together. The first of which could be, say, an initial prompt.

The entire Dagger API is a set of objects, each with its own set of function calls, schema and state. So, within the Dagger Shell, you can create a container object:

LLM | with-container (Container | from alpine | with-new-file yay.txt 'my favorite language is PHP')

Executing the above example of creating a container object, Hykes added a file, yay.txt, to prove the veracity of his live demo.

In addition to creating the container, the command also connects it to the LLM itself, he noted.

From there, you can chain together multiple objects.

When the “build” is run, an OpenTelemetry instrumentation can list all the steps it had taken, including how the LLM recovered from all the various errors (such as calling the wrong installation package) that the LLM will need to go through to complete its goals (which is also great for accountability).

Hykes also showed how, on first pass, the command to create the container had installed PHP into the container itself, so it would be available for subsequent use.

Chilling!

cURL Clone in Three Functions

The bare minimum for an LLM workspace, Hykes advised, would at least be a container and a state, functions for reading and writing files, and a build function (ideally with no arguments).

Hykes wrote a dag with all these things, called toy-workspace.

In the demo, he installed toy-workspace into an LLM container. He added a rudimentary prompt for the LLM:

  1. You are an expert Go programmer.
  2. You have access to a workspace.
  3. Use the read, write and build tools to complete the following assignment:

The user command is assigned to an @assignment variable.

He then had some final instructions:

  • DO NOT USE CONTAINER TOOL.
  • Don’t build until your code builds.
  • The function is looped.

Showing off his demo chops, Hykes then ran this very program, adding only the instruction, “Write me a cURL clone.” A minute later, he had a working cURL clone running.

“This is the magic of agent development,” Hykes said.

Agent Debugging

YK Sugi, the Sourcegraph senior AI developer advocate who organized the meetup, appreciated Dagger’s approach, especially for the debugging.

“As someone who’s built agents myself, I know that building AI agents can be a challenge,” he wrote in a LinkedIn message.

“Your errors could be coming from the LLM API that you’re using or whatever setup you have for your LLM,” he wrote. They could be rate-limiting issues or the syntax not matching the current version that’s available. It can be a pain to find the source of the issue.

“With agents, you might have a specific issue with the path that it’s trying to follow or maybe the syntax of the tool usage not being correct from the LLM output. Even if the LLM behaves the way you want it to, you might have problems with the backend services.”

Dagger’s ability to examine all of the logs, not just the ones from the LLM, but also from the ones from the backend services, could be a great help in this regard.

“It seems to make not just debugging simpler, but also development in general, so that it’s easier to develop a more reliable system,” he wrote.

The entire evening of Sourcegraph‘s AI Dev Tools Night can be found here.

TRENDING STORIES
Joab Jackson is a senior editor for The New Stack, covering cloud native computing and system operations. He has reported on IT infrastructure and development for over 30 years, including stints at IDG and Government Computer News. Before that, he...
Read more from Joab Jackson
SHARE THIS STORY
TRENDING STORIES
TNS owner Insight Partners is an investor in: Sourcegraph, Docker.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.