Skip to main content
CodeDTX

How do you monitor an AI agent in production?

Follow agent work from evidence to execution, detect behavioural failures, and connect production alerts to a named operator and a tested response.

A silver operations console beside a connected workflow, with an orange route, a spare component and a pause control.

Monitor an AI agent by following each request through evidence retrieval, proposal, human decision, and execution. Combine service health with checks on task behaviour, permission boundaries, and the resulting business record. Every alert should reach an owner who can investigate the trace, contain the affected capability, and verify recovery.

Define the work that monitoring must explain

Agent monitoring is the practice of observing a running workflow closely enough to recognise an unacceptable state and decide what to do about it. A model endpoint responding successfully does not establish that the product completed the user's task. It may have retrieved the wrong evidence, drafted an unusable proposal, or left an approved request stranded before execution.

Start from the workflow's states. A request can be waiting for evidence, awaiting a decision, rejected, ready to execute, applied, or unresolved after a failure. Define which transitions are permitted and which component owns each transition. Monitoring should help an operator distinguish an expected wait from abandoned work.

Consider a hypothetical internal catalogue application. An agent proposes corrections to product descriptions using approved source records. A reviewer decides whether to accept a particular correction, and an executor updates the catalogue. Observing the generated text alone would miss a correction that never reached the catalogue or was applied to the wrong item.

Trace the complete request across boundaries

Assign a correlation reference when the application accepts a request. Carry that reference through permitted retrieval, model interaction, proposal storage, approval, execution, and result confirmation. Keep references to related attempts without pretending that a retry is a new business request.

The trace should identify the deployed configuration: model selection, prompt version, tool contract version, and retrieval configuration where applicable. Record the actual information available from dependencies rather than claiming a version detail that a service does not expose. Those references let investigators compare a failing request with the configuration used during evaluation.

Trace context connects observations across components; it should not become a channel for copying private business content into unrelated services. This distinction is consistent with the OpenTelemetry guidance on context propagation, which describes signal correlation and the potential sensitivity of propagated context.

Record observable events and evidence references. An investigation does not require hidden model reasoning. The operator needs to know what information was supplied, what the agent proposed, what decision was recorded, what operation was attempted, and what the target system confirmed.

Keep service health separate from task behaviour

Service monitoring answers whether dependencies are available, requests are stalling, and resources remain within operating budgets. It should distinguish a model failure from an unavailable search index, expired credential, or rejected write operation. Sending every exception to an undifferentiated agent-error bucket hides the recovery action.

Behavioural monitoring answers whether the workflow remains useful and bounded. Look for proposals missing required evidence, output that fails its contract, repeated requests for unavailable tools, or reviewer feedback indicating that the proposal misunderstands the task. A syntactically valid response can still be unsuitable for the business decision.

Review outcomes also need interpretation. A rejected proposal might demonstrate that the approval gate worked, reveal a recurring agent mistake, or reflect a legitimate change in user intent. Preserve the review reason and inspect the affected workflow before declaring that rejection itself is a failure.

Use agent evals to investigate recurring behaviour under controlled conditions. Production observations supply candidates for evaluation; they do not automatically establish the expected answer. A domain reviewer should confirm the failure and remove unnecessary sensitive material before a captured incident becomes a regression case.

Observe the decision and execution boundary

CodeDTX's Propose–Decide–Execute pattern gives monitoring explicit boundaries. The agent writes proposals with evidence and has no outward write tool. A named human records a decision with a reason. A separate execution layer applies approved work and records the resulting artefact.

Watch for broken relationships between those records. An execution attempt must refer to an applicable approval for the exact operation. A changed proposal should not inherit approval silently. An applied status must come from evidence of the result, rather than the proposing model's claim that it finished.

In the catalogue example, a lost response after an update leaves the outcome uncertain. The operator should inspect the target record and the execution reference before retrying. A monitor that merely restarts the task could repeat a change or overwrite a subsequent edit. The recovery path belongs in application logic and the runbook.

An audit trail and operational monitoring serve related purposes. The audit trail preserves decision evidence; monitoring draws attention to conditions that need intervention. Their access and retention policies may differ. The separate guide to what an agent audit trail contains describes the record itself.

Cover the architecture without creating disconnected dashboards

Use the reference architecture to check whether an operational view misses a dependency. The agent layer exposes task and tool behaviour. The integration layer exposes contract failures and access decisions. The knowledge layer shows retrieval failures, source availability, and evidence provenance.

The reliability layer connects traces, evaluations, recovery, and operating budgets. The safety layer reveals boundary violations and the state of human approval gates. The product layer shows whether people can review, correct, and complete the workflow. These are different explanations for why work might stop.

Operators should be able to move from an affected request to its relevant evidence without consulting unrelated dashboards manually. Preserve the distinctions between components while connecting their records. Enterprise AI integration is where declared interfaces, identities, and permission checks give those observations an enforceable meaning.

Turn an alert into a response someone can perform

Define the trigger, affected capability, decision owner, and available containment action together. A missing required approval may require disabling execution while preserving pending proposals. An unavailable knowledge source may require stopping new drafts until evidence is available. A failed review notification may require restoring the queue's delivery path.

The response should explain how to find affected work and what users will see. Pausing the model while leaving the interface claiming that requests are processing creates a second operational problem. Preserve request state, communicate the restriction in the product, and provide a supported route for urgent work.

Exercise alerts with controlled failures. Confirm that the intended operator receives the signal, can access the necessary trace, and has permission to use the containment control. After repair, verify the affected workflow and record the release decision before restoring execution. The guide to who operates an agent after launch covers how these responsibilities are assigned.

Frequently asked questions

Is a successful model response enough to mark a request complete?

No. It establishes only that a response was returned. The application still needs to validate the proposal, obtain any required human decision, execute the approved operation, and confirm the resulting state. Completion should reflect the business workflow's acceptance conditions. Keep generated statements about success separate from confirmation supplied by the system that owns the record.

Should monitoring store every prompt and response?

Decide what evidence is necessary for investigation and apply the organisation's data access and retention rules. Metadata, configuration references, and controlled links to evidence may be sufficient for routine support. Where content capture is justified, restrict access and redact unnecessary sensitive material. Collecting everything by default can expose information to people who could not access the original records.

How do we detect a decline in proposal quality?

Combine structured reviewer feedback, representative output review, and evaluations of the deployed configuration. Investigate missing evidence, misunderstood requests, and inappropriate tool choices separately. Compare affected cases with source and configuration changes before attributing the issue to the model. A useful finding explains the failure and the action needed, rather than reporting an unexplained change in a dashboard.

Can the agent repair itself when an alert fires?

It can help assemble diagnostic evidence or propose a repair within its permitted scope. Consequential changes should follow the established decision and execution controls. Automatic recovery routines may be appropriate for predefined infrastructure conditions, but they need explicit limits and tests. An alert should not grant the proposing agent new credentials or permission to change its own operating boundaries.

Contact us to build the right product

Talk to our engineers about your application, the systems it connects to, and what you want to build next.

Get in touch
Two people discussing work with a laptop