惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

NISL@THU
NISL@THU
宝玉的分享
宝玉的分享
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
F
Full Disclosure
WordPress大学
WordPress大学
The Cloudflare Blog
小众软件
小众软件
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
爱范儿
爱范儿
月光博客
月光博客
云风的 BLOG
云风的 BLOG
Hugging Face - Blog
Hugging Face - Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google DeepMind News
Google DeepMind News
B
Blog
MyScale Blog
MyScale Blog
博客园 - 叶小钗
P
Privacy International News Feed
大猫的无限游戏
大猫的无限游戏
Simon Willison's Weblog
Simon Willison's Weblog
Attack and Defense Labs
Attack and Defense Labs
Vercel News
Vercel News
S
Schneier on Security
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
T
Tailwind CSS Blog
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
G
Google Developers Blog
E
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
S
Security @ Cisco Blogs
Webroot Blog
Webroot Blog
The Last Watchdog
The Last Watchdog
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Securelist
aimingoo的专栏
aimingoo的专栏

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
We burned 136 million tokens running an autonomous agent studio. Here's how we cut the bill ~90%.
wartzar-bee · 2026-06-15 · via DEV Community

We run a studio where AI agents work mostly unattended — they write code, ship sites, produce content, and keep going without a human in the loop. Running agents like that, around the clock, teaches you one thing fast: the bill is the product constraint. Not the model's intelligence. The bill.

Here's the most expensive lesson we paid for, and the architecture we rebuilt to stop paying it.

The 136M-token fire

One of our agents burned ~136 million tokens in a stretch where it produced almost nothing. We assumed runaway tool calls. It wasn't.

The cause was mundane and brutal: the agent was waking itself on a timer (a cron / scheduled self-invoke) into one ever-growing session. Two things compounded:

  1. The whole thread is re-sent every turn. An LLM is stateless. A long agent session doesn't "remember" — the entire conversation is re-uploaded as input on every single call. A session that grows to 800k tokens of context costs ~800k input tokens per turn, even if the model writes two sentences.

  2. The prompt cache expires. Providers cache your context so re-sends are cheap — but the cache has a short TTL (minutes). Any timer that fires slower than the TTL means every wake-up re-reads the full context uncached, at roughly 10× the cached price.

So: a self-looping agent, on a timer longer than the cache window, re-sending an ever-larger thread, uncached, forever. That's how you turn "a few cents of output" into 136M tokens.

The reflex fix vs the real fix

The reflex fix is "use less / set a token limit." That caps the damage; it doesn't change the economics. You're still running every step on a frontier model, still re-sending context, still paying frontier prices for work a much cheaper model could do.

The real fix was to stop treating the expensive model as the default. We rebuilt the runtime around four cost-native principles. None of them are exotic — but no agent framework ships them as the default, because most of the ecosystem makes money when your usage goes up, not down.

1. Never self-re-invoke a frontier model on a timer

A frontier model running a recurring loop in one session is the single most expensive pattern in agent ops. We banned it. Recurring, autonomous work runs off the frontier model entirely — a cheap planner decomposes the goal, a cheap/local worker executes, and a deterministic check verifies. The frontier model is summoned only when a genuine human-level judgment call is needed, and then in a fresh, lean session.

2. Route every step to the cheapest model that can do it

This is the lever almost nobody defaults to, and it's the biggest one. Most steps in an agent loop are mechanical: read a file, run a command, reformat output, check a condition. You do not need a $15/M-token model for that. You need a $0.14/M-token model — or a local one running at ~$0 marginal cost.

We route by step:

  • Routine / mechanical → a cheap API model (DeepSeek, Gemini Flash) or a local model (Ollama / MLX) at zero marginal cost.
  • Genuine reasoning / judgment → a frontier model, deliberately, and only then.

Reported savings for this pattern across the industry land at 60–86%. Our own bill dropped about an order of magnitude. The quality cost is near zero if you add the next piece.

3. Gate cheap work with a deterministic verify

The fear with cheap/local models is quality. The answer isn't "trust the cheap model" — it's "let the cheap model do the work, then verify it with something that can't lie." A test suite. A linter. A schema check. An exit code. If the cheap model's output passes a deterministic gate, it's correct by construction and you never paid frontier prices to find out. If it fails, you retry or escalate. The verify-gate is what makes aggressive downshifting safe.

4. Hard caps + honest per-agent attribution

Every agent runs under a spend cap. Cross it and the agent defers, it doesn't barrel on. And we attribute spend per agent — so when something costs too much, we know exactly which one and why, instead of staring at one big number at the end of the month. (The 136M fire was invisible precisely because nothing attributed cost to the loop while it ran.)

The other half: don't re-derive the world every session

The context-resend problem has a second fix beyond caching: keep sessions short and lean, and put continuity in durable files, not in one infinite thread. Our agents write their state, decisions, and memory to disk. A fresh session reads a small digest of what matters instead of re-uploading a 500k-token history. Short threads are cheap threads.

Why this isn't the default anywhere

If routing-to-cheap saves 60–90%, why doesn't every agent framework do it out of the box?

Incentives. The big agent frameworks and observability tools monetize usage, seats, and traces — they grow when your token count grows. The model providers obviously don't profit from you spending less with them. So the most valuable cost lever in agent engineering is the one nobody in the value chain is motivated to ship as a default. It gets left to you.

That's the whole reason we open-sourced our runtime.

The takeaway

You cannot run a real agent network on a frontier model alone. It will cost you your margin. The architecture that works:

  • frontier model only for genuine judgment, in fresh lean sessions,
  • everything else routed to cheap or local models,
  • a deterministic verify-gate so cheap stays correct,
  • hard per-agent caps and real attribution,
  • durable files for continuity instead of one infinite thread.

We learned it by setting 136 million tokens on fire. You don't have to.


We're building this in the open — a cost-native, brain-agnostic agent runtime (run any agent on a local model, a cheap API, or a frontier model; same code, same isolation). If you want the runtime or the deeper postmortems, follow along.