Save energy, resources and cost – without giving up AI support. Ten practical best practices for running AI agents sustainably in software development.
Save energy, resources and cost – without giving up AI support.
Agents should react to triggers (a commit, a webhook, a ticket) – not poll in an endless loop. An agent that asks "is there anything to do?" every 30 seconds burns energy doing nothing.
Not every task needs the biggest model. Simple tasks (classification, extraction, small refactorings) → a small, efficient model. Architecture and complex logic → a large model. Model routing can cut energy use by a large factor – for the same result.
Don't dump the whole codebase into every prompt. Pass only the relevant files and use prompt caching. Fewer tokens = less energy = lower API cost.
Force short, precise answers (max_tokens, clear prompts, structured outputs instead of prose). Bloated model output ("babbling") is pure wasted energy – studies show up to 89% savings through output discipline.
Set hard limits on iterations, retries and agent runtime. An agent stuck in an error loop overnight produces nothing but power consumption and a big bill.
Collect non-time-critical tasks (code reviews, documentation generation, test runs) and process them in bundles – ideally via batch APIs, which are often cheaper too.
Don't send the same question to the model twice. Persist answers, embeddings and analyses instead of regenerating them on every run.
Don't let agents "try" endlessly and unsupervised. A quick human check after n iterations prevents an agent from computing in the wrong direction for hours.
Track token consumption, API cost and – where possible – CO₂ per workflow (e.g. via Software Carbon Intensity, SCI). What gets measured gets optimized. API cost is a useful proxy for energy.
Audit agents, cron jobs and pipelines: what actually delivers value? Forgotten agents that have been running unused for weeks are the AI equivalent of a light left on in an empty office.
Rule of thumb: With agents, green and cheap are the same thing. Every token saved saves energy and money – here, sustainability isn't a trade-off, it's craftsmanship.
If you want to apply these ideas to a project in your organisation, let's talk – free and non-binding.