Tag: observability

  • Build CX Scores You Can Defend: My 5-step playbook for transparent, trustworthy AI metrics

    Build CX Scores You Can Defend: My 5-step playbook for transparent, trustworthy AI metrics

    “You don’t have to trust the algorithm; you can see exactly why a conversation earned the score it did.”

    We recently shared how we redesigned CX Score to deliver deeper, more actionable insights across every conversation. The most common follow-up from support leaders was simpler and incredibly important: “Can I trust it?” It’s the right question—and it’s the one I use as my own bar for whether a metric is ready for the C‑suite.

    CS teams are the subject matter experts on customer experience. They understand the nuance of what customers feel, the context behind every interaction, and the difference between a technically resolved issue and a genuinely satisfied customer. I’ve learned, conversation by conversation, that any metric we ship has to capture that nuance at scale—or it doesn’t deserve to be used.

    We built CX Score to give support teams a complete view of how their customers feel across every conversation. It surfaces what’s working, what’s not, and why—so leaders can communicate impact clearly and drive change across support, product, and the wider business.

    Interface card displaying 'CX Score: 2' summarizing a case where repeated CSV export attempts failed, frustrating the customer; the AI agent explains the issue and requests more details; rounded gradient border.
    A CX Score in action: repeated CSV export failures trigger a low score and customer frustration, while the AI agent clarifies next steps and gathers details—turning raw signals into actionable support insights.

    Here’s exactly how I approached building a trustworthy metric that support leaders can inspect, explain, and defend.

    1) It’s grounded in how support teams define quality. I started with how experienced support professionals actually evaluate conversations—collecting real examples of strong, mixed, and poor interactions across industries, identifying the specific factors that shape overall experience, and writing plain-English rules for each. The result: CX Score applies the same criteria a trained support professional would use, not generic LLM assumptions.

    2) It’s aligned with human judgment. We created a dataset of thousands of real customer conversations spanning multiple industries, languages, channels, and agent types. Each was manually reviewed by experienced support professionals—with two reviewers per conversation where possible and disagreement resolution to create stable consensus labels. The result: CX Score is trained and tested to behave like an expert reviewer, not a language model making broad guesses.

    Analytics dashboard visualizing a CX Score with KPI cards and a Sankey performance funnel linking support channels to AI involvement, resolutions, and positive, neutral, or negative outcomes.
    A modern CX analytics view shows how conversations flow from chat, email, and mobile into AI assistance, then to resolutions and sentiment outcomes—turning messy support data into a single, defensible CX Score.

    3) It’s engineered by AI specialists. CX Score isn’t a prompt attached to an LLM. It’s a production system built by Intercom’s AI Group: 37 ML scientists and 350 engineers whose full-time focus is AI for customer service. The system includes specialized handling for long transcripts, model configuration tailored for support language and subtle sentiment, prompt engineering designed to default to neutral when evidence is weak, and a multi-stage evaluation pipeline that checks for precision, consistency, and reliability. The result: A metric built by a team that understands LLM behavior in production support environments, where accuracy and consistency matter most.

    4) It’s validated statistically, not qualitatively. Trust requires measurement, not vibes. We tested CX Score across standard ML metrics: Precision (when the model flags a negative experience, how often do humans agree?), recall (how many human-identified issues does it catch?), and F1 score (the balance between both). We set an explicit bar: F1 above 0.8, representing high agreement with human judgment. We reran these evaluations through every revision, checking for regressions or biases, and I focused especially on negative experiences, because a false negative hides a real problem. The result: CX Score meets a measurable standard before it ships—not a gut check, a statistical requirement.

    5) It was battle-tested with real customers. Lab accuracy isn’t enough. Customer environments are messy: Varied ticket types, mixed languages, unpredictable edge cases. Before release, we ran a multi-phase field test—shadow-scoring conversations with both old and new models, validating sensible behavior across agent type and conversation length, then rolling out to a controlled customer group who confirmed the scores felt right, reasons were clear, and insights were actionable. The result: CX Score shipped because real teams told us it made sense in practice, not because it passed internal tests.

    Donut chart of CX categories beside a chat UI showing a CX Score of 3 with a 'Negative policy feedback' tag, highlighting policy feedback, answer quality, customer effort, and emotion.
    From conversation to clarity: this visual maps the drivers behind a CX Score. Explore how policy feedback, answer quality, and effort combine to produce defendable insights support leaders can act on.

    The importance of explainability. One of the most critical choices I made was ensuring CX Score isn’t a black box. Every score comes with clear reasons, concrete excerpts, and a short explanation of what influenced the rating. This turns the metric into something you can inspect, audit, and explain to executives. You don’t have to trust the algorithm. You can see exactly why a conversation earned the score it did.

    A metric that evolves with your business. Customer expectations shift. Products change. AI improves. A trustworthy metric can’t be static. CX Score evolves with the same commitments that shaped its redesign: Evaluate the real signals that shape customer experience, keep the logic simple and interpretable, and ensure leaders can make clear decisions from it. It’s built to be a durable source of truth across every conversation.

    The takeaway. In a world where products look the same and AI can generate any interaction, customer experience is one of the few differentiators that actually matters. Support leaders have built that expertise conversation by conversation. What they’ve lacked is a measurement system that could validate it at scale—one that’s reliable enough to report to the C-suite, explainable enough to defend in strategy meetings, and rigorous enough to drive real decisions. That’s what CX Score is designed to be: A metric that reflects the reality support leaders see every day, backed by the technical rigor to make it credible everywhere else.

    Want to see CX Score in your workspace? Ask your admin to enable it for your team, and start using explainable AI insights to improve customer experience and coach with confidence.


    Inspired by this post on The Intercom Blog.


    Book a consult png image
  • Building Reliable AI Agent Systems: A Product Leader’s Playbook

    Building Reliable AI Agent Systems: A Product Leader’s Playbook

    Your AI agent performs beautifully in a controlled demo. Then real users arrive with incomplete instructions, stale records, missing permissions, ambiguous goals, and requests that cross the boundary between drafting something and actually changing the business.

    The answer is rarely a longer prompt or a newer model. A reliable agent is a product system: a bounded workflow with trusted context, constrained tools, explicit verification, measurable release gates, and a safe way to stop. Build those pieces together and you can increase autonomy without losing control of quality, cost, or risk.

    Start with a reliability contract, not an agent architecture

    Before discussing models, memory, orchestration, or frameworks, define the job the agent is accountable for completing. “Answer customer questions” is too vague. “Resolve an eligible billing question using approved account and policy data, record the result, and escalate when authorization or evidence is missing” is a testable contract.

    This distinction separates output from outcome. A fluent answer is output. A correctly changed business state is an outcome. The useful metrics therefore sit at the workflow level: resolution rate, time to a verified result, cost per completed task, qualified pipeline influenced, or another measure tied to the user’s job. That outcome-first capability design should happen before anyone selects a model.

    Contract fieldDecision you must makeEvidence the system must retain
    OutcomeWhat real-world state counts as completed?The accepted artifact, updated system record, or verified tool result
    ScopeWhich intents, data, tools, and actions are allowed?The classified intent, permission decision, and tools invoked
    Quality barWhat must be correct, grounded, complete, and timely?Evaluation results and postcondition checks for the task
    Stopping conditionWhen must the agent ask, refuse, or hand off?The missing evidence, policy conflict, failed tool call, or risk trigger
    RecoveryHow can a failed or interrupted run be resumed or reversed?Run state, committed actions, pending actions, approvals, and rollback path

    The stopping condition deserves as much product attention as the happy path. If two trusted records conflict, the reliable behavior may be to expose the conflict. If an API times out after a write, the agent must determine whether the write happened before retrying. If a request would delete data, spend money, alter access, contact a customer, or create a legal commitment, a draft-and-approve flow is safer than silent execution. The downside is not an awkward response; it is an irreversible business action.

    A practical autonomy ladder is observe, recommend, prepare, execute a reversible action, and execute a consequential action. Move a workflow upward only when the additional autonomy is necessary for the user outcome and the preceding level has evidence behind it. My rule is simple: earn autonomy one consequential action at a time.

    Write the expected handoff as part of the contract. Name who receives it, what context travels with it, what the agent already attempted, and what decision remains. “Escalated to a person” is not a successful fallback if that person has to reconstruct the entire case.

    Put a deterministic shell around the probabilistic core

    An LLM can interpret ambiguity and propose a plan. It should not also be the unobserved authority for identity, permissions, transaction state, policy enforcement, and whether its own work succeeded. Keep those controls in ordinary application logic wherever possible.

    A production workflow usually needs the following control points:

    1. Authenticate the user and validate the request before sending it into the agent loop.
    2. Retrieve only the authorized context needed for this task, with identifiers and provenance attached.
    3. Ask the model for a structured plan that can be inspected, constrained, or rejected.
    4. Validate every proposed tool and argument against policy, permissions, and a typed schema.
    5. Execute scoped actions with timeouts, retry rules, and protection against duplicate writes.
    6. Verify the resulting system state instead of trusting a generated claim that the task succeeded.
    7. Return the result, evidence, unresolved uncertainty, and next state to the user.

    That sequence creates a crucial separation between proposing an action, authorizing it, executing it, and verifying it. The LLM can participate in each stage, but it should not collapse all four into one opaque response.

    Retrieve evidence for the task, not everything that might be relevant

    A retrieval-first pipeline is usually more controllable than placing a large collection of documents in the prompt. Filter by tenant, user permissions, document type, effective date, product area, and workflow state before semantic ranking. Preserve record IDs and timestamps so the answer can be traced back to what the agent actually saw. Lean context also reduces latency, cost, and the chance that irrelevant instructions steer the run.

    Embedding similarity is only one retrieval tool. Questions such as “Which decisions changed across these meetings?” depend on time, structure, and purpose, not just semantic proximity. A more capable search layer can combine vector retrieval, lexical search such as BM25, metadata queries, and purpose-built summaries. Route the query to the appropriate retrieval method and give the agent a way to inspect gaps rather than forcing every question through one embedding index.

    Retrieved content is still untrusted input. A document can contain stale policy, hostile instructions, or text that resembles a system command. Keep instructions separate from evidence, restrict which tools retrieved text can influence, and apply least-privilege access at the API layer. Privacy-by-design, data governance, structured logs, and tests for prompt injection and data exfiltration belong in the architecture, not in a pre-launch checklist.

    Treat every tool as a narrow product interface

    A tool description is not merely prompt text. It is an interface contract. Give each tool a single clear responsibility, explicit input types, constrained values, recognizable error states, and a response the workflow can verify. Separate read tools from write tools. Where the underlying system allows it, add dry-run modes, idempotency keys, and an endpoint that checks the final state.

    Avoid exposing a broad “run anything” tool when the agent only needs to look up an account, prepare a ticket, or update one approved field. Narrow tools reduce the decision surface, simplify evaluation, and make permission reviews legible. They also let you disable one unsafe capability without taking the entire agent offline.

    Persist enough state to answer operational questions after the run: which prompt and model version ran, what was retrieved, which plan was selected, which tools were attempted, what they returned, what was committed, which verification passed, and whether a person approved the action. Do not rely on a natural-language transcript as the only record. Store structured events with a run identifier and propagate that identifier through tool calls.

    Model selection comes after these boundaries are clear. Tool-use fidelity, prose quality, latency, multilingual performance, context needs, and cost can point to different choices. Newer is not automatically better: one production team found GPT-4.1 more suitable for its prose workload than newer alternatives. Keep the workflow and evaluation interfaces model-agnostic enough to compare or replace providers without rewriting the product.

    The same discipline applies to multi-agent designs. Parallel agents are useful when tasks are genuinely independent, such as preparing different artifacts from a shared meeting. Specialized agents can also isolate permissions or context. But each added agent introduces another prompt, model call, state transition, failure path, and cost center. A second agent is not meaningful verification when it sees the same evidence, inherits the same assumptions, and merely agrees with the first. Add orchestration only when the separation has a measurable job.

    Make workflow evaluations a release gate

    A few attractive examples cannot tell you whether an agent is production-ready. Reliability work starts by naming how the workflow can fail, then turning those failure modes into repeatable tests.

    Use a failure taxonomy that follows the run from request to outcome:

    • The agent misunderstood the intent or accepted a task outside its scope.
    • Retrieval omitted the necessary record, returned stale information, or crossed an access boundary.
    • The plan skipped a required step or selected an unsafe sequence.
    • The agent chose the wrong tool or supplied invalid arguments.
    • A tool failed, timed out, or completed after the agent assumed it had failed.
    • The response introduced an unsupported claim or concealed uncertainty.
    • The agent claimed success even though the intended system state was not reached.
    • The handoff occurred too late or omitted information the recipient needed.

    Build a golden dataset from real user intents and known edge cases. Include normal successful work, ambiguous instructions, missing data, conflicting records, insufficient permissions, tool errors, adversarial content, and requests that should be refused or escalated. Each case needs an expected outcome, allowed tools, forbidden actions, required evidence, and an evaluation method. Otherwise the dataset is a collection of prompts, not a product specification.

    Grade the system at several layers. Task success checks whether the intended state was reached. Grounding checks whether material claims are supported by authorized evidence. Tool-use evaluation checks selection, argument correctness, sequence, and postconditions. Safety evaluation checks policy and access boundaries. Handoff quality checks whether the receiving person can continue without repeating work. Latency and cost reveal whether the successful path is operationally sustainable.

    Use deterministic checks where the answer is objective. An account ID, required field, permission decision, or database state should not need a subjective model judge. Use rubric-based model evaluation or calibrated human review for writing quality, helpfulness, and other dimensions that genuinely require judgment. Regularly compare automated grades with human decisions; an evaluator can drift or share the actor model’s blind spots.

    Do not hide a severe failure behind an average score. Segment results by intent, tool, customer type, language, risk class, and workflow version. A high overall pass rate says little if the agent consistently fails the one action that changes access or sends a customer-facing commitment. Set separate go/no-go requirements for critical slices and treat forbidden actions as release blockers.

    A disciplined release path looks like this:

    1. Run offline evaluations against the current production version and the candidate change.
    2. Replay representative historical traces with writes disabled and inspect changed decisions.
    3. Shadow real traffic without allowing the candidate to act.
    4. Expose the candidate behind a feature flag to internal or explicitly selected users.
    5. Canary the workflow with a limited production population and a tested rollback path.
    6. Use an online experiment when the question concerns user or business impact, defining the minimum detectable effect before interpreting the result.
    7. Expand only after task success, safety, handoff, latency, and cost remain within their release requirements.

    This is eval-driven development in practical terms. Prompt, retrieval, model, tool, and policy changes are versioned product changes. They enter the same comparison pipeline and cannot bypass it because someone considers a prompt edit “just configuration.”

    Scale reliability and unit economics as one system

    An agent can be accurate and still be unscalable. It can also look inexpensive per model call while becoming costly per resolved task because it retrieves too much, retries weak plans, invokes unnecessary tools, or sends avoidable cases to people.

    Measure cost per completed safe task. The numerator should include model inference, retrieval, external APIs, tool execution, retries, verification calls, and required human review. The denominator should include only tasks that reached the intended state without violating the contract. Counting failed or falsely completed runs as successful makes the economics look better precisely when reliability is deteriorating.

    Instrument the complete trace so you can attribute both cost and delay to a stage. Useful operating views include task success by intent, tool errors by endpoint, retries by plan type, escalations by reason, latency by stage, cost by model and workflow version, unsupported-claim rate, and verification failures. Pair those measures with user satisfaction and downstream correction signals; a fast completion is not a win if a person has to undo it later.

    Cost work should target the mechanism, not apply a blanket downgrade. Shorten irrelevant context. Retrieve smaller evidence sets. Cache stable prompt prefixes where the provider and privacy posture allow it. Route simple classifications away from expensive reasoning models. Reuse deterministic results. Remove redundant verification, but only when evaluations show it adds no protection. In one concrete case, Earmark reported reducing its meeting workflow from about $70 per meeting to under $1 through prompt caching. That is a product-specific result, not a general benchmark, but it shows why context and caching decisions can determine whether an agent remains a demonstration or reaches everyday use.

    Define service objectives around the user journey rather than a generic chatbot response. Track whether eligible tasks finish safely, whether consequential actions are verified, how long the user waits for the intended outcome, whether interrupted runs recover, and whether handoffs retain context. Set the actual thresholds from the workflow’s risk, user promise, baseline performance, and economics; there is no responsible universal target for every agent.

    Prepare for incidents before increasing exposure. The operating playbook should identify the on-call owner, alert conditions, kill switch, feature flags, tool-specific disablement, prompt and model rollback procedure, trace replay process, customer-impact assessment, and postmortem owner. Test that the team can stop writes while preserving read-only or handoff behavior. An all-or-nothing shutdown is avoidable when capabilities are independently gated.

    Data retention is another scaling decision, not merely a legal footnote. Record what must be retained for debugging, audit, recovery, and user value; minimize everything else; define access and deletion behavior; and make the choice visible to enterprise reviewers. An ephemeral architecture can become a commercial advantage when persistent conversation storage is unnecessary: a no-storage design reduced a real enterprise adoption objection. It will not fit every workflow, especially where auditability requires durable records, so make retention a deliberate contract rather than a default.

    Use the first 90 days to earn a narrow production footprint

    A useful 90-day plan does not promise an autonomous platform by the end of the quarter. It creates one bounded production workflow, evidence that the workflow is valuable, and the controls required to expand it. The sequence below adapts an outcome-led 90-day AI operating model to agent reliability.

    Days 0-30: define the contract and make failure observable

    • Choose a frequent workflow with a recognizable end state and enough value to justify automation.
    • Write the outcome, eligible intents, tools, data boundaries, prohibited actions, stopping conditions, and handoff owner.
    • Map every identity, permission, retention, and policy dependency before connecting write tools.
    • Baseline the current process so improvements in completion, time, cost, and quality have a meaningful comparison.
    • Assemble real and adversarial evaluation cases with expected outcomes and forbidden behaviors.
    • Implement structured traces and a read-only or dry-run version of the workflow.

    The exit criterion is not a persuasive demo. You should be able to inspect a run and determine, without guessing, whether it completed the job, what evidence it used, what it changed, and why it stopped.

    Days 31-60: connect tools behind controls

    • Implement narrow tool adapters with typed inputs, permission checks, stable errors, timeouts, and duplicate-write protection.
    • Add retrieval filters, provenance, postcondition checks, and explicit approval points.
    • Version prompts, models, policies, retrieval settings, and tool schemas as one releasable workflow.
    • Run offline comparisons and shadow traffic, then review failures by category rather than as isolated bad answers.
    • Add feature flags, tool-specific disablement, alerts, and a tested rollback path.
    • Assign a product owner for the outcome and named engineering, risk, security, and operational partners for the controls they own.

    Leave this phase only when every serious known failure class has either a preventive control, a detection mechanism, or an explicit human gate. A line in a risk register is not a runtime control.

    Days 61-90: canary, learn, and expand selectively

    • Release to a limited population whose intents and permissions match the evaluated scope.
    • Monitor safe task completion, false-success signals, handoffs, latency, cost, corrections, and user outcomes by workflow version.
    • Review traces for both failures and unexpected successes; an agent may reach the right answer through an unsafe path.
    • Run incident and rollback drills before raising the exposure or enabling a more consequential action.
    • Compare production behavior with the baseline and the predeclared release requirements.
    • Expand one dimension at a time: more users, another intent, a new tool, or greater autonomy. Re-run the relevant evaluations after each change.

    The exit criterion is operational ownership. Someone owns the workflow’s outcome, someone responds when it degrades, the system can be rolled back, and the roadmap is driven by observed failure and value rather than a list of impressive agent capabilities.

    Key takeaways

    • Define reliability as a completed, verified user outcome inside explicit boundaries.
    • Keep authorization, policy enforcement, transaction state, and postcondition checks outside the model wherever possible.
    • Evaluate retrieval, planning, tool use, safety, handoff, and final state – not just the generated response.
    • Gate changes with offline tests, shadowing, feature flags, canaries, and rollback procedures.
    • Measure cost per completed safe task and optimize the stage causing the expense.
    • Increase scope and autonomy separately so production evidence can tell you which change caused a regression.

    Start with one workflow this week. Write its reliability contract, collect representative failures, and make a dry run traceable from request to verified outcome. Once that narrow path is measurable and recoverable, you have something worth scaling – and a defensible reason to grant the agent its next action.

    References

  • Reliable AI Infrastructure: A Product Leader’s Playbook

    Reliable AI Infrastructure: A Product Leader’s Playbook

    Your AI feature can be online, fast, and still be failing. A report renders but omits important records. A workflow returns valid JSON with the wrong meaning. A retry creates a duplicate. A permissions change quietly removes the data needed for a trustworthy answer.

    If you own an AI product, an uptime dashboard cannot tell you whether users are receiving the outcome you promised. You need a reliability system that covers data, models, runtime dependencies, output quality, delivery, and recovery. The practical goal is not to eliminate every failure. It is to detect meaningful failures early, contain their impact, and recover without making the situation worse.

    Define reliability at the user-outcome boundary

    Traditional service reliability often starts with a relatively clean question: did the request succeed? AI products make that question insufficient. A request can return a success status while the user receives an incomplete, structurally invalid, stale, unauthorized, or semantically poor result.

    The failures worth designing for include small schema changes in non-deterministic output, silent permission changes, token-limit truncation, burst-driven rate limits, and clock skew affecting idempotent writes. None requires a total outage. Each can still break the product promise.

    Start by writing a reliability contract for one important user journey. State what must be true when that journey succeeds. A useful contract usually covers these dimensions:

    Reliability dimensionQuestion to answerEvidence to capture
    CompletionDid the workflow reach a terminal outcome?Completed, rejected, timed out, cancelled, or still pending
    Structural validityDoes the output satisfy the interface expected downstream?Schema-validation result, schema version, and rejection reason
    Data integrityWas the required data accessible, current, and complete enough for the task?Data-source status, permission result, retrieval result, and freshness signal
    Semantic qualityIs the answer useful and acceptable for this use case?Evaluation result by task, customer segment, language, or workflow
    LatencyDid the outcome arrive while it was still useful?End-to-end latency and latency for each pipeline stage
    Delivery integrityWas the result applied once, without duplication or corruption?Idempotency key, write status, attempt count, and final state
    Privacy and riskDid processing respect the product’s data-handling rules?Policy checks, PII-scanning result, access decision, and exception path

    This contract prevents an easy but damaging mistake: counting technically completed requests as successful user outcomes. If a report is truncated yet parseable, the transport succeeded and the product failed. If a model response is excellent but based on data the user can no longer access, the answer should not be delivered as a success.

    Turn the contract into service-level indicators that the system can measure. Then set service-level objectives around the indicators that matter to the user. The difference between the objective and actual performance becomes the error budget available for change and experimentation.

    Do not hide behind a global average. Break reliability down by model, prompt version, schema version, dataset, workflow, customer segment, and dependency. AI failures are often concentrated. A healthy aggregate can conceal a severe regression for one language, one integration, or one high-value workflow.

    Your error budget should also drive decisions. When budget consumption accelerates, narrow the rollout, pause the risky change, or redirect capacity toward the failure path. When the budget is healthy, you have evidence that the product can absorb controlled experimentation. That is more useful than declaring reliability important while allowing roadmap pressure to settle every tradeoff.

    Instrument the full path from request to delivered outcome

    A useful AI trace does not stop at the model call. It follows the user request through authentication, permission checks, data retrieval, context assembly, model execution, output validation, business rules, persistence, and delivery. Give the journey one correlation identifier so an engineer can move from a failed user outcome to the responsible stage without reconstructing the request from unrelated logs.

    Build visibility at three levels:

    • Structured events: Record the request identifier, workflow, customer segment, model, prompt version, schema version, dependency, attempt number, latency, result class, and failure code. Use controlled fields rather than free-form error messages for the dimensions you expect to aggregate.
    • Distributed traces: Create a span for each meaningful stage. A trace should show whether time was spent waiting in a queue, retrieving data, calling a provider, validating output, or committing a side effect.
    • Product-level metrics: Measure valid completion, semantic evaluation results, p95 latency, queue pressure, validation failures, permission failures, truncation, retry volume, circuit-breaker activity, and error-budget consumption.

    Keep raw customer data, prompts, and model responses out of routine telemetry unless there is a defined and approved need to retain them. Structured metadata is usually enough for operational diagnosis. When content must be inspected, apply access controls, retention rules, redaction, and PII scanning as part of the observability design. Logging sensitive data first and deciding how to govern it later creates a second reliability problem: the monitoring system becomes a source of risk.

    Design failure codes around actions, not organizational boundaries. Invalid model output, missing source permission, provider throttling, exhausted token budget, duplicate delivery, and policy rejection tell the responder what kind of path failed. A generic model error or integration error forces the on-call person to rediscover information the system already had.

    Alerts should represent conditions that require intervention. Error-budget burn, broad validation failures, growing queue age, or a dependency circuit remaining open may justify an immediate response. A slow-moving change in evaluation performance may belong in a product review instead. If every anomaly pages someone, the monitoring system trains the organization to ignore it.

    The same dashboard should work for product and engineering. An SRE needs the failing dependency and trace. A product leader needs the affected workflow, segment, volume, and user consequence. Connecting both views prevents a team from fixing the loudest technical symptom while a quieter failure causes more product damage.

    Harden each boundary instead of trusting the happy path

    Most AI workflows combine components with different failure behavior: internal services, databases, queues, retrieval systems, model providers, and third-party data sources. Reliability comes from controlling the boundary around each component. The following sequence gives you a practical hardening checklist.

    1. Bound every external call. Set explicit timeouts using observed latency distributions, including p95 behavior, as an input. A missing timeout allows one slow dependency to consume workers and delay unrelated requests. Treat timeout as a classified outcome rather than an unhandled exception.
    2. Retry only failures likely to be temporary. Provider throttling and transient network failures may recover. Invalid input, permission denial, and schema rejection usually will not. Use delayed retries with exponential backoff and jitter so concurrent failures do not return as another synchronized burst. Cap attempts and record the final reason.
    3. Put a circuit breaker around unstable dependencies. When failure crosses the condition you have defined, stop sending traffic long enough to prevent resource exhaustion and cascading latency. Make the open, probing, and closed states visible. The product should communicate a controlled unavailable or delayed state rather than pretending work completed.
    4. Make side effects idempotent. Derive the idempotency key from the logical operation, destination, and relevant payload version. Persist the result of the operation so retries can return or reconcile the prior outcome. Do not depend on local wall-clock time alone to distinguish writes; clock skew can turn retry protection into duplicate or missing work.
    5. Apply backpressure before the queue becomes the outage. Bound concurrency for each constrained dependency. When demand exceeds safe processing capacity, queue, defer, or reject according to the user promise. Preserve enough state to resume safely. Unbounded retries feeding an unbounded queue convert a temporary provider problem into a long recovery.
    6. Validate contracts before committing effects. Validate generated JSON against the expected schema, including required fields, types, allowed values, and relevant bounds. Keep parsing separate from business validation: syntactically valid output can still violate a product rule. Reject or quarantine invalid results before they reach reporting, billing, messaging, or another irreversible operation.
    7. Detect incomplete generation explicitly. Budget context and expected output together. When the provider exposes completion metadata, use it to distinguish a completed response from one stopped by a limit. Do not pass partial structured output downstream merely because a parser can repair it. Reduce unnecessary context, split an oversized task, or return a controlled failure.
    8. Treat permissions as changing runtime state. Check access near the point of retrieval, classify authorization failures separately, and monitor permission-related drops by integration. Do not repeatedly retry a denial. If upstream access changes silently, the product should expose which data is unavailable rather than producing an apparently complete result from a partial dataset.
    9. Put risky behavior behind feature flags. Separate deployment from release. A flag should let you disable a model, prompt, retrieval path, or downstream action without waiting for another deployment. Test the rollback or disable path before relying on it during an incident.

    These controls need an explicit order of operations. Validate permissions before retrieving sensitive data. Validate generated output before executing a side effect. Persist idempotency state before acknowledging completion. Apply retry policy after classifying the failure. Ordering is what prevents individually sensible mechanisms from undermining one another.

    Be careful with graceful degradation. It is useful when the degraded state remains honest and valuable, such as delaying a non-urgent report or identifying an unavailable data source. It is dangerous when the system silently substitutes stale, incomplete, or lower-quality information and presents it as equivalent. The user must be able to distinguish degraded output from normal output.

    Make model and prompt releases earn production traffic

    A prompt edit can change output structure. A model change can improve one task while weakening another. A retrieval change can alter both answer quality and latency. Treat these modifications as production changes even when no application code changed.

    An eval-driven release path should work like this:

    1. Version the complete behavior. Record the model, prompt, schema, retrieval configuration, tool definitions, policy rules, and relevant application release. Without this bundle, a failed response cannot be reproduced with confidence.
    2. Build evaluations around the product contract. Cover representative tasks, important customer segments, difficult inputs, and failure cases discovered in production. Include structural checks alongside semantic checks. A quality score cannot compensate for output that breaks its interface.
    3. Establish a baseline. Compare the candidate with the current production behavior on the same evaluation set. Review the distribution by meaningful slice rather than relying only on one average score.
    4. Gate promotion in CI/CD. Require the agreed evaluation baselines to hold or improve before the candidate can progress. Make exceptions explicit, owned, and reversible. A hidden manual bypass is not a release policy.
    5. Release through a canary. Send a limited, observable portion of eligible traffic to the candidate. Keep the current version available. Watch evaluation signals, validation failures, p95 latency, dependency behavior, and error-budget consumption by version.
    6. Expand in stages or roll back. Increase exposure only while the user-facing indicators remain within the agreed conditions. If a signal degrades, use the feature flag or version control to stop exposure quickly while preserving diagnostic evidence.

    The release gate needs product judgment. Not every evaluation failure carries the same consequence. A formatting defect in an internal draft is different from an unsupported claim in a customer-facing recommendation or an unauthorized action by an agent. Define which failures block release, which require human review, and which can be monitored after release.

    Do not force a choice between delivery speed and reliability without evidence. Track deployment frequency alongside change failure rate. Frequent, small, reversible releases can improve both learning speed and recovery. Large bundled changes make it harder to identify the cause of regression and increase the amount of behavior a rollback must undo.

    Before approving an AI release, a product leader should be able to answer five questions:

    • Which user promise can this change affect?
    • Which evaluation and production indicators represent that promise?
    • Which segments could regress even if the aggregate improves?
    • What condition stops or reverses the rollout?
    • Who has the authority and the mechanism to act when that condition appears?

    If those answers are missing, the release is relying on optimism rather than a control system.

    Run reliability as a product operating system

    Technical safeguards decay unless ownership and operating routines keep them current. Models change, integrations evolve, permissions move, and traffic develops new burst patterns. Reliability therefore belongs in roadmap and incident decisions, not in a one-time infrastructure project.

    Prepare a lightweight runbook for each critical journey. It should identify the owner, user-visible failure states, primary indicators, relevant dashboards, recent release controls, dependency status, safe disable path, and rules for replaying work. A responder should not have to infer whether replay can duplicate a message, report, charge, or external action.

    During an incident, establish the user impact before chasing every technical symptom. Identify the affected workflow and segment, stop further harm, preserve evidence, and use the safest available rollback or containment control. Communicate whether results are delayed, incomplete, unavailable, or at risk of duplication. Those states require different user actions.

    Afterward, use a blameless review to find the conditions that allowed the failure to reach users. The strongest follow-up actions are testable and automatable: a new schema check, an evaluation case, a permission metric, a retry limit, a canary gate, a better idempotency key, or a rehearsed rollback. An instruction to be more careful is not a control.

    Prioritize the reliability backlog by user consequence and error-budget impact. A noisy internal exception with no lost outcome may matter less than a silent data omission affecting a small but important workflow. This keeps observability from becoming a competition to reduce whichever counter is easiest to move.

    Privacy-by-design and AI risk management belong in the same operating system. Add PII scanning, access validation, and policy checks to the pipeline and release gates. Assign owners for exceptions. Revisit the controls as the product gains new data sources or actions. Risk is a continuing product constraint, not a review performed after the architecture is settled.

    Key takeaways

    • Define success at the delivered user outcome, not at the HTTP response or completed model call.
    • Measure completion, structural validity, data integrity, semantic quality, latency, delivery integrity, and privacy where each applies.
    • Trace the whole pipeline and segment reliability by model, prompt, schema, workflow, dataset, and customer group.
    • Use timeouts, selective retries, circuit breakers, idempotency, backpressure, validation, and feature flags as coordinated controls.
    • Gate model and prompt changes with evaluations, then use canaries and staged releases to limit exposure.
    • Let SLOs, error-budget consumption, and user consequence determine when reliability work outranks feature work.

    Choose your highest-consequence AI journey and write its reliability contract. Trace it end to end, attach an SLO to the user outcome, and replay the known failure modes against the controls you already have. If the system cannot tell you whether its output was valid, complete, permitted, and delivered once, that is the first reliability gap to close.

    References

  • The Safety of Speed: 180 Deploys a Day, 12‑Minute Releases, 99.8%+ Availability

    The Safety of Speed: 180 Deploys a Day, 12‑Minute Releases, 99.8%+ Availability

    “Speed is not the enemy of safety; it is the prerequisite for it.” I live by this principle. In our organization, the average time from merging code to it being used by customers in production is just 12 minutes, and that short window is fundamental to how we build, ship, and learn.

    In January 2026, we are averaging 180 ships per workday – roughly 20 deployments every hour. Conventional wisdom suggests that to increase stability, you must slow down. I believe the opposite. Speed is not the enemy of safety; it is the prerequisite for it. Accumulating code creates risk; shipping small batches minimizes it. Shipping is our company’s heartbeat.

    Maintaining this frequency while targeting 99.8+% availability has required over a decade of focused investment in systems, principles, and processes. We protect the integrity of our systems through three layers of defense: an automated pipeline that is simple, reliable, and removes the need for manual intervention, a shipping workflow that promotes ownership and uses guardrails as accelerants, and a recovery model that optimizes for mitigating inevitable failures. Here’s how we’ve built each layer so that velocity is our greatest source of stability.

    While our platform consists of various services and frontend applications, I’ll focus here on our Ruby on Rails monolith. It is our core application and the one we deploy most frequently; we also deploy it to three different data‑hosting regions with independent pipelines. Our other services follow similar pipeline principles and safeguards, but the Rails monolith is the clearest example of how we ship at scale.

    The automated pipeline is designed to move code from merge to production as fast as possible while enforcing strict safety checks. It is fully automated, and the vast majority of releases require no human intervention—critical for CI/CD at high deployment frequency.

    Once an engineer merges code to GitHub, two things happen immediately. First, the build: we compile the Rails application and its dependencies into a deployable asset (a slug) in about four minutes. Second, parallel CI: our test suite runs alongside the build; through extensive optimization, parallelization, and test selection, the vast majority of CI builds finish in under five minutes.

    As soon as the slug is built, it’s deployed to a pre‑production environment. CI does not block the progression of the slug to pre‑production. Deploying to pre‑production takes around two minutes. This environment serves no customer traffic, but it is connected to our production datastores, mirrors our production infrastructure variants (e.g., web serving, asynchronous worker), and is configured so that requests exercise the pre‑release code and workers.

    Immediately after deployment, we run and await several automated approval gates. We verify that the application boots cleanly on hosts (boot test), confirm the parallel test suite passed (CI check), and execute functional synthetics using Datadog Synthetics on critical flows—such as loading or editing a Fin workflow. If any gate fails, the release is halted and does not go to production.

    Once approved, we promote the code to thousands of large virtual machines. A deployment orchestrator triggers these deployments simultaneously, while a decentralized, staggered rollout avoids changing the state of the entire fleet at the same millisecond. Within each machine, a rolling restart mechanism removes a process with old code from the serving path, lets it drain gracefully, and replaces it with a fresh process running the new code. From the moment a deployment starts, first requests are served by new code within roughly two minutes, and the vast majority of the global fleet updates transparently within six minutes. When restarts trigger on every machine, production unblocks so the next deployment can begin.

    We treat a stalled pipeline as a high‑priority incident. If the automated system rejects three consecutive release attempts, it pages an on‑call engineer. These are pre‑production blocks, but if the shipping lane stops moving, changes pile up—and our stability relies on building and shipping in small steps. The on‑call’s job is to restore flow so that tiny, safe, frequent updates continue to keep risk low.

    Our shipping workflow is built on extreme ownership: tools assist, but the engineer is accountable for quality and the decision to merge. I insist that you are present when you ship. The practical benefit of a 12‑minute deployment cycle is that engineers remain in the zone, focused on the problem they just solved, and ready to validate behavior as it goes live.

    Stylized rocket launch piercing dramatic cumulus clouds at sunrise, glowing vapor trail symbolizing fast yet controlled delivery; overlaid headline text reads 'The safety of speed' in the sky.
    A rocket lifts into a luminous sky, a metaphor for shipping code fast without breaking things, where precision, automation, and guardrails power 180 safe deployments a day.

    To support this, our deployment system sends Slack notifications the moment code is submitted and as it advances through stages, embeds direct observability links to relevant dashboards and logs in every PR and message, and prompts verification so engineers actively watch the dials and test features in production. It is not acceptable to rely on green builds. You’re expected to watch your change go live and if you’re not prepared to rollback, you’re not prepared to ship. We maintain a no‑blame culture: quick rollbacks and immediate reverts are signs of vigilance and ownership, not failure.

    We make extensive use of feature flags to turn deployment into a non‑event. By decoupling deployment (moving code to servers) from release (turning features on), we shrink the blast radius of change. Flags can be enabled for all customers, a specific subset, or disabled for everyone in under 60 seconds through our backend UI. Engineers can group flags into beta features and run phased rollouts; we also ensure flags work consistently across non‑monolith applications. In the past three months, we created over 560 flags—and we actively manage them to avoid permanent complexity.

    For complex refactors—especially when behavior should not change—we leverage GitHub Scientist, an open‑source experimentation library. It runs candidate logic (new code) in parallel with existing logic (old code) in production, instruments both paths for result and timing comparisons, and keeps existing behavior user‑visible. That means we can iterate on and validate new code under real load without risking the experience, then switch seamlessly when confident.

    When engineers need to go deeper before merging, they can generate a slug and deploy it to a virtual machine, detaching a running production host from the serving path and connecting for manual testing. They can also put a pre‑release slug on a serving machine that handles a small percentage of jobs or web requests. Single‑host validation lets us slice observability to those hosts, compare against the main release, and make low‑level changes safer. Staging is a simulation; production is reality. Testing on a single production host validates assumptions with real‑world data without risking the fleet.

    Our recovery model starts from a simple principle: stop monitoring systems; start monitoring outcomes. Traditional monitoring tells you if a server is healthy; we care whether customers are healthy. We rely on heartbeat metrics—vital signs that represent the core value our product provides—such as the rate at which messages and comments are created.

    Unlike standard uptime checks, heartbeat metrics are binary in spirit. If message send rates dip below baseline, it does not matter if infrastructure dashboards are green. Down is down, and if customers can’t do their job, uptime percentages are irrelevant. By tracking real‑world success rates as a high‑level signal, we catch subtle degradations that traditional alerting either misses or over‑alerts on.

    Because we ship in small, incremental steps and maintain previous releases on our virtual machines, our Time to Recover (TTR) is generally very fast. If a heartbeat metric drops or a critical anomaly is detected right after a ship, the system can trigger an automatic rollback, reverting to the release that was running 20 minutes ago—often restoring service before an engineer responds. For complex issues, engineers can initiate a manual rollback through our deployment UI; doing so also locks the production pipeline to prevent further releases while we investigate and remove problematic code.

    Resumption of service is not the end. Every incident prompts an incident review, and we don’t just fix the bug. We ask, “How did the machine allow this to happen?” Then we harden the system so it cannot happen again. This loop—fast shipping, fast recovery, rigorous learning—compounds resilience over time.

    This operating model aligns to DORA metrics: high deployment frequency, short lead time for changes, low change failure rate, and rapid time to restore service. It’s a CI/CD and SRE‑informed approach that converts speed into a defensive advantage rather than a liability.

    Shipping 180 times a day isn’t a vanity metric; it’s a deliberate choice to protect the customer experience. With a 12‑minute window from code to customer, the feedback loop is tight and engineers retain context—and accountability—for the immediate impact of their work. Maintaining this pace requires more than fast CI; it requires judgment, extreme ownership, disciplined use of feature flags, and a recovery model that monitors outcomes. We rely on human expertise, augmented by these layers of defense, to catch issues before they turn into customer pain. We don’t ship fast despite our need for stability; we ship fast to stay in control of change.


    Inspired by this post on The Intercom Blog.


    Book a consult png image
  • Agentic AI for Construction Tendering: A Product Playbook

    Agentic AI for Construction Tendering: A Product Playbook

    Your tender inbox contains a deadline, a stack of attachments, and a chain of decisions that still lives in people’s heads. The tempting response is to buy a model that can read PDFs. That solves only the most visible part of the problem.

    A useful tendering product must determine which documents matter, extract requirements with evidence, match those requirements to a catalog, retrieve approved pricing, draft an offer, identify uncertainty, and route exceptions before anything reaches the customer. If you lead AI or product strategy for a manufacturer or supplier, your first goal should not be an autonomous bidder. It should be the smallest tender category in which every decision can be observed, evaluated, and improved.

    Pick a bounded quote, not the entire tendering department

    Construction tendering is too broad for a credible first release. Product categories have different terminology, selection rules, catalogs, pricing structures, and exception patterns. A system that works for one bounded category has not automatically learned how to quote every building product.

    One effective wedge started with radiator requests for a single design partner before expanding to other building products. That constraint made the catalog, expected outputs, and expert reviewers knowable. It also created a place to learn the real workflow rather than designing from an idealized process diagram.

    Choose your wedge using operational criteria, not enthusiasm for the model:

    • The request appears often enough for reviewers to recognize recurring patterns.
    • The relevant catalog is bounded and maintained by a clear owner.
    • A domain expert can explain why a product is suitable, unsuitable, or uncertain.
    • The correct price can be traced to an approved system or document.
    • Historical tenders and reviewer corrections are available for evaluation.
    • An error can be caught during review before it becomes a customer-facing commitment.

    A design partner is especially valuable because the work is not fully documented. In one implementation, the product team spent a week observing the process on-site. That kind of observation exposes the browser tabs, informal checks, catalog shortcuts, and exception handling that an interview alone can miss.

    Follow one tender from the incoming email to the final offer. At every handoff, record five things: the input, the decision, the evidence used, the person or system responsible, and the condition that triggers an exception. If you cannot state those five things, you do not yet have a well-defined agent task.

    Keep three layers of information separate from the beginning:

    • Stated requirements: what the tender explicitly asks for, with the originating file, page, section, or table cell.
    • Interpretations: conclusions the system or reviewer draws when terminology is ambiguous, incomplete, or inconsistent.
    • Commercial decisions: the selected product, approved price, assumptions, exclusions, and offer language.

    This separation matters because a polished offer can hide a weak inference. A reviewer needs to see where the tender ends and the system’s judgment begins.

    Define the first outcome as a review-ready tender case: organized source documents, structured requirements, proposed product matches, price provenance, unresolved issues, and a draft offer. That is a more useful product boundary than “understands construction PDFs.” It gives the reviewer something concrete to accept, correct, or reject.

    Turn the workflow into a decision graph with specialist agents

    A chatbot is the wrong mental model. Tendering is a decision graph in which an early classification or extraction error can contaminate every downstream step. Real packages can range from a short request to more than 1,800 pages describing an entire building. The system therefore needs to plan work, retain state, reconcile evidence, and know when coverage is incomplete.

    Use agents only where a task requires interpretation, planning, or exception handling. Keep exact operations – file handling, arithmetic, catalog queries, identifiers, template validation, and access control – in deterministic code or approved systems.

    StagePreferred controlRequired output
    IntakeRules plus a classifierA tender case containing the email, attachments, document types, and routing status
    Requirement extractionParser tools plus a specialist agentStructured requirements with source locations, missing fields, and ambiguities
    Product matchingCatalog retrieval plus a reasoning agentCandidate products, requirement coverage, incompatibilities, and rationale
    PricingApproved database, CPQ, or pricing serviceExact product-price records with source and validity information
    Offer generationControlled template plus a drafting agentA draft that distinguishes confirmed facts, assumptions, and exclusions
    Quality reviewRules plus a separate review agentA pass or block decision with issue codes and supporting evidence
    Human approvalDomain and commercial policyAn approval, correction, rejection, or escalation that becomes evaluation data

    Each agent should have an explicit contract. Specify its permitted inputs, tools, output schema, evidence requirements, completion test, and escalation behavior. “Find the right product” is not a contract. “Return catalog candidates that meet the extracted requirements, identify uncovered requirements, cite the catalog evidence, and abstain when no candidate qualifies” is much closer to one.

    For large document sets, require the workflow to maintain a task plan. It should inventory files, identify relevant sections, process bounded units of work, track completed and pending units, reconcile repeated or conflicting requirements, and run a final coverage check. A generated answer is not proof that the package was fully processed.

    The review agent deserves its own role. Asking the drafting agent to “check your work” keeps creation and approval inside the same reasoning path. A separate reviewer can inspect the draft against the extracted requirements, catalog evidence, price records, and policy rules. It should return defects and a gate decision rather than silently rewriting the offer. Silent rewriting makes it harder to identify which upstream component failed.

    This pattern has practical value because a dedicated review agent can catch errors before human review, much like a separate code review step. Independence comes from the reviewer’s task and evidence contract; adding more agent personas without distinct responsibilities only creates orchestration overhead.

    The interface is part of the architecture. During discovery, a dedicated web workbench can be more useful than hiding the workflow behind a legacy integration. Put the source document, extracted requirement, proposed match, price evidence, and review issue within the same review path. That gives the product team control over feedback capture and makes the reason for each correction visible. One tendering product used its own web application to iterate toward greater automation rather than beginning as a backend-only integration.

    You can still read from and write to existing systems at defined boundaries. The distinction is between integration and dependence: integrate with systems of record for catalogs, prices, customers, and approved quotes, but do not let an inflexible legacy screen determine how reviewers inspect an emerging AI workflow.

    Evaluate every decision before judging the complete quote

    An end-to-end result tells you whether a tender case failed. It rarely tells you why. If the final product is wrong, the defect may have come from document routing, requirement extraction, catalog retrieval, product reasoning, pricing, drafting, or review. A single overall accuracy score collapses those failure modes into an unactionable number.

    Build an evaluation set for each agent contract and retain a smaller end-to-end set for workflow behavior. Per-agent evaluations make changes and regressions easier to localize. The useful measures differ by decision:

    • Intake: correct document classification, attachment coverage, and routing accuracy for each supported tender type.
    • Extraction: field-level completeness, exactness for identifiers and numeric values, source-location accuracy, and the rate of unsupported fields.
    • Product matching: reviewer agreement, requirement coverage, incompatible recommendations, unsupported matches, and appropriate abstention.
    • Pricing: exact agreement with the approved source, correct product-price association, formula validation, and rejection of unavailable or invalid records.
    • Offer generation: required-field completeness, consistency with selected products and prices, correct treatment of assumptions, and unsupported statements.
    • Review: detection of known defects, false blocks on valid cases, issue classification, and evidence quality.

    Slice failures by characteristics that change the work: document length, file type, layout, product category, presence of tables, and conflicting or revised requirements. An aggregate score can improve while performance deteriorates on the long or unusual tenders that consume most reviewer attention.

    Use end-to-end measures for the product outcome: review time, correction volume, correction severity, exception rate, percentage of cases that reach the defined completion state, and whether the workflow finishes before its operational deadline. Keep commercial outcomes separate from model correctness. Quote acceptance or win rate can be affected by price, availability, competition, customer relationships, and sales execution; it should not be treated as a clean extraction or matching metric.

    Observability must connect those layers. For each tender case, retain the task plan, agent inputs and outputs, tool calls, retrieved catalog or price records, prompt and model versions, gate decisions, latency, failures, and human corrections. Complex agent chains can exceed what generic monitoring exposes, which is why custom tracing and Agent Analytics became necessary in a production tendering workflow.

    Capture reviewer feedback as structured data, not only as an edited final document. Store the original output, corrected value, responsible stage, reason code, evidence used, and final disposition. Useful reason codes include missing requirement, incorrect extraction, unsupported product match, pricing issue, unresolved conflict, invalid assumption, and drafting defect.

    Do not feed every edit directly back into the system and call it self-learning. A reviewer may change wording for preference, apply customer-specific knowledge, or correct an upstream error in the final draft. Validate the correction, assign it to the right component, and add it to the corresponding evaluation set. That turns human review into controlled learning rather than an untraceable feedback loop.

    Release changes through two gates. First, the modified agent must pass its own evaluation set. Second, the complete workflow must pass the end-to-end set because an improvement in one component can change the assumptions of another. The trace should show exactly which version produced every customer-facing artifact.

    Earn autonomy one commercial boundary at a time

    “Straight-through processing” is incomplete unless you define where the straight-through path ends. Automatically extracting requirements is not the same risk as automatically selecting a product, committing a price, writing to the CPQ, or sending an offer to a customer.

    Use an autonomy ladder with an explicit boundary at each stage:

    1. Shadow: the system processes live-shaped cases, but its outputs do not affect the operational tender.
    2. Assist: it organizes documents and extracts requirements while a person performs matching, pricing, and drafting.
    3. Draft: it proposes products and produces an offer, but a human must review and approve every case.
    4. Gated processing: it completes predefined internal actions for in-scope cases and sends all exceptions to a reviewer.
    5. External dispatch: it sends an offer without case-by-case approval only when commercial policy explicitly permits that action and every required gate passes.

    Eligibility for a higher-autonomy path should be machine-checkable. At minimum, confirm that the product category is in scope, every required document was processed, required fields are present, source evidence is attached, conflicts and revisions are resolved, the product match satisfies its evidence rules, the price comes from an approved valid source, the review agent reports no blocking defect, and the full trace is retained.

    A wrong product or price can create margin, delivery, contractual, and customer-trust exposure. If an offer may create a binding commitment, keep human approval until the appropriate commercial and legal owners have defined the policy for automatic dispatch. The safe alternative is to automate preparation while preserving approval at the commitment boundary.

    Operational controls matter after launch. Give reviewers a visible exception queue, make the reason for every block legible, preserve manual processing when the AI path is unavailable, and provide a way to suspend autonomous actions without disabling access to already processed cases. Assign owners for catalog quality, pricing validity, tender policy, model behavior, and production reliability; otherwise each exception will bounce between teams.

    Expansion should follow evidence and customer pull. A request to replace an existing CPQ system is a meaningful product-market signal, but it is also a change in product scope. CPQ replacement introduces responsibilities for quote versions, approval policy, catalog administration, pricing governance, integrations, and records. Treat that request as a roadmap decision, not as proof that the original agent workflow already covers those capabilities.

    Key takeaways

    • Start with one product category, one known workflow, and reviewers who can explain the correct decision.
    • Optimize first for a review-ready tender case, not an impressive answer from a general chatbot.
    • Use deterministic systems for exact operations and specialist agents for interpretation, planning, and exceptions.
    • Require structured outputs, source evidence, explicit completion tests, and an abstain-or-escalate path from every agent.
    • Evaluate each stage separately, then use end-to-end metrics to measure the operational outcome.
    • Increase autonomy only when observable eligibility gates protect the next commercial boundary.

    At your next roadmap review, put one representative tender on the screen and draw the decision path from email to offer. Name the owner, evidence, pass condition, and exception path for every node. Wherever those are missing, the next task is workflow discovery, not another agent. Once the graph is explicit, you can automate one bounded decision, measure it, and earn the right to automate the next.

    References

  • How to Govern AI Agents With Product Analytics That Drives Action

    How to Govern AI Agents With Product Analytics That Drives Action

    Your dashboard can show growing AI agent usage while the product itself gets worse. Users may invoke the agent, wait for an answer, rewrite it, repeat the task manually, or discover too late that an action needs to be undone. An invocation count records activity. It does not tell you whether the agent was useful, safe, or worthy of more authority.

    If you own an agent roadmap, the practical question is not whether the model can complete an impressive demo. It is whether you can see what the agent did, limit what it was allowed to do, connect its behavior to a user or business outcome, and stop or reverse a bad release. Product analytics should be the control system that helps you answer those questions.

    Key takeaways

    • Define the agent’s job, eligible users, data boundary, action boundary, target outcome, and failure conditions before choosing dashboard metrics.
    • Join product behavior, agent decisions, tool activity, and business outcomes with shared run and workflow identifiers. A model trace or product funnel on its own is incomplete.
    • Treat permissions as product logic. Read access, recommendations, reversible actions, and high-consequence actions need different controls and evidence.
    • Version prompts, retrieval sources, models, tools, policies, and event schemas together so that a change in performance can be traced to a release.
    • Use quality, safety, experience, business, and operational gates to decide whether an agent should expand, remain constrained, be revised, or be retired.

    Define the outcome and authority before the events

    Teams often start by instrumenting what is easiest to count: conversations, messages, tool calls, and thumbs-up feedback. That produces a busy dashboard without a decision model. Start one level earlier. What job is the agent responsible for, and what evidence would justify giving it more reach or authority?

    Write a one-page agent contract

    An agent contract is a product artifact, not a legal document. It creates a stable reference for instrumentation, evaluation, access control, and rollout decisions. Write down:

    • Job: the decision or task the agent helps complete. Avoid broad mandates such as improve support or assist product managers.
    • Eligible workflow: the exact point at which the agent may appear or run. Eligibility must be measurable even when the user never invokes the agent.
    • Eligible users and accounts: the roles, segments, or environments included in the release, plus explicit exclusions.
    • Inputs: the approved resources, fields, retrieval collections, and user-provided context the agent may inspect.
    • Outputs: whether the agent answers, recommends, drafts, updates a system, contacts someone, or triggers another workflow.
    • Human checkpoints: the actions that require review, the person authorized to review them, and what that person must be shown.
    • Target outcome: the user or business result, its denominator, its measurement window, and the system that records it.
    • Known failure states: unsupported answers, irrelevant retrieval, repeated retries, blocked tools, abandoned approvals, incorrect actions, and failed handoffs.
    • Stop condition: the quality, risk, reliability, or outcome signal that pauses the rollout and identifies who owns the decision.

    The eligibility definition matters more than it appears. If you count only people who chose to use the agent, your dashboard excludes people who ignored it, did not notice it, distrusted it, or could not access it. Record the eligible population first. That gives adoption, completion, and outcome metrics a defensible denominator.

    Keep the first contract narrow. A practical starting footprint is one valuable question, a small team, and one assistant. Narrow scope is not merely easier to ship. It makes failures interpretable and limits the consequences of a bad policy, prompt, connector, or event definition.

    Translate authority into enforceable policy

    I use a strict definition of governance: the agent has a bounded objective, a known identity, limited data access, limited tools, recorded policy decisions, an escalation route, and a named owner. A policy page that the runtime cannot enforce is guidance, not governance.

    Authority levelWhat the agent may doEvidence to retainDefault release control
    RetrieveRead approved analytics, records, or knowledge without changing a systemResource identifiers, applied scope, retrieval status, policy version, and references usedPre-approved resources with least-privilege access and data minimization
    RecommendExplain, summarize, rank, draft, or propose an actionAgent version, supporting references, presentation status, and user responseThe user decides whether to accept, edit, reject, or escalate
    Act reversiblyCreate a note or make another bounded change that can be reliably undoneTool, target, before-and-after state, approval, execution result, and reversal pathExplicit approval during the bounded rollout, followed by evidence-based expansion
    Act with high consequenceSend an external communication, alter access or entitlements, disclose sensitive data, or perform a hard-to-reverse operationEverything above, plus approver identity, policy result, purpose, and incident linkageA human makes the consequential decision; eligibility and tool scope remain narrow

    Technical reversibility is not the same as consequence reversibility. A database field may be restored while a customer message, exposed record, or lost trust cannot be recalled. Classify authority by the real-world consequence, not by whether an API offers an undo method.

    Model Context Protocol can make the policy surface clearer because it separates read-only resources from bounded tools and gives agents a standard way to discover them. That interface is useful, but the protocol does not decide who should access a resource, which fields are permitted, or whether an action needs approval. Authentication, authorization, redaction, policy enforcement, retention, and audit logging still belong in your architecture.

    Apply controls before the model call and again before every tool execution. Prompts, retrieved context, logs, and third-party services can all become paths for sensitive-data leakage. Redact data the task does not require, keep secrets outside prompts, use scoped credentials, validate structured tool inputs, and record blocked requests as carefully as successful ones. A denied request is evidence that your policy worked, but repeated denials may also reveal a broken workflow, an overly broad prompt, or an attempted attack.

    Build telemetry that joins agent decisions to user outcomes

    Product analytics and AI observability answer different halves of the same question. A trace can show which context was retrieved, which policy ran, and which tool was called. Product analytics can show what the user did before and after the interaction, which cohort they belonged to, and whether the workflow reached its intended result. Neither view alone proves that the agent created value.

    Join them with two identifiers. An agent run identifier follows one execution from trigger to final status. A workflow identifier connects that execution to the broader task, including manual steps, retries, handoffs, and the eventual business outcome. A user may start several runs inside one workflow, so treating every run as an independent success will inflate apparent demand and hide rework.

    Use a minimum viable event contract

    The following event model is deliberately small. Adapt the names to your analytics conventions, but preserve the states and identifiers.

    Suggested eventRequired propertiesDecision it supports
    agent_eligibleWorkflow identifier, use case, surface, cohort, eligibility reason, and policy versionWho could have used the agent, including people who did not invoke it?
    agent_run_startedRun identifier, workflow identifier, agent version, entry point, and initiating actor typeWhere is the agent being invoked, and how often do workflows require retries?
    agent_answer_presentedRun identifier, answer status, retrieval status, reference status, latency band, and fallback statusDid the user receive a grounded answer, a fallback, or no usable response?
    agent_action_requestedRun identifier, tool, target type, authority level, required scope, approval requirement, and policy resultWhat is the agent attempting, and where are requests blocked or escalated?
    agent_action_finishedRun identifier, tool, execution status, error class, approver state, reversibility state, and duration bandDid an approved action actually complete, fail, time out, or require recovery?
    agent_handoff_startedRun identifier, workflow identifier, handoff reason, destination, context-transfer status, and user choiceWhy did automation stop, and could the receiving person continue without reconstructing the task?
    agent_run_outcomeRun identifier, workflow identifier, completion state, user response, correction state, and failure taxonomyWas the output accepted, edited, rejected, abandoned, retried, or escalated?
    workflow_outcomeWorkflow identifier, outcome name, outcome state, measurement window, and source systemDid the underlying product or business result occur?

    Put the agent, model, prompt, retrieval, tool, policy, and event-schema versions on the relevant records. Without version lineage, a quality shift produces debate instead of diagnosis. You will know that performance changed but not whether the cause was a prompt edit, a new model, a retrieval update, a permission change, a tool release, or broken instrumentation.

    Do not make raw prompts and complete responses the default payload in a general-purpose analytics tool. They can contain personal data, secrets, customer content, or retrieved text that the analytics audience should not see. Send structured classifications and reference identifiers to product analytics. Keep any detailed trace required for investigation in an access-controlled store with explicit retention rules.

    Use enumerated properties for states such as accepted, edited, rejected, blocked, failed, and handed off. Free-text status fields fragment quickly and make reliable cohorts impossible. Preserve a limited diagnostic field only where someone owns its review and classification.

    Measure a stack, not a vanity metric

    A useful scorecard separates five layers. Each layer answers a different management question:

    • Reach and adoption: Of eligible workflows, where was the agent offered and invoked? This shows discoverability and voluntary use, not value.
    • Task experience: Of started workflows, how many completed, retried, fell back, transferred to a person, or were abandoned? Segment edits and overrides instead of treating every acceptance as equally successful.
    • Agent quality: Was the answer supported by approved context, relevant to the request, structurally valid, and consistent with the task-specific evaluation criteria?
    • Governance and safety: Which tool requests were allowed, denied, escalated, or attempted outside the approved scope? Which redaction, moderation, or policy checks failed?
    • Business outcome: Did the downstream result move for the eligible workflow and intended cohort? Examples include completed onboarding, resolved cases, qualified leads, retained users, or a shorter cycle, depending on the contract.

    Always display the numerator and denominator behind a rate. A falling handoff rate may look positive until you discover that completions also fell. A high acceptance rate may hide repeated runs if the dashboard counts only the final answer. A rising task outcome may reflect a changing user mix rather than the agent. Cohort, version, eligibility, and workflow-level views prevent those misreadings.

    Behavioral analytics can establish association and expose where to investigate. It does not automatically establish causality. When the decision requires a causal claim, use a controlled experiment only after both variants meet the same safety and access requirements. Prompts, decision rules, and handoff designs can be tested across appropriate user cohorts; known unsafe behavior, privacy controls, and access boundaries are not experiment variants.

    Turn analytics into release gates, not retrospective reporting

    A governed agent release includes more than a prompt. It includes the model configuration, instructions, retrieval sources, tool definitions, permission scopes, policy rules, user disclosures, approval flow, handoff design, and telemetry. Change any of those and you have changed the product behavior.

    That is why evaluation belongs in delivery, not in a quarterly review. Task-specific test sets, reference answers, error classifications, and pass-or-block thresholds can gate model and prompt changes in CI/CD. Production analytics then checks whether the behavior generalizes to real workflows without weakening the controls established before launch.

    Use a staged promotion path

    1. Validate the interface. Enumerate the resources, tools, schemas, scopes, and denial behavior. Run harmless requests and confirm that unavailable capabilities remain unavailable.
    2. Run task evaluations. Test representative requests, known failure cases, adversarial inputs, missing context, malformed tool arguments, and handoff conditions. Classify failures by consequence rather than relying on one blended quality score.
    3. Exercise the workflow without autonomous consequence. Use dry runs or recommendation-only behavior. Confirm telemetry, references, approvals, fallback, escalation, and rollback before enabling writes.
    4. Release to a bounded eligible cohort. Keep tool scopes narrow and consequential actions under human control. Compare observed behavior with the contract, not with the enthusiasm generated by the demo.
    5. Experiment inside the approved boundary. Test prompt, retrieval, interaction, and handoff variants only after they independently satisfy the safety gate. Analyze results by workflow and version.
    6. Promote or constrain deliberately. Expand access or authority only when the relevant gates pass. A failed safety gate can restrict a release even when adoption or the business metric improves.

    Pre-commit the gates

    Choose thresholds and blocking conditions before reading the launch results. If the team sets them afterward, a promising outcome can quietly lower the quality bar, while a favored feature can turn every failure into an exception.

    GateEvidenceBlocking conditionTypical response
    QualityTask evaluations, grounded-answer checks, correction categories, and unsupported-output reviewsA consequential failure class exceeds the pre-agreed tolerance or lacks a reliable detectorRevise instructions, retrieval, output constraints, or task scope
    Safety and governancePolicy decisions, unauthorized tool attempts, redaction results, approval records, and incidentsAn unresolved high-severity policy or data-control failure remains possibleDisable the affected tool or cohort, rotate credentials where needed, and follow the incident runbook
    User experienceCompletion, edits, rejection, fallback, abandonment, retries, and handoff continuity by cohortThe agent adds work, obscures control, or fails to transfer usable contextSimplify the interaction, improve disclosure, or return the step to a human workflow
    Business outcomeThe contract’s downstream metric for eligible workflows, with an appropriate comparisonUsage grows without a credible improvement in the intended outcomeRevisit the job, target cohort, workflow placement, or value hypothesis
    OperationsTool errors, latency, timeouts, dependency health, fallback success, and rollback readinessThe workflow cannot meet its reliability requirement or cannot fail safelyReduce dependency surface, improve fallback, or pause promotion

    Do not average these gates into a single agent score. A composite score can let strong adoption cancel a serious security failure or let low latency hide poor answer quality. Keep each gate visible, assign its owner, and specify which failures block promotion without negotiation.

    Release decisions should also be reversible. Keep prior prompt, policy, retrieval, and tool configurations identifiable. Define how the runtime disables a tool, narrows a cohort, returns to recommendation-only behavior, or routes directly to a person. A rollback plan that depends on diagnosing the root cause first is too slow for a live incident.

    Make the dashboard an operating system for the product team

    The best agent dashboard does not attempt to show every event. It puts the release decision in view. Organize it in the order the team should reason:

    1. Outcome: eligible workflows, target business result, comparison group where appropriate, and results by cohort and release version.
    2. Journey: eligible, offered, invoked, answer presented, action proposed, approved, executed, handed off, and completed.
    3. Quality and trust: grounded status, acceptance, substantive edits, rejection, retries, corrections, fallback, and qualitative feedback categories.
    4. Governance and operations: allowed and denied tools, approval states, out-of-scope attempts, redaction failures, incidents, errors, latency, and dependency health.

    Every panel should filter by agent version, policy version, tool, entry point, cohort, and workflow outcome. A top-line average is useful for orientation, but releases fail in slices: a user role with missing permissions, a workflow with poor retrieval, a new policy that blocks a required tool, or a handoff destination that cannot use the transferred context.

    Run a decision review, not a dashboard tour

    A regular review with the product trio can use behavioral telemetry, user feedback, and business outcomes to refine prompts, retrieval, and decision logic. Bring security, legal, analytics, operations, or domain owners into decisions that cross their boundaries. The meeting should answer:

    • Which intended outcome moved, for which eligible cohort, and under which release version?
    • Where did users retry, edit, reject, abandon, or request a person, and what does the failure taxonomy show?
    • Which permissions were never needed, and which denied requests reveal either a valid attack defense or a mismatch between the job and the available tools?
    • Did the agent reduce user work, or did it move that work into reviewing, correcting, approving, and recovering?
    • Are outcomes consistent across important roles and workflow entry points, or is the top-line result hiding a weak segment?
    • What changed since the prior release across the model, prompt, retrieval corpus, tools, policies, user experience, and instrumentation?
    • Should the team expand, hold, revise, restrict, roll back, or retire the current behavior?

    Record the decision beside the release lineage: the hypothesis, eligible scope, versions, expected outcome, gates, observed evidence, known risks, owner, and next review condition. This turns governance into an operating history. It also prevents the same debate from restarting when a metric moves or a stakeholder changes.

    Ownership must be explicit. Product owns the job, intended outcome, and promotion decision. Engineering owns runtime reliability, tool boundaries, traceability, and rollback mechanics. Design owns disclosure, user control, approval clarity, correction, and handoff. Data or analytics owns event integrity and metric definitions. Security and legal own the policies and incident requirements within their mandates. Shared input is valuable; shared accountability without a decision owner is not.

    Start with one consequential workflow. Write its contract, add the eligibility event and shared identifiers, classify every available tool by authority, pre-commit the release gates, and review the first bounded cohort against the business outcome. Do not broaden the agent until you can explain why it ran, what it was permitted to see and do, what the user did next, whether the workflow improved, and how you would stop it safely.

    References

  • Context-Driven AI Product Engineering That Survives Production

    Context-Driven AI Product Engineering That Survives Production

    Your AI feature can look excellent in a demo and still fail in production. The prompt has not changed, but the user, account, permissions, available data, and business decision have. A fluent answer built on the wrong context is still the wrong answer.

    If your team keeps rewriting instructions to fix inconsistent results, inspect what the model can see, why it can see it, and what it is expected to do with that information. Context-driven AI product engineering turns those decisions into a versioned, measurable product system rather than hiding them inside one large prompt.

    Determine whether context is actually the bottleneck

    Runtime context is the complete package available to the model for a specific task. It includes instructions, retrieved evidence, permissions, conversation state, memory, tool definitions, metric definitions, output requirements, and stop conditions. Prompt text is only one part of that package.

    This distinction matters because different failure classes require different fixes. A prompt change cannot retrieve a missing CRM record. A larger model cannot make a stale policy current. Better prose cannot repair an authorization error. Start by assigning every bad result to the layer that produced it.

    • Evidence is missing: the necessary record, document, event, or metric never reached the system.
    • Evidence was available but not selected: retrieval, filtering, metadata, or ranking favored the wrong material.
    • Evidence is stale or contradictory: the system lacks a freshness rule or conflict-resolution policy.
    • The procedure is incomplete: the model has facts but not the sequence, metric definition, or decision rule needed to use them.
    • The scope is unsafe: the context contains data the current user, role, tenant, or workflow should not access.
    • The answer contract is unclear: the model does not know when to cite evidence, expose uncertainty, request missing input, call a tool, or abstain.
    • The answer is technically correct but operationally unhelpful: it does not fit the user’s role, decision, timing, or next action.

    For one failed session, reconstruct the full path instead of reading only the final answer:

    1. Capture the user’s request, detected intent, role, tenant, and relevant permissions.
    2. Record the retrieval queries, filters, candidate results, metadata, and ranking scores.
    3. Show which candidates entered the context, which were excluded, and why.
    4. Inspect the assembled instructions, evidence, memory, tool contracts, and output schema.
    5. Record every tool call, returned result, retry, timeout, and policy decision.
    6. Compare the answer with the evidence that was actually available at generation time.

    The resulting trace gives you a practical decision tree. If the correct evidence was absent from the candidate set, fix ingestion or retrieval. If it was retrieved but excluded, fix ranking or context packing. If it entered the prompt but the answer contradicted it, test instruction hierarchy, conflict handling, or model behavior. If the evidence and answer were both correct but the user still could not act, fix the product experience.

    This is why a retrieval-first, context-aware design usually creates more leverage than another round of isolated prompt editing: it makes the evidence path visible and gives each failure an identifiable owner.

    Write a context contract before choosing the architecture

    A context contract defines what the AI needs for one product task, where that context may come from, how it must be constrained, and what the system should do when the contract cannot be satisfied. It is the interface between product intent and runtime engineering.

    Consider an account-risk assistant used by a customer success manager. Its contract could look like this:

    Contract fieldDecision to makeExample implementation
    Task boundaryWhat may the AI decide or produce?Summarize risk signals and propose a next step; do not change the account record.
    Authorized evidenceWhich information is both relevant and permitted?CRM fields, recent support history, approved playbooks, and defined product-usage metrics visible to the current user.
    Identity and scopeWhich user, tenant, account, and role govern access?Resolve all four before retrieval and preserve them through every tool call.
    FreshnessHow current must each evidence type be?Carry the captured-at timestamp and qualify the answer when a required record exceeds the product’s approved freshness window.
    Conflict ruleWhat happens when trusted inputs disagree?Expose the conflict and its timestamps instead of silently choosing one value.
    ProcedureWhich reasoning process should the workflow execute?Identify the account, retrieve authorized signals, apply metric definitions, compare evidence, state caveats, and propose an action.
    Output contractWhat structure must the response follow?Answer, supporting evidence, caveats, recommended action, and provenance.
    Abstention ruleWhen should the system decline to conclude?Report missing evidence when a required record, metric definition, or permission check is unavailable.
    Audit payloadWhat must be reproducible later?Context-contract version, evidence identifiers, timestamps, policy version, tool results, and model configuration.

    The contract should keep five kinds of context distinct. Task context says what the user is trying to accomplish. Evidence context contains facts relevant to that task. Policy context defines permissions, governance, and prohibited behavior. Interaction context carries the useful parts of the current conversation and approved long-term memory. Execution context defines tools, schemas, retries, and stop conditions.

    Keeping those layers separate prevents a common production mistake: treating all text as equally authoritative. A user’s request should not override a permission rule. A retrieved comment should not outrank an approved policy. An old conversation should not silently redefine a current metric. Your assembly logic needs an explicit precedence order for these collisions.

    Personalization belongs in the contract too. Intent and role should narrow context, not merely add more of it. A finance user may need policy-safe excerpts and transaction evidence. A customer success user may need current account activity and support history. A product manager may need metric definitions, cohorts, experiment state, and caveats. Role-aware assembly and scoped memory make the same underlying capability useful without exposing every available field to every request.

    You know the contract is testable when each field can become a pass-or-fail assertion. Did the workflow apply the current permission scope? Did it include the required metric definition? Did it expose a conflict? Did it abstain when decisive evidence was unavailable? If a requirement cannot be tested or observed, it is still an aspiration rather than an engineering contract.

    Build context assembly as a controlled pipeline

    The production unit is not a prompt template. It is the pipeline that converts a user request into a bounded evidence packet and an executable task. That pipeline should have explicit stages:

    1. Authorize the request. Resolve identity, role, tenant, account scope, and permitted operations before searching for evidence. Apply access controls again before generation as a second check.
    2. Normalize the inputs. Give each record or chunk a stable identifier plus source type, owner, tenant, timestamp, policy classification, schema version, and other metadata needed for filtering.
    3. Generate retrieval candidates. Combine semantic retrieval for conceptually related language with keyword retrieval for exact identifiers, product names, codes, and policy terms.
    4. Filter and rank for the task. Use intent, role, account, freshness, authority, and source-level confidence in addition to semantic similarity.
    5. Resolve stale and conflicting evidence. Apply the contract’s freshness and precedence rules before the model sees the packet. Preserve unresolved conflicts as explicit context.
    6. Pack the context window. Allocate space by priority, remove duplicates, keep decisive passages intact, and exclude material that does not change the task.
    7. Execute through a defined interface. Supply tool schemas, metric definitions, procedure steps, output fields, citation requirements, and abstention conditions.
    8. Attach provenance and emit a trace. Store identifiers and versions needed to reproduce the decision without indiscriminately copying sensitive raw content into logs.

    Hybrid retrieval is useful because semantic and lexical search solve different problems. Semantic search can find a relevant concept expressed in different words. Keyword search protects exact matches such as an account identifier, event name, plan code, or policy term. Metadata then makes the results usable: a highly similar passage from the wrong tenant or an obsolete policy is not a valid result.

    Authorization must shape retrieval itself. Do not search a global corpus, rank everything, and rely on a final prompt instruction to hide unauthorized results. That approach can expose sensitive material to intermediate services, caches, traces, or debugging tools even if it never appears in the final answer. Filter at the retrieval boundary, preserve tenant and role scope through tool calls, and validate the assembled packet before generation.

    Context-window management is also a relevance problem, not just a token-count problem. Reserve capacity in a deliberate order: non-negotiable policy and permissions, the current task, decisive evidence, required procedure and definitions, recent interaction state, then supplemental material. When the packet is too large, compress or drop lower-priority evidence rather than truncating whichever section happens to come last.

    Memory needs its own product rules. Short-term conversation state should retain unresolved references, user corrections, and active task decisions. Long-term memory should be scoped to durable facts that the product is allowed to retain. Define how memory is written, validated, refreshed, read, and deleted. Dumping a full transcript into every turn increases noise and can revive facts or instructions that no longer apply.

    For analytical products, context must include a procedure as well as data. A reliable workflow starts with the decision to be made, anchors it to metric definitions and guardrails, retrieves trusted data, generates testable hypotheses, segments the evidence, and returns options with trade-offs and caveats. That structured analyst loop is far easier to evaluate than a broad instruction to analyze the data.

    The same restraint applies to agents. Use multiple steps or tools when decomposition makes the task clearer, safer, or more verifiable. Each step needs an input schema, permitted tools, completion condition, failure path, and evidence handoff. Agentic patterns are most useful when task decomposition reduces real complexity; extra autonomy without a clearer control boundary simply creates more places for context to drift.

    Ship with layered evaluations, observability, and ownership

    Evaluate the evidence path before scoring the prose

    A single answer-quality score hides the layer that failed. Build an evaluation stack that follows the same stages as the runtime pipeline:

    • Retrieval evaluation: Was the required evidence present in the candidate set, and where did it rank?
    • Assembly evaluation: Did the final packet include required facts and policies, exclude unauthorized or irrelevant material, preserve provenance, and respect freshness rules?
    • Behavior evaluation: Did the model follow the procedure, use the supplied evidence, handle conflicts, cite support, and abstain when required?
    • Answer evaluation: Was the result correct, grounded, complete enough for the task, and structured as promised?
    • Product evaluation: Did the user complete the task, reach an answer faster, correct the output, return to the capability, or escalate to a human?
    • Operational evaluation: Did latency, context size, cost, tool failures, permission denials, and fallback behavior stay within the product’s approved limits?

    Your offline evaluation set should represent the failure surface, not just normal requests. Include different roles and intents, sparse accounts, stale records, contradictory inputs, missing definitions, empty retrieval, tool failures, unauthorized requests, and cases where abstention is the correct result. Label the evidence that should be retrieved as well as the answer that should be produced. Otherwise, a system can pass by reaching the right conclusion through the wrong material.

    Version the evaluation cases, context contract, retrieval configuration, policy set, prompt, tools, and model independently. Change one major layer at a time when possible. If a model upgrade, ranking change, and prompt rewrite ship together, an improved aggregate score will not tell you what worked or which change caused a regression in a sensitive slice.

    After offline acceptance, use staged online experiments with a predeclared outcome, guardrails, acceptance threshold, and minimum detectable effect. Task success, groundedness, time to first answer, adoption, and deflection can all be useful, but only when they match the workflow. A support assistant should not optimize deflection by confidently blocking necessary escalation. An analytical assistant should not optimize speed by dropping caveats required for a sound decision.

    Instrument enough to reproduce failure without creating a new data risk

    For each request, emit a structured event envelope containing the workflow and context-contract versions, detected intent, authorized scope, retrieval-query identifier, evidence identifiers, ranking metadata, freshness state, tool outcomes, policy decisions, answer status, latency, and user feedback. This gives product and engineering a common record for diagnosing failure.

    Do not default to logging every raw prompt, retrieved document, or tool response. Production context can contain customer data, confidential policy, or personal information. Prefer stable identifiers, approved redaction, access-controlled traces, and retention rules. Keep the minimum raw material needed for authorized debugging and evaluation, and make data ownership explicit.

    Roll out in stages: run the new pipeline against offline cases, observe it without user impact where possible, expose it to a constrained cohort, compare it with the existing experience, and expand only after both quality and operational guardrails hold. Preserve a feature flag, a known-safe fallback, and a rollback path for context changes as well as model changes.

    Give every context surface an owner

    Context crosses organizational boundaries, so shared responsibility without named ownership turns into drift. Assign decisions explicitly:

    • Product owns the task boundary, target user, intended decision, outcome metric, failure taxonomy, and acceptance trade-offs.
    • Design owns how evidence, uncertainty, correction, abstention, and human handoff appear in the experience.
    • AI and platform engineering own retrieval, ranking, assembly, tool interfaces, reproducibility, evaluation infrastructure, and fallbacks.
    • Data owners own schemas, metric definitions, lineage, freshness, and the authoritative status of each collection.
    • Security, privacy, and governance owners define permitted use, redaction, retention, and audit requirements.
    • SRE owns service-level monitoring, failure alerts, capacity behavior, deployment safety, and rollback readiness.

    A Staff AI Engineer can connect these concerns by turning research choices into repeatable workflows and shared evaluation infrastructure, but that role should not become the sole owner of product judgment, source governance, or production reliability. Cross-functional execution works when each decision has one accountable owner and the whole group uses the same context trace and evaluation results.

    Treat context changes like code changes. A release should identify the changed source, schema, ranking rule, contract, or policy; show the affected evaluation slices; state the expected product outcome; and preserve a rollback path. CI/CD guardrails, drift monitoring, and human review turn context from an informal prompt dependency into an operable platform capability.

    Key takeaways

    • Diagnose the failed layer before editing the prompt. Missing evidence, bad ranking, stale data, unsafe scope, incomplete procedure, and weak UX are different problems.
    • Define a context contract for each workflow: task boundary, authorized evidence, freshness, precedence, procedure, output, abstention, and audit payload.
    • Authorize before retrieval, rank with task and metadata signals, and validate the assembled packet before generation.
    • Manage the context window by authority and decision value, not by filling every available token.
    • Evaluate retrieval, assembly, model behavior, answer quality, user outcomes, and operational performance separately.
    • Version context components independently, release them through staged controls, and assign an accountable owner to every surface.

    At your next AI product review, do not approve the experience from the final answer alone. Ask to see the evidence packet, permission scope, context-contract version, failed evaluation slices, runtime trace, and rollback path. Those artifacts reveal whether the feature is dependable or merely persuasive.

    Start with one production workflow whose failures matter to users. Trace its most common failure, write the contract, repair the responsible layer, and require the change to pass both offline evaluation and a guarded rollout. Once that loop works, you have the foundation for a reusable context platform rather than another prompt that only works in the demo.

    References

  • Agentic AI for Incident Response: A Practical Operating Model

    Agentic AI for Incident Response: A Practical Operating Model

    An incident fires. Your responders are not short of data; they are short of a trustworthy path through it. Deployment timelines, service ownership, dashboards, logs, runbooks, and prior incidents live in separate places, while the cost of a wrong action rises by the minute.

    The decision in front of you is not whether AI can summarize the incident channel. It is whether an agent can shorten the investigation without becoming another failure mode. That requires an operating model covering the agent’s job, context, permissions, interface, and evaluation before you give it meaningful authority.

    Give the agent an investigation job before action authority

    An incident-response agent should run a goal-directed investigation loop, not wait for isolated prompts like a chatbot. A credible implementation can collect context, form and test hypotheses, and draft fixes inside Slack. The important product decision is where that loop must stop for human judgment.

    Model the loop on the work a strong responder already performs:

    1. Scope the incident. Identify the affected service, environment, customer surface, start time, and known symptoms. Preserve unknowns instead of filling them with plausible guesses.
    2. Gather relevant context. Retrieve recent changes, service ownership, dependencies, telemetry, runbooks, feature-flag changes, and similar incidents.
    3. Form competing hypotheses. Produce a ranked set rather than locking onto the first convincing explanation. Distinguish observed facts from inferences.
    4. Test each hypothesis. Use read-only tools to query metrics, logs, traces, deployment state, and dependency health. Record what supports or weakens each possibility.
    5. Propose the next best action. Explain the target, expected effect, risk, preconditions, and recovery path. Do not hide uncertainty behind an authoritative tone.
    6. Update the investigation. Incorporate tool results and responder corrections, discard disproven hypotheses, and choose the next check.

    The incident commander remains accountable for priorities and mitigation. The agent acts as an investigation engine: it gathers, tests, organizes, and proposes. This division is more useful than treating human involvement as a final approval click after the AI has already made every material decision.

    Choose the first workflow with care. A good starting point has a bounded service area, dependable read-only signals, known responders, established runbooks, and outcomes you can verify after the incident. A workflow that depends on undocumented tribal knowledge or unrestricted production access is not ready for agentic automation. Fix the operating system around the incident before expecting a model to compensate for it.

    Do not begin with the most dramatic remediation you can automate. Early value usually comes from reducing context switching, locating the correct owner, connecting symptoms to recent changes, and eliminating weak hypotheses. Those tasks consume scarce attention but do not require the agent to mutate production.

    Context quality determines the ceiling of the investigation

    A capable model cannot reason with operational context it cannot find, distinguish, or trust. If a service has three names across the deployment system, observability platform, and incident channel, retrieval becomes unreliable before model reasoning even begins.

    Create a context contract for every service placed within the agent’s scope. At minimum, make these fields explicit:

    • Identity: canonical service name, aliases, repository, runtime, and environment.
    • Ownership: accountable team, current on-call route, and escalation path.
    • Topology: upstream dependencies, downstream consumers, data stores, queues, and shared infrastructure.
    • Change history: deployments, configuration changes, feature flags, migrations, and rollback state.
    • Operational knowledge: current runbooks, known failure modes, dashboards, alerts, and prior incident records.
    • Control policy: tools the agent may call, environments it may inspect, actions it may propose, and actions it may never execute.

    Start retrieval with exact operational signals. Filter by canonical service, environment, incident time window, deployment identifier, alert type, and ownership tag. Then rerank the surviving records for the current question. This deterministic tagging and reranking foundation is easier to debug than making semantic similarity responsible for every retrieval decision.

    Add embeddings where language actually creates ambiguity: matching an unfamiliar symptom to a differently worded historical incident, finding a relevant paragraph inside a long runbook, or connecting terminology used by two teams. Semantic retrieval should widen discovery, not erase exact boundaries such as production versus staging or one tenant versus another.

    Require every retrieved item to carry provenance that a responder can inspect: its system of record, service and environment, creation or update time, incident-time availability, and reason for retrieval. This lets the responder notice four common failures quickly:

    • A runbook is relevant but stale.
    • An ownership record is current but was different when the incident began.
    • A similar incident came from another environment with different dependencies.
    • A historical evaluation accidentally exposed the final root cause before the agent could have known it.

    Treat missing context as an observable product state. The agent should say that it cannot locate a deployment record or dependency map, identify which system was checked, and propose a safe way to continue. A confident answer assembled around a missing record is more dangerous than an explicit gap.

    Scale permissions to reversibility and blast radius

    Autonomy is not one switch. It is a set of permissions attached to particular tools, targets, environments, and action classes. Granting broad credentials because the agent usually behaves conservatively turns a model-quality issue into a production-control issue.

    Action classAppropriate agent roleRequired human control
    Read-only investigationQuery approved telemetry, changes, ownership, and runbooksAudited access with service and environment boundaries
    Recommendation or communicationDraft a diagnostic check, remediation plan, incident update, or escalationA responder reviews customer-facing messages and consequential recommendations
    Bounded, reversible executionInvoke a preapproved runbook against an explicitly named targetApproval bound to the exact action, target, inputs, and current incident
    Irreversible or broad executionExplain the need and prepare a plan, but do not execute during the initial rolloutExisting change controls and accountable operators remain in force

    Do not label an action reversible merely because the interface contains a rollback button. A deployment rollback can still be unsafe after an incompatible schema or data change. A restart can amplify load or destroy useful diagnostic state. Reversibility has to be validated for the specific service state, not inferred from the action name.

    For every executable tool, define guardrails outside the prompt:

    • Use least-privilege credentials scoped by service and environment.
    • Allowlist tools, targets, and input shapes rather than relying on natural-language prohibitions.
    • Preview the exact command or workflow, target, parameters, and expected effect before approval.
    • Bind approval to that exact action so the agent cannot reuse it for a changed target or plan.
    • Use rate limits, idempotency controls, and circuit breakers where repeated calls could cause harm.
    • Route production changes through existing CI/CD or runbook automation when possible.
    • Record retrievals, tool inputs, tool outputs, approvals, denials, and resulting state changes in an audit trail.
    • Provide a direct way to suspend the agent’s tool access without disabling the incident workflow itself.

    The action proposal should be a control artifact, not a conversational suggestion. It needs the evidence supporting the action, the exact target, the expected observable result, the maximum intended scope, known preconditions, and what the responder will do if the result does not appear. If the agent cannot supply those fields, it has not earned execution authority for that action.

    Keep outward communication on a separate permission path. Drafting a status update is low-risk technically but consequential for customers and the business. Human review should verify what is known, what remains uncertain, and whether the message promises a recovery time the evidence cannot support.

    Make evidence and uncertainty legible in the incident room

    Putting the agent inside the collaboration surface where incidents already unfold reduces the friction of opening another product and re-explaining the situation. It also means the agent’s output competes with urgent human messages. Long narrative answers will be skipped, however intelligent they sound.

    Give each investigation update a stable structure:

    • Observed: facts returned by named systems, with timestamps and links where available.
    • Hypotheses: ranked explanations with the supporting and conflicting evidence for each.
    • Changed since the last update: new evidence, rejected hypotheses, and responder corrections.
    • Next check: the read-only query or tool call most likely to distinguish between the remaining possibilities.
    • Proposed action: target, expected effect, blast radius, preconditions, and recovery path.
    • Decision needed: the specific approval, input, or ownership choice required from a human.

    This is not a request to expose a model’s private, free-form chain of thought. Responders need a structured evidence trail: claims, retrieved signals, tool results, rejected alternatives, and action rationale. That artifact is more useful for review because each part can be checked against the operational record.

    Confidence labels are helpful only when they change behavior. Define what the interface does when confidence is low: ask for a missing service identifier, run another safe check, present multiple hypotheses, or escalate to the owner. Do not display a precise-looking score unless you have evaluated whether that score corresponds to actual correctness in your incident set.

    Design human correction as part of the main workflow. A responder should be able to reject a hypothesis, correct the service or environment, mark a retrieved record stale, deny an action, and state why. The agent should preserve that decision in the incident record and replan from it. Repeatedly resurfacing a rejected hypothesis erodes trust even when the underlying model is otherwise capable.

    Watch for a subtle interface failure: polished summaries can make weak investigations look complete. Make unresolved questions and conflicting signals visually prominent in the message structure. The goal is not to make the agent sound certain. It is to help the incident commander see what is known, what is inferred, and what decision comes next.

    Test against past incidents, then expand authority one boundary at a time

    A demo proves that the agent can complete a favorable path. It does not prove that the agent will retrieve the right context, resist a misleading correlation, respect permissions, or propose a safe action when production is ambiguous.

    Use post-incident time-travel evaluations. Reconstruct what the agent could have known at each point in a real incident. Begin with the original trigger and expose deployments, telemetry, messages, and tool results only when they became available. Hide the final root cause, later analysis, and corrected metadata until the corresponding point in the replay. Otherwise, you are testing hindsight rather than incident response.

    Grade the investigation on operational usefulness, not prose quality:

    • Scoping accuracy: Did it identify the correct service, environment, symptoms, and ownership route?
    • Context retrieval: Did it find the relevant change, runbook, dependency, or earlier incident without mixing incompatible records?
    • Hypothesis quality: Where did the eventual cause appear in the ranked set, and what evidence was used to test it?
    • Evidence integrity: Does every factual claim match a retrieved record or tool result? Did the agent invent a signal that was never observed?
    • Tool correctness: Did it select the correct tool, target, environment, and parameters?
    • Action safety: Was the proposed action inside policy, and were its blast radius, preconditions, and recovery path explicit?
    • Calibration: Did expressed certainty track actual correctness, especially when context was incomplete?
    • Time compression: How did the time to a useful hypothesis, correct owner, mitigation decision, and recovery compare with the existing workflow?
    • Human effort: Which searches, handoffs, repeated explanations, and diagnostic checks did the agent remove or add?

    Treat safety failures differently from diagnostic misses. A missed hypothesis is a capability problem. Crossing a permission boundary, inventing evidence, or targeting the wrong environment is a release blocker for that tool path. Averaging all outcomes into one quality score can conceal exactly the failure that matters most.

    A practical rollout sequence

    1. Instrument the human workflow. Capture incident timelines, ownership changes, diagnostic steps, approvals, mitigations, and outcomes. You need a baseline before claiming improvement.
    2. Replay historical incidents. Use time-bounded context and score the agent against known outcomes. Repair retrieval and service metadata before tuning for eloquence.
    3. Run in shadow mode. Let the agent investigate live incidents without posting conclusions or changing systems. Compare its evidence and hypotheses with the responder’s path.
    4. Expose read-only assistance. Allow responders to request context, hypothesis checks, and draft updates. Collect explicit acceptance, correction, and rejection signals.
    5. Add recommendation mode. Let the agent propose remediations using the structured action artifact, while humans continue to execute through established controls.
    6. Enable one bounded action path. Choose a preapproved runbook with a clear target, validated preconditions, observable effect, and recovery procedure. Keep approval attached to the exact invocation.
    7. Expand by tool and service. Grant additional authority only when evaluation evidence supports that particular boundary. Do not treat success on one service as proof of readiness everywhere.

    Re-run the evaluation set after changes to prompts, models, tools, service topology, runbooks, or permissions. An agent can regress even when its general language quality improves. Operational behavior depends on the whole system around the model.

    Key takeaways

    • Start with investigation and context compression; earn execution authority later.
    • Build deterministic service, environment, time, and ownership filters before depending on semantic retrieval.
    • Separate observed facts, hypotheses, and proposed actions in every incident update.
    • Enforce permissions in tools and infrastructure, not only in prompts.
    • Evaluate with historical time travel so the agent never sees facts that were unavailable during the real incident.
    • Expand autonomy one action, tool, service, and environment boundary at a time.

    The next outage is the wrong time to discover that your agent cannot distinguish a plausible explanation from verified evidence. Before it happens, choose one bounded incident workflow, define its context contract and permission envelope, and replay several real investigations without future information. If the agent can make its evidence legible, stay inside policy, and consistently move responders toward the next correct decision, you have a foundation worth expanding.

    References