AI Engineer · Published 2026-10-08

Brains vs Hands: How to Run AI Agents Safely in Production — Viren Baraiya

Open on YouTube ↗

Summary

Overview

  • Speaker: Viren Baraiya
  • Channel: AI Engineer
  • Main topic: Running AI agents reliably and safely in production using durable runtimes (harnesses) to handle deterministic and non-deterministic tasks.
  • Purpose: To provide engineers with architectural patterns and runtime principles for orchestrating AI agents in production environments safely, reliably, and durably. In this talk, Viren Baraiya discusses the operational realities of running AI agents in production. He argues that building agents is not just about LLM chatbots or simple tool-calling loops, but requires a clear separation of responsibilities: the agent (the brain) plans and reasons non-deterministically, while the harness (the execution engine/application) handles deterministic execution, state, routing, and persistence. Using Conductor as an example of a durable workflow engine, Baraiya demonstrates how late-bound sagas enable agents to safely plan actions at runtime within a bounded, deterministic vocabulary.

Topic Map

The Expanding Scope of AI Agents

  • Explanation: Agents are moving beyond basic chatbots into background workers, scheduled agents, event-driven listeners, long-running coordinators, and multi-agent systems where humans are rarely watching every step.
  • Key claims:
    • Most real agents are not simple chatbots.
    • Production agents operate as background workers, scheduled tasks, or event-driven actors without constant human supervision.
  • Examples:
    • An agent running every hour to check system schedules or listening to infrastructure alert logs.
  • Terminology:
    • Background workers
    • Scheduled agents
    • Event-driven agents
    • Multi-agent systems
  • Why it matters: Understanding production agents requires moving past the simple request-response chat interface paradigm.

Component vs Application: The Harness

  • Explanation: An agent is a component, not a full application. Just like microservices are orchestrated by an application layer, agents must be wrapped in a harness (an orchestration layer) that handles state, routing, policy, and failure handling.
  • Key claims:
    • You never ship a single microservice without an orchestration layer; the same applies to AI agents.
    • The harness is the application layer around agents where agent behavior becomes product behavior.
  • Examples:
    • An SRE harness orchestrating multiple agents to monitor logs, query metrics, and trigger rollbacks.
  • Terminology:
    • Harness
    • Orchestration layer
    • Single-service responsibility
  • Why it matters: Without a harness, agents cannot reliably interact with external enterprise systems or databases.

Deterministic vs Non-Deterministic Work

  • Explanation: Production workflows require combining non-deterministic LLM reasoning (planning, reasoning, classifying, summarizing) with deterministic operations (payments, provisioning, approvals, compliance checks, rollbacks) that must never be improvised.
  • Key claims:
    • A harness runs more than just an agent loop; it combines non-deterministic planning with deterministic execution.
    • The agent has no business owning the deterministic half of the application.
  • Examples:
    • Executing payments or rolling back a Kubernetes cluster deployment must be deterministic.
  • Terminology:
    • Deterministic work
    • Non-deterministic work
    • Idempotency
    • LLM reasoning
  • Why it matters: Allowing LLMs to improvise critical infrastructure or financial operations leads to hallucinations and catastrophic failures.

Durability Across Time

  • Explanation: Harnesses run across time—seconds, days, or weeks—waiting on humans, reacting to events, firing on schedules, and resuming after crashes. Durability is a core requirement, not an optional feature.
  • Key claims:
    • These applications don't run inside a request; they run for hours, days, or weeks.
    • Durability is the cost of admission for long-running agentic workflows.
  • Examples:
    • Order management systems waiting on third-party shipments or human approvals.
  • Terminology:
    • Durability
    • State management
    • Long-running processes
  • Why it matters: Network failures, server restarts, and infrastructure partitions require systems to recover seamlessly without losing state.

Separation of Responsibilities: Brains and Hands

  • Explanation: The agent plans (decides what to do, why, and how to adapt as the world changes), while the harness executes (decides what is allowed, what already happened, what can be retried, what needs approval, and what runs next).
  • Key claims:
    • The agent plans. The harness executes.
    • The agent proposes; the harness operationalizes.
  • Examples:
    • An agent identifies an unhealthy cluster; the harness executes the approved, deterministic restart procedure.
  • Terminology:
    • Planning vs execution
    • Human-in-the-loop gates
    • Idempotent operations
  • Why it matters: Clear boundaries prevent LLMs from executing dangerous unauthorized actions directly.

