<- Back to all posts

Langoedge Blog

Reliable LLM Agents: Memory, Sandboxed Tools and Testing Before Launch

Arnab Chakraborty, Founder, LangoedgeUpdated Oct 25, 20269 min read

A reliable LLM agent is one that still does the right thing after the conversation gets messy: a customer corrects an earlier answer, a step needs to run code nobody reviewed in advance, or the call hits an edge case nobody scripted for. None of that is about picking a smarter model. It's three separate engineering problems — how state is kept, how dynamic logic is contained, and how you find out something's broken before a customer does — and each one fails in its own specific way if it's skipped.

Key facts

  • OWASP's GenAI Security Project published the first Top 10 for Agentic Applications on 9 December 2025, treating tool misuse and credential/privilege abuse as distinct, first-class risks of giving a model the ability to act — not variants of a chatbot just saying the wrong thing.
  • A 2026 testing report from Cekura, which runs scripted and adversarial calls against production voice agents, found first-attempt task completion of 87.80%–97.56% across seven provider configurations, but reliability on the same scenario repeated three times fell to 30.49%–75.61%. Its own conclusion: "one passing test call does not predict production behavior."
  • Overwriting a state variable instead of appending to it is a common, quiet cause of agents that "forget" a correction a customer already made.
  • Letting a model write code to solve a problem and letting that code touch a filesystem or a socket are two different permissions, and conflating them is how a sandbox stops being one.

Reliability breaks at three specific points

Most "best practices for LLM agents" content treats reliability as one undifferentiated quality — write better prompts, add more guardrails. In practice it splits into problems that don't share a fix. Credential exposure and tool misuse — the two risks OWASP's Top 10 for Agentic Applications names as ASI03 and ASI02 — are about what an agent is allowed to do and who can see the keys; we've covered that ground in detail in secure LLM tool calling: keeping credentials out of the model's context. This post is about the other three failure points: an agent losing track of what already happened, an agent running code with no real boundary around it, and an agent whose first real test is a paying customer.

Memory that survives a correction, not just a conversation

The common way to design agent state is as a set of variables the next step overwrites: appointment_day = "Tuesday", then later appointment_day = "Wednesday". It's the obvious design, and it has a specific failure mode — the moment a customer changes their mind, the system has no record that a change happened at all, only the latest value. An agent asked "wait, didn't I originally want Tuesday?" has nothing to answer with, because Tuesday was deleted, not superseded.

Langoedge's state model avoids this by making state fields append-only rather than overwritable: every time a node writes to a field, the new value is added to a running list rather than replacing what was there, via what the framework calls a reducer. The customer's original "Tuesday" and the later "actually, Wednesday" both stay on the record, in order, so a later node (or the model itself, scanning the history) can see that a change happened, not just what the current value is.

flowchart TD A["Customer: book Tuesday"] --> B{"How does the agent store it?"} B -->|"Overwrite"| C["appointment_day = Tuesday"] B -->|"Append"| D["appointment_history = (Tuesday)"] C --> E["Customer: actually, Wednesday"] D --> E E --> F["Overwrite path: appointment_day = Wednesday — Tuesday is gone"] E --> G["Append path: appointment_history = (Tuesday, Wednesday) — both turns on record"] F --> H["🤷 Agent can't answer 'wait, what did I say first?'"] G --> I["✅ Agent can reference the correction and when it happened"] style A fill:#2a78d6,stroke:#2a78d6,color:#fff style B fill:#4a3aa7,stroke:#4a3aa7,color:#fff style C fill:#eb6834,stroke:#eb6834,color:#fff style D fill:#1baf7a,stroke:#1baf7a,color:#fff style F fill:#eb6834,stroke:#eb6834,color:#fff style G fill:#1baf7a,stroke:#1baf7a,color:#fff style H fill:#e34948,stroke:#e34948,color:#fff style I fill:#1baf7a,stroke:#1baf7a,color:#fff

Both paths handle the happy path identically. They only diverge the moment a customer changes their mind — which is precisely when an agent needs its memory to be good.

The same append-only history doubles as an audit trail: because nothing is deleted, a developer debugging a bad outcome can read back exactly which node wrote which value and when, rather than trying to reconstruct a deleted variable's past from logs.

Let the model write code, not touch the machine

Some tasks are easier to solve by having the model write and run a short script than by pre-building a tool for every possible calculation a user might ask for. That's useful, and also exactly the kind of capability that becomes dangerous the moment "run some code" quietly becomes "run arbitrary code with arbitrary access."

Langoedge's Code Sandbox tool draws that line explicitly rather than leaving it to convention: the runtime blocks direct filesystem writes, network socket binding, raw system commands (os.system and equivalents), and environment-variable modification, while allowing data calculations, statistical modelling, plotting, string parsing and clean package imports. A model asked to work out a compound-interest schedule, or to turn a table of monthly figures into a chart, can write and execute that code freely; a model asked (whether by a legitimate request or a manipulated one) to write to disk or open a socket can't, because the capability isn't there to misuse, not because a prompt told it not to.

