From the event: Mindstone Oxford November AI MeetupLet Claude Cook - Strategies and Tips for Long-Running and Looping Agents
View event

Let Claude Cook - Strategies and Tips for Long-Running and Looping Agents

Hello, everyone. My name is Josh Laman. I build various AI systems and help companies when they're trying to improve their existing AI products.

Introduction

Today, I'm going to be talking about long -running and looping agents, which for me is one of the most exciting things in the last few months with the release of since Fable 5 .1 and Opus 5 .5 in particular, because the amount of trust I think we can have for the systems in a sort of looping fashion has gone up a lot.

Before that, obviously, there were things we could run on a daily process with a lot more structure. But when I think of looping and long -running agents, I feel like we've made a leap, especially since Fable 5 .1, where you can hand over a lot more autonomy to the agent if it's properly structured.

So I kind of want to go through three main things. One is agents on a schedule. What does that mean to run agents on a loop? There's lots of different ways you can think about looping agents, But the main one I'm going to be talking about is just looping them according to time on a schedule.

And then I've got some examples and experiments, just some various things I've tried, things that worked or didn't work, running things on a schedule for months at a time and seeing kind of what happened.

And then tips for long -running agents.

Why Long-Running Agents Are Hard to Evaluate

So there's all this media press and excitement about allowing agents to run for days or weeks at a time to do a lot of activity. And I think it's quite difficult both to learn how to do that as well as build intuitions for that.

I mean, some of it's intrinsic to the nature of the task, because if you kick off a three month task, how do you get better at doing that? Because the main source of feedback is at the conclusion of that three months.

Usually in the early days of these AI models, we could open up three tabs, ask Gemini, ask ChatGPT, ask Claude, and look at the three responses to get a sense of how they take different kinds of questions.

But how do you do that when you're trying to modify, when you're trying to kick off a three month agent that's modifying your system as it goes, and you can't run three of them in parallel.

Agents on a Schedule

So agents on a schedule is number one.

The Agent Loop and Scheduling Model

So the original model loop, which can make this more confusing, I just want to get out of the way first.

What's happening when you're using Cloud Code or ChatGPT in 2026? Basically, the model receives an input text from you in the input box. The model calls tools on repeat, and then it sends you a message. That's just the core loop that's unlocked unlocked all this functionality. This is what Cloud Code is doing.

People talk about Codex, Cloud Code, various models. I think it's important to distinguish, I know this is basics, but the harness that you're running, so Cloud Code or Codex with the underlying model that's operating within this context.

And then so the scheduling an agent, all this means is just kicking this off every day. But the difference with the model's input is it's no longer or you as the user giving contextual input at that moment. It's either identical input. Well, it's usually identical input initially, but then tools to access context that may vary by day, or may not, as the case may be.

For scheduled agents, if you work with Claude, you can go through to the Claude tab, the Claude section, and claude .ai, and then just create schedules here. They make it really easy. They give you free compute to do this. you can also just ask Claude to schedule it either running remotely or on your local device.

Inner and Outer Harnesses

So what are some considerations with this? So the input we talked about in the sort of classic Chachi BT example, that's just your text input. The model, that's your Astra, your Opus, whatever. Your inner harness, that's your Claude code, your codex, and your outer harness.

This is the context, the tools, the skills that you have on your computer. So you might find Claude code code operates on your computer quite differently than your colleague's computer because they have no skills or they have all the skills installed or they didn't connect certain things.

The context in which the model operates influences its behavior quite significantly, which matters particularly in this context because if you're kicking off these agents to the cloud versus running on your computer, they're going to have drastically different outer harness in the context that they live in.

Maybe I'll pause there. Does this make sense? I just thought you had something else. OK.

Example: A Daily UX Ideation Agent

So one initial example of this, if we were to run a sort of daily loop, is a daily UX idea. So we could ask a model to look through the available context, whatever you've wired it up to with its connectors, linear, Slack, Notion, the code base, et cetera.

ID8 using a dynamic workflow. If you're not using these in Cloud Code, highly recommend it. Basically, a way for it to spin up a lot of agents in parallel, kind of like a swarm, basically, but in a structure where they can get fresh context and be given diverse directions by the orchestrating agent.

And so use some sort of workflow, fan out, come up with the most compelling UX idea that we haven't yet implemented. And you can do a tournament behind the scenes that might generate 20 ideas and then whittle it down to one. And the beauty of it being on a schedule is it doesn't really matter if this takes two hours.

Then create a 30 -second voiced video explaining your idea and post it on Slack. Slack. Then the UX team can just review that idea and comment on the thread. Save a backlog of the ideas you didn't go with. In some sort of workflow, when they've ideated a lot, they can save to some markdown file somewhere, the backlog of ideas that didn't win this time.

