{"id":822,"date":"2026-11-27T14:31:33","date_gmt":"2026-11-27T14:31:33","guid":{"rendered":"https:\/\/www.algofuse.ai\/blog\/green-ci-broken-agent-why-integration-tests-miss-live-agent-behavior\/"},"modified":"2026-11-27T14:31:33","modified_gmt":"2026-11-27T14:31:33","slug":"green-ci-broken-agent-why-integration-tests-miss-live-agent-behavior","status":"publish","type":"post","link":"https:\/\/www.algofuse.ai\/blog\/green-ci-broken-agent-why-integration-tests-miss-live-agent-behavior\/","title":{"rendered":"Green CI, Broken Agent: Why Integration Tests Miss Live Agent Behavior"},"content":{"rendered":"<p>The pipeline is green. Every integration test passed, the staging environment looks healthy, and the release goes out on Thursday. By Monday, a customer-facing agent has double-booked a dozen meetings, called a refund tool with a plausible but wrong amount, and burned through a week of token budget in a retry loop.<\/p>\n<p>Nothing in that story requires a bug in the traditional sense. Each API responded correctly. Each schema validated. The failure lived in the agent&#8217;s decisions, and decisions are exactly what integration tests were never built to examine.<\/p>\n<p>This article takes a specific angle: not &#8220;how to test agents&#8221; in general, but why the integration testing model itself carries assumptions that agents break. We will walk through each assumption, look at what the available data says about the gap, and finish with a practical test stack and checklist. A note on sources: many 2026 agent-reliability numbers come from vendor reports and secondary summaries, so treat them as directional signals rather than settled benchmarks. Where a figure is widely cited, we say who reported it.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/szukdzugaodusagltwla.supabase.co\/storage\/v1\/object\/public\/marketing-media\/f71482aa-ece0-4f48-be89-4a95e0933103\/f4a12196-ea85-4820-9460-03572b015dfc\/image\/1795789598172.png\" alt=\"Split-screen showing a tidy green CI pipeline versus a tangled live agent trajectory with warning nodes\" \/><\/p>\n<h2>Integration Tests Verify Contracts. Agents Make Decisions.<\/h2>\n<p>A classic integration test asks one question: when component A talks to component B, do they honor the agreed contract? The input is fixed, the expected output is known, and the assertion is an equality or a schema match. If it passes today, it passes tomorrow.<\/p>\n<p>That model is excellent for services. It tells you the payment API accepts the payload, the queue delivers the message, and the database returns the row.<\/p>\n<h3>What an agent adds on top<\/h3>\n<p>An agent sits above those contracts and chooses which one to invoke, in what order, with what arguments, and when to stop. Every one of those choices is made by a probabilistic model reading context. The contracts underneath can all be healthy while the choices are wrong.<\/p>\n<p>Consider the scheduling agent example that appears in several practitioner write-ups. The agent sometimes skipped the availability check and created meetings directly, producing double-bookings. The tool-level tests passed, because the calendar tool did exactly what it promised. Nothing tested whether the agent consulted availability first.<\/p>\n<h3>Syntactically valid, semantically wrong<\/h3>\n<p>This is the core category of agent failure: output that is well-formed and wrong. A refund of the wrong amount is still a valid integer. A summary that invents a clause is still valid text. Schema validation cannot see it, and a test that only checks &#8220;did the call succeed&#8221; will happily score it a pass.<\/p>\n<p>The gap, then, is not a coverage problem you can close by adding more of the same tests. It is a category problem: the thing that fails is not the thing being asserted on.<\/p>\n<h2>Non-Determinism Turns a Pass Into a Coin Flip<\/h2>\n<p>Traditional tests assume repeatability. Run the suite twice, get the same answer twice. Agents violate this at the root. Sampling, prompt changes, context ordering, and upstream model updates all mean the same input can yield different reasoning paths and different tool sequences.<\/p>\n<h3>One run tells you very little<\/h3>\n<p>A 2026 benchmark attributed to Microsoft, cited in an Atos summary, ran 507 business tasks repeatedly. The strongest model completed about 66.5% of tasks on a single attempt, but only 47.5% when the same tasks were repeated 20 times and success was required across runs. A separate cited result fell from 57% on one try to under 18% across 20.<\/p>\n<p>The exact figures matter less than the shape: single-run scores overstate reliability, sometimes dramatically. A CI job that executes each scenario once is sampling one path from a distribution.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/szukdzugaodusagltwla.supabase.co\/storage\/v1\/object\/public\/marketing-media\/f71482aa-ece0-4f48-be89-4a95e0933103\/f4a12196-ea85-4820-9460-03572b015dfc\/image\/1795789651745.png\" alt=\"Chart comparing 66.5% single-run success to 47.5% across 20 repeated runs\" \/><\/p>\n<h3>The 30% detection problem<\/h3>\n<p>One practitioner account describes an integration test that caught an unsafe behavior only about 30% of the time. The other 70% of CI runs were green. Teams then do what teams always do with flaky tests: rerun until it passes, or quarantine it. With deterministic software, a flaky test is noise. With agents, a flaky test is often the signal.<\/p>\n<h3>What to do instead<\/h3>\n<ul>\n<li>Run each scenario N times (10 to 20 is a common starting range) and report a pass rate, not a pass\/fail.<\/li>\n<li>Set thresholds on the rate, for example &#8220;at least 95% on safety-critical scenarios.&#8221;<\/li>\n<li>Treat any nonzero failure on a hard-constraint scenario (never delete, never email externally) as a blocker, regardless of average.<\/li>\n<li>Pin model versions and record sampling settings, so a change in rate can be attributed.<\/li>\n<\/ul>\n<h2>The Trajectory Blind Spot<\/h2>\n<p>Most integration tests look at the end state: the response, the record written, the status code. For an agent, the path matters as much as the destination, and the path is where the problems hide.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/szukdzugaodusagltwla.supabase.co\/storage\/v1\/object\/public\/marketing-media\/f71482aa-ece0-4f48-be89-4a95e0933103\/f4a12196-ea85-4820-9460-03572b015dfc\/image\/1795789708890.png\" alt=\"Agent trajectory diagram with a skipped availability check highlighted while the final output looks fine\" \/><\/p>\n<h3>What a trajectory contains<\/h3>\n<ul>\n<li><strong>Tool selection:<\/strong> did the agent pick the right tool, or hallucinate one that does not exist?<\/li>\n<li><strong>Argument validity:<\/strong> are the parameters correct and within policy, not just type-correct?<\/li>\n<li><strong>Step ordering:<\/strong> were prerequisites such as lookups and permission checks done first?<\/li>\n<li><strong>Retries and loops:<\/strong> how many calls were made, and did it stop when it should?<\/li>\n<li><strong>State retention:<\/strong> did it remember a constraint from step two at step nine?<\/li>\n<\/ul>\n<h3>Correct answer, costly path<\/h3>\n<p>An agent can reach the right answer through twelve unnecessary calls, or through an action that would have been unsafe had the data been slightly different. An end-state assertion passes both. Cost, latency, and risk exposure are all properties of the trajectory, and none show up in a final-output check.<\/p>\n<h3>Testing the path<\/h3>\n<p>Assert on the trace. Examples: &#8220;the availability tool was called before the create tool,&#8221; &#8220;no more than six tool calls for this task class,&#8221; &#8220;the refund argument equals the order total or less.&#8221; These are cheap to write once you capture structured traces, and they catch exactly the class of failure that tool-level tests miss.<\/p>\n<h2>Mocks Remove the Mess That Causes Failures<\/h2>\n<p>Integration tests for agents frequently mock the tools, because real calls are slow, costly, or side-effecting. Mocks return clean, predictable payloads. Production does not.<\/p>\n<h3>What production adds<\/h3>\n<ul>\n<li><strong>Ambiguous requests:<\/strong> users say &#8220;move my thing to next week&#8221; with no antecedent.<\/li>\n<li><strong>Malformed records:<\/strong> null fields, duplicate customers, inconsistent date formats.<\/li>\n<li><strong>Tool failures:<\/strong> timeouts, 429s, partial responses, and intermittent 500s.<\/li>\n<li><strong>Schema drift:<\/strong> an upstream team renames a field and the agent&#8217;s learned usage pattern quietly stops working.<\/li>\n<li><strong>Permission boundaries:<\/strong> the agent attempts an action the calling user cannot authorize.<\/li>\n<li><strong>Concurrency:<\/strong> two sessions modify the same record.<\/li>\n<\/ul>\n<p>An agent&#8217;s behavior under error is a decision problem. Does it retry, give up, fabricate a result, or ask the user? A mock that always succeeds never asks the question.<\/p>\n<h3>Make mocks hostile<\/h3>\n<p>If you keep mocks, give them fault injection. A wrapper that randomly returns errors, delays, empty results, and slightly malformed fields turns a happy-path suite into a stress test. Pair it with replayed real payloads (scrubbed of personal data) so the shapes reflect what production actually sends.<\/p>\n<h2>Errors Compound Across Steps<\/h2>\n<p>Multi-step workflows multiply small error rates. If each step is right 95% of the time, a ten-step task succeeds end to end roughly 60% of the time (0.95 to the tenth power is about 0.60). That arithmetic is simple, yet integration tests rarely reflect it because they validate steps in isolation.<\/p>\n<h3>Intermediate errors that do not announce themselves<\/h3>\n<p>A wrong lookup at step three does not throw an exception. It becomes the premise for steps four through ten, each of which behaves perfectly given its input. The final result is confidently wrong, and every individual component passes its own test.<\/p>\n<h3>Long context, lost state<\/h3>\n<p>Long-running sessions add another failure source: constraints stated early get diluted or dropped as context grows. Short integration scenarios never reach the context length where this appears. Include long-horizon scenarios in your suite, with constraints planted early and checked late.<\/p>\n<h2>Emergent Behavior in Multi-Agent and Multi-Tool Systems<\/h2>\n<p>Individually correct components can combine into incorrect systems. Two agents each doing the sensible thing can create a loop: one rewrites a record, the other detects a change and rewrites it back. A planner and an executor can deadlock waiting on each other. A new tool added to the registry can change which tool an unrelated task selects.<\/p>\n<h3>Why integration tests cannot enumerate this<\/h3>\n<p>Integration tests enumerate known interactions. Emergent behavior is, by definition, the set of interactions nobody listed. The test matrix explodes with each additional tool, and the model&#8217;s choices among them are not fixed.<\/p>\n<h3>Practical defenses<\/h3>\n<ul>\n<li>Hard budgets: maximum steps, tokens, wall-clock time, and spend per task.<\/li>\n<li>Loop detection on repeated identical tool calls.<\/li>\n<li>Regression runs of the full existing suite whenever a tool is added or a description changes, since tool descriptions are effectively prompts.<\/li>\n<li>Least-privilege credentials, so a wrong decision has a bounded blast radius.<\/li>\n<\/ul>\n<h2>What the Evidence Says About the Evaluation Gap<\/h2>\n<p>Several 2026 surveys point the same direction, though methodologies vary and some come from vendors.<\/p>\n<ul>\n<li>A VentureBeat survey, as summarized by others, reported that 52% of organizations running pre-deployment evaluations still saw a customer-facing agent failure afterward, and 30% saw more than one. Only 28% monitored whether agent answers were correct.<\/li>\n<li>Another summary reported that 89% of teams had agent observability, but only 52% ran offline evaluations and 37% evaluated live production traffic. About 29.5% evaluated nothing.<\/li>\n<li>A 2026 study of 306 practitioners and 20 case studies across 26 domains found teams struggled to adapt conventional regression tests to nondeterministic behavior and to cover enough runtime scenarios.<\/li>\n<li>One analysis cited performance dropping from 91% offline to 68% in production, attributing it to distribution shift, tool errors, coordination problems, and weak failure diagnosis. Treat that single number cautiously, since its provenance is thin.<\/li>\n<\/ul>\n<p>The consistent pattern is that teams can see their agents (observability) more often than they can judge them (evaluation). Seeing a trace is not the same as knowing it was a good one.<\/p>\n<h2>Production Signals Arrive Before Errors Do<\/h2>\n<p>Uptime-style monitoring watches for exceptions. Agents seldom throw them when they fail. A seven-month analysis of more than 100 monitored agents, reported by a monitoring vendor, found that quality, cost, and latency alerts preceded explicit errors. 89% of the agents triggered alerts, with a median first alert after about six days in production.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/szukdzugaodusagltwla.supabase.co\/storage\/v1\/object\/public\/marketing-media\/f71482aa-ece0-4f48-be89-4a95e0933103\/f4a12196-ea85-4820-9460-03572b015dfc\/image\/1795789775579.png\" alt=\"Agent monitoring dashboard showing cost, latency, and quality drift alerts\" \/><\/p>\n<p>Take that vendor framing with appropriate caution, but the six-day figure fits the intuition: a new agent meets reality quickly, and the first surprise is rarely a crash.<\/p>\n<h3>Signals worth alerting on<\/h3>\n<ul>\n<li><strong>Cost per task:<\/strong> sudden rises often indicate loops or over-calling.<\/li>\n<li><strong>Tool-call count distribution:<\/strong> a shifting tail signals changed behavior.<\/li>\n<li><strong>Latency percentiles:<\/strong> p95 growth hints at retries.<\/li>\n<li><strong>Quality scores:<\/strong> sampled LLM-as-judge or rubric scoring on live traffic.<\/li>\n<li><strong>Escalation and override rate:<\/strong> how often humans correct the agent.<\/li>\n<li><strong>Refusal and fallback rate:<\/strong> a drop may mean it is overreaching, a rise may mean a broken tool.<\/li>\n<\/ul>\n<h3>Judge with care<\/h3>\n<p>Automated judges are useful for scale but are themselves models. Calibrate them against a small human-labeled sample, and re-check the calibration periodically.<\/p>\n<h2>A Test Stack Built for Agents<\/h2>\n<p>None of this means throwing away integration tests. They still guard the contracts the agent depends on. They simply stop being the release gate for behavior. A layered approach works better.<\/p>\n<h3>Layer 1: Contract and tool tests<\/h3>\n<p>Keep deterministic tests for every tool: schemas, error codes, idempotency, and permissions. These are fast and should stay green always.<\/p>\n<h3>Layer 2: Scenario evals with repeated runs<\/h3>\n<p>Build a library of tasks with explicit success criteria, run each many times, and report rates. Include ambiguous requests, adversarial inputs, and fault-injected tools.<\/p>\n<h3>Layer 3: Trajectory assertions<\/h3>\n<p>Check ordering, call budgets, argument constraints, and forbidden actions on each trace. This layer is where the double-booking class of bug gets caught.<\/p>\n<h3>Layer 4: Shadow and canary in production<\/h3>\n<p>Run the new version in shadow mode against live traffic, comparing decisions with the incumbent without acting. Then release to a small percentage with automatic rollback on quality, cost, or override-rate thresholds.<\/p>\n<h3>Layer 5: The feedback loop<\/h3>\n<p>Every production failure becomes a regression case. Capture the trace, scrub it, convert it to a scenario, and add it to the suite so that the same mistake cannot return silently.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/szukdzugaodusagltwla.supabase.co\/storage\/v1\/object\/public\/marketing-media\/f71482aa-ece0-4f48-be89-4a95e0933103\/f4a12196-ea85-4820-9460-03572b015dfc\/image\/1795789831846.png\" alt=\"Loop from production failure to trace to regression case to release gate\" \/><\/p>\n<h2>A Practical Checklist and Where to Start<\/h2>\n<p>If you can only do a few things this quarter, order them by return.<\/p>\n<ol>\n<li><strong>Capture structured traces<\/strong> of every tool call, argument, and result. Everything else depends on this.<\/li>\n<li><strong>Convert your top five production incidents<\/strong> into repeatable scenarios.<\/li>\n<li><strong>Run scenarios multiple times<\/strong> and gate on pass rate, not a single pass.<\/li>\n<li><strong>Add hard budgets<\/strong> for steps, spend, and time, plus loop detection.<\/li>\n<li><strong>Write three trajectory assertions<\/strong> for your riskiest workflow, such as required lookups before writes.<\/li>\n<li><strong>Inject faults<\/strong> into tool mocks: timeouts, empty results, malformed fields.<\/li>\n<li><strong>Sample live traffic for quality scoring<\/strong> and alert on cost and override rate.<\/li>\n<li><strong>Use least-privilege credentials<\/strong> and require human approval for irreversible actions.<\/li>\n<\/ol>\n<h3>The mindset shift<\/h3>\n<p>Integration testing answers &#8220;does the system connect?&#8221; Agent evaluation answers &#8220;does the system decide well, repeatedly, under messy conditions?&#8221; Those are different questions with different instruments. Green CI is still necessary. It is just no longer evidence about the thing most likely to hurt you.<\/p>\n<h2>Conclusion<\/h2>\n<p>Integration tests miss live agent behavior because they were designed for deterministic components with fixed contracts. Agents introduce probabilistic choices, multi-step trajectories, error compounding, and emergent interactions, none of which a single-run, end-state, mocked test can observe.<\/p>\n<p>The fix is additive rather than a replacement: keep contract tests, then layer on repeated-run scenario evals, trajectory assertions, hostile mocks, production quality monitoring, and a loop that turns every live failure into a permanent test. Teams that treat production as the final, continuous test environment will find problems in days that a green pipeline would have hidden for months.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Integration tests check contracts, not decisions. Here is why agents pass CI and still fail in production, and the test stack that closes the gap.<\/p>\n","protected":false},"author":1,"featured_media":821,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[510],"tags":[575,80,574,576,548,577],"class_list":["post-822","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-automation","tag-agent-evaluation","tag-ai-agents","tag-integration-testing","tag-llm-reliability","tag-observability","tag-production-ai"],"_links":{"self":[{"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/posts\/822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/comments?post=822"}],"version-history":[{"count":0,"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/posts\/822\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/media\/821"}],"wp:attachment":[{"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/media?parent=822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/categories?post=822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.algofuse.ai\/blog\/wp-json\/wp\/v2\/tags?post=822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}