~/ai_assets_directory_
tutorialSep 7, 20263 min read· by Lorenzo Meola

What is an agent harness, and how do you run one with DeepSeek?

A harness is the loop that turns a model into a coding agent. Here's what that means, plus a step-by-step setup you can actually follow and check as you go.

"DeepSeek harness" isn't one official product you download from a single website. It's a pattern: take an open-source agent harness and point it at DeepSeek's models instead of a closed API. This guide walks through what that means and gets you running one yourself, with a checkpoint after each step so you know it actually worked before moving on.

First, what is a harness?

A language model, on its own, only predicts text. A harness is the code around it that turns predictions into action: it sends the model your code, reads its reply, decides that reply means "edit this file" or "run this command," does it, then sends the result back so the model can decide what to do next. Claude Code, Cursor, and Aider are all harnesses. The model is replaceable inside them. That's the part this guide relies on.

Checkpoint before you continue: if someone asked you right now, could you explain the difference between "the model" and "the harness" in one sentence? If not, reread the paragraph above before moving on. Everything else in this guide builds on that distinction.

What you'll need

  • A terminal and Python 3.9 or newer installed.
  • A DeepSeek API key (see the next step).
  • A project folder you don't mind an agent poking around in. Use a throwaway repo for your first run, not production code.

Step 1: get a DeepSeek API key

Create an account on DeepSeek's own platform and generate an API key from your account dashboard. Copy it somewhere safe. You'll set it as an environment variable, not paste it into a config file that might get committed to git.

Checkpoint: run echo $DEEPSEEK_API_KEY (macOS/Linux) or echo $env:DEEPSEEK_API_KEY (PowerShell) after setting it. If nothing prints, set the variable again before continuing:

export DEEPSEEK_API_KEY="your-key-here"       # macOS/Linux
$env:DEEPSEEK_API_KEY = "your-key-here"        # PowerShell

Step 2: install a harness

Aider is a solid first choice: it's open source, actively maintained, and already supports pointing at DeepSeek's API instead of OpenAI or Anthropic. Install it with:

python -m pip install aider-chat

Checkpoint: run aider --version. If you see a version number, the install worked. If you get a "command not found" error, your Python scripts directory probably isn't on your PATH, a common issue on Windows installs.

Step 3: point the harness at DeepSeek

With the API key set as an environment variable, start Aider with the DeepSeek model:

aider --model deepseek/deepseek-chat

Aider uses a provider/model naming convention, so deepseek/ tells it to route the request to DeepSeek's API using the key you exported. If that exact flag errors on your version, run aider --help and look for the current model or provider flag. Flag names shift between releases.

Checkpoint: Aider should start and show a prompt asking what you'd like to do, with no authentication error. If you get a 401 or "invalid API key" message, double-check the environment variable is set in the same terminal session you're running Aider from.

Step 4: run a real, small task

Don't test with "write me an app." Pick something small and checkable:

Add a docstring to the main function in this file, and nothing else.

Watch what the harness does: which file it opens, what diff it proposes, whether it asks before writing. That loop, propose, confirm, write, is the harness at work, not the model.

Checkpoint: open the file afterward. Did it change only what you asked? If it touched something else, that's useful information about how much you need to supervise this combination before trusting it with bigger tasks.

Troubleshooting

The agent seems to ignore instructions. Check whether your instruction was specific enough. Vague requests get vague results regardless of which model sits underneath.

Requests are slow or time out. DeepSeek's reasoning model (R1) thinks through steps before answering, which takes longer than a plain chat model. That's expected, not a bug.

You want to switch models later. That's the whole point of separating the harness from the model. Change the --model flag, keep the same harness, and compare results on the same task.

Where to go from here

Try the same small task with a different model in the same harness, and compare. That comparison, more than any benchmark you'll read about, is what tells you whether a model is actually a good fit for how you work.

#deepseek#ai-agents#tutorial#setup
LM

Lorenzo Meola

I use agentic AI daily in my day job to build tools, and I've spent months learning how these systems actually work under the hood. I'm not an AI expert by title, just someone building this directory so other developers can find AI assets that are genuinely useful and verified to work, not just indexed.

Project on GitHub