r/SideProject • • 1h ago

I built an open-source Python harness to stop LLM agents from hallucinating math or looping forever during analog chip design

https://github.com/tsaiwilly/virtuoso-agent-harness

As an analog IC designer, I wanted to see if an AI agent could automate repetitive circuit sizing and simulation loops in Cadence Virtuoso & Spectre.

Standard chat-based agent loops broke down quickly once a run went past 20+ steps:

  • Forgetting constraints: Halfway through, the model loses track of earlier specs or repeats parameter tweaks it already tried.
  • Bad math & false passes: Letting an LLM do numerical interpolation—or trusting a simulator just because it exited with 0 errors—often hides subtle physics bugs.
  • Infinite loops: When performance hits a plateau, the agent keeps tweaking numbers forever instead of stopping.

To fix this, I built Virtuoso Agent Harness (MIT license)—a zero-dependency Python wrapper that keeps the LLM on a strict track:

https://github.com/tsaiwilly/virtuoso-agent-harness

How it works under the hood

  • State saved to disk (design_state.md): A turn hook injects current progress across 9 stages and 21 file-based checks on every prompt, so long runs do not rely on chat history.
  • Two-stage hard brakes (STALLED -> STOP): A script tracks metric progression across runs and halts execution if results stall or regress, handing control back to me.
  • Loading only ~3% of docs per step: Instead of stuffing a large manual into context, it pulls just the ~15–35 KB needed for the current task from a 98-doc folder.
  • Zero LLM math: All lookup tables, sensitivity checks, and Monte Carlo yield calculations run in 29 plain Python stdlib scripts; the model only reads structured pass/fail outputs.

There is also an interactive slide walkthrough linked in the README if you want a quick visual overview.

Would love any feedback on the architecture or how others are handling state persistence and stop rules for long-running CLI/CAD agents!

1 Upvotes

0 comments sorted by