Then monitor Slack for feedback on your idea and save memories to inform future ideation. In the context of a daily loop, that means monitoring it once a day when it kicks off. You could put this step at the beginning when it comes up with a new idea to respond to the feedback from before.

This is not the core idea, but this is like an example, like simple idea integrated where you're leveraging Claude's ability to basically do a lot of ideation and creativity for you and leaning into the model's brilliance to find new things that your team's not spotting, but giving your team a very easy -to -digest way to act on it.

In the Slack post, you could also tag the PR that's already open and ready to review if it's cleared. cleared.

Example: Scheduled Ticket Completion

Same sort of thing with ticket completion. I'm going to skip through this one. But basically, models do very well when there's a self -verifiable task or low ambiguity.

So if you have a linear ticket or lots of tasks your company needs doing, you could have an agent run on a loop looking for the simplest, most non -ambiguous, it doesn't have to be simplest, the least ambiguous ticket that can be self -verified by an agent in its current context.

So given Given the tools that it has, the files that it has, it can verify a quality completion, select the best candidate, attempt a solution, and then post a PR.

Tips for Scheduled Agents

Tips for this sort of concept of just scheduling an agent. Clarify ambiguity upfront. This is really important. You're basically setting off someone that's going to be doing this task every day. There's always ambiguity in our tasks and our instructions. Asking the agent, use your ask question tool, clarify the ambiguity. Where have I given you poor directions? What could we do better?

Provide a communication channel. So give it a way to email you. I usually use Resend myself and give an API key for the scheduled agents so that they can email me if they have concerns or things that are ongoing.

Consider model intelligence and habits. So the same instructions, the same outer harness, the same inner harness. It's going to be drastically different whether you plug in Astra or Opus or Fable. They have different center of gravities, as it were, and so considering that, if you're not sure, I would say just the smartest model, if you have the token budget for it, is best, but they act differently and with different amounts of agency.

Then leverage memory storage. Agents already store memories as you're doing tasks. I think for scheduled and long -running agents, it's even more important to encourage them to use their memory to say, for this specific thing, like let's say in my instructions, make sure you log memories as you go according to this dimension, just so we make sure that we're tracking with this. I think there's a huge uplift if you create task -specific memory stores. Again, Claude can manage this for you.

And then create watcher agents. If you start having a lot of these daily loops or weekly loops, have another agent that watches the watchers. Another agent that watches these loops and gives you a weekly update email of how your other loops are doing. If you set some of them up poorly, if they're getting stuck or failing, running out of tokens, whatever it is.

All of this is designed around trying to figure out how you as a human can leverage as many agents as possible, but digesting the information you need to digest. That's agents on a loop.

Experiments With Long-Running Loops

Some experiments. These are mostly code -based experiments.

Better Every Day: What Failed

This is better every day. The prompt for this one, this was like a fresh GitHub repo, repo, was basically, make this tool better every single day.

Like a very silly, stupid... I think I touched up the prompt here. This is the later prompt because I was upset with the early pushes.

But basically, I said, make this better every single day, and I've just been running it now for 150 days. And it's pretty bad, unfortunately, after 150 days.

But basically, I said, just make changes to this website every day, it should be useful for people, you can be ambitious, do what you want, etc. etc. And it's made a pretty bad product as a result.

I was kind of excited. I kicked off two of these at once and I was like, oh, this is going to be amazing. And then it was just really bad. It's got a changelog.

So what worked? It's got a changelog and it's super cool. You can see day 155 today, November 20th, adding new features. It's actually stayed on task. It's kept the same integrity of the task.

What went wrong? on the slide for this, but it was pretty poor, it was pretty constrained in its imagination, I would say, for what it added. So the functionality kind of got into a rut.

Better Every Day turned into adding a new micro -feature that incrementally improved the existing product. And it over -adhered to the existing patterns and instructions from earlier agents. I think there was a severe lack of creativity in the process that I implemented.

Peer Rejected: Structure Improves Results

Another example is Peer Rejected. Do I have the image here? Is it going to show up? No.

Well, Peer Rejected is a daily fake scientific newspaper that ideates a new fake science paper every day. And it worked a lot better because... One of the things that worked a lot better is I provided a lot more structure for how I wanted to solve the problem each day, including an ideation stage and a sort of like polishing stage.

So the early, the better every day loop was just solve this problem and just keep doing it. This one, I asked for some more layers at a meta level of like, I knew I wanted ideation. I knew I wanted to look at the recent titles to get inspiration. I knew I wanted to do research. I knew a drafting stage would be better and adding diagrams. And I didn't ask it to do all at once.

So figuring out where there are natural divisions for your task was a huge unlock here to make the quality of the papers a lot better. The way that I figured this out myself was just trying to make a lot of fake science papers and figuring out what was needed to make it do it without further prompting.

