How to tame your AI agents: from $900 in 18 days to coding smarter
It started with curiosity and ended with a $900 bill after 18 days testing three AI coding agents: Claude Code, Gemini CLI, Cursor and Codex. The experience was chaos at first but ended in learning, and at Q2BSTUDIO we leveraged that experience to define best practices when developing custom applications and custom software for our clients.
When I started using Cursor it was like having a hyperactive coding partner that never asked for a break. Later I tried Claude Code and I was encouraged to create a complete CRM demo with a React frontend, Go backend and Postgres database. Then came Gemini CLI for a bigger challenge: a banking microservices application with OpenTelemetry tracing. The result: unexpected bills and agents that sometimes got lost in loops, with one day where Gemini accumulated $300 in charges from repeated automatic decisions.
Costly lessons we learned and apply at Q2BSTUDIO when developing custom software and artificial intelligence solutions for businesses:
Don't let AI take the wheel. Treating agents like senior developers without clear direction was my first mistake. You need to provide precise requirements, concrete constraints and defined deliverables. At Q2BSTUDIO we follow the rule of writing a PLAN.md that breaks down each objective, order and limits, and we supervise step by step to prevent the agent from growing into unnecessary complexity.
Confused Docker identity. Allowing an agent to mix docker compose configurations for local development and Kubernetes for production led to deployments that didn't work anywhere. The solution was to separate infrastructures: different folders for local and production and making it clear to the agent which world it is in before it writes a single line.
OpenTelemetry overload. Blindly trusting AI to instrument traces caused outdated APIs, duplicate spans and inconsistent configurations with Jaeger. Now in our projects we define the exact observability stack, libraries and versions in ARCHITECTURE.md and ask the agent to perform dependency audits to avoid conflicts.
The 1.8GB Docker image. An AI-generated Dockerfile that installed complete development dependencies and copied the entire code tree produced huge images and slow startups. The solution was to require multi-stage builds and production optimizations, which in a real case reduced the weight by approximately 97 percent. At Q2BSTUDIO we optimize images and deploy best practices for AWS and Azure cloud services.
Wins and practices that work. A PLAN.md as a beacon reduces model hallucinations and keeps execution aligned with objectives. Multi-agent flows where each agent has a specialized role improves quality: for example, one agent to generate code, another to review security and another for dependency auditing produces more robust results. We also force AI to demonstrate tests before integrating changes, with CI tests that block merges if they fail.
Testing with real traffic. In addition to unit tests, we use traffic recording and replay to detect changes in API contracts that break integrations. This technique, combined with business intelligence and monitoring tools, prevents AI agent-generated modifications from introducing regressions in production.
Troubleshooting checklist when an AI agent starts consuming tokens or enters a loop: overloaded context, vague requirements, missing constraints, no success criteria, tool confusion, infinite loops and scope creep. If you detect issues, restart with a PLAN.md and deliver tasks one by one.
How to avoid another $900 sprint. Choosing a main model with suitable plans, using web interfaces to sketch the plan and then delegating it to the agent, watching dependencies in files like package.json, pom.xml or go.mod, and forcing small commits for each change. At Q2BSTUDIO we also recommend cost controls and usage limits on API accounts to prevent surprises.
Q2BSTUDIO services. We are a custom software and application development company, specialists in artificial intelligence, cybersecurity, AWS and Azure cloud services, business intelligence services and Power BI implementation to help businesses turn data into decisions. We work on custom software projects and offer AI solutions for businesses with a practical approach, quality control and security from the first commit.
Practical tips for taming AI agents in real projects: document architecture and standards in ARCHITECTURE.md, require optimized and multi-stage builds, define the exact observability stack, configure roles for specialized agents, require automated tests to be delivered and replay real traffic in pre-production. These measures protect time and budget and are part of the approach we apply at Q2BSTUDIO.
Was it worth it? As a startup co-founder or product manager, the metric is learning speed and the ability to iterate. The experiment with AI agents allowed us to iterate quickly and present results at events like infrastructure conferences, demonstrating that accelerating delivery with control is more valuable than initial perfection.
If you want Q2BSTUDIO to help you integrate AI agents into your workflow without surprises, optimize your Docker images, ensure traceability with OpenTelemetry, deploy on AWS and Azure cloud services, or implement business intelligence and Power BI solutions, contact us for an initial audit. AI empowers, but human talent and good practices are essential for custom applications and custom software to meet real objectives.
Share your experience with AI agents and the most expensive lesson you've learned in production. Together we can build the definitive guide to mastering AI agents, integrating artificial intelligence, cybersecurity, AI agents and development practices that truly work for businesses.



