<title>Agents That Code Overnight: Our $0.80 Cloud Harness with DeepSeek V4 and Pi — Tinqs Blog</title>
<metaname="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.">
"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."
<h1class="post__title">Agents That Code Overnight: Our $0.80 Cloud Harness with DeepSeek V4 and Pi</h1>
<pclass="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>
<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><ahref="https://pi.dev"style="color: var(–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>
<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>
<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>
<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 <ahref="https://github.com/BlackBeltTechnology/pi-agent-dashboard"style="color: var(–c-accent-l);">pi-agent-dashboard</a> into the Pi monorepo. One command:</p>
<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>
<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>
<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 <ahref="https://arikigame.com"style="color: var(–c-accent-l);">Ariki</a> using the same tools.</em></p>