flowchart TD A["🧠 Model writes Python to solve a task"] --> B{"Does the code touch a blocked operation?"} B -->|"Yes — filesystem write, socket bind, os.system, env mutation"| C["🚫 Rejected before execution"] B -->|"No — calculation, stats, plotting, parsing, clean imports"| D["▶️ Executes in an isolated, short-lived runtime"] D --> E["📊 Result returned as text, or an image URL if a plot was generated"] style A fill:#2a78d6,stroke:#2a78d6,color:#fff style B fill:#4a3aa7,stroke:#4a3aa7,color:#fff style C fill:#e34948,stroke:#e34948,color:#fff style D fill:#1baf7a,stroke:#1baf7a,color:#fff style E fill:#1baf7a,stroke:#1baf7a,color:#fff

The boundary is enforced by what the runtime will execute, not by asking the model nicely to stay inside it.

You don't know it's reliable until you've tried to break it

A model that handles every scenario you personally thought to test is not the same thing as a reliable agent — it's an agent that's untested against everything you didn't think of, which in a live deployment is usually most of what actually happens. Cekura's 2026 testing report makes the scale of that gap concrete: the same seven voice-agent configurations that completed 87.80%–97.56% of bookings correctly on a single attempt dropped to 30.49%–75.61% reliability when the identical scenario was run three times. A demo call going well is close to no evidence at all about whether the hundredth call will.

Langoedge's own Voice Evaluation system is built around not trusting a single good call either. It reads the system prompts already written on a Voice Graph's nodes and auto-generates a set of test scenarios — typically three to six, covering main paths, edge cases and failure modes — each with a synthetic caller persona (communication style, emotional state, how it reacts when interrupted or when the agent slips up) and a scenario goal with its own mock data. Launching a simulation drops that synthetic caller into a live session against the real agent — same nodes, same tools, same transitions production calls would hit — and the resulting transcript lands in the same session history as real calls, scored by the same LLM-as-judge evaluators, tracked as an Intelligence Score, a Success Rate and an Audit Coverage metric over time.

This is a different layer from the two reliability mechanisms we've covered elsewhere on this blog, not a restatement of either: self-reflecting agents check a single node's own output against an evaluator mid-task, inside one call; LLM-as-judge evaluation grades calls that already happened, after the fact. Simulation tests an agent against calls that haven't happened yet, deliberately adversarial ones, before any real customer is on the line.

What "reliable" doesn't mean

None of this amounts to a guarantee. A sandboxed code tool stops a model from writing to disk; it doesn't stop a model from writing code that calculates something wrong. An append-only state history stops an agent from forgetting a correction; it doesn't stop an agent from misinterpreting one. A simulation suite built from three to six generated scenarios tests the paths someone (or some generation prompt) thought to cover — Cekura's own point stands in the other direction too: passing simulated tests is better evidence than a single demo call, but it's still not the same as a live production track record. Treat each of these as a design discipline that removes a specific, known failure mode, not as a certification that nothing is left to go wrong.

FAQ

What makes an LLM agent "reliable" rather than just functional?

A reliable agent keeps an accurate record of what's already happened in a conversation (so corrections aren't silently lost), contains any dynamic code it runs to operations that can't cause damage even if misused, and has been tested against adversarial, synthetic scenarios before a real customer is the first person to find an edge case.

Why does overwriting a state variable cause problems?

Overwriting replaces the old value with the new one, leaving no record that a change happened. If a customer corrects an earlier answer, an agent built on overwritten state has no way to reference what was said originally or explain what changed — only the latest value survives.

Is letting a model write and execute its own code safe?

It can be, if the execution environment — not the prompt — enforces what the code is allowed to touch. Langoedge's Code Sandbox tool blocks filesystem writes, socket binding, raw system commands and environment-variable changes at the runtime level, so a model can solve genuinely dynamic problems (calculations, data transforms, plotting) without being able to misuse that capability even under a manipulated prompt.

How do you test an AI agent before real customers start calling it?

By generating adversarial synthetic callers — personas with a goal, an emotional state and realistic imperfections — and running them against the live agent in a real session, the same way Langoedge's Voice Evaluation simulation feature does. Scoring those transcripts with the same LLM-as-judge evaluators used on production calls means a pre-launch test and a real customer call are directly comparable, not graded on different scales.

Does passing every simulated test mean an agent is production-ready?

It means an agent has survived the scenarios that were generated or written for it, which is a meaningfully higher bar than a single good demo call — Cekura's testing found reliability on repeated identical calls can be dramatically lower than first-attempt success, even for configurations that looked fine on one run. It is not a guarantee against a scenario nobody wrote.

Sources


About the author. Arnab Chakraborty is the founder of Langoedge, a Melbourne company building voice and text AI agents on LangGraph with direct SIP telephony. Disclosure: the state, sandbox and evaluation mechanics described here are Langoedge's own architecture.