Set It and Ship It: How I Let AI Agents Build My Java Services While I Sleep
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
A practical workflow for using AI agents to autonomously build Java services, centered on three key principles: writing machine-gradable requirements before starting, using a separate critique agent to enforce those requirements, and running everything in an always-on environment without permission interruptions. The post walks through a concrete example of a Spring Boot PaymentReconciliation service built overnight, with a 15/15 requirement checklist verified by the critique agent before any human review. Key pitfalls covered include vague requirements, self-review by the builder agent, partial passes, and token cost management during long multi-hour runs.
Table of contents
Why this is the thing to get rightThe rules I don't breakWriting requirements that hold upThe critique gateWhere it runs matters more than you'd thinkA Tuesday with MithunHow I actually run this, step by stepThe ways this goes wrongQuestions this post answers
How do I prevent an AI coding agent from drifting off-task during a long multi-hour run?
Drift is prevented by combining three gates: testable requirements written before the agent starts (specific behaviours, files, interfaces, and limits — not vague goals), a separate critique agent that checks the output against every requirement and returns failures to the builder, and an always-on environment that runs uninterrupted. The builder only delivers when the critic marks 100% of requirements as passing. Developers tuning long-running AI agent workflows track patterns like these on daily.dev.
What should a good requirements file for an AI agent building a Spring Boot service look like?
A solid requirements file separates functional requirements (specific endpoints, matching rules, persistence behaviour), non-functional requirements (Java version, p95 latency targets, test coverage percentage, security constraints like no secrets in logs), and a definition of done (mvn verify green, OpenAPI regenerated, README updated). Every item must be binary pass/fail with no ambiguity, so a critique agent can grade it without human input. Java teams adopting AI-assisted development workflows share concrete examples like this on daily.dev.
What are the main ways an AI agent workflow fails in practice?
The most common failure modes are: vague requirements that give the agent nothing measurable to be checked against, self-review where the builder grades its own output, accepting partial passes instead of requiring 100%, leftover permission prompts that force babysitting and break autonomy, and running on a machine that sleeps mid-task. Token costs are also a risk — builder-plus-critique loops with retries can burn tokens fast and unpredictably, so hard budget limits are essential. Developers building reliable AI agent pipelines find hard-won lessons like these on daily.dev.