Defining a Behavioral Baseline for a Deployed Agent Retroactively
Rebuild an agent's expected behavior from traces, then check it against its instructions.

Traditional error monitoring fails for AI agents because even when a run succeeds, the agent can take the wrong action, use a made-up argument, or skip a required approval. Defining a behavioral baseline retroactively means reconstructing expected behavior from production traces, then checking it against the agent’s instructions. That reconciled baseline makes silent deviations detectable even when infrastructure metrics and status codes remain healthy.
Why agents ship without a behavioral baseline in the first place
Agent tooling makes deployment possible without requiring a definition of correct behavior first. When the architecture treats the LLM as the product, context, validation, and observability become optional layers for release. The omission becomes visible in the agent’s behavior only after deployment. Standard APM and infrastructure monitoring can stay green while behavior degrades, leaving teams to assemble their first baseline after something goes wrong, from whatever traces exist.
Why traditional error monitoring fails for AI agents
Error monitoring detects crashes and execution faults, but silent misbehavior need not produce either. A tool invoked with a hallucinated user ID can return a success code even though its argument has no legitimate basis in the task. The call succeeded in the narrow operational sense. Without a behavioral baseline, monitoring has no expected argument pattern or authorized workflow against which to judge that success.
This explains why an agent can look healthy in logs while giving users bad outputs. Status codes report execution outcomes. Microsoft AI Red Team’s updated taxonomy lists failure modes including goal hijacking, inter-agent trust escalation, and session context contamination that are hard to spot on their own. To find them, teams need to analyze behavior across the full session. A baseline supplies the reference for that analysis by defining expected actions and constraints, rather than treating the absence of an exception as evidence of correct behavior.
What traces actually record and what they leave out
Production traces provide a partial but workable behavioral record. They capture which tool was called, the arguments passed, the tool’s return, latency per span, and the next recorded reasoning step. These are observations of what the agent did. They do not establish its intent or prove that an action served the user’s goal. Even a recorded reasoning step must therefore be assessed against the task and instructions rather than accepted as evidence that the execution was appropriate.
Step-level tracing is the minimum viable signal for this work, because a run can return success at every step while behaving incorrectly throughout. In multi-agent systems, reconstruction also requires a shared trace ID propagated from the orchestrator to every sub-agent. Without that link, the complete failure trajectory cannot be reconstructed and attributed across agents. Separate successful calls are not a complete session. Retroactive baselining must work within these limits, using traces to establish behavior and instructions to establish what that behavior should have been.
Mining traces for behavioral signals worth clustering
To start reconstruction, teams should pull out stable signals that show how runs are structured. Start with tool-call sequences, keeping track of which tools fired and in what order in runs that handled similar tasks. Repeated paths become candidates for normal behavior later. At this stage, the extraction should retain the sequence without deciding whether its frequency makes it acceptable. That separation prevents the collection process from silently approving the behavior it records.
Next, extract argument shapes from tool-call spans, including schemas, required fields, and observed value ranges. Missing fields and out-of-range values can then appear as distribution outliers, while fabricated IDs are candidates for scrutiny. Also pull out step counts and loop patterns that repeat. When step counts rise without getting closer to the goal, they are a planning-failure fingerprint. Per-run cost and token usage add another signal, since excessive resource use can remain invisible to error monitoring even when it departs sharply from the agent’s usual behavior.
Tool returns need to be paired with subsequent actions so that error handling becomes observable. If the agent proceeds identically after a tool error and a tool success, the trace signals absent error handling. Raw output text varies too much to use as the baseline, while latency alone is an infrastructure signal and pass/fail codes cannot show semantic correctness. Failure categories can guide extraction without supplying ready-made fingerprints. The same taxonomy identifies goal hijacking and session context contamination, but does not map them to trace patterns such as divergence between planned and executed tool sequences.
Clustering extracted signals into a working definition of normal
To turn those signals into a baseline, group traces by task type before clustering their behavioral patterns. A support agent handling customer lookups and cancellation flows has different expected paths for each. Combining them would hide those differences and give a poor picture of both tasks. There is no useful single average trace. The working baseline is a set of task-specific clusters, each with its own modal pattern and expected ranges.
Within each task group, find the modal tool-call sequence, which is the path most traces follow. Treat that path as a baseline candidate. Check the less common paths before accepting them as alternates. For a hypothetical support agent, teams should judge a cancellation path against cancellation runs, even if customer lookups make up most of the corpus. Task grouping gives frequency a meaningful context.
Each cluster should set out the tool sequence it expects and the alternates it accepts, the argument schemas and value bounds, the step-count range, and the range of cost and token usage for each run. These dimensions describe the behavioral envelope for that task. Traces that fall outside every cluster are the first ones to audit. They may have no clear task type or may follow a tool sequence found in only a small minority of runs. The result describes what the agent usually did, but does not yet show whether it was allowed to take those actions.
Reconciling the descriptive baseline with what the agent was instructed to do
To make that description a trustworthy reference, audit each cluster against the system prompt, tool definitions, and policy constraints. Those instructions are the normative source for intended behavior. Frequency alone cannot establish that a workflow is correct. A failure already present during the collection window can dominate a cluster and become embedded in its modal sequence. Without reconciliation, the baseline would classify that repeated failure as normal.
The audit should compare the modal tool sequence with the intended workflow, test argument ranges against policy bounds, and identify required steps missing from the trace. Common findings include regularly invoked tools that the instructions do not authorize and argument ranges that exceed policy limits. A frequent omission is still an omission. The red team identifies human-in-the-loop bypass as a failure mode amplified in agentic contexts, and reconciliation makes that class of failure concrete when traces show action without the required approval step.
After the audit, remove frequent but policy-violating behavior from the accepted baseline. Required behavior that rarely appears should instead be recorded as a reliability gap. Production traces show the agent’s habits, while the instructions say which of those habits are allowed. A reconciled baseline can therefore detect both unfamiliar deviations and familiar violations.
Deciding how much historical trace data is enough to trust the baseline
Confidence depends on task variability. An agent with one task type and a constrained tool set can reach a stable modal pattern sooner than an agent handling many different tasks. Cluster stability is the practical test. Add the next batch of traces and check whether the modal sequence changes. When more data stops moving that sequence, the cluster has a stable descriptive pattern, subject to the instruction checks already described.
Keep thin clusters visible and mark them as undersampled. A thin cluster with a high rate of outliers signals that the task type is among the agent’s least reliable areas. Confidence is therefore specific to each cluster. A well-represented task can support monitoring while another remains provisional.
Traces from before a model update, prompt change, or tool schema revision represent a different behavioral regime and should be segmented. More history is not always better evidence. Adding more traces from incompatible regimes can shift the modal sequence for reasons that have nothing to do with how reliable the agent is now. A segmented, stability-tested corpus provides a stronger foundation than an undifferentiated archive.
Turning a retroactive baseline into an ongoing monitoring signal
To operationalize the baseline, evaluate incoming traces against the expected envelope for their task type at the step level. Run-level status is insufficient because one tool call can deviate silently within an otherwise successful execution. Alerts should identify tool sequences outside known task clusters and argument values outside established ranges. They should also flag step counts or costs above the cluster’s expected range, tools the agent is not allowed to use, and required steps it skipped.
Continuous evaluations should run against the baseline, with a rollback review triggered when sampled accuracy drops materially below it. This ties behavioral monitoring to the decision to keep or roll back a release, while leaving room to check whether an unusual trace is a failure. Confirmed failures have a further operational use. Risky production traces that triggered an alert and were later established as failures should be promoted into an evaluation dataset.
New agent versions should run against that evaluation dataset before deployment, using the baseline as a forward-looking CI gate that makes a significant drop an early signal to halt. An alert that requires opening a separate monitoring console is slower to act on than one surfaced in the developer’s existing workflow. Slack integration and direct coding-agent integration can reduce the interval between detecting a deviation and fixing it.
How the baseline evolves as the agent and its environment change
A historical baseline becomes stale when the agent, its prompts, its tools, or its upstream models change. A provider’s model update can shift output distributions and tool-call patterns without any action by the team. A prompt edit can change what the agent is allowed to do even when its behavior looks much the same. Tool schemas can change the validity of arguments. New user behavior can also introduce task types that the existing clusters do not cover, leaving a previously useful baseline incomplete.
These change events should trigger a structured update protocol, with clustering and reconciliation rerun on traces from the new regime. Keep traces from before a change separate from those recorded after it. Stability should be reassessed after every model update, significant prompt change, and tool schema revision. A mature baseline is a versioned artifact with a record of what triggered each revision. That record connects changes in expected behavior to the conditions under which they became valid.
The red team’s taxonomy expanded through operational experience, underscoring that the failure surface itself evolves. Baseline maintenance must account for that evolution as well as changes in the agent’s observed patterns. The work begins with recovery of missing expectations, but its value extends beyond correcting an omission at deployment. A retroactively built baseline is the beginning of a reliability practice, giving teams a way to detect behavioral failure before a crash forces the investigation.


