Azure SRE 에이전트의 에이전트 작업 감사

에이전트는 도구 호출, 모델 호출, 인시던트 처리 및 승인 결정을 포함한 모든 작업을 Application Insights 리소스에 기록합니다. 에이전트가 수행한 작업, 시기 및 이유를 정확하게 확인하려면 KQL(Kusto 쿼리 언어)을 사용하여 테이블을 쿼리 customEvents 합니다. 에이전트 포털의 모니터> 로그에서 직접 로그에 액세스합니다.

로그를 찾을 수 있는 위치

에이전트는 모든 작업을 Azure Application Insights에 자동으로 기록합니다. 에이전트를 만들 때 Application Insights 리소스도 만듭니다.

로그에 액세스하려면 다음을 수행합니다.

  1. 에이전트 포털에서 모니터>로그로 이동합니다.
  2. 이 작업을 수행하면 Azure Portal에서 에이전트의 Application Insights 리소스가 열립니다.
  3. KQL을 사용하여 테이블을 쿼리합니다 customEvents .

기본 쿼리는 traces | where timestamp > ago(1d)입니다. 에이전트 작업 원격 분석을 보려면 이 쿼리 customEvents 를 변경합니다.

이벤트 유형

에이전트는 테이블에 9개의 사용자 지정 이벤트 유형을 기록합니다 customEvents . 다음 쿼리는 모든 이벤트 유형 및 해당 개수를 보여 줍니다.

customEvents
| summarize Count = count() by name
| sort by Count desc
이벤트 이름 캡처한 내용 일반적인 볼륨
AgentResponse 사용자에게 전송된 채팅 응답 높음
ModelGeneration 모든 LLM 호출(입력/출력 토큰, 모델 ID) 높음
AgentToolExecution 모든 도구 호출(이름, 입력, 출력) 높음
AgentExecution 에이전트 세션 시작/종료 수명 주기 중간
MetaAgent 에이전트 라우팅 및 오케스트레이션 결정 중간
AgentHandoff 에이전트 간 핸드오프 중간
IncidentActivitySnapshot 인시던트 수명 주기(심각도, 상태, 완화 결과) Low
AgentAzCliExecution 에이전트에서 실행하는 Azure CLI 명령 Low
ApprovalDecision 제안된 작업의 승인 또는 거부 Low

주요 이벤트 및 해당 필드

다음 섹션에서는 가장 일반적으로 쿼리되는 이벤트 유형 및 해당 필드에 대해 설명합니다.

도구 실행(AgentToolExecution)

시스템은 에이전트가 도구를 호출할 때마다 이 이벤트를 기록합니다.

분야 설명 예제 값
EventType ToolStart 또는 ToolEnd ToolStart
ToolName 도구의 이름 SearchResource
ToolInput 도구에 전달된 인수 {"resourceTypes": ["microsoft.resources/subscriptions"]}
ToolOutput 도구에서 반환된 결과(이벤트)ToolEnd (도구 출력 JSON)
SubAgentName 도구를 호출한 에이전트의 이름 meta_agent
CallId 페어링에 대한 상관 관계 ID call_aaaabbbb-0000-cccc-...
customEvents
| where name == "AgentToolExecution"
| where customDimensions.EventType == "ToolStart"
| where timestamp > ago(7d)
| project timestamp,
    Tool = tostring(customDimensions.ToolName),
    Input = tostring(customDimensions.ToolInput)
| sort by timestamp desc

인시던트 수명 주기(IncidentActivitySnapshot)

에이전트가 처리하는 모든 인시던트에 대해 이 이벤트를 기록합니다. 생성에서 해결까지 전체 수명 주기를 캡처합니다.

분야 설명 예제 값
IncidentId 플랫폼 인시던트 ID Q2VVG0T8K7AL0J
IncidentTitle 인시던트 설명 DailyIssueTriager blocked: cannot access repo
IncidentSeverity 플랫폼의 심각도 Not set
IncidentStatus 현재 상태 active
IncidentPlatform 원본 플랫폼 PagerDuty
IncidentMitigatedByAgent 에이전트가 해결했는지 여부 True 또는 False
IncidentAssistedByAgent 에이전트가 조사에 도움을 주었는지 여부 True 또는 False
AgentAutonomyLevel 에이전트가 처리하는 방법 autonomous 또는 review
ResponsePlanId 사용된 응답 계획 PDtrigger
ResponsePlanCustom 기본 또는 사용자 지정 계획 True 또는 False
IncidentImpactedService 영향을 받는 서비스 SRE Agent
IncidentCreatedOn 인시던트가 생성된 경우 ISO 8601 datetime
IncidentHandledOn 에이전트가 처리를 시작한 경우 ISO 8601 datetime
IncidentMitigatedOn 해결된 경우(완화된 경우) ISO 8601 datetime
// Incident outcomes over the last 30 days
customEvents
| where name == "IncidentActivitySnapshot"
| where timestamp > ago(30d)
| project timestamp,
    IncidentId = tostring(customDimensions.IncidentId),
    Title = tostring(customDimensions.IncidentTitle),
    Platform = tostring(customDimensions.IncidentPlatform),
    MitigatedByAgent = tostring(customDimensions.IncidentMitigatedByAgent),
    AssistedByAgent = tostring(customDimensions.IncidentAssistedByAgent),
    Autonomy = tostring(customDimensions.AgentAutonomyLevel),
    ResponsePlan = tostring(customDimensions.ResponsePlanId)
