AI DOERS
Book a Call
← All insightsAI Excellence

How to Build With AI Agents While You Sleep

Treat agents like a workforce on a schedule: collaborate with them by day, then hand off one command so they run unattended overnight, with an orchestrator driving Claude Code and Codex as sub-agents.

How to Build With AI Agents While You Sleep
Illustration: AI DOERS Studio

Running AI agents overnight while you sleep is not science fiction and it is not a developer-only workflow. I am Madhuranjan Kumar, and the concrete example that makes this real is a physics simulation where AI agents wrote, tested, and iterated on flight scripts across forty hours of mostly unattended operation, with the human role reduced almost entirely to typing prompts and reviewing results. The simulation is not the point. The six principles that made it work are.

1. Split the day into collaborative hours and automated hours

The session described above did not happen in one continuous block. It ran on a rhythm: collaborative work during waking hours, automated work overnight. During the day, the operator sat with the agents, reviewed their outputs, made decisions, and redirected when something went sideways. At night, a single command handed the next batch of work to the agents and let them run until morning.

That split is the operating model. The collaborative hours are when your judgment is most needed: reviewing plan proposals, catching directional errors, setting the parameters for the next automated session. The automated hours are when the repetitive, well-defined work gets done without anyone watching. The morning review is what connects the two sessions.

For a business, the practical translation is: identify the work in your week that is repetitive enough to hand to an automated overnight session, configure that work during the day when you can watch the first runs and correct them, and then let it run while you sleep once it is reliable. The total elapsed time to set up a reliable overnight workflow is typically three to five active hours spread across a week. What it produces in return is every morning starting with work already done that would otherwise be on the day's list.

How it works (short)

2. Build an orchestrator that drives other agents as sub-agents

The session used an orchestrator called Hermes that sat on top and spun up fresh instances of Claude Code and Codex as sub-agents. The orchestrator gave each sub-agent its task, collected the result, gave feedback to the sub-agent so it could improve, and repeated the loop for a fixed number of iterations before moving on.

This architecture matters for business owners because it makes the overnight session self-improving. The first iteration of a batch task produces output that might need correction. The second iteration, run with the first iteration's errors as feedback, produces better output. By iteration five or ten, the output quality is substantially higher than what the first run produced. The whole loop runs without human direction between iterations.

The financial advantage of this architecture is also real. Routing work through Claude Code and Codex means the processing happens under those tools' existing subscription plans rather than burning metered API credits. Long sessions that would cost significant API fees run effectively free inside the plan limits. For a business that runs overnight batches regularly, this changes the economics of running the sessions frequently versus running them sparingly.

Proposals finished per week (illustrative)

3. Define a clear success criterion before the overnight run starts

The most important thing you set before starting an automated overnight run is not the task description. It is the success criterion. How will the agent know whether its output is good enough? How will it evaluate its own work between iterations? Without a clear success criterion, the agent has no basis for self-improvement, and the iterations all produce roughly the same output rather than converging toward a better one.

In the simulation example, the success criterion was concrete: a working flight script that kept the ship in orbit without running out of fuel, measured across 100 random starting conditions. The agent could run its script, measure the outcome against those 100 conditions, and know numerically how much better iteration five was than iteration one.

For a roofing company using overnight AI to draft proposals from inspection notes, the success criterion might be: a proposal that includes the property address, the total square footage, a line item for each service type identified in the inspection, the standard warranty language, and the company's current labor rate for each service type. The agent can check its own output against those criteria between drafts and identify which elements are missing or incorrectly formatted without waiting for a human review.

4. Isolate the agent environment from your main machine

The fastest path to trusting an overnight agent is running it somewhere other than your primary computer. The simulation used a VPS reached over SSH, or a spare laptop with a dedicated setup. The reason is not that overnight agents are likely to do something catastrophic. It is that removing the possibility of catastrophe from the main machine removes the last psychological barrier to giving the agent the permissions it needs to run efficiently.

An agent running overnight on an isolated machine with full permission to make changes within its working directory does not need approval prompts for every file operation. Removing those prompts speeds up the run significantly and removes the most common cause of a session stalling overnight because it is waiting for a human to click a button. The blast radius of any error stays contained to the isolated machine, which you can wipe and restore from a snapshot if something goes seriously wrong.

