Skip to content
Cursos/DeepSeek Harness (DSH)/DeepSeek Harness · Phase 10
Revisión pendiente desde 21 ago 20262 fuentes primarias

Troubleshooting and production operation

A production-ready agent knows when to stop, ask for help and leave a trace. Begin with reversible tasks and increase autonomy only with evidence.

Qué vas a conseguir ahora

Una decisión o prueba aplicada a «Troubleshooting and production operation».

  1. 1Entiende el criterio
  2. 2Haz una práctica pequeña
  3. 3Guarda una evidencia
Evidencia

Una nota breve con qué hiciste, qué salió bien, qué falló y qué revisarías después.

Objetivos de aprendizaje
  • Resolve common failures without widening permissions.
  • Design useful, minimized logs.
  • Define stop and rollback criteria.

Diagnose in order

When a session fails, do not increase model size, context and permissions at the same time. Isolate one variable: configuration, provider, tool, permission, prompt or input data.

  • Cannot find files: check the path and workspace.
  • Weak answers: narrow the task, add verifiable context and compare models.
  • Tool failure: run its manual version before delegating it.
  • Loops: set a turn limit and an exit condition.

Python SDK for programmatic use

The official guide presents the SDK as the programmatic alternative to the Web UI. It installs `deepseek-harness-sdk`, runs a checked-in example and stores the session as JSONL.

The SDK starts the bundled runtime lazily and reuses it until the context manager exits. Reusing the same `session_id` preserves conversation and shell state; use a new id for independent tasks.

Terminal
git clone https://github.com/deepseek-ai/deepseek-harness.git
cd deepseek-harness
python -m venv .venv
. .venv/bin/activate
python -m pip install deepseek-harness-sdk

export DEEPSEEK_API_KEY=sk-your-key-here

python examples/jsonrpc-agent/minimal.py \
  --workspace /absolute/path/to/workspace \
  --session-root /absolute/path/to/sessions \
  --session-id example-001 \
  "Inspect the repository and fix the failing tests."

Minimum SDK composition

The JSON-RPC example uses `DeepSeekHarness` with provider, model, cwd, session_root and a Cordis file. The documented minimal composition exposes persistent bash and `str_replace_editor`, disables compaction and stores uncompressed logs.

Careful: the official example uses `danger-full-access` inside its composition. Run it only in a disposable checkout or container, especially if the task can write files.

Terminal
from pathlib import Path
from deepseek_harness import DeepSeekHarness

config = Path('examples/jsonrpc-agent/minimal.cordis.yml').resolve()
workspace = Path('/absolute/path/to/workspace').resolve()
sessions = Path('/absolute/path/to/sessions').resolve()

with DeepSeekHarness(
    provider='deepseek-official',
    model='deepseek-v4-flash',
    cwd=str(workspace),
    session_root=str(sessions),
    cordis=str(config),
) as harness:
    result = harness.run('Inspect the repository.', session_id='example-001')

print(result.final_response)

Minimum operation

Record enough to reproduce a decision without copying sensitive data. Schedule reviews and keep a kill switch for automations.

Terminal
Minimum log:
- profile and model version
- objective and outcome
- invoked tools
- human approvals
- error and recovery
- diff or artifact reference
- review date
Comprueba que funciona. Write a one-page runbook: how to start, what to inspect, how to stop, how to roll back and who to escalate to.
Guardar y reabrir el proyecto.
Production is not full access: it is controlled repetition, observability and the ability to return safely.
Complete Aulafy mapSee how this lesson fits without leaving your path.

Complete Aulafy map

How all courses connect

This is not a checklist. Start with the foundation, choose an outcome, and go deeper only when your project needs more control.

  1. 1Understand
  2. 2Apply or build
  3. 3Operate with confidence
01

Choose an application

Turn the foundation into a visible outcome: a website, a business improvement, media, or an interactive experience.

Continue into the technical branch when you need to maintain code, data, or infrastructure.

02

Build with code

Prepare your environment, work with coding agents, and run models while keeping control of your projects.

This branch prepares you to design and operate reliable AI systems.

03

Take systems to production

Combine retrieval, agents, evaluation, security, deployment, and model adaptation when the problem requires it.

You do not need every course: choose the component your system needs and return as it grows.

View full catalogue