cd /news/ai-agents/i-built-promptshark-in-one-evening-t… · home topics ai-agents article
[ARTICLE · art-30775] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

I Built PromptShark in One Evening to Stop My AI Agents from Burning Money on Infinite Loops

A developer built PromptShark, an open-source MITM proxy that prevents AI agents from burning API credits on infinite loops. The tool sits between code and LLM providers, detects repetitive tool-call failures, and blocks requests before they reach the API. It also caches sessions locally and provides a UI for monitoring token usage and costs.

read2 min views1 publishedJun 17, 2026

If you've ever built an AI agent using function calling (tool use), you probably know the exact feeling of pure panic. You test your agent, it seems fine, you go grab a coffee, and come back to see it got stuck in an infinite loop—calling the exact same tool, failing, and retrying 500 times. Suddenly, your OpenAI API balance is completely drained. 💸

After burning my own credits one too many times, I decided enough was enough. I built PromptShark—an open-source MITM proxy designed specifically to catch these loops, save your wallet, and make debugging agents painless.

PromptShark is a drop-in local proxy that sits between your code and the LLM provider. The best part? Zero code changes required.

You don't need to rewrite your agent or install heavy SDKs. Just change your base_url

to http://localhost:8080/v1 and keep your API key as is. PromptShark intercepts the traffic and does the magic.

Here are the main features:

PromptShark tracks your agent's sessions and hashes the request payloads. If it detects that your agent is stuck in a repetitive loop (e.g., repeatedly passing the exact same wrong arguments to a tool and failing), it instantly blocks the request before it hits the OpenAI API. No more burned money.

Debugging multi-step agents is expensive because when it fails at step 10, you usually have to restart and pay for steps 1-9 all over again.

PromptShark caches the session locally in SQLite. If your agent makes a mistake, you can:

It comes with a clean, dark-mode UI where you can track Time-To-First-Token (TTFT), monitor token usage (prompt vs. completion tokens separated per step), and see your exact cost in USD in real-time.

I wanted this tool to be fast, reliable, and easy to run locally:

You can spin it up right now using Docker Compose.

If you are building AI agents and are tired of losing API credits to rogue tool calls, I’d love for you to try it out.

🔗 **GitHub Repository:** [apvcode/PromptShark](https://github.com/apvcode/PromptShark)
── more in #ai-agents 4 stories · sorted by recency
mcp360.ai · · #ai-agents
MCP360
── more on @promptshark 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-built-promptshark-…] indexed:0 read:2min 2026-06-17 ·