MLOPS-COMMUNITY · 2026-05 AI & TECH
MLOPS-COMMUNITY · EPISODE DECK

Building AI Agents That Survive Production

Haytham Abuelfutuh · CTO, Union AI

Haytham Abuelfutuh · Union AI首席技术官;Flyte联合作者

Haytham Abuelfutuh认为,生产环境智能体的难点不仅在于提示词和工具,还在于围绕长时运行、容易出错的会话的运营基底。演讲围绕动态执行、持久恢复和防御性沙箱三个维度构建了生产就绪性的框架,并以人类旅行社为例,说明了中断处理、状态保持和恢复比一个干净的演示循环更为重要。

构建能在生产环境中存活的AI智能体
构建能在生产环境中存活的AI智能体 AI & TECH

Why this talk matters

The honest opener

Show of hands at the conference: many built an agent. Almost no hands stayed up for "shipped to production."

Two layers of failure

Most of your time goes into prompts and tools. Most of your crashes come from infrastructure you ignored.

Three D's

A first-principles platform spec: Dynamic, Durable, Defended.

Failures will happen

The pitch is not "no failures." It is "make recovery from failure cheap."

A worked example

Dragonfly: 250,000 products indexed by a four-tier agent fleet, prototype to production in one session.

The platform shift

Researchers and ML engineers wanting to own infrastructure, and platform teams learning to let them.

构建能在生产环境中存活的AI智能体 AI & TECH

The travel agent, 18 years ago

Haytham opens with a story from his honeymoon planning, "many many many moons ago, about 18 years ago actually."

"Never once did the agent ask me to, you know, repeat everything I said... we had many email exchanges, phone calls, dropped phone calls."

The human travel agent kept state for weeks. Dropped calls? She called back and continued. No re-prompting. No "context too long."

That is the bar Haytham sets for the agents we build today.

the human agent had
  • 📞 multi-week sessions
  • 🧠 perfect recall
  • 📱 dropped-call recovery
  • ↩️ pick up where you left off
  • 🤝 no "repeat yourself"
I want the same from my AI agent.
构建能在生产环境中存活的AI智能体 AI & TECH

The room test

Haytham asked the room to keep their hands up:

Built an agent

🙋🙋🙋🙋🙋
"many many of you"

Shipped it to production

🙋
"very very few of you"

"That's really the whole point. If you have built one, you know it takes very time-consuming to get... the right context and the right prompts to get LLMs to do what you want, and the guardrails around them, and the API calls, and the tools, this and that."

构建能在生产环境中存活的AI智能体 AI & TECH

Two layers of failure

You spend almost all your time on the top layer. You crash because of the bottom one.

Top — semantic & logical

prompts, tools, guardrails — your IP, your innovation. Mostly iterated on a laptop.

Bottom — infrastructure

"agents crash, you know, you run out of memory, the tools are not scaling... you get API limits and throttling, and just all kinds of production issues."

And these manifest as "corrupt context. You have to restart sessions" — terrible UX for users.

Semantic & logicalprompts · tools · guardrails · agent IPwhere youspend mostof your timeInfrastructureOOM · spot machines · API limitsthrottling · network · corrupt contextwhere youactually crashin production
构建能在生产环境中存活的AI智能体 AI & TECH

The thesis

"agents do fail and they will fail in production... instead of trying to really prevent that, or like trying to design the perfect agent that will never fail when you put it in production, you should be building agents that tolerate that, that know how to react when failure is happening."

The job is not preventing failure. The job is making the agent survive it.

构建能在生产环境中存活的AI智能体 AI & TECH

Three D's

A first-principles spec for the platform that runs your agents.

Dynamic — no DSL. Just write the agent like normal Python: loops, try/except, async.

Durable — sessions can run for weeks. When something crashes, recover where you left off without re-asking the user.

Defended — when the agent wants to write and run custom code, sandbox it; when it gives up, hand back to a human.

Three D'sDynamicno DSLplain PythonDurablerecoverfrom crashDefendedsandboxhuman-in-loopplatform requirements for agents in production
构建能在生产环境中存活的AI智能体 AI & TECH

Dynamic · just write Python

No DSL. No "tell me ahead of time if you're branching or looping."

The constraining way

  • Author of an agent has to declare control flow up-front
  • "you have to tell me if you're trying two branches or you're trying to do a loop"
  • Bad dev experience, no real dynamism