What went wrong? It wasn't very funny, especially the second iteration. The first iteration I felt like was really funny. And then the later scientific papers were kind of not very funny. And that was actually weirdly hard to debug how you make them funny.

I was trying to get the right balance between insider, appealing to the PhD student who's studying that subject, but also funny for the everyday person. And it was hard to strike that balance. And I don't think I really solved that.

Town Tools: Layered Agent Systems

Another concept is town tools. This one has a number of agents on a loop doing different kinds of tasks. Basically, any town that's inputted, agents research the town, They design tools for it, look up public APIs, and add them as they go.

And what worked with this, I've got this diagram here. We've got a lot of different agents that are running on a loop. So there's agents that do the initial research from the waitlist, and their whole job is to just be basically research managers for towns, avoid the cliches of the towns, build up research packs that all the later agents can use as a source of truth.

And then you've got tool builders that are doing their own independent things, and then other agents that are looking for errors, expecting their things to go wrong, and doing maintenance or improvements and things like that.

The most important thing here, there was a separation of tasks and probably about five different of these kinds of agents that were running on daily loops. Initially, it was every six hours and then that was a bit too much tokens.

Design Principles From the Experiments

Some tips that come out of this. Use layers of agents. Future agents can address stress weaknesses of earlier agents. So you don't have to do it all in one scheduled agent.

If you find your daily UX idea is not working very well, then layer other agents that look to improve and modify the structure of the problem. It doesn't have to be all in one.

Design the approach to the problem. So one of the things I think as a human that you can do best or alongside the agent is think at a meta level of what would be the most successful steps that you would walk through to solve this problem.

So instead of saying, come up with a new UX idea, it'd be saying, spend time ideating, spend time whittling down those ideas, spend time prototyping how those ideas could look. That one idea you've selected, show me four different ways it could look. Critique and refine. Thinking through the sort of like stages that you would give and then give it those stages to walk through.

Have the model identify the environment and task constraints up front. So just like resolving ambiguity, you can have the model resolve issues it's going to run into, ask it to test its tool calls, what has it got access to that it will need, anticipate future requirements.

And then create a dreaming mechanism. I'm not sure if you've come across this, but this concept is idea of a cross -session learning. So having a mechanism that looks across all the session threads on a cadence, like a weekly cadence, and updating or adding memory notes based on that to stop future things happening in a repeated way, and then subdivide the tasks.

I think I'll probably Let me speed up things here. Let me just check my time.

Running a Single Agent for a Long Time

So finally, with long -running agents, or one long -running agent, back to the start again, we talked about scheduling an agent was basically the original agent loop, but just being triggered every day.

For a long -running agent, it is the original agent loop, but you're just asking it to call tools many times before it sends a user message. And the question is, how do you get an agent to run for a long time? It's a really strange thing to just say, what do you do?

I don't know how long the longest people have run it for but when I was trying this out It's it's a bit strange to get all this PR that you know, they can solve a problem for days at a time It turns out you can actually especially if you've got the computer running you can just tell it You've got a long time to accomplish this task

And if it's an appropriately long task giving it that sort of budget in terms of time or tokens Can be a way of signaling to it that you you know, you go ahead you do this You don't need to like you don't need to save my cloud subscription This is the sort of how to spend your Cloud subscription in one prompt.

And also, thinking about the structural point earlier, encouraging it to use lots of workflows. So these are things where they fan out and have other agents subdivide it, is going to not only protect the context, but help it think through those stages. And encouraging it to think through those stages is good.

Workflows and Self-Verification

And then finally, we're always talking about self -verification and closing the loop so the agent knows when it's done.

If your task is not like a maths problem, when you know it's solved or have simulated focus groups that have to clear the product or other people in your org who are mocked and simulated, what would they say based on their Slack messages or every other message they've given you in the past? What would they say to this? Would they be happy with this UX idea? And if they're not happy with it, it doesn't go out the door and keep going until they're happy.

Practical Tips for Long-Running Agents

Tips that come out of this, give a pep talk, cast the vision.

Actually, Peter Steinberger of OpenClaw, when asked what to do, he said, Yeah, recently at the London Dev Day, he said, give a pep talk. If the model thinks it can't do it, I think that's very good. Believe in the model. Give it ownership. The model is incredibly smart. Help it to elicit that behavior.

When you're writing a prompt for a long -running agent, maybe just turn on transcription and talk for a long time to encourage yourself to give more context. Meta -level thinking about the agent. I'm just kind of blitzing through these now.

And oh, yeah, have the agent send you regular video updates so you know it's on the right track. Ask it to twice a day, send you a video via email of its progress and yeah, that's it.

Conclusion

Questions? Thank you.

Finished reading?