Agent Trajectory Monitor
Overview
Agent trajectory monitors check how an agent's spans occur and relate β alerting when a span happens too often or too rarely, or when spans appear in an unexpected relationship. Unlike metric and evaluation monitors, they do not use alert_conditions; the alerting logic lives in a single agent_span_alert_condition, evaluated over a time_filter window.
Reference scopeThis page covers MaC YAML configuration. For how trajectory monitoring works, see Agent Trajectory Monitors.
MaC key: agent_trajectory. Trajectory monitors operate at the agent/trace grain β they are always span-grain (no trace/conversation aggregation), and span-level refinements (workflow/task/span_name) belong in the alert condition, not in agent_span_filters.
Author by export. Theagent_span_alert_conditiontree is intricate. The most reliable way to get its exact shape is to build the monitor in the Monte Carlo UI and export it withmontecarlo monitors export, then manage the exported YAML.
Quick Start
montecarlo:
agent_trajectory:
- name: retrieval_workflow_occurs
description: Alert when the retrieval workflow runs more than once
agent: my-otel-agent # the agent's service_name
agent_span_alert_condition:
operator: OR
conditions:
- type: SPAN_OCCURRENCE
span_field:
workflow:
literal: retrieval
predicate:
name: occurs
comparison_operator: MORE_THAN
count: 1
time_filter:
time_field:
field: ingest_ts
lookback_in_hrs: 10
schedule:
type: fixed
interval_minutes: 60
start_time: "2025-01-01T00:00:00+00:00"
domains:
- my-domainConfiguration
string Β· required
The agent whose spans the monitor reads. Agent monitors name an agent instead of a table; the warehouse source is derived from it. The value takes one of two forms, told apart by its shape:
- Warehouse platform agents (e.g. Snowflake Cortex, Databricks) β a
<database>:<schema>.<name>reference, where<name>is the agent's display name when it has one (otherwise its underlying identifier). Notrace_table. - OpenTelemetry agents β the agent's bare
service_name. By default the OpenTelemetry trace store is resolved automatically; settrace_tableonly when the spans live in a specific warehouse table.
agent: my-otel-agentstring Β· optional
<database>:<schema>.<table> naming the warehouse trace table that holds an OpenTelemetry agent's spans. Required when the spans live in your warehouse, or when the warehouse holds more than one OpenTelemetry trace table. Omit it for platform agents and for agents resolved from the default OpenTelemetry trace store.
trace_table: "ingest:opentelemetry.traces"object Β· required
Defines what to alert on. A set of span conditions combined by a boolean operator (AND / OR). Each condition is one of:
SPAN_OCCURRENCEβ a span (identified byspan_field) occurs more/less/exactly acountof times. Fields:span_field,predicate,comparison_operator(MORE_THANΒ·LESS_THANΒ·EXACTLY),count.SPAN_RELATIONβ a span relates to one or more other spans (related_span_fields).
span_field targets a span by workflow, task, and/or span_name (each a literal), following the workflow β task β span_name hierarchy.
agent_span_alert_condition:
operator: OR
conditions:
- type: SPAN_OCCURRENCE
span_field:
workflow:
literal: retrieval
predicate:
name: occurs
comparison_operator: MORE_THAN
count: 1object Β· required
The lookback window the condition is evaluated over. time_field must be the ingest_ts field; lookback_in_hrs must be at least 1.
time_filter:
time_field:
field: ingest_ts
lookback_in_hrs: 10object Β· optional
A predicate tree (FilterGroup) that further restricts which spans are considered, beyond the agent and the alert condition.
array of objects Β· optional
For trajectory monitors only the agent dimension is meaningful here; span-level refinements (workflow/task/span_name) are rejected β express those in agent_span_alert_condition instead. The agent is already set by agent, so this is rarely needed.
object Β· required
type (fixed or manual), interval_minutes, start_time, timezone. Dynamic schedules are not supported for trajectory monitors.
schedule:
type: fixed
interval_minutes: 60
start_time: "2025-01-01T00:00:00+00:00"The shared rule-monitor envelope:
namestringΒ· optional β unique identifier (auto-generated if omitted); renaming creates a new monitor.descriptionstringΒ· optional β max 512 characters.warehousestringΒ· optional β UUID or name; overrides themontecarlo.ymldefault.connection_namestringΒ· optional β query engine to use within the warehouse.timeoutintegerΒ· optional β query timeout in seconds.notesstringΒ· optional β shown in the UI, not in notifications.audiences/failure_audiencesarray of stringsΒ· optional β notification channels.priorityenumΒ· optional βP1βP5.event_rollup_countintegerΒ· optional β minimum 2; roll up repeated breaches into one incident.tagsarray of objectsΒ· optional βname(required) +value(optional).data_quality_dimensionenumΒ· optional βACCURACYΒ·COMPLETENESSΒ·CONSISTENCYΒ·TIMELINESSΒ·UNIQUENESSΒ·VALIDITY.domainsarray of stringsΒ· optional (required on accounts created after January 2025).
Deprecated fields
| Field | Use instead |
|---|---|
resource | warehouse |
domain_uuids | domains |
labels | audiences |
Examples
OpenTelemetry agent β workflow occurrence
Alert when the retrieval workflow span occurs more than once in the last 10 hours.
montecarlo:
agent_trajectory:
- name: retrieval_workflow_occurs
description: Alert when the retrieval workflow runs more than once
agent: my-otel-agent
agent_span_alert_condition:
operator: OR
conditions:
- type: SPAN_OCCURRENCE
span_field:
workflow:
literal: retrieval
predicate:
name: occurs
comparison_operator: MORE_THAN
count: 1
time_filter:
time_field:
field: ingest_ts
lookback_in_hrs: 10
schedule:
type: fixed
interval_minutes: 60
start_time: "2025-01-01T00:00:00+00:00"
domains:
- my-domainPlatform agent β trajectory on a Snowflake/Databricks agent
The same monitor against a warehouse platform agent, referenced by its <database>:<schema>.<name> identity (no trace_table).
montecarlo:
agent_trajectory:
- name: cortex_tool_call_frequency
description: Alert when the tool is called more than 10 times
agent: "ANALYTICS:AGENTS.support_cortex_agent"
agent_span_alert_condition:
operator: OR
conditions:
- type: SPAN_OCCURRENCE
span_field:
task:
literal: call_tool
predicate:
name: occurs
comparison_operator: MORE_THAN
count: 10
time_filter:
time_field:
field: ingest_ts
lookback_in_hrs: 24
schedule:
type: fixed
interval_minutes: 120
start_time: "2025-01-01T00:00:00+00:00"
domains:
- my-domainTroubleshooting
Agent source
- Omitting
agent. Every agent monitor requires anagent. A monitor without one fails validation. - Platform reference not found / ambiguous. A
<database>:<schema>.<name>reference must match exactly one registered agent in the target account and warehouse. A display name shared by two agents in a schema is ambiguous β use the underlying endpoint identity. Cross-account: register the agent first. - Setting
trace_tablefor a default-store agent. Redundant and rejected when the OpenTelemetry trace store resolves automatically. Omit it.
Trajectory specifics
- Using
alert_conditions. Trajectory monitors have noalert_conditionsfield β the logic goes inagent_span_alert_condition. - Span-level
agent_span_filters.workflow/task/span_namerefinements are rejected here; express them insideagent_span_alert_condition. time_filterfield other thaningest_ts. Thetime_fieldmust beingest_ts, andlookback_in_hrsmust be at least 1.- A dynamic schedule. Trajectory monitors don't support
schedule.type: dynamic. - Span-field hierarchy. When targeting a
span_name, itstaskandworkflowmust also be set; when targeting atask, itsworkflowmust be set.