Late-Bound Sagas

  • Explanation: Instead of pre-defining all workflow branches in a closed world, agentic workflows use late-bound sagas where the agent proposes and builds workflows at runtime from a pre-registered vocabulary of deterministic tools and operations defined by the harness.
  • Key claims:
    • Bound late, over operations whose guarantees were bound early.
    • The agent owns the plan; the harness owns the guarantees.
  • Examples:
    • A production remediation workflow where the agent decides at runtime to query metrics, trip circuit breakers, and notify teams.
  • Terminology:
    • Late-bound sagas
    • Bounded vocabulary
    • DAG (Directed Acyclic Graph)
    • Closed world vs open world
  • Why it matters: It combines the flexibility of runtime LLM planning with the safety and determinism of traditional enterprise workflow engines.

Key Points

An agent is a component, not an application

  • Explanation: Just as microservices require an orchestration layer for routing, state, and failure handling, AI agents need a harness to coordinate successfully.
  • Evidence: Comparison to microservice architecture where services communicate through choreography and orchestration.
  • Practical implication: Do not build monolithic agent applications; encapsulate agents within structured runtime harnesses.

Deterministic execution must be separated from LLM reasoning

  • Explanation: LLMs should handle reasoning, planning, and classification, while deterministic processes like payments and provisioning must be strictly controlled by code.
  • Evidence: List of deterministic tasks (payments, provisioning, rollbacks) versus non-deterministic tasks (planning, reasoning, summarizing).
  • Practical implication: Eliminate LLM hallucinations in critical operational paths by enforcing hardcoded deterministic procedures.

Durability is essential for long-running workflows

  • Explanation: Agent harnesses must persist state across crashes, restarts, and extended timeframes ranging from seconds to weeks.
  • Evidence: Examples of order management and long-running SRE monitoring tasks.
  • Practical implication: Use durable workflow orchestration engines to back agentic pipelines.

Late-bound sagas solve the open-world planning problem

  • Explanation: Allowing agents to select steps from a pre-registered vocabulary at runtime provides flexibility while maintaining strict execution guarantees.
  • Evidence: Demonstration of runtime workflow compilation and execution DAGs in Conductor.
  • Practical implication: Define strict tool vocabularies in your harness while letting agents compose them dynamically.

Frameworks, Models & Processes

The Agent Harness Framework

  • How it works: Wraps non-deterministic agent loops inside a durable runtime that manages state, system tools, human-in-the-loop approvals, and deterministic execution steps.
  • Components:
    • Agent loop (LLM planning)
    • Orchestration layer (harness)
    • Tools and MCP (Model Context Protocol)
    • Human in the loop gates
    • Enterprise systems and databases
  • When to use: When deploying AI agents into production systems that require high reliability, safety, and auditability.

Late-Bound Sagas

  • How it works: Combines early-binding of operations (pre-registered safe tools with strict guarantees) with late-binding of workflows (agent constructs the execution plan at runtime).
  • Components:
    • Registry (deploy time, early binding of operations)
    • Plan (run time, agent creates execution DAG)
    • Execution engine (durable workflow execution like Conductor)
    • Compensation and rollbacks
  • When to use: When building flexible agentic workflows that must execute mission-critical or high-risk tasks safely.

Examples & Case Studies

An SRE remediation agent detects an unhealthy Kubernetes cluster, analyzes logs, determines root cause, and executes a rollback workflow.

  • Illustrates: Separation of agent planning (analyzing logs, planning steps) and harness execution (performing cluster restarts, sending Slack notifications).
  • Lesson: Agents should propose remediation steps, but the harness must execute them deterministically with proper error handling and approvals.

Actionable Takeaways

  • Immediate:
    • Treat AI agents as components rather than standalone monolithic applications.
    • Separate non-deterministic LLM planning from deterministic execution logic.
    • Implement durable execution runtimes for any agentic workflow running longer than a single request.
  • Strategic:
    • Adopt late-bound sagas to give agents runtime flexibility while enforcing early-bound safety guarantees.
    • Leverage existing open-source workflow orchestration engines (such as Conductor) to manage agent state and orchestration.
    • Design systems with clear separation of brains (LLMs) and hands (harness execution).
  • Questions to investigate:
    • How do we handle complex multi-agent negotiations under strict deterministic safety constraints?
    • What are the best patterns for managing state corruption when an agent's plan fails mid-execution?
    • How can Model Context Protocol (MCP) standards integrate more tightly with durable execution runtimes?

Claims Worth Verifying

  • The agent owns the plan; the harness owns the guarantees. (Architectural principle)
  • Durability is the cost of admission for production agent workflows. (System design claim)

Notable Quotes

"The agent owns the plan. The harness owns the guarantees." "Durability is the cost of admission." "The agent proposes. The harness operationalizes."

Compressed Summary

  • Agents are components requiring durable runtime harnesses, not standalone apps.
  • Separate non-deterministic LLM planning from deterministic execution operations.
  • Late-bound sagas allow agents to build plans at runtime using pre-registered safe tools.
  • Durable workflow engines like Conductor ensure long-running agent workflows survive failures and crashes.
  • Keywords: agents, harness, orchestration, durability, sagas
  • Core insight: AI agents need durable runtime harnesses that separate non-deterministic LLM planning from deterministic execution to safely operate in production.

Core insights

6
Architecturehigh noveltystrong evidence

The agent should own only non-deterministic planning (reasoning, classifying, summarizing, choosing tools) while the harness owns all deterministic execution — payments, provisioning, rollbacks, approvals, compliance checks — so that guaranteed operations are bound early and never improvised by the LLM.

Why it matters

It draws a hard responsibility boundary that removes hallucination risk from irreversible operational paths, which is the failure class that makes agents unshippable in production.

Generalization

Applies to any agentic system with side effects: separate the probabilistic planner from a contractual, idempotent execution layer rather than giving the model direct tool authority.

The agent has no business owning the deterministic half of the application.
Open source video
A harness runs more than just an agent loop; it combines non-deterministic planning with deterministic execution.
Open source video
Mechanismhigh noveltystrong evidence

Late-bound sagas invert the traditional workflow-engine model: instead of pre-defining all branches (closed world), the agent assembles a workflow DAG at runtime, but only from a pre-registered, bounded vocabulary of deterministic operations whose guarantees were fixed at build time.

Why it matters

It is a concrete mechanism for reconciling the flexibility of runtime LLM planning with the safety and recoverability of enterprise workflow engines — the central tension in agentic orchestration.

Generalization

Any system that needs open-ended runtime planning over safety-critical operations can constrain the plan space by fixing the tool/operation set and their guarantees while leaving sequencing to the model.

Bound late, over operations whose guarantees were bound early.
Open source video
The agent owns the plan; the harness owns the guarantees.
Open source video
Mental Modelmedium noveltystrong evidence

An agent is a component, not an application; it must be wrapped in a harness (orchestration layer) that handles state, routing, policy, and failure handling, mirroring how microservices require an orchestration layer rather than being shipped raw.

Why it matters

It relocates where product behavior, policy, and reliability logic live, and warns against monolithic 'agent applications' that conflate reasoning with runtime concerns.

Generalization

Reuse the microservice-orchestration analogy for autonomy: autonomous components get wrapped, not shipped bare.

An agent is a component, not a full application.
Open source video
You never ship a single microservice without an orchestration layer; the same applies to AI agents.
Open source video
Practicemedium noveltystrong evidence

Durability is a non-optional, first-class requirement for agentic workflows because they run across seconds, hours, days, or weeks — waiting on humans, third-party events, schedules — and must resume after crashes, restarts, or network partitions without losing state.

Why it matters

Treating durability as an add-on rather than a runtime primitive causes state loss and unrecoverable workflows exactly where agents are most valuable: long-lived, event-waiting processes.

Generalization

Any agent process that outlives a request needs durable, resumable state as an architectural premise, not a library bolted on later.

Durability is the cost of admission for long-running agentic workflows.
Open source video
These applications don't run inside a request; they run for hours, days, or weeks.
Open source video
Mental Modelmedium noveltymoderate evidence

Production agents are predominantly background workers, scheduled jobs, and event-driven actors rather than interactive chatbots, so they are designed for operation without a human watching each step.

Why it matters