The natural way

  • Plain Python: for, if, try/except, async
  • "you should uh be able to build the agent to interact with the user the way you think it should interact"
  • The platform conforms to your code, not the other way around

"There is no DSL required. You're just running your code on that infrastructure."

构建能在生产环境中存活的AI智能体 AI & TECH

Declare infrastructure inside the code

A function that doesn't know how much RAM it has can't recover from running out.

The problem

"if it doesn't know that, oh, I allocated a 32 GB RAM for this task... when you get an out of memory error, it will have no idea what to do with it because it didn't even know that it was running on a 32 GB machine in the first place."

The fix

Declare the environment in the code. Memory, CPUs, GPU type — all sit next to the function that needs them.

If it fails, you can:

  • retry on the same hardware
  • bump memory and retry
  • hand off to a different machine

作者概括: your code controls both the infrastructure and the logic running on it — that's the only way the recovery loop can be smart.

构建能在生产环境中存活的AI智能体 AI & TECH

Spot machines, OOM, and the things try/except can't catch

What try/except catches

  • API call returned an error
  • Tool returned bad JSON
  • Logic errors inside your function

What it can't catch

  • "if the spot machine is taken away from you, it's not a thing you can handle in your function... because the entire process will just go."
  • "if you run out of memory, it's not a thing you can handle."

The escape: tell the platform "I want this job retried" or "rerun on a different piece of hardware." External, declarative retries — not user code.

Why spot? "they're cheaper, you get a cheaper GPU, or you're running on a new cloud, so you can get actual GPUs because you can't find them otherwise."

构建能在生产环境中存活的AI智能体 AI & TECH

Durable · sessions live for weeks

"the problem with agents is they're long-running, right? You can have a session open with a user for weeks at end. So, something bad is going to happen while this session is going."

Normal services

crash and restart. People even deploy "chaos monkeys" to kill services on purpose.

Agents

a 2-hour user session that dies halfway through cannot just start over.

So

the platform has to record every action the agent took and replay through them on recovery.

构建能在生产环境中存活的AI智能体 AI & TECH

What "recover from a crash" actually means

The platform records every external action. On recovery, you don't re-do them — you replay the recorded outcomes.

Two things you especially don't want to repeat:

LLM calls. "if you're calling an LLM, you know, 2 days ago, if I call it again today with the same prompt, it's probably not going to give you the same response."

User prompts. "if I ask a user for something in the beginning of the session... and the session crashes and recovers, you don't want to ask the user the same question again, right?"

Imagine the travel agent forgetting and asking your budget again two weeks later. Annoying.

ask userbudget?LLM call(non-det)CRASHOOM /spot killreplay fromcachecontinuesessionone user session, weeks longevery external action recorded · cache non-determinism · don't re-ask the user
构建能在生产环境中存活的AI智能体 AI & TECH

Caching across sessions

Zoom out from one user. You have many users doing similar things in parallel.

Cache this

  • web searches on the same term, same day
  • deterministic tool calls
  • "shared cache across different agent runs"
Saves tokens. Saves latency.

Don't cache this

  • LLM call to generate a unique report
  • per-user personalized outputs
  • anything where the user expects freshness

"having the ability and the power from the platform to decide that for certain things I'm okay caching... is very powerful."

构建能在生产环境中存活的AI智能体 AI & TECH

Make failures cheap

"if there's one thing I would love everyone to agree with is that failures will happen and it's not about... preventing failures. It's about how we deal with these failures when they do happen — and you want them to be cheap."

Cheap recovery

no full restart

Recorded actions

replay, don't redo

Tolerable failures

declare what to retry

"It's like metadata about metadata really."

构建能在生产环境中存活的AI智能体 AI & TECH

Defended · the escape hatch

Sometimes the agent looks at all the tools you gave it and decides none of them fit.

"you will get to a point where the agent will look at 100 tool you gave it and says none of these really do the job. I want to run this custom, you know, travel flight lookup... I want to write code and you want that. You want this sort of escape hatch in a lot of cases."

1. Sandbox it

network-isolated, host-isolated

2. Run it

collect output and errors

3. React

iterate, retry, or bail

Shout-out: Pydantic's Monty project — "low-level Python environment that is sandboxed."

构建能在生产环境中存活的AI智能体 AI & TECH

The sandbox loop

A "naive" but effective recipe:

1. agent writes code → run in sandbox

2. error? feed it back: "I tried to run this, I got this error, iterate."

3. "Usually the LLMs got a lot better at building code that runs, and compiling it beforehand... eventually, you will get code that does the thing you want it to do."

