# sallespro/dsh-dynamic-agent architecture

> Architecture diagram of the GitHub repository sallespro/dsh-dynamic-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sallespro/dsh-dynamic-agent
- Repository: https://github.com/sallespro/dsh-dynamic-agent

## Overview

This repository provides two command-line workflows over DeepSeek Harness: a one-turn web-research agent and a structured two-stage extract-then-write chain. Both scripts author a fetch plugin and patch at runtime, launch the harness through its SDK client, and use an OpenAI route. The chain additionally feeds validated extraction results into a writing stage. The harness internals are external to this repository; links to their behavior are based on README documentation and the shown launch/configuration code.

Main entry points: [`dsh-chain-agents.mjs`](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs) (Chain runner), [`dsh-dynamic-agent.mjs`](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs) (Research runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI workflows"]
  node_single["Research runner"]
  node_chained["Chain runner"]
end

subgraph group_setup["Runtime setup"]
  node_plugin["Fetch plugin"]
  node_patch["Runtime patch"]
  node_chain_plugin["Chain fetch plugin"]
  node_chain_patch["Chain patch"]
end

subgraph group_research["Research runtime"]
  node_sdk["Harness SDK client"]
  node_runtime["dsh runtime"]
  node_researcher["Research subagent"]
  node_fetch["fetch_url tool"]
end

subgraph group_chain["Structured chain"]
  node_chain_sdk["Harness SDK client"]
  node_pipeline["Workflow pipeline"]
  node_extract["Extract stage"]
  node_write["Write stage"]
  node_chain_runtime["dsh runtime"]
end

node_user(("CLI user"))
node_web(("HTTP&#40;S&#41; pages"))
node_model(("OpenAI model"))

node_user -->|"runs prompt"| node_single
node_single -->|"writes plugin"| node_plugin
node_single -->|"writes overlay"| node_patch
node_single -->|"launches and runs"| node_sdk
node_sdk -->|"starts subprocess"| node_runtime
node_patch -->|"configures runtime"| node_runtime
node_plugin -->|"mounts plugin"| node_runtime
node_runtime -->|"registers subagent"| node_researcher
node_researcher -->|"uses allowed tool"| node_fetch
node_fetch -->|"fetches URL"| node_web
node_runtime -->|"routes requests"| node_model
node_model -->|"delegates research"| node_researcher
node_user -->|"runs URL list"| node_chained
node_chained -->|"writes plugin"| node_chain_plugin
node_chained -->|"writes overlay"| node_chain_patch
node_chained -->|"launches harness"| node_chain_sdk
node_chain_sdk -->|"starts subprocess"| node_chain_runtime
node_chain_patch -->|"configures runtime"| node_chain_runtime
node_chain_plugin -->|"mounts plugin"| node_chain_runtime
node_chained -->|"calls pipeline"| node_pipeline
node_pipeline -->|"runs stage"| node_extract
node_extract -->|"runs agent"| node_chain_runtime
node_extract -->|"retrieves page"| node_fetch
node_extract -->|"passes structured facts"| node_write
node_pipeline -->|"runs stage"| node_write
node_write -->|"runs agent"| node_chain_runtime
node_chain_runtime -->|"routes requests"| node_model

click node_single "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs"
click node_chained "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs"
click node_plugin "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs"
click node_patch "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs"
click node_chain_plugin "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs"
click node_chain_patch "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs"
click node_sdk "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs"
click node_fetch "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs"
click node_chain_sdk "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs"
click node_pipeline "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs"
click node_extract "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs"
click node_write "https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_single,node_chained,node_user toneBlue
class node_plugin,node_patch,node_chain_plugin,node_chain_patch toneAmber
class node_sdk,node_runtime,node_researcher,node_fetch toneMint
class node_chain_sdk,node_pipeline,node_extract,node_write,node_chain_runtime toneRose
class node_web,node_model toneIndigo
```

## Components

### CLI workflows

- [Research runner](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs): `dsh-dynamic-agent.mjs`
- [Chain runner](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs): `dsh-chain-agents.mjs`

### Runtime setup

- [Fetch plugin](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs): `dsh-dynamic-agent.mjs`
- [Runtime patch](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs): `dsh-dynamic-agent.mjs`
- [Chain fetch plugin](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs): `dsh-chain-agents.mjs`
- [Chain patch](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs): `dsh-chain-agents.mjs`

### Research runtime

- [Harness SDK client](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs): `dsh-dynamic-agent.mjs`
- **dsh runtime**
- **Research subagent**
- [fetch_url tool](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-dynamic-agent.mjs): `dsh-dynamic-agent.mjs`

### Structured chain

- [Harness SDK client](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs): `dsh-chain-agents.mjs`
- [Workflow pipeline](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs): `dsh-chain-agents.mjs`
- [Extract stage](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs): `dsh-chain-agents.mjs`
- [Write stage](https://github.com/sallespro/dsh-dynamic-agent/blob/main/dsh-chain-agents.mjs): `dsh-chain-agents.mjs`
- **dsh runtime**

### Other components

- **CLI user**
- **HTTP(S) pages**
- **OpenAI model**

## Connections

- CLI user → Research runner: runs prompt (evidence: `README.md`)
- Research runner → Fetch plugin: writes plugin (evidence: `dsh-dynamic-agent.mjs`)
- Research runner → Runtime patch: writes overlay (evidence: `dsh-dynamic-agent.mjs`)
- Research runner → Harness SDK client: launches and runs (evidence: `dsh-dynamic-agent.mjs`)
- Harness SDK client → dsh runtime: starts subprocess (evidence: `dsh-dynamic-agent.mjs`)
- Runtime patch → dsh runtime: configures runtime (evidence: `README.md`)
- Fetch plugin → dsh runtime: mounts plugin (evidence: `README.md`)
- dsh runtime → Research subagent: registers subagent (evidence: `README.md`)
- Research subagent → fetch_url tool: uses allowed tool (evidence: `README.md`)
- fetch_url tool → HTTP(S) pages: fetches URL (evidence: `dsh-dynamic-agent.mjs`)
- dsh runtime → OpenAI model: routes requests (evidence: `README.md`)
- OpenAI model → Research subagent: delegates research (evidence: `README.md`)
- CLI user → Chain runner: runs URL list (evidence: `README.md`)
- Chain runner → Chain fetch plugin: writes plugin (evidence: `dsh-chain-agents.mjs`)
- Chain runner → Chain patch: writes overlay (evidence: `dsh-chain-agents.mjs`)
- Chain runner → Harness SDK client: launches harness (evidence: `dsh-chain-agents.mjs`)
- Harness SDK client → dsh runtime: starts subprocess (evidence: `dsh-chain-agents.mjs`)
- Chain patch → dsh runtime: configures runtime (evidence: `README.md`)
- Chain fetch plugin → dsh runtime: mounts plugin (evidence: `README.md`)
- Chain runner → Workflow pipeline: calls pipeline (evidence: `dsh-chain-agents.mjs`)
- Workflow pipeline → Extract stage: runs stage (evidence: `dsh-chain-agents.mjs`)
- Extract stage → dsh runtime: runs agent (evidence: `dsh-chain-agents.mjs`)
- Extract stage → fetch_url tool: retrieves page (evidence: `README.md`)
- Extract stage → Write stage: passes structured facts (evidence: `dsh-chain-agents.mjs`)
- Workflow pipeline → Write stage: runs stage (evidence: `dsh-chain-agents.mjs`)
- Write stage → dsh runtime: runs agent (evidence: `dsh-chain-agents.mjs`)
- dsh runtime → OpenAI model: routes requests (evidence: `README.md`)