It reframes design priorities toward observability, scheduling, event routing, and unattended failure recovery instead of conversational UX.

Generalization

If agents run unattended, design assumptions must shift from synchronous request-response to long-running, supervised-only-indirectly processes.

Most real agents are not simple chatbots.
Open source video
Production agents operate as background workers, scheduled tasks, or event-driven actors without constant human supervision.
Open source video
Practicemedium noveltymoderate evidence

The harness decides what is allowed, what already happened, what can be retried, what needs approval, and what runs next — meaning idempotency and human-in-the-loop gates are harness responsibilities, not agent responsibilities.

Why it matters

It makes retry safety and approval gating explicit runtime concerns, which is what allows execution to survive failures and meet compliance requirements.

Generalization

Governance primitives (idempotency keys, approval gates, replay-safety) belong in the execution layer so they apply uniformly regardless of which agent or plan invoked them.

The agent proposes; the harness operationalizes.
Open source video
The agent plans. The harness executes.
Open source video

Deep dives

5

Versioning and evolution of bounded operation vocabularies in late-bound sagas

Research question

How should a bounded vocabulary of deterministic operations be defined, versioned, and evolved so that in-flight late-bound sagas continue to execute safely?

Why

Central to safely combining runtime LLM planning with build-time guarantees; without a versioning strategy, vocabulary changes can break running agent-composed workflows.

Bound late, over operations whose guarantees were bound early.
Open source video
The agent owns the plan; the harness owns the guarantees.
Open source video
Source video

Enforcement points for human-in-the-loop approval gates in durable agent harnesses

Research question

Where should human-in-the-loop approval gates be enforced — harness policy or agent plan — and how does that choice affect state replay and correctness on resume?

Why

Determines whether approval workflows can survive crashes and restarts without duplicate or missed approvals, a key compliance requirement.

The agent proposes; the harness operationalizes.
Open source video
The agent plans. The harness executes.
Open source video
Source video

Measuring the safety delta of harness-mediated execution on irreversible operations

Research question

What is the measurable reduction in critical-operation failures and hallucination-induced harmful actions when deterministic execution is moved out of the LLM loop?

Why

Provides empirical grounding for the architectural claim that LLMs should not own irreversible operations, which currently rests on argument rather than measurement.

Allowing LLMs to improvise critical infrastructure or financial operations leads to hallucinations and catastrophic failures.
Open source video
The agent has no business owning the deterministic half of the application.
Open source video
Source video

Retry, idempotency, and compensation semantics for agent-composed sagas

Research question

When an agent-composed saga fails midway, how does the harness decide between retry, idempotent replay, and compensating rollback?

Why

Failure recovery semantics for partially executed, runtime-composed plans are unspecified but critical for safe long-running workflows.

The agent proposes; the harness operationalizes.
Open source video
A harness runs more than just an agent loop; it combines non-deterministic planning with deterministic execution.
Open source video
Source video

Multi-agent coordination failure modes under harness orchestration

Research question

Does the microservice-orchestration analogy hold for multi-agent systems, or do new coordination failure modes emerge under partial failure and contention?

Why

Determines whether existing orchestration patterns can be reused for multi-agent systems or require new coordination primitives.

You never ship a single microservice without an orchestration layer; the same applies to AI agents.
Open source video
Source video

Article ideas

4

The Agent Is Not the Application: Why Your LLM Loop Needs a Harness

Treating the agent as the application conflates probabilistic reasoning with deterministic execution, state management, and policy; the reliable pattern is to confine the agent to planning and wrap it in a harness that owns operational guarantees.

Angle

Architectural argument contrasting monolithic agent apps with harness-mediated designs, using microservice orchestration as an analogy.

Source video

Late-Bound Sagas: How to Get Runtime Adaptability Without Ceding Safety

By fixing the set of deterministic operations and their guarantees at build time while letting the agent bind sequence at runtime, teams achieve open-ended planning without exposing irreversible operations to hallucination.

Angle

Mechanism deep-dive on late-bound sagas and bounded vocabularies, with concrete examples of payments and rollbacks.

Source video

Durability Is Not an Add-On: Designing Agents for Weeks-Long Workflows

Long-running agentic workflows that wait on humans, events, and schedules require durable execution as a runtime primitive; bolting on state persistence after the fact leads to unrecoverable failures.

