Files
blog/cloud-harness.html
T

347 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Agents That Code Overnight: Our $0.80 Cloud Harness with DeepSeek V4 and Pi — Tinqs Blog</title>
<meta name="description" content="A Pi fork for the brain, a Go orchestrator inside Gitea for overnight batch work, and a browser dashboard for daytime. Agents code while you sleep for about $0.80.">
<meta name="robots" content="index, follow">
<link rel="canonical" href="https://www.tinqs.com/blog/cloud-harness">
<meta property="og:type" content="article">
<meta property="og:url" content="https://www.tinqs.com/blog/cloud-harness">
<meta property="og:title" content="Agents That Code Overnight: Our $0.80 Cloud Harness with DeepSeek V4 and Pi">
<meta property="og:description" content="Pi fork + Go orchestrator + browser dashboard. Agents code overnight for $0.80.">
<meta property="og:image" content="https://www.tinqs.com/blog/img/cloud-harness-architecture.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Agents That Code Overnight: Our $0.80 Cloud Harness with DeepSeek V4 and Pi">
<meta name="twitter:description" content="Pi fork + Go orchestrator + browser dashboard. Agents code overnight for $0.80.">
<meta name="twitter:image" content="https://www.tinqs.com/blog/img/cloud-harness-architecture.png">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "Agents That Code Overnight: Our $0.80 Cloud Harness with DeepSeek V4 and Pi",
"datePublished": "2026-05-26",
"author": {
"@type": "Person",
"name": "Ozan Bozkurt"
},
"publisher": {
"@type": "Organization",
"name": "Tinqs Limited",
"url": "https://www.tinqs.com"
},
"description": "A Pi fork for the brain, a Go orchestrator inside Gitea for overnight batch work, and a browser dashboard for daytime. Agents code while you sleep for about $0.80."
}
</script>
<style>
/* ── Self-contained post styles (Studio provides site chrome) ── */
:root {
--c-accent: #c9935a;
--c-accent-l: #d4a87c;
--c-bg: #0d1117;
--c-text: #e6edf3;
--c-muted: #9aa7b4;
--c-border: #2a3340;
--c-blue: #38bdf8;
--c-purple: #a855f7;
--c-gold: #f59e0b;
--c-code-bg: #1c2230;
--c-pre-bg: #0a0e14;
}
*, *::before, *::after { box-sizing: border-box; }
body {
margin: 0;
padding: 0;
background: transparent;
color: var(--c-text);
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
}
/* ── Post container ── */
.post {
max-width: 720px;
margin: 0 auto;
padding: 40px 24px 48px;
}
/* ── Back link ── */
.post__back {
color: var(--c-blue);
text-decoration: none;
font-size: 0.9rem;
display: inline-block;
margin-bottom: 24px;
}
.post__back:hover { color: var(--c-purple); }
/* ── Gradient title ── */
.post__title {
background: linear-gradient(90deg, #c9935a, #f59e0b 40%, #38bdf8);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
font-weight: 800;
font-size: 2.2rem;
line-height: 1.25;
margin: 0 0 16px;
}
/* ── Date pill ── */
.post__date {
display: inline-block;
font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
font-size: 0.72rem;
letter-spacing: 0.22em;
text-transform: uppercase;
color: var(--c-blue);
border: 1px solid rgba(147, 140, 129, 0.25);
border-radius: 999px;
padding: 4px 14px;
margin-bottom: 16px;
}
/* ── Lead ── */
.post__lead {
color: var(--c-muted);
font-size: 1.08rem;
line-height: 1.7;
}
/* ── Body ── */
.post__body { font-size: 1rem; line-height: 1.7; }
.post__body p { margin: 14px 0; }
.post__body h2 {
font-size: 1.7rem;
margin: 54px 0 6px;
padding-left: 16px;
border-left: 4px solid var(--c-accent);
line-height: 1.3;
}
.post__body h3 {
color: var(--c-purple);
font-size: 1.18rem;
margin: 30px 0 4px;
}
.post__body h4, .post__body h5, .post__body h6 {
margin: 20px 0 4px;
}
/* ── Inline code ── */
.post__body code {
font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
font-size: 0.86em;
background: var(--c-code-bg);
color: #9fe6c0;
padding: 2px 6px;
border-radius: 5px;
border: 1px solid var(--c-border);
}
/* ── Code blocks ── */
.post__body pre {
background: var(--c-pre-bg);
border: 1px solid var(--c-border);
border-radius: 10px;
padding: 16px 18px;
overflow-x: auto;
margin: 14px 0;
font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
font-size: 0.85rem;
line-height: 1.55;
color: var(--c-text);
}
.post__body pre code {
background: transparent;
padding: 0;
border: none;
font-size: inherit;
color: inherit;
border-radius: 0;
}
/* ── Blockquote ── */
.post__body blockquote {
background: rgba(245, 158, 11, 0.08);
border: 1px solid rgba(245, 158, 11, 0.25);
border-left: 4px solid var(--c-gold);
border-radius: 0 12px 12px 0;
padding: 16px 18px;
margin: 18px 0;
color: #f4e3c4;
font-size: 0.94rem;
}
/* ── Links ── */
.post__body a { color: var(--c-blue); }
.post__body a:hover { color: var(--c-purple); }
/* ── Strong ── */
.post__body strong { color: var(--c-gold); }
/* ── HR ── */
.post__body hr {
border: none;
border-top: 1px solid var(--c-border);
margin: 32px 0;
}
/* ── Figures ── */
.post__body figure { margin: 20px 0; }
.post__body figure img {
max-width: 100%;
border-radius: 12px;
border: 1px solid var(--c-border);
}
.post__body figcaption {
color: var(--c-muted);
font-size: 0.85rem;
margin-top: 6px;
}
/* ── Lists ── */
.post__body ul, .post__body ol { padding-left: 1.5em; margin: 10px 0; }
.post__body li { margin: 4px 0; }
/* ── Author ── */
.post__author {
display: flex;
align-items: center;
gap: 14px;
margin-top: 48px;
padding-top: 24px;
border-top: 1px solid var(--c-border);
}
.post__author-avatar {
width: 48px;
height: 48px;
border-radius: 50%;
background: var(--c-accent);
color: var(--c-bg);
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 0.85rem;
flex-shrink: 0;
}
.post__author-info {
font-size: 0.85rem;
color: var(--c-muted);
line-height: 1.4;
}
.post__author-name {
color: var(--c-text);
font-weight: 600;
}
</style>
</head>
<body>
<!-- POST -->
<article class="post">
<a href="/blog/" class="post__back">&larr; All Posts</a>
<span class="post__date">26 May 2026</span>
<h1 class="post__title">Agents That Code Overnight: Our $0.80 Cloud Harness with DeepSeek V4 and Pi</h1>
<p class="post__lead">Every coding agent today — Claude Code, Codex, Cursor, Pi — has the same limitation: it runs in your terminal. You watch it work. You close the laptop, it stops. There's no way to say "build these eight features overnight" and wake up to pull requests.</p>
<div class="post__body">
<p>We built exactly that. A Pi fork for the brain, a Go orchestrator inside our Gitea platform for overnight batch work, and a browser dashboard for daytime. Here's the stack.</p>
<h2>The problem with terminal-only agents</h2>
<p>Claude Code runs on Opus at $15/MTok output. Codex uses GPT-5.5. Running eight agents overnight on either would cost $50-200. That's not sustainable for a four-person studio.</p>
<p>DeepSeek V4 Flash costs $0.28/MTok output. Eight overnight tasks: <strong>about $0.80</strong>. The cost differential changes what's possible — from "I'll use this sparingly" to "run it on everything."</p>
<p>But cost isn't the only issue. Cloud tools are black boxes. You can't add a Gitea API tool, a fal.ai image generator, or a guardrail that blocks destructive commands. With our own harness, you add an extension and it's live. Agents are not a feature to outsource — they're the product.</p>
<h2>Pi — the agent brain</h2>
<p><a href="https://pi.dev" style="color: var(&ndash;c-accent-l);">Pi</a> is an open-source coding agent. MIT license, TypeScript, 51k stars. Four core tools (read, write, edit, bash) and an extension system. We forked it and added four extensions:</p>
<ul>
<li><strong>tinqs-provider</strong> — routes DeepSeek V4 Flash/Pro through our inference proxy</li>
<li><strong>tinqs-tools</strong> — Gitea REST API, fal.ai image generation, vision model access</li>
<li><strong>tinqs-ci</strong> — reads CI pipeline status, logs, polls for completion</li>
<li><strong>tinqs-guardrail</strong> — 29 safety patterns blocking dangerous commands</li>
</ul>
<p>Each extension is a single TypeScript file. No npm dependencies. The core Pi code is untouched — we only add files.</p>
<p>Pi's RPC mode is what makes overnight automation possible. It runs headless, accepting JSON on stdin/stdout. The orchestrator spawns it as a subprocess, sends tasks, receives results. No terminal, no editor UI.</p>
<h2>DeepSeek V4 — the LLM</h2>
<p>DeepSeek V4 Flash through our own inference proxy. OpenAI-compatible API, so Pi treats it like any other provider. The proxy adds:</p>
<ul>
<li>Redis job queue (10 concurrent workers)</li>
<li>Per-user usage tracking</li>
<li>System prompt injection for cache-hit optimization</li>
<li>Gitea PAT authentication — same token as git push</li>
</ul>
<p>Cost per task: $0.02-0.10 depending on complexity.</p>
<h2>Go orchestrator — overnight batch work</h2>
<p>Inside our Gitea fork we added <code>modules/agents/</code> — a Go worker pool that spawns Pi processes, tracks task lifecycle, and streams events over SSE to any connected UI. Six endpoints, same auth as git push:</p>
<pre><code>POST /api/v1/agents/tasks — submit a task
GET /api/v1/agents/tasks — list all tasks
GET /api/v1/agents/tasks/{id} — get task details
DELETE /api/v1/agents/tasks/{id} — stop a task
GET /api/v1/agents/stream — SSE live events
GET /api/v1/agents/health — orchestrator status</code></pre>
<p>The orchestrator lives in the same binary as git — same auth, no extra service to deploy. The intended loop:</p>
<pre><code>Orchestrator reads task brief
→ spawns pi --mode rpc
→ Pi writes code using DeepSeek V4
→ Pi pushes branch, calls ci_wait
→ CI green → Pi opens PR via gitea_api
→ CI red → Pi reads ci_logs, fixes, retries (≤3)
→ Human reviews PR, merges</code></pre>
<h2>Browser dashboard — daytime UI</h2>
<p>The orchestrator is for overnight batch work. During the day, you want to see agents, chat with them, and spawn sessions — without living in a terminal.</p>
<p>We merged <a href="https://github.com/BlackBeltTechnology/pi-agent-dashboard" style="color: var(&ndash;c-accent-l);">pi-agent-dashboard</a> into the Pi monorepo. One command:</p>
<pre><code class="language-bash">npm run dashboard:dev</code></pre>
<p>Open <code>localhost:33634</code> and you get live session streaming (watch tool calls and model output in real time), interactive chat, session spawning in any project folder, and per-session cost tracking. The dashboard talks to Pi sessions over WebSocket on port 9999. Inference uses the same Tinqs proxy as the CLI — one API key, one billing account.</p>
<pre><code>Browser (localhost:33634)
↕ WebSocket (port 9999)
Pi sessions (interactive or headless)
↕ OpenAI-compatible API
Tinqs proxy (tinqs.com/api/v1/ai)
↕ DeepSeek V4 Flash / Pro</code></pre>
<h2>The guardrail</h2>
<p>The biggest fear with autonomous agents: hallucination. An agent claiming it read a file without calling <code>read</code>. Three consecutive turns with no tool calls. Running <code>aws ec2 terminate-instances</code> at 3am.</p>
<p>The guardrail extension monitors every turn:</p>
<ul>
<li><strong>Hallucination detection</strong> — claims without tool calls get corrected</li>
<li><strong>No-tool drift</strong> — three turns with zero tool calls triggers a warning</li>
<li><strong>Command blocking</strong> — 29 patterns covering destructive git, AWS teardown, process killing, production API abuse</li>
</ul>
<p>Guardrails at the platform layer, not the prompt layer. Prompts can be ignored. Platform gates cannot.</p>
<h2>What it cost to build</h2>
<p>About 2,000 lines of Go, 900 lines of TypeScript extensions, 52 tests, plus merging the dashboard into the Pi monorepo. No new servers — Pi is a Node subprocess; the dashboard is another Node process on your machine. The orchestrator is a Go module inside our existing Gitea binary — zero additional infrastructure.</p>
<hr>
<p>The harness — inference proxy, guardrails, dashboard, orchestrator API — is in place. Agents code while you sleep for pocket change. And because everything runs on your own infrastructure, you control the models, the tools, and the safety rails.</p>
<p><em>Tinqs Studio is an open platform for game development — git hosting, AI inference, asset generation, and autonomous agents. We're building <a href="https://arikigame.com" style="color: var(&ndash;c-accent-l);">Ariki</a> using the same tools.</em></p>
</div>
<div class="post__author">
<div class="post__author-avatar">OB</div>
<div class="post__author-info">
<span class="post__author-name">Ozan Bozkurt</span><br>
CTO & Developer, Tinqs
</div>
</div>
</article>
</body>
</html>