Yacine Mahdid, co-founder of Datadom and host of Deep Learning Explained, maps eight ways to make long-running agents more reliable in this hour-long AI Engineer Code Summit talk.

Keep the working context small

  • Compact the history. Replace old turns with a shorter record the agent can resume from. The cache study he cites reports 27.7% lower average cost and 1.7 points higher average benchmark scores than its summarization baseline.
  • Keep large inputs outside the prompt. Give the model a way to inspect files or records in pieces. Recursive Language Models use that approach to process inputs far larger than a model’s context window in controlled tests.
  • Let the model write code for its tools. A script can combine several steps and become a reusable tool. A continual harness goes further: it preserves proposed fixes to prompts, skills, and worker roles. Keep a version you can roll back to.

Give agents limits and a way to check their work

  • Treat the sandbox as part of the design. An agent can get a good score for bad work if the environment exposes what the grader should know on its own. Keep the checks separate from what the agent can change.
  • Use workers where the task splits cleanly. Give each one a fresh context and a bounded job. A controlled study found gains on work that could be split up and losses on sequential planning.
  • Keep coordination readable. A shared task record can help a team avoid duplicating work. Agents agreeing with one another still need an outside check. A two-agent study found that the agents often stopped enforcing the review protocol under its experimental incentives.
  • Separate search from discovery. Prime Intellect’s 153-run nanoGPT study found that its best agent closed 81.7% of the gap to a human step-count target. The authors found no fundamentally new method in those runs.

Put a feedback loop around the agent

  • Factory sensors: Split runs into phases and use signal-processing tools to extract, score, and normalize features. Give the model those measurements, then have a specialist review the missed events and fix the tools.
  • Equipment quotes: A staged system brings customer requirements, past jobs, and supplier lead times into the quote. Mahdid says it brought a months-long turnaround to under a day in one shop. Engineers still review the result.
  • Video editing: Twelve stages give fresh workers focused jobs. Mahdid reviews the cut and uses traces of what the agent did to find the step that needs a fix. When a cut needs text behind a person, he gives the editor a tool that can separate the person from the background.
  • Log the result that matters. Match each run to what happened later: the ticket was resolved, the change was merged, or the customer came back. Fix tools and instructions first. Consider training when the same failure survives those fixes.

Caveat: The projects are Mahdid’s own examples. The turnaround and editing estimates are reports from those workflows, not measured accuracy or labor savings across customers.

“You might optimize the wrong thing.” — Yacine Mahdid, 58:37