cleandataengineering.aiAgent Harness, drawn simply
You are here: End to end › Eval › The trace › App Insights & Log Analytics

Agent Harness Tutorial · End to end · Zoom level 3

Where it lands: App Insights and Log Analytics

On Azure everything the agent records ends up in one place: a Log Analytics workspace. Application Insights is "workspace-based", which means it has no store of its own: its traces, requests, metrics and exceptions are tables in the workspace, next to the container logs. Every question you ask, every alert, and the transaction view in the portal is a KQL query over these tables.

The harnessspans · metricsOpen: APIMAPIMits own request rowzoom in ›Container Appsstdout · systemOTel distroApplication Insightsworkspace-basedLOG ANALYTICS WORKSPACEAppDependenciesour spansAppRequestsAPIM's callsAppMetricsour countersAppExceptionserrors on spansContainerAppConsoleLogs_CLstdoutContainerAppSystemLogs_CLrestarts, crashesTransaction searchopen one turn by SessionIdKQL queriesad hoc questionsOpen: 6 alert rules6 alert rulesscheduled KQL, every 15 minzoom in ›Budget$10/month (Cost Management)Workbooknot built yet
Retention 30 days (included); a daily cap of 0.1 GB keeps it inside the free 5 GB a month.
TableOne row isKey columns we use
AppDependenciesone of our spans (agent.turn, gen_ai.chat, agent.tool, agent.policy ...)Name, DurationMs, Success, SessionId (= conversation id), OperationId (= trace), Properties["agent.*"]
AppRequestsone call through APIM, logged by APIM itselfName (e.g. chat/completions), ResultCode, DurationMs
AppMetricsone aggregated metric valueName (agent.turns, agent.spend ...), Sum, Count, Properties (labels)
AppExceptionsan exception recorded on a spanProblemId, OuterMessage, OperationId
ContainerAppConsoleLogs_CLa line the container printedContainerAppName_s, RevisionName_s, Log_s
ContainerAppSystemLogs_CLa platform event: start, restart, crashReason_s, Log_s

Following one turn. Every span of a turn shares one OperationId, and SessionId holds the conversation id. In the portal: Application Insights → Transaction search → the SessionId. In KQL:

AppDependencies
| where SessionId == "cnv_964aee272863061a"
| project TimeGenerated, Name, DurationMs, Success,
          route = tostring(Properties["agent.route.kind"]),
          cost  = todouble(Properties["agent.cost.usd"])
| order by TimeGenerated asc