Angle

Practical guide to durable execution engines for agent workflows, arguing for architectural shift from request-response to long-running processes.

Source video

Keep Your LLM Away from Payments: The Case for Harness-Owned Deterministic Execution

Allowing LLMs to directly invoke irreversible operations like payments, provisioning, or rollbacks invites catastrophic failures; the harness must own these with idempotency and approval gates.

Angle

Risk-focused argument with failure modes, citing the deterministic/non-deterministic split as the remedy.

Source video

Project ideas

4

Harness-Mediated Execution Benchmark

beyond-evals

Harness-mediated execution reduces critical-operation failure rates (including hallucination-induced harmful actions) by at least 10x compared to direct tool-calling agents on irreversible tasks.

Proof of concept

Build a benchmark suite of irreversible-operation tasks (e.g., payments, rollbacks, provisioning) and compare failure/hallucination rates for direct-tool vs harness-mediated execution under identical LLM planners.

Measurement

Failure rate per 1000 operations; count of hallucinated or unauthorized actions; recovery success rate.

Source video

Versioned Operation Registry for Late-Bound Sagas

new

A versioned operation registry with contract evolution allows in-flight agent-composed sagas to survive vocabulary updates without breaking, maintaining safe execution.

Proof of concept

Prototype a tool/operation registry with semantic versioning and test how running late-bound sagas behave when vocabulary changes mid-flight, including rollback and migration paths.

Measurement

Percentage of in-flight sagas that complete correctly after vocabulary change; number of broken guarantees; migration success rate.

Source video

Approval Gate Replay Correctness

gatehouse

Placing human-in-the-loop approval gates in the harness (not agent plan) ensures correct state replay across crash-and-resume with pending approvals, with zero duplicate or missed approvals.

Proof of concept

Build a durable harness with configurable approval gates and inject crashes before, during, and after approval decisions; measure replay correctness.

Measurement

State consistency after resume; duplicate approval count; missed approval count; time to resume.

Source video

Multi-Agent Harness Orchestration Failure Modes

new

Multi-agent systems orchestrated by a single harness exhibit new coordination failure modes (e.g., plan conflicts, deadlocks) not present in microservice orchestration, requiring novel coordination primitives.

Proof of concept

Compare harness orchestration of multiple agents (e.g., SRE agents monitoring logs, metrics, rollbacks) against microservice orchestration under partial failure and contention scenarios.

Measurement

Coordination failures per 1000 runs; deadlock rate; conflict resolution time; recovery success.

Source video

Architectural implications

3

Agents are treated as a component inside an orchestration layer rather than as the application itself.

Before

A monolithic agent application where the LLM loop owns tools, state, retries, and side effects directly.

After

A harness/application layer owning state, routing, policy, retries, and approvals, with the agent confined to planning and proposal.

Consequence

Policy, durability, and failure handling become centralized and reusable, while agent reasoning can be swapped without re-implementing operational guarantees.

Source video

Deterministic operations carry build-time guarantees while plan sequencing is bound at runtime.

Before

Workflow branches fully pre-defined at design time (closed world), limiting adaptivity to novel conditions.

After

Agent composes runtime DAGs from a pre-registered bounded vocabulary of deterministic tools.

Consequence

Teams get runtime adaptability without ceding control over the safety semantics of the underlying operations.

Source video

Durability is a runtime primitive for agents that outlive a request.

Before

Agent state held in-process, lost on restart or partition, assuming synchronous execution.

After

Durable execution engine persisting state across crashes and multi-day waits on humans or external events.

Consequence

Long-running, event-driven, and human-gated workflows become feasible, but the system now depends on a durable workflow runtime as critical infrastructure.

Source video

Tradeoffs and failure modes

3

Runtime planning flexibility vs. bounded operation vocabulary

Benefit

Late-bound sagas let the agent adapt plans to novel runtime conditions rather than following a pre-baked branch set.

Cost or risk

Expressiveness is capped by the pre-registered vocabulary; anything outside it cannot be planned, which may force awkward workarounds or block legitimate actions.

Bound late, over operations whose guarantees were bound early.
Open source video
Source video

LLM autonomy on irreversible operations

Benefit

Letting the agent own end-to-end execution maximizes adaptability and reduces hand-authored workflow code.

