What I learned running 25+ Claude Code and Codex agents in a loop, unattended for a month
▲ 42 r/AIAgentsInAction+2 crossposts

What I learned running 25+ Claude Code and Codex agents in a loop, unattended for a month

Over the last month I've had ~25 agents running Claude Code and Codex in a loop - on their own schedules.

After analyzing hundreds of runs, I realized there are a bunch of non-obvious challenges with running autonomous agents in a loop - so I thought I'd share a few learnings and tips for running your own scheduled recurring agents.

The main project that needed lots of recurring agents: a self-driving AI events site (aievents.now) with one agent per city, 22 different cities, each researching and curating it's own schedule every morning for the city's upcoming events.

Here are just a few things I learned and tips if you want to automate your own recurring agents:

1. Beware of "workflow explosions" - give your agents duration constraints

If your agent has the ability to edit it's own instructions/memory over time, the context will continue to accumulate and you'll eventually get an explosion in the original workflow.

For example, for the events site - it started by just finding events through web research, but it decided at some point that each morning it was also going to audit all existing events to make sure they didn't get cancelled, changed, etc. That worked great when there were 15 events in the calendar- but once there were 200+ the agent started crashing and hitting the 1-hour time limit.

One trick I found is to literally tell the agent they have a time limit to complete their work - claude will continually check to see how it's doing on time and scope it's work accordingly to ensure it fits within the allotted time. This saved me a lot of headaches.

https://preview.redd.it/rowk9p4i6ekh1.png?width=1540&format=png&auto=webp&s=c2eeb84ec10ea33a419bbdc2e3f6b9649780436e

2. Stagger runs to avoid concurrency limits

Like I said, my fleet of agents all need to run early each morning to discover and curate the city's events before humans wake up to check the schedule. The problem is - when you have 20+ cities and each city's run takes about 30 mins, you'll run into overlap concurrency issues.

The solution is to stagger the runs - I have each next city start 15 minutes after the first, so I never exceed a concurrency of ~3.

3. Test to find the cheapest/dumbest possible model you can get away with

I run my agents on cronloop which lets me use my existing claude code subscription - I initially had all of the city agents running on opus which would absolutely blow through my 5-hour usage limits each morning.

So I decided to experiment to find the optimal model for the job - I connected my local claude code to the cronloop MCP and just told it to run agents in various cities to test with various models (codex and claude code) to find the cheapest and fastest model possible that consistently did a high-quality job (no hallucination, no missing events, etc.).

Turns out I didn't need opus at all - sonnet 5 / gpt 5.6 terra, and even haiku were all very solid for the same job - pretty much as good as opus - and used up way less usage, leaving me with lots of headroom to run all of the agents. Big win.

https://preview.redd.it/jl1tjj8e6ekh1.png?width=1504&format=png&auto=webp&s=4716a1f0d41f18a49aa48b2001d2c95f26c89efa

4. Store every log of every run

This is critical - you need to be able to observe how your agents are performing over time and analyze if they are operating smoothly/efficiently. In my case, I have access to the logs of every single agent run that has happened for my events system, so I simply just point claude at it (via cronloop MCP) and ask it to analyze the most recent N runs for each agent to discover inefficiencies and opportunities for improvement. Then I simply ask claude to update each agent's instructions accordingly.

This would be impossible if I didn't have visibility into all of the run data.

https://preview.redd.it/ljpch8s96ekh1.png?width=2066&format=png&auto=webp&s=03d7b60064e56c78f7a9c4fead03fc8147e67f42

5. Give your agents memory (MASSIVE WIN)

This is by far the single highest-leverage thing I learned from this.

I have each agent write its learnings to durable markdown files at the end of every run and read from it at the start of the next. They get noticeably better over a couple of weeks.

In the case of my event curator agents, they stopped re-researching dead sources, they remember which venues publish garbage data, and they even started to record tips for future agents like private JSON endpoints of events sites that they found to streamline event retrieval instead of parsing through each HTML page on the site every time.

Without this every run starts from zero and makes the same mistakes forever.

This led to way faster and more efficient agent runs, far less mistakes, and better results overall.

By just giving them a simple durable markdown memory system, they keep getting better and compounding without you having to do anything special.

https://preview.redd.it/inyblii66ekh1.png?width=2038&format=png&auto=webp&s=5135e10069fdf04bd697543807472ead08a91c89

I built the whole all-in-one system for myself (scheduling, connectors, memory, monitoring, MCP, etc.) so I could easily spin up new agents and make this all 10x easier rather than having to build a whole new system for each thing I wanted to automate, but the tips apply whether you use it - cronloop.ai - or something else. #1 thing is give your agents memory and the ability to self-improve. That alone will significantly improve the performance of your recurring agents.

Happy to answer anything about the setup either way, the lessons above apply regardless of what you use to schedule it.

My agents have already curated over 1,000 AI-related events happening in major cities. Here's the website's CMS:

Website powered by my platform Cactal.ai - cronloop and cactal integrate perfectly together for this kinda thing

u/vscode1 — 12 hours ago