A customer support agent can answer one ticket in a single model call and spend several calls on another. A release comparison has to preserve that distinction. Otherwise, a percentage rollout can appear expensive merely because its users brought harder tickets.
Short answer: use a server-side feature flags API for basic toggles and percentage rollouts, poll for configuration changes, and record the actual flag decision alongside each agent loop's latency and accumulated call cost. Keep user targeting rules explicit in application code until their evaluation contract is verified. Judge the release on comparable support tasks and answer quality, with the loop as the unit of observation.
The result to aim for is an attributable comparison, not a dashboard full of individual calls. This experiment note describes a proposed measurement design; the numbers below are synthetic fixtures, not production results or vendor benchmarks. Its constraint is simple: a faster agent that stops before resolving the customer's issue hasn't passed the evaluation.
How should a feature flags API measure a percentage rollout?
It tells you how broadly you intend to expose a change.
It doesn't establish that exposed and unexposed tickets have comparable difficulty, or that the agent's answer improved.
For a notebook-to-prod support workflow, start with a bounded change: enable an extra retrieval step before composing a reply. Keep an eval set of support questions and their expected resolution criteria. Run the existing and proposed behavior against that set before expanding live exposure. This is where an eval-driven release earns its keep: latency and prompt cost become constraints on a useful answer, rather than substitutes for one.
The tempting simple approach is to compare average model-call duration before and after flipping a flag. That design loses the agent loop. A retrieval change might alter the number of calls, so faster individual calls could coexist with a slower completed ticket. Summing call durations also doesn't establish elapsed loop time when work overlaps. Measure elapsed time at the loop boundary and accumulate monetary cost separately from the calls it contains.
Preserve the denominator.
Keep the release decision fixed for that loop. Evaluate once at its entry, store the returned decision in the loop context, and let subsequent steps reuse it. If configuration changes halfway through a ticket, a record labeled only with the latest flag value cannot explain which behavior ran. This is an application design rule; it does not require claiming a particular vendor's targeting algorithm or hashing behavior.
User targeting deserves the same care. An application's eligibility rule might restrict the proposed retrieval step to a particular support queue. Record that eligibility separately from the rollout decision. Don't assume that a percentage control also supplies arbitrary user attributes, stable cross-service assignment, or a particular cohort identity contract. Those are verification questions before implementation, especially if one service receives the ticket and another runs the agent. For an Express entry point handing work to a Python agent, pass the captured decision with the job rather than independently assigning exposure in each runtime.
Keep one useful record per completed loop
Start by inspecting the flag response at the application boundary. This standard-library Python program makes a read-only request for an existing flag. Supply INFRAI_BASE_URL from your trusted deployment configuration, using the service's versioned API base, and set INFRAI_API_KEY and FLAG_KEY in the environment. The program prints the actual JSON response without guessing an undocumented response field or targeting parameter. It makes at most 5 attempts, honoring either form of Retry-After on rate-limited reads and otherwise using exponential backoff. Other HTTP errors retain their response body for diagnosis.
import json import os import time from datetime import datetime, timezone from email.utils import parsedate_to_datetime from urllib.error import HTTPError from urllib.parse import quote from urllib.request import Request, urlopen def retry_delay(header, attempt): if header: try: return max(0.0, float(header)) except ValueError: try: deadline = parsedate_to_datetime(header) return max( 0.0, (deadline - datetime.now(timezone.utc)).total_seconds(), ) except (TypeError, ValueError, OverflowError): pass return float(2 ** attempt) base = os.environ["INFRAI_BASE_URL"].rstrip("/") key = quote(os.environ["FLAG_KEY"], safe="") request = Request( f"{base}/flags/is_enabled/{key}", headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"}, method="GET", ) for attempt in range(5): try: with urlopen(request, timeout=15) as response: print(json.dumps(json.load(response), indent=2)) break except HTTPError as error: if error.code == 429 and attempt < 4: delay = retry_delay(error.headers.get("Retry-After"), attempt) error.close() time.sleep(delay) continue body = error.read().decode("utf-8", errors="replace") error.close() raise RuntimeError(f"HTTP {error.code}: {body}") from error Bind the verified response shape to the loop-entry decision in your application. Keep that adapter separate from measurement. The following local aggregation example uses application-owned field names, not a vendor response schema. Its enabled value represents a decision already captured at loop entry; this program does not implement flag evaluation or user targeting.
from collections import defaultdict from dataclasses import dataclass from statistics import mean @dataclass(frozen=True) class LoopRecord: task: str enabled: bool elapsed_ms: int call_costs_usd: tuple[float, ...] resolved: bool # Synthetic fixtures for checking the aggregation logic. records = [ LoopRecord("delivery_status", False, 800, (0.0010,), True), LoopRecord("delivery_status", True, 1050, (0.0010, 0.0006), True), LoopRecord("refund_exception", False, 2200, (0.0020, 0.0010), False), LoopRecord("refund_exception", True, 2500, (0.0020, 0.0014), True), ] groups = defaultdict(list) for record in records: groups[(record.task, record.enabled)].append(record) for (task, enabled), group in sorted(groups.items()): elapsed = mean(record.elapsed_ms for record in group) cost = mean(sum(record.call_costs_usd) for record in group) resolved = sum(record.resolved for record in group) print( f"{task} enabled={enabled} n={len(group)} " f"mean_elapsed_ms={elapsed:.0f} mean_cost_usd={cost:.4f} " f"resolved={resolved}/{len(group)}" ) Four records are enough to exercise grouping.
They are not enough to justify expanding a rollout. The monetary values are arbitrary test inputs, not service prices. Each record also represents a completed loop; a production measurement plan must account for abandoned, timed-out, and failed loops so that excluding them doesn't flatter the release.
The useful detail is the grouping key. It keeps delivery questions apart from refund exceptions and preserves the actual exposure decision. In the synthetic delivery pair, elapsed time rises from 800 ms to 1050 ms while both tickets resolve. The trade-off is extra retrieval time and model spend in exchange for a potential quality improvement on harder tasks; the delivery pair alone supplies no evidence of that improvement. Whether that trade-off is acceptable depends on the support team's resolution criteria and latency budget. The sample deliberately makes no verdict.
For real instrumentation, add an application-generated loop identifier, a release revision, the eligibility decision, and the evaluation rubric version. Keep identifiers out of aggregate metric dimensions when they would create one series per ticket; retain them in the detailed record used for investigation. Avoid copying customer messages into rollout labels. A compact decision record usually answers the attribution question more directly than another copy of the conversation.
Polling changes the interpretation of a release
With polling-based clients, a control-plane change and a running process's observation of that change are separate events. Record when the application obtained its configuration as well as which decision it applied. Choose a polling interval against your acceptable propagation delay, then test the actual delay across the processes that run support agents.
That delay matters during rollback too.
A timestamp saying “rollout changed” cannot replace the per-loop decision. Grouping tickets solely by wall-clock time around the change mixes processes that have observed different configuration. The same mistake can contaminate an eval comparison if a long-running worker starts a ticket using one configuration and reports its completion after another becomes current.
Don't solve this by collecting every intermediate event indiscriminately. Keep a concise loop summary and retain enough detailed call records to explain outliers. Prompt-cost awareness means asking which calls contributed to a resolved ticket, including retries and repeated retrieval, rather than treating a smaller prompt as an automatic win. For latency, inspect the distribution alongside task mix and sample counts; the tiny fixture's means are just a check of the program's arithmetic.
Choose tools by the evidence they must preserve
The comparison axis here is signal quality versus noise. A feature management product and an observability pipeline have different jobs. Before choosing either, write down which component owns exposure decisions, which stores their history, and which evaluates support outcomes. Requiring a single tool to answer all three questions can obscure the measurement contract.
LaunchDarkly, Unleash, and Flagsmith are three real alternatives worth evaluating through their respective documentation. Apply the same support-ticket example to each. The differences that matter are how the product represents targeting, where evaluation happens, how changes reach a running process, and what evidence remains when a ticket is investigated later. Avoid declaring a winner from a feature checklist without testing that path.
| Option | Evaluation focus for this support workflow | Decision boundary |
|---|---|---|
| LaunchDarkly | Examine its targeting model against the support queue's eligibility rules. | Choose it only after validating the required targeting and change-history workflow. |
| Unleash | Examine its activation strategies against the intended gradual release behavior. | Validate assignment behavior with your own user identifiers before comparing outcomes. |
| Flagsmith | Examine its identity and segment concepts against the application's targeting model. | Verify how the chosen evaluation arrangement reaches the agent workers. |
| A basic server-side flags API | Create or update a flag, check its state or value, and apply a percentage rollout. | Keep the scope to basic toggles and polling clients; supply outcome measurement in the application. |
Infrai fits the basic-flags option when one key, one wallet, and one bill across a unified API matter: 295 routes across 20 modules use a consistent REST API contract. Flags, AI calls, and metrics share that credential, reducing credential management and billing reconciliation as the support agent gains capabilities. Its specified per-call cost and latency metadata also gives the support-loop aggregator useful inputs; measure total elapsed loop time separately. That combination is relevant when taking an agent from notebook to production without assembling a separate integration for every backend task.
Keep the decision boundary narrow. Use this option for basic server-side toggles and percentage rollouts with polling clients. If release approval requires change-history review, evaluation analytics, dependent flags, or recoverable deletion, make those acceptance criteria for a dedicated flag platform. An application-owned loop record serves outcome attribution; it doesn't establish that every governance requirement has been met.
For the measurement side, compare Sentry, Datadog, and Grafana separately from the flag service. Sentry is a candidate when investigating application errors is the starting point; Datadog is a candidate when the agent's behavior needs to be examined alongside broader service telemetry; Grafana is a candidate when existing metric sources and dashboards already anchor the team's investigations. These are selection priorities, not claims that any product is confined to one task. Test each candidate with the same loop identifier, exposure decision, and support-task grouping. A product demo that shows fast individual calls still hasn't demonstrated your completed-ticket measurement.
Measure this before expanding exposure
Carry the same eval rubric from the notebook into the release decision. Compare resolution outcomes, elapsed loop latency, accumulated call cost, and the number of observations within each support-task group. Include incomplete attempts in the accounting. Inspect whether exposure groups contain comparable tasks before interpreting a difference as an effect of the retrieval change.
Then test propagation.
Record the configuration observation time and actual decision at loop entry on every worker used in the trial. Check that the decision survives the handoff from the request handler to the agent, remains fixed through the loop, and can be joined to its outcome. Set acceptable quality, latency, and cost budgets before reading the comparison. A percentage rollout controls exposure; this measurement contract determines whether expanding it is justified.
References
The references below provide feature-toggle design context and starting points for comparing the named alternatives. Product documentation should be checked against the deployment and plan being considered.
