Run Pi Coding Agent Locally with TensorSharp + Qwen3.8-27B: Full CLI & SDK Tutorial
fuzhongkai · reddit · 2026-11-11
A reproducible end-to-end tutorial for using TensorSharp, a native .NET LLM inference engine, as the local backend for Pi Coding Agent — no Pi source changes needed.
What you build
- Pi handles the agent loop, conversation state, and tools; TensorSharp serves Qwen3.8-27B-UD-IQ3XXS (GGUF) via an OpenAI-compatible API on 127.0.0.1:5000/v1
- DFlash2 speculative decoding enabled (7 draft tokens per step, greedy decoding) via the model preset
- A dedicated isolated Pi agent profile, plus both an interactive CLI workflow and a Node.js SDK example
- An E2E test verifying the agent can fix a small project without altering its tests
Setup
- Validated on Apple Silicon (M5 Pro MacBook Pro, 48GB unified memory); requires .NET 10 SDK, CMake ≥3.20, Xcode CLT, Node.js ≥22.19, Pi 1.5.1
- Flow: clone TensorSharp, build TensorSharp.Server.Host, then run examples/pi-coding-agent/scripts/start-server.sh, which downloads pinned main and DFlash2 draft models with SHA-256 verification
- Pi overlay config: max-tokens 16384, q80 KV cache, MAXCONTEXT 65536; model path customizable via TENSORSHARPMODELS
More from coding & agent
- HydraDB builds a unified knowledge graph to give AI agents accurate context — vaibhavbetter · 2026-11-11
- Reddit Users Compare Notes on GLM-5.3-flash's Random Coding Mistakes — JustinHoMi · 2026-11-11
- Dev fine-tunes Qwen3-1.7B into a 1.83GB GLB 3D asset coder that runs on CPU — ConfidentDinner6648 · 2026-11-11
- Solo dev shares 20k-word workflow: Opus 5.5 + Seedance 2.5 for 4 viral product videos — dotey · 2026-11-11
- CodeGraph turns codebases into Neo4j graphs so agents can do dependency-aware refactoring — JeremyCMorgan · 2026-11-11
- Primitive imagines guardian agents that enforce team decisions infrastructure-wide — daniel_mac8 · 2026-11-11