DeerFlow is the open-source execution environment for autonomous agents developed by ByteDance. Instead of just chatting, it provides the agent with a real file system and an isolated bash terminal. After testing it on my Mac Mini, I'll explain how to set it up with Ollama to run local models with zero API costs.
If you want to build a "super agent" capable of analyzing data, writing scripts, and executing them autonomously, DeerFlow is currently the safest solution available. Let's break down why its Docker-based architecture is essential and how to connect it to your local models in 15 minutes.
What is DeerFlow and why you need it
While frameworks like OpenClaw handle agent orchestration, DeerFlow solves a different problem: secure code execution. When you ask an LLM to write and run a Python script to analyze a CSV file, you absolutely do not want that script running directly on your host operating system.
DeerFlow creates a closed sandbox where the agent can operate safely. It has access to a terminal, can install packages, create files, and fail without causing any damage to your computer.
Want to build secure AI agents for your business?
Subscribe to the dev newsletter: I share the local setups I use in production every week.
The importance of a Docker sandbox
Running AI-generated code on your host machine is a massive security risk, a challenge we also explored when testing strangeClaw and microVMs. A malicious command generated by mistake (or model hallucination) could delete your projects.
DeerFlow uses Docker containers to isolate the agent. Each task runs in a temporary container that is destroyed when the operation finishes. This approach guarantees:
- Security: The agent cannot access your personal files.
- Reproducibility: The starting environment is always clean and identical.
- Dependency isolation: The packages installed by the agent do not pollute your system.
Setting up DeerFlow with Ollama
DeerFlow's default configuration often points to OpenAI or Anthropic APIs. To keep data local and eliminate costs, we can connect it to Ollama.
Before starting, make sure you have Docker and Ollama installed. Download a model capable of generating code, such as Qwen 3.5:
ollama run qwen2.5-coder:32bNext, clone the DeerFlow repository and configure the API endpoint to point to your local Ollama server (usually http://localhost:11434/v1). In DeerFlow's .env file, set:
OPENAI_API_BASE="http://host.docker.internal:11434/v1"
OPENAI_API_KEY="ollama"
MODEL_NAME="qwen2.5-coder:32b"
I use host.docker.internal because DeerFlow runs inside a container and needs to communicate with Ollama running on the host.
Building your first super agent
Once configured, you can launch DeerFlow. Let's try a practical task: we will give it a CSV file with sales data and ask it to extract the main trends.
Copy your sales.csv into DeerFlow's workspace folder and run:
python run.py --task "Read sales.csv, write a Python script to calculate total sales by month, and save a chart to output.png"DeerFlow will spin up the container. The Qwen model will write the script, execute it in the virtual terminal, install any missing libraries (like pandas or matplotlib), and finally generate the chart. All in complete autonomy.
Current limitations and future potential
DeerFlow is a young project. I've noticed that the Docker environment sometimes takes a few extra seconds to start, and error handling isn't always clear if the model enters an infinite loop of incorrect commands.
However, ByteDance's approach is the right one: separate the agent's logic from the execution environment. Integrated with an orchestrator like OpenClaw, it opens the doors to creating swarms of local agents that work in parallel in total security.
Frequently asked questions
Is DeerFlow free?
Yes, the framework is open-source. By using it with Ollama, you also eliminate the costs of API calls to language models.
Can I use lighter models than Qwen 32B?
Certainly. You can use llama3:8b or qwen2.5-coder:7b, but larger models make fewer syntax errors when writing and executing complex scripts in the sandbox.
Does it work on Mac Apple Silicon?
Yes. Docker Desktop and Ollama natively support M1/M2/M3 chips. My primary setup runs on a Mac Mini M2 Pro without any compatibility issues.
Written by Matteo Giardino, CTO and founder. I build AI agents for SMEs in Italy. My projects.