For most small businesses, a VPS from any cloud provider at the five-to-ten dollar per month tier is a sufficient overnight agent environment. The agent connects to the same cloud tools and APIs the business uses during the day; it just runs its work on the remote machine rather than on the owner's laptop.

5. Use iteration as the primary quality driver, not prompt engineering

The most important result from the overnight session is not the output of the first iteration. It is the pattern of improvement across iterations. The first flight scripts crashed into the sun. The fifteenth flew like an experienced pilot. The improvement happened through iteration, not through better prompting on the first run.

This principle applies directly to business tasks. The first batch of AI-drafted proposals will have errors. Some line items will be formatted incorrectly. Some proposals will miss elements that the success criterion specifies. The fifth batch, after four rounds of iteration feedback, will be substantially cleaner. The twentieth batch will require almost no correction.

The implication is to start overnight agent sessions earlier than your confidence in the output quality would suggest, not later. The early batches will need correction. That is expected and fine. The correction is what feeds the next iteration's improvement. An owner who waits until they are confident the output will be perfect before starting the overnight sessions never starts, because confidence in AI output quality only comes from running the sessions and observing the improvement.

6. Build a private benchmark on your own real tasks

The simulation built a private benchmark because public benchmarks can be gamed: labs sometimes train on the same test data that benchmarks use to evaluate them. The only evaluation that matters for a business is how a tool performs on the specific tasks the business needs it to do.

A roofing company that wants to choose between two AI tools for overnight proposal drafting does not need to read comparison reviews or benchmark rankings. It needs to run both tools on the same ten past inspections and evaluate the proposals each tool produces against the company's success criteria. The tool that produces more accurate, more complete proposals on those ten tests is the right tool for the business, regardless of what any benchmark ranking says.

This principle generalizes. Before investing in any AI tool at significant scale, design your own test. Use real inputs from your business. Define what good output looks like in specific, measurable terms. Run both tools on the same inputs. Evaluate the outputs against the criteria. The tool that wins your benchmark is the one to use. This produces better selection decisions than any external review and builds the evaluation criteria that make the overnight agent configuration more precise from the start.

What a roofing company does with an overnight agent in its first month

A roofing company doing fifteen to twenty inspections per week can run the overnight proposal drafting agent from the first week, starting with a success criterion that covers the five elements every proposal must include. The first-week outputs will need correction on roughly thirty percent of proposals. The second-week outputs will need correction on fifteen percent. By week four, the correction rate is under five percent, and the review step takes the estimator forty-five minutes in the morning rather than four hours throughout the day.

The financial impact is calculable. If the estimator previously spent four hours per day on proposal drafting and review, at an effective hourly cost of forty dollars, the monthly cost of that activity was roughly three thousand two hundred dollars. If the overnight agent handles the drafting and the estimator spends forty-five minutes per morning on review, the monthly cost of the same output drops to six hundred dollars. The difference funds the VPS, the tool subscriptions, and a meaningful amount of Google Ads spend against the proposals that get sent out faster because the process no longer waits for the estimator to have a free hour.

Faster proposal delivery also improves acceptance rate. A roofing proposal that arrives the day of the inspection converts at a higher rate than one that arrives three days later because the homeowner's urgency and emotional engagement with the problem is highest immediately after the inspection. The overnight agent shifts the proposal timeline from days to hours without increasing the estimator's workload. That timing improvement alone is worth more than the raw cost savings, and both of them flow from the six principles above applied consistently across the first four weeks of the overnight workflow.

Do it with an expert
You can build this yourself, or have it set up right the first time.

That is exactly what we do at AI DOERS. Book a private 30-minute call with Madhuranjan Kumar and we will map the fastest path to it for your specific business.

Book your call →
Madhuranjan Kumar

Madhuranjan Kumar

Founder, AI DOERS · Performance Marketing

Madhuranjan Kumar brings 20 years of performance-marketing experience and has managed over $200 million in Facebook ad spend for brands across the United States and beyond. His expertise spans the full modern marketing stack: Meta, Google Ads, TikTok, email automation, CRM, and the websites that hold it together. At AI DOERS he turns that track record into lead-generation systems for businesses across every industry.

← Back to all insights
How to Build With AI Agents While You Sleep | AI Doers