4. if not — "give it your best shot, try five times" — then bail to the human.

agent / LLMgenerated codesandboxerror?iterate, ≤ 5 triesask the userbail out
构建能在生产环境中存活的AI智能体 AI & TECH

Human in the loop is a feature, not a fallback

"you want a human in the loop capability. You want to be able to say, 'Hey, I tried to build this tool or tried to do this thing and I can't. Tell me what to do next.' Or maybe it gives you a few options, and you want to ask the user, 'Which one would you prefer?'"

When? After bounded retries fail. Or when the agent has multiple defensible options and no preference.

What it buys you: clean handoff back to a person, then the agent picks up the answer and continues — no restart, no lost context.

构建能在生产环境中存活的AI智能体 AI & TECH

A real example · Dragonfly

A "case study we recently published" — built by Haytham's colleague Niels with the Dragonfly team.

The problem of choice

You want to add an HR tool, or an issue tracker. There are thousands. Which one fits your stack?

"How do I pick the issue tracker?"

The catalog

250,000+
software products, constantly crawled, indexed, and compared on demand.

The hard part wasn't "can an agent give a recommendation." It was: can a fleet of agents keep a catalog of a quarter-million products fresh, queryable, and reliable in production?

构建能在生产环境中存活的AI智能体 AI & TECH

Dragonfly · the architecture

A four-tier system, all coordinated, all traced, all auditable.

Tier 1 — Calling agents. Always running. Decide what to research next.

Tier 2 — Coordinators. Smart enough to notice "you look like you're doing the same things — let me stop one of you."

Tier 3 — Researchers. One job: research a specific product end-to-end.

Tier 4 — Tools. Web search, doc indexing, whatever a researcher needs.

Calling Agents (always running)Coordinators (dedupe parallel work)Researchers (one per product)Tools (web search, doc index, ...)
构建能在生产环境中存活的AI智能体 AI & TECH

Prototype to production in one session

"they took this from a sort of a prototype they were building on their laptop to do the thing they're trying to do to a running thing in production in one session sitting with him. It's like a couple of hours — and it was running already on the system that can scale."

Laptop prototype
the typical starting point
~ 2 hours
of pair-debugging
Production fleet
scaling on the platform
构建能在生产环境中存活的AI智能体 AI & TECH

Q&A · "Are you guys using any Erlang under the hood?"

The user-facing layer

"we use Python for the our SDK. This is the user-facing how you develop the agents."

The system underneath

"the system in the back is all built on Go and Rust services. So, even the Python SDK has a Rust component that is running the coordination is super fast."

"But, we're not using Erlang, no."

The split is deliberate: ergonomic surface for the agent author, hard-engineered coordination layer underneath.

构建能在生产环境中存活的AI智能体 AI & TECH

Q&A · "shifting left" infrastructure to developers

An audience question from someone on a traditional platform team:

"How do you deal with companies that are a little bit more on the side of not wanting to change that and get the developers wanting to start thinking about those things? Essentially shifting left that piece of component there."

The friction

Platform team was historically the sole owner of anything that runs in the cloud. Researchers had to package, Helm-chart, deploy through them.

The sell

"if you want to sell that promise... I would really show them how fast it is for them to iterate. They cannot get the same speed if there is another hop."

"I could see it in people's eyes once they experiment with the platform."

构建能在生产环境中存活的AI智能体 AI & TECH

核心金句

这场 30 分钟 talk 里最值得记住的几句:

"agents do fail and they will fail in production... you should be building agents that tolerate that, that know how to react when failure is happening."

— the thesis of the whole talk

"Never once did the agent ask me to, you know, repeat everything I said... we had many email exchanges, phone calls, dropped phone calls."

— on the human travel agent he booked his honeymoon with 18 years ago

"the problem with agents is they're long-running. You can have a session open with a user for weeks at end."

— why crash recovery is different from normal services

"It's not about... preventing failures. It's about how we deal with these failures when they do happen — and you want them to be cheap."

— the operational mantra

"the agent will look at 100 tool you gave it and says none of these really do the job... you want this sort of escape hatch."

— why agents need to write and run their own code, in a sandbox

"I could see it in people's eyes once they experiment with the platform."

— on developers discovering they can ship their own infra
Haytham Abuelfutuh

Failures will happen.

Make recovery cheap.

Haytham Abuelfutuh · Union AI / Flyte

MLOps Community · AI Agents 2026 · Seattle

← PodDeck