| sort by timestamp desc

모델 생성(ModelGeneration)

모든 LLM 호출에 대해 이 이벤트를 기록합니다. 토큰 사용량, 모델 선택 및 요청 에이전트를 추적합니다.

분야 설명 예제 값
EventType ModelGenerationStart, ModelGenerationEnd 또는 ModelGenerationError ModelGenerationEnd
AgentName LLM 호출을 만드는 에이전트 daily_report_agent
ModelId 사용된 모델 gpt-4o
InputTokens 프롬프트의 토큰 29828
OutputTokens 응답의 토큰 871
ThreadId 대화 스레드 bb171c1f-3bb2-4895-...
// Token usage by agent in the last 7 days
customEvents
| where name == "ModelGeneration"
| where customDimensions.EventType == "ModelGenerationEnd"
| where timestamp > ago(7d)
| extend Agent = tostring(customDimensions.AgentName),
    InputTokens = toint(customDimensions.InputTokens),
    OutputTokens = toint(customDimensions.OutputTokens),
    Model = tostring(customDimensions.ModelId)
| summarize TotalInput = sum(InputTokens),
    TotalOutput = sum(OutputTokens),
    Calls = count()
    by Agent, Model
| sort by TotalInput desc

승인 결정(ApprovalDecision)

제안된 에이전트 작업을 승인하거나 거부할 때 이 이벤트를 기록합니다.

// All approval decisions
customEvents
| where name == "ApprovalDecision"
| where timestamp > ago(30d)
| project timestamp, customDimensions

일반 쿼리

다음 KQL 쿼리를 사용하여 에이전트의 동작에 대한 일반적인 질문에 답변합니다.

에이전트가 특정 스레드에서 무엇을 했나요?

customEvents
| where timestamp > ago(7d)
| where tostring(customDimensions.ThreadId) == "<YOUR_THREAD_ID>"
| project timestamp,
    Event = name,
    EventType = tostring(customDimensions.EventType),
    Tool = tostring(customDimensions.ToolName),
    Agent = tostring(customDimensions.SubAgentName)
| sort by timestamp asc

대화의 스레드 ID로 바꿉 <YOUR_THREAD_ID> 니다.

가장 자주 사용하는 도구는 무엇입니까?

customEvents
| where name == "AgentToolExecution"
| where customDimensions.EventType == "ToolStart"
| where timestamp > ago(30d)
| summarize Count = count() by Tool = tostring(customDimensions.ToolName)
| sort by Count desc
| take 20

에이전트가 완화한 인시던트 수와 지원되는 인시던트 수는 몇 건입니까?

customEvents
| where name == "IncidentActivitySnapshot"
| where timestamp > ago(30d)
| summarize
    Total = count(),
    MitigatedByAgent = countif(tostring(customDimensions.IncidentMitigatedByAgent) == "True"),
    AssistedByAgent = countif(tostring(customDimensions.IncidentAssistedByAgent) == "True")

일일 토큰 소비 추세

customEvents
| where name == "ModelGeneration"
| where customDimensions.EventType == "ModelGenerationEnd"
| where timestamp > ago(30d)
| extend InputTokens = toint(customDimensions.InputTokens),
    OutputTokens = toint(customDimensions.OutputTokens)
| summarize TotalTokens = sum(InputTokens) + sum(OutputTokens) by bin(timestamp, 1d)
| render timechart

모든 이벤트의 공유 필드

모든 사용자 지정 이벤트에는 상관 관계 및 추적을 위한 다음 필드가 포함됩니다.

분야 설명
gen_ai.agent.id 에이전트의 Azure Resource Manager ID
gen_ai.agent.name 에이전트 이름
TraceId 단일 요청 간에 이벤트 상관 관계를 지정하는 OpenTelemetry 추적 ID
SpanId OpenTelemetry 범위 ID
ParentSpanId 호출 계층 구조에 대한 부모 범위
ThreadId 대화 스레드 GUID
LogTimestamp ISO 8601 타임스탬프
CorrelationId 로그 그룹화에 대한 짧은 상관 관계 ID

에이전트 추론, 도구 호출 및 응답을 통해 사용자 입력의 단일 요청을 따르는 데 사용합니다 TraceId .

Azure 활동 로그

에이전트 리소스 만들기, 업데이트 또는 삭제와 같은 Azure 리소스 수준 작업의 경우 Azure 활동 로그를 사용합니다. 활동 로그는 에이전트, 관리 ID 및 Application Insights 리소스에 대한 모든 Azure Resource Manager 작업을 캡처합니다.

에이전트의 리소스 그룹 아래에 있는 Azure Portal 에서 활동 로그인에 액세스합니다.

시작하기

감사 로깅은 모든 에이전트에 대해 자동으로 사용하도록 설정됩니다. 에이전트 포털에서 모니터>로그를 열어 KQL을 사용하여 작업 기록을 쿼리합니다.

Resource 학습할 내용
Kusto 도구 만들기 재사용 가능한 KQL 쿼리를 빌드하여 감사 데이터 마이닝
권한 RBAC가 감사 데이터를 쿼리할 수 있는 사용자를 제어하는 방법

다음 단계: