DeepSeek Harness: First Use

Last updated: 2026-08-31

Using DeepSeek Harness for the first time is like sitting in a smart car for the first time — the dashboard looks complex, but once you know where the steering wheel and accelerator are, you can start driving. This lesson takes you from zero to your first conversation with the DSH Agent.

💡 Tip: The DSH Agent is not a chatbot, but an intelligent assistant that can operate files, execute commands, and search code. Its core capability lies in "taking action" rather than just "talking."

📋 Prerequisites: Completed 02-install.md, DSH Web UI successfully started

1. What You'll Learn


2. Web UI Interface Introduction

(1) Four Main Areas

The DSH Web UI consists of four core areas:

DSH Web UI Layout

100%
graph TB
    subgraph DSH Web UI
        A[Left: Session List]
        B[Center: Chat Area]
        C[Right: Tool Panel]
        D[Top: Control Bar<br/>Mode + Model + Settings]
    end
    D --> B
    A --> B
    B --> C
Area Position Function
Session List Left Shows history sessions; supports creating, searching, deleting
Chat Area Center Main interaction area; send messages, view replies, tool execution results
Tool Panel Right Real-time display of tool call details, approval actions, execution logs
Control Bar Top Mode switching, model selection, settings entry

(2) Top Control Bar Details

The top control bar contains:

TEXT 📖 Display only
┌──────────────────────────────────────────────────┐
│ [Standard ▼]  [deepseek-chat ▼]  ⚙️  📋  ❓  │
└──────────────────────────────────────────────────┘
   ↑Mode Selection   ↑Model Selection   ↑Settings ↑Logs ↑Help

(3) Chat Area Details

The chat area is the core interaction zone. Each message may contain:

TEXT 📖 Display only
┌─────────────────────────────────────────┐
│ 👤 Alice                                │
│ Help me analyze the project structure   │
│ in the current directory                │
├─────────────────────────────────────────┤
│ 🤖 Agent                                │
│ 🔍 Using tool: search                   │
│   → Searching in /home/alice/project... │
│ ✅ Found 15 files                       │
│                                         │
│ This project is an Express.js app.      │
│ Main structure:                         │
│ - src/routes/ — Route definitions       │
│ - src/models/ — Data models             │
│ - src/middleware/ — Middleware           │
└─────────────────────────────────────────┘

3. Selecting a Workspace

(1) Purpose of the Workspace

The workspace is the root directory for Agent operations. All file operations and Shell commands are relative to it:

Select Workspace

BASH
# The workspace determines the Agent's "field of view"
/home/alice/project     ← Agent can only see files in this directory
├── src/
├── package.json
└── README.md

(2) Selecting a Workspace

On first startup, DSH prompts you to select a workspace:

TEXT 📖 Display only
📂 Select Workspace
┌──────────────────────────────────────┐
│ ○ /home/alice/project               │
│ ○ /home/alice/another-repo          │
│ ● Enter custom path...              │
└──────────────────────────────────────┘

You can also switch at any time in settings:

BASH
# Pre-set workspace via environment variable
export DSH_WORKSPACE="/home/alice/my-project"

# Or in Web UI: Settings → Workspace → Change

(3) Workspace and Sandbox

The workspace works with the sandbox mechanism to limit the Agent's scope of operations:

100%
graph TB
    W[Workspace /home/alice/project] -->|Allowed| A1[Read Files]
    W -->|Allowed| A2[Edit Files]
    W -->|Allowed| A3[Execute Commands]
    OUT[Outside Workspace /etc/passwd] -->|Denied| B1[Read]
    OUT -->|Denied| B2[Edit]

4. First Conversation

(1) Let the Agent Analyze a Repository

After workspace selection is complete, we send our first message:

First Conversation

TEXT 📖 Display only
Hello, please help me analyze the code quality of this project

Agent's complete response process:

TEXT 📖 Display only
🤖 Agent: I'll help you analyze this project.

🔍 Using tool: search
  → Pattern: *
  → Path: /home/alice/project
  → Max depth: 3

🔍 Using tool: file_edit (read)
  → File: package.json
  → Action: read

📊 Analysis Results:

1. Tech Stack:
   - Runtime: Node.js 20.x
   - Framework: Express 4.18
   - Database: PostgreSQL (pg 8.12)
   - Testing: Jest 29.x

2. Directory Structure:
   src/
   ├── routes/    — 8 route files
   ├── models/    — 5 data models
   ├── middleware/ — 3 middleware
   └── utils/     — Utility functions

3. Suggestions:
   - Missing TypeScript type definitions
   - Recommend adding src/services/ layer to separate business logic

(2) Agent Tool Execution Process

Each tool call is displayed in real-time in the right-side tool panel:

Tool Panel

TEXT 📖 Display only
│                                      │
│ 🔍 search                            │
│ ├─ Status: ✅ Complete               │
│ ├─ Duration: 0.3s                    │
│ └─ Files found: 23                   │
│                                      │
│ 📄 file_edit (read)                  │
│ ├─ Status: ✅ Complete               │
│ ├─ Duration: 0.1s                    │
│ └─ File: package.json (1.2KB)        │
│                                      │
│ 📊 Total tools: 2                    │
│ 📊 Total time: 0.4s                  │
└──────────────────────────────────────┘

Web UI Workflow

(3) Tool Execution Pipeline

Each tool call goes through three stages:

100%
graph LR
    A[pre-execute<br/>Parameter Validation<br/>Permission Check] --> B[execute<br/>Actual Execution]
    B --> C[post-execute<br/>Result Processing<br/>Log Recording]
TYPESCRIPT
// Tool execution pipeline pseudocode
async function executeTool(tool, params) {
  // 1. pre-execute: validation + approval
  await preExecute(tool, params);
  
  // 2. execute: actual execution
  const result = await tool.execute(params);
  
  // 3. post-execute: log recording
  await postExecute(tool, params, result);
  
  return result;
}

5. Approval Popup Mechanism

(1) Why Approval Is Needed

The Agent has powerful operational capabilities (editing files, executing commands), but improper operations can cause damage. The approval mechanism lets users confirm before the Agent executes dangerous operations.

Approval Popup Mechanism

(2) ▶ Example 2

When the Agent wants to edit a file, the Web UI shows an approval dialog:

TEXT 📖 Display only
┌─ ⚠️ Approval Required ───────────────────┐
│                                            │
│ Agent wants to:                            │
│ 📝 Edit file: src/index.ts                 │
│                                            │
│ Changes:                                   │
│ - Line 12: Add import statement            │
│ - Line 45: Modify error handler            │
│                                            │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐    │
│ │  ✅ Allow │ │ 🔁 Always│ │  ❌ Deny │    │
│ └──────────┘ └──────────┘ └──────────┘    │
└────────────────────────────────────────────┘

Meaning of the three options:

Option Meaning Use Case
Allow Allow this time; still requires approval next time One-time operation
Always Always allow this type of operation; no more popups Trusted operation types
Deny Deny this operation Unwanted operations

(3) Approval Policy Configuration

You can preset approval policies in settings:

YAML
# dsh.config.yaml
approval:
  # File reads: always allow
  file_read: always
  
  # File edits: require approval
  file_edit: ask
  
  # Shell commands: based on danger level
  shell:
    safe_commands: always     # ls, cat, grep, etc.
    unsafe_commands: ask      # rm, chmod, sudo, etc.
    dangerous_commands: deny  # rm -rf /, dd, etc.
  
  # Search operations: always allow
  search: always

(4) Sandbox Mode and Approval Relationship

Sandbox Mode Approval Behavior Risk Level
strict All operations require approval 🟢 Safe
permissive Only dangerous operations require approval 🟡 Moderate
off No approval; Agent operates freely 🔴 High risk
BASH
# Set sandbox mode
export DSH_SANDBOX=strict    # Most secure
export DSH_SANDBOX=permissive # Default
export DSH_SANDBOX=off        # Not recommended

6. Hands-on: A Complete Agent Interaction

(1) Scenario Description

Alice wants the Agent to add a health check endpoint to her project.

Complete Agent Interaction

(2) ▶ Example 2

TEXT 📖 Display only
👤 Alice: Create health.ts under src/routes/, add a /health GET endpoint
        that returns { status: "ok", timestamp: Date.now() }

🤖 Agent: I'll create the health check endpoint for you.

📝 Using tool: file_edit
  → Action: create
  → Path: src/routes/health.ts
  → Content: 
    import { Router } from 'express';
    const router = Router();
    router.get('/health', (_req, res) => {
      res.json({ status: 'ok', timestamp: Date.now() });
    });
    export default router;

⚠️ Approval Required: Create file src/routes/health.ts
  → [Alice clicks Allow]

✅ File created: src/routes/health.ts

Now we need to register this route in app.ts:

📝 Using tool: file_edit
  → Action: edit
  → Path: src/app.ts
  → Changes: 
    + import healthRouter from './routes/health';
    + app.use('/health', healthRouter);

⚠️ Approval Required: Edit file src/app.ts
  → [Alice clicks Allow]

✅ File edited: src/app.ts

Done! Health check endpoint added. Test it at GET /health.

(3) ▶ Example 3

TEXT 📖 Display only
┌─ Tool Panel ────────────────────────┐
│ 📝 file_edit (create)                │
│ ├─ Path: src/routes/health.ts        │
│ ├─ Status: ✅ Approved & Complete    │
│ └─ Duration: 0.2s                    │
│                                      │
│ 📝 file_edit (edit)                  │
│ ├─ Path: src/app.ts                  │
│ ├─ Changes: +2 lines                 │
│ ├─ Status: ✅ Approved & Complete    │
│ └─ Duration: 0.1s                    │
└──────────────────────────────────────┘

7. Session Management

(1) Creating a New Session

TEXT 📖 Display only
Left session list → Click + button → New session

Sessions are automatically named (based on first conversation content), or can be manually renamed.

Session Management

(2) Switching Sessions

Click different sessions in the left session list to switch. Each session has independent:

(3) Session Persistence

DSH session logs use an append-only mode:

Session Log

TYPESCRIPT
// Each SessionEvent is automatically persisted
interface SessionEvent {
  type: 'user_message' | 'agent_message' | 'tool_call' | 'tool_result' | 'approval';
  timestamp: number;
  data: Record<string, unknown>;
}

After closing the browser, session data is not lost — simply reopen the Web UI to restore it.

Sandbox and Workspace


❓ FAQ

Q What if the Agent doesn't respond?
A Check: 1) Is the API Key configured correctly; 2) Is the network connected to the LLM endpoint; 3) Are there any error messages in the tool panel on the right. You can try restarting DSH.
Q The approval popups are too frequent. How can I reduce them?
A Set trusted operation types to always in settings, or switch to permissive sandbox mode. We don't recommend using off mode in non-isolated environments.
Q The Agent modified the wrong file. What should I do?
A DSH's side effects are reversible. Find the corresponding operation in the tool panel and click the rollback button. You can also restore to any point in time through the Trajectory view.
Q How can I see what the Agent is currently executing?
A The right-side tool panel shows the current tool call status in real-time. If the Agent is stuck, the panel will display the specific reason for waiting (e.g., waiting for approval, network timeout, etc.).
Q Can I change the workspace if I selected the wrong one?
A Yes. Click Settings → Workspace → Change at the top to switch. Existing conversation history is not affected, but subsequent file operations will be based on the new workspace.
Q Does the Web UI support multiple users simultaneously?
A DSH defaults to single-user mode. Multi-user access requires starting separate DSH instances (on different ports) for each user, or waiting for official multi-user support.

📖 Summary


📝 Exercises

1. ⭐ Basic: Start the DSH Web UI, select a workspace, and send the Agent "Help me view the project's package.json content." Record which tools the Agent used.

2. ⭐⭐ Intermediate: Have the Agent create a hello-dsh.txt file in the workspace with the content "Hello, DSH!". Observe the approval popup, try both Allow and Deny, and record the different subsequent behaviors.

3. ⭐⭐⭐ Challenge: Configure permissive sandbox mode and have the Agent simultaneously complete three operations: 1) Create a new file; 2) Edit an existing file; 3) Execute the Shell command ls -la. Record which operations triggered approval popups and which didn't, and analyze why.

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