Cost or risk

Allowing the model to improvise critical infrastructure or financial operations produces hallucinations and catastrophic failures.

Allowing LLMs to improvise critical infrastructure or financial operations leads to hallucinations and catastrophic failures.
Open source video
Source video

Durability as a prerequisite

Benefit

State survives crashes, restarts, and multi-week waits, enabling reliable long-running agentic workflows.

Cost or risk

Durability is framed as a mandatory cost of admission, adding runtime complexity and infrastructure dependency to any agent process that outlives a request.

Durability is the cost of admission for long-running agentic workflows.
Open source video
Source video

Open questions

5

How is the bounded vocabulary of deterministic operations defined, versioned, and evolved without breaking in-flight late-bound sagas?

Why unresolved

The summary describes the bounded-vocabulary mechanism but gives no detail on registration, versioning, or schema evolution.

Research direction

Prototype a tool/operation registry with versioned contracts and test how running agent-composed DAGs behave when the vocabulary changes mid-flight.

Source video

Where exactly is the human-in-the-loop gate enforced — harness policy or agent plan — and how does that affect replay on resume?

Why unresolved

The summary lists human-in-the-loop gates and approvals as harness concerns but does not specify enforcement points or interactions with durability.

Research direction

Build a harness with approval gates and measure correctness of state replay across crash-and-resume with pending approvals.

Source video

What is the measurable safety delta between direct tool-calling agents and harness-mediated agents on irreversible operations?

Why unresolved

The deterministic/non-deterministic separation is argued architecturally but no empirical comparison or metric is provided.

Research direction

Construct a benchmark of irreversible-operation tasks (payments, rollbacks) and compare failure/hallucination rates for direct-tool vs harness-mediated execution.

Source video

How do retries, idempotency, and compensating actions interact when an agent-composed saga fails midway?

Why unresolved

Idempotency and retry ownership are assigned to the harness, but no compensation/recovery semantics for partially executed agent-composed plans are described.

Research direction

Model failure injection in late-bound sagas to determine which agent-chosen orderings require compensating transactions and how the harness decides retry vs rollback.

Source video

Does the microservice-orchestration analogy hold for multi-agent systems, or do new coordination failure modes emerge?

Why unresolved

The summary asserts the analogy without addressing multi-agent coordination specifics.

Research direction

Compare harness orchestration of multiple agents against microservice orchestration patterns under partial failure and contention.

Source video

Key claims

7
opinionVerification needed

An agent is a component that must be wrapped in an orchestration harness rather than being a standalone application.

Evidence

An agent is a component, not a full application.

Question

Do production agent deployments that adopt an explicit harness show better reliability/maintainability than monolithic agent applications?

Source video
causalVerification needed

Deterministic operations such as payments, provisioning, and rollbacks must be owned by code, not by the LLM.

Evidence

The agent has no business owning the deterministic half of the application.

Question

What measurable reduction in critical-operation failures results from moving deterministic execution out of the LLM loop?

Source video
opinionVerification needed

Durability is a mandatory requirement for long-running agentic workflows.

Evidence

Durability is the cost of admission for long-running agentic workflows.

Question

Which agent workflows actually require durable state resumption, and what is the observed cost of not having it?

Source video
factualVerification needed

Agentic workflows run over seconds to weeks rather than inside a single request.

Evidence

These applications don't run inside a request; they run for hours, days, or weeks.

Question

What is the real distribution of agent workflow durations in deployed systems?

Source video
causalVerification not requested

In late-bound sagas, planning is bound at runtime while operation guarantees are bound early.

Evidence

Bound late, over operations whose guarantees were bound early.

Source video
factualVerification needed

Most production agents are background workers, scheduled tasks, or event-driven actors rather than chatbots.

Evidence

Production agents operate as background workers, scheduled tasks, or event-driven actors without constant human supervision.

Question

What proportion of deployed agents are unattended/background versus interactive?

Source video
causalVerification needed

Allowing LLMs to improvise critical infrastructure or financial operations leads to hallucinations and catastrophic failures.

Evidence

Allowing LLMs to improvise critical infrastructure or financial operations leads to hallucinations and catastrophic failures.

Question

Under what conditions and at what rate does LLM improvisation on critical operations produce harmful actions?

Source video

Connections

5