Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

- TestMu AI (Formerly LambdaTest)
- /
- Blog
- /
- Building Deterministic Infrastructure for Non-Deterministic AI Agents [Testμ 2026]
Building Deterministic Infrastructure for Non-Deterministic AI Agents [Testμ 2026]
Nishant Gupta of Meta on the patterns that keep probabilistic AI agents safe in production: tool contracts, policy gates, budgets and replayable traces.

TestMu AI
Author
Published on:
A deployment agent sees a failed rollout. A human engineer would stop and ask why it failed. The agent retries, triggers a rollback, fires off extra diagnostic queries, and takes a second service down with it.
In this session from Testμ Conf 2026, Nishant Gupta, Staff Software Engineer and Tech Lead at Meta, treats that outcome as an infrastructure problem rather than a model problem. His talk is framed as an engineering playbook for letting a probabilistic component operate safely inside a deterministic production system.
If you couldn’t catch all the sessions live, you can access the recordings at your convenience by visiting the TestMu AI YouTube Channel.
TL;DR
Deterministic infrastructure for AI agents means wrapping a probabilistic model in a runtime that owns validation, execution, retries, and recording. The model proposes a plan and the infrastructure decides what actually runs. The approach assumes the model will sometimes be wrong rather than waiting for it to become reliable.
- Model proposes, infrastructure disposes - The model turns natural language intent into a candidate plan, and the runtime owns validation, execution, retries, and recording. It is the discipline already applied to untrusted API clients, with extra controls because the caller is probabilistic.
- Agent failure modes - Wrong action, retry storms, cost spirals, and silent success. The ingredients are familiar from distributed systems; what is new is ambiguous planning combined with self-directed tool selection.
- Tools as contracts - A tool call needs a JSON schema, required fields, semantic validators, idempotency keys, rate and spend limits, side-effect classification, and a defined rollback path. The schema is a contract boundary, not only a safety layer.
- Zero trust action model - A model’s intent is never sufficient authorization. Action requests are evaluated against identity, tenant boundaries, tool risk level, data classification, change window, and policy, and the agent never receives raw production credentials.
- Chatbot evals vs agent evals - A chatbot eval asks whether the answer was good. An agent eval asks whether the system chose the right tool, respected permissions, stopped when blocked, recovered from partial failures, and stayed inside cost and latency budgets.
- Budgets as safety signals - Token, step, wall-clock, fan-out, and spend limits double as confusion detectors. An agent that loops or keeps expanding context should stop, summarize its state, and escalate rather than keep reasoning.
Nishant opened with the shift that makes this a live problem rather than a theoretical one.
From Text Output to Real Actions
Two or three years ago, models mostly returned text. A human read the output, copied what was useful, and made the decision, so failures were visible before anything changed state.
In the agentic setup, the model is a decision-making component wired to real tools. It selects the tool, the runtime executes the action, and a wrong decision can mutate infrastructure, change data, move money, or affect critical customer state.
Nishant was clear that the goal is not a deterministic model. Temperature controls and structured outputs help, but the model remains a probabilistic planner, so the engineering job is to place it inside a deterministic execution envelope.
"The agent can reason probabilistically. The system must execute predictably."
— TestMu AI (@testmuai) August 19, 2026
Been waiting for models to get reliable enough to trust with real actions? Nishant Gupta's take at hashtag#TestMuConf26: wrong thing to wait for. Wrap determinism around the model instead.
Reasoning… pic.twitter.com/mlYNQexqCL
His test for whether that envelope exists is a set of questions an engineer should be able to answer after any agent run:
- What did the agent believe when it was executing, and what action did it request?
- What schema did that action satisfy, and what policy allowed the decision?
- Which tools did it have access to, and which did it actually execute?
- What state changed, and how would you replay or roll back the workflow?
He condensed that into a production rule: every agent action should be reconstructible as a typed request, together with a policy decision, a tool result, and a durable state transition.
How Agents Break in Production
Nishant argued that every production architecture should be driven by the incidents it has to survive, so he started with failure modes rather than capabilities.
- Wrong action - the agent picks a tool that is valid but inappropriate for the situation it is actually in.
- Retry storms - a failed call is reattempted without a bound, multiplying load on an already degraded system.
- Cost spiral - the loop keeps expanding context and fanning out, and spend climbs with no ceiling.
- Silent success - the run reports completion while the underlying outcome was never achieved.
None of those ingredients are new. Software systems have had retries, state machines, and permissions for decades, and what agents add on top is ambiguous planning and self-directed tool selection.
The rollout example makes the composition concrete. With unbounded retries and broad permissions, an ambiguous failure stops being a contained error and becomes a cascading incident for the organisation.
Sources of Non-Determinism
Non-determinism is not only a question of random seeds. Nishant mapped the points where it enters an agentic system: prompt context, external tool calls, concurrent execution, state compaction when the context window is close to full, and human feedback.
Those points sit inside an orchestrator loop. Model output leads to tool execution, tool output is fed back into the model, and the loop continues, with every step offering another place for uncertainty to amplify.
The exercise he recommended is to ask, at each layer, where the deterministic contract lives:
| Layer | Deterministic contract |
|---|---|
| Prompts | Task specifications that fix what the model is being asked to do, rather than free-form phrasing that drifts between runs. |
| Tools | A JSON schema plus an explicit permission scope, so the shape of the call and the reach of the call are both bounded. |
| State | Append-only event logs and idempotency keys, so a repeated action does not produce a second effect. |
| Humans | Approval records and an escalation policy, so the handoff to a person is itself an auditable event. |
Asking those questions layer by layer, he said, reduces non-determinism to a very small residue rather than eliminating it outright.
The Deterministic Shell
The core architectural idea of the talk is a shell placed around the agent. The model transforms natural language intent into a candidate plan, and the runtime owns the semantics of validation, execution, retries, and recording.
Nishant drew the analogy to ordinary distributed systems practice. A client is not trusted to mutate databases directly, so the design puts APIs, an authorization layer, idempotency, transactions, and audit logs in the way.
An agent deserves the same discipline, with additional controls layered on because this particular caller is probabilistic. That splits responsibilities cleanly between the two halves of the system.
- The model - proposes a plan, explains its reasoning, and adapts when circumstances change.
- The infrastructure - constrains the output, executes it, verifies the result, persists the record, and escalates to a human when required.
Eight Patterns for Agent Infrastructure
The middle of the session worked through eight patterns that turn the shell from a diagram into something a team can build.
1. Workflows Before Autonomy
Nishant treats autonomy as a reliability budget to be spent only where it creates value. Most enterprise workflows do not need the agent deciding every next step.
What they need is a deterministic workflow with occasional model calls for classification, synthesis, ranking, or planning proposals. Autonomy is a knob, not the default architecture.
2. Every Tool Is a Contract
Constraining model output to a JSON schema is the starting point rather than the whole job. Required fields, semantic validators, and dry-run previews with idempotency keys all sit on top of it.
The parts teams most often skip are rate and spend limits, side-effect classification, and a defined rollback or compensation path. Treating the schema as a contract boundary rather than a safety layer is what makes those enforceable.
3. Deterministic and Boring Retries
Retries in distributed systems are simple until they are not, and agents make them harder. A model can read a failed tool result and generate a new plan that looks like a retry while being semantically different.
So retries route through the orchestrator. The model may request a retry or propose a fallback, and the runtime makes the final call because it holds the retry budget, knows whether the call is idempotent and the failure retryable, and knows whether a human needs to approve the next step.
4. Human Approval Gates
Reading, summarising, and classification can be auto-approved. Security, financial, legal, and regulated actions should route to a human, and often to two-person approval, according to policy.
A gate that only says the agent wants to proceed is a rubber stamp. Nishant listed what it should actually surface: the plan, the changes relative to current production, the evidence justifying them, the policy checks, the expected side effects, the rollback path, and the confidence.
He framed the placement as a product design question. Put humans where judgment and accountability matter, because approving every trivial step destroys the value of automation and adds operational toil.
5. Zero Trust Action Model
Applying zero trust to agents means the model’s intention never counts as authorization. The runtime evaluates each action request against user identity, tenant boundaries, tool risk level, data classification, change window, rate limits, and policy.
The mental model is policy as code. The model produces an action request, a validator builds a policy input document, and the policy engine returns allow, deny, require approval, or request more context.
The agent cannot route around any of it, because it never receives raw credentials or the authorization needed to mutate production directly.
Note: Agent evals only work if something scores the behaviour. TestMu AI Agent Testing runs autonomous testing agents against chat, voice, and phone agents and scores them on hallucination, bias, completeness, and context awareness. Try it free!
6. Evals as Release Gates
Evaluation for agents has to include the environment, not just the output. A chatbot eval asks whether the answer was good, which is a much narrower question.
An agent eval asks whether the system chose the right tool, respected its permissions, stopped when it was blocked, recovered from partial failures, asked for human approval when required, and stayed within its cost and latency budgets.
His bar for shipping is that no agent goes out unless it passes the normal software tests plus adversarial tool-use scenarios and rehearsed rollback and escalation drills.
7. Observability for Decisions
Traditional observability covers latency, errors, saturation, and logs. Agent observability needs all of that plus semantic traces: what the agent saw, how it interpreted the task, what plan it produced, which tools it chose, which policies ran, and what it believed the outcome was.
A usable incident console should be able to attribute a failure to prompt context, model reasoning, tool behaviour, a policy denial, human delay, or an external service. Without that, teams blame the model for infrastructure problems and the infrastructure for model problems.
The design question he puts to any dashboard is whether it can answer why the agent took a particular action.
8. Budgets as Safety Signals
Nishant reframed cost as a safety signal rather than a finance concern. An agent that loops, fans out, or keeps expanding context is not only expensive, it may be confused, stuck, or operating outside the intended workflow.
The practical controls are token budgets, step budgets, maximum wall-clock time, fan-out limits, retry caps, and a ceiling on spend.
What matters is the behaviour on exhaustion. The correct response is not to keep reasoning but to stop, summarise the current state, and escalate with a clear next-action plan a human can review.
Reference Architecture for an Agent Runtime
Nishant then assembled the patterns into a reference runtime, reading left to right:
- User intent enters as a normalised task envelope.
- The planner proposes bounded steps rather than an open-ended plan.
- The validator checks schema, tool availability, and semantic constraints.
- The policy engine decides whether to allow, deny, request more context, or require approval.
- The tool broker mints credentials scoped to that agent and that action, executing in a sandbox wherever possible.
- Every step is written to an append-only trace and state store.
He drew out three properties that fall out of the design. The security property is that the model never directly holds broad production credentials.
The reliability property is that orchestration state, retries, and verification are owned by deterministic services. The operational property is that every agent run is replayable enough to debug and audit.
Comparing the two paths for a deployment remediation agent makes the point sharply. The unsafe path hands the agent broad credentials and treats each model response as a command, while the deterministic path treats each response as a proposal that a validator, policy engine, approval gate, idempotent executor, and verifier each narrow.
The model can be identical in both paths. The production outcome differs because the execution fabric differs, which is the argument for infrastructure-first agent safety.
Progressive Autonomy
The rollout model Nishant has been using follows a graded path: suggestions first, then drafts where the agent prepares artifacts or commands, then dry runs, then approval-gated production, and finally tightly bounded atomic execution.
Jumping straight from chatbot to autonomous production operator skips every stage where you would have learned something. Each promotion should clear objective criteria rather than a product decision.
- Eval results - the agent passes its evaluation suite at the current stage before moving up.
- Observed incident rate - real incidents attributable to the agent stay within an acceptable band.
- Approval rate - human reviewers are agreeing with the agent’s proposals often enough to justify loosening the gate.
- Rollback success - reversals work when they are needed, not just in theory.
- Budget stability - token, step, and spend budgets hold steady rather than drifting upward.
- Audit completeness - traces are complete enough to reconstruct what happened.
Framed that way, autonomy is an operational maturity level rather than a launch switch.
Q & A Session
The session ran to time without a live Q&A, and host Kavita Joshi, Senior Marketing Specialist at TestMu AI, closed by directing audience questions to the TestMu AI community channels. These are the questions the talk itself sets up, and how Nishant answered them.
- Should teams wait for models to become deterministic?
Nishant: No. Design the surrounding infrastructure as if the model will be probabilistic, occasionally wrong, and sometimes overconfident. Even with temperature control and structured outputs, the model is still a probabilistic planner, so the engineering goal is to place it inside a deterministic execution envelope rather than to fix the model.
- What makes agent failures different from ordinary software failures?
Nishant: The ingredients are familiar, since software systems already have retries, state machines, and permissions. Agents add ambiguous planning and self-directed tool selection on top. A failed rollout that would make a human stop and ask why can instead trigger an agent to retry, roll back, and run extra diagnostics until an ambiguous failure becomes a cascading incident.
- Where should a team start if agents are already in production?
Nishant: Start with two checklist questions. Are retries centralised, bounded, and idempotent, and can you replay a trace from intent through the policy decision and tool result to the final outcome? A safe agent platform is not a better prompt; it is a runtime, a policy layer, a workflow engine, and an operating model.
His closing takeaway was that the future of agents is systems engineering rather than model work alone, and that autonomy should evolve gradually behind valves, canaries, approvals, and rollbacks. Agents can be creative in planning, but never creative in production control.
Kavita closed the session on the same note, observing that determinism has to live in the infrastructure rather than the model.
This session was part of day one of Testμ Conf 2026, which ran across three days of sessions on agentic engineering and quality. Registrations for the next edition are already open on the Testμ Conference 2027 page.
Author
TestMu AI is World's First Full Stack AI Agentic Quality Engineering platform that empowers teams to test intelligently, smarter, and ship faster. Built for scale, it offers a full-stack testing cloud with 10K+ real devices and 3,000+ browsers. With AI-native test management, MCP servers, and agent-based automation, TestMu AI supports Selenium, Appium, Playwright, and all major frameworks. AI Agents like HyperExecute and KaneAI bring the power of AI and cloud into your software testing workflow, enabling seamless automation testing with 120+ integrations. TestMu AI Agents accelerate your testing throughout the entire SDLC, from test planning and authoring to automation, infrastructure, execution, RCA, and reporting.
Did you find this page helpful?
More Related Blogs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests



