Agentforce observability — preview traces and sf agent trace, the trace step types, Apex debug in preview, enhanced event logs, Session Tracing in Data 360 with its data model, and the OpenTelemetry export API

Where to see what an Agentforce agent did. In development, preview writes a trace per turn that `sf agent trace` reads by dimension (actions, grounding, routing, errors). In production, Session Tracing stores sessions, turns, steps, LLM prompts and quality scores in Data 360 objects, and a beta API exports one session as OpenTelemetry. Covers what to turn on in Setup, what each source holds, and the limits.

markdownreferencev2CKRV-D4MFstage: operatetrust: officialservice: agentforceinterface: cliinterface: restinterface: data-360agent observabilitysf agent trace listsf agent trace readsf agent trace delete--format summary detail raw--dimension actions grounding routing errorstrace files .sfdx/agentsplanIdNodeEntryStateStepEnabledToolsStepReasoningStepPlannerResponseStepVariableUpdateStepsafety scorepreview transcripts--apex-debug Replay Debuggerenable_enhanced_event_logs--enrich-logsAgentforce Session TracingEinstein Audit, Analytics, and Monitoring SetupAudit and FeedbackAiAgentSessionAiAgentInteractionAiAgentInteractionStepAiAgentMomentAiAgentTagAssociation quality scoreGenAIGeneration__dlmGenAIGatewayRequest__dlmTOPIC_STEP LLM_STEP ACTION_STEP TRUST_GUARDRAILS_STEPOpenTelemetry export/einstein/audit/otel72 hoursAgent Health Monitoring

Created 23 Oct 2026 · Modified 23 Oct 2026 · 2 versions

Agent observability

QuestionLook at
Why did my draft agent pick that subagent or action?Preview traces, read with sf agent trace
Why did my Apex action fail inside the agent?Live preview with --apex-debug, then the Apex Replay Debugger
What happened in production yesterday?Session Tracing in Data 360
Does my agent still pass after a change?Agent tests (reference/agentforce/agent-testing.md)

Preview traces (development)

Every sf agent preview turn records a trace in the project: .sfdx/agents/<agent>/sessions/<sessionId>/traces/<planId>.json, per Salesforce's sf-skills. Keep .sfdx/ out of git. Transcripts save to ./temp/agent-preview (--output-dir changes it).

sf agent trace list --agent Steward_Agent --since 2026-10-23
sf agent trace read --session-id <id>                                  # per-turn summary
sf agent trace read --session-id <id> --format detail --dimension actions --turn 2
sf agent trace read --session-id <id> --format raw                     # the JSON, for your own analysis
sf agent trace delete --older-than 7d --no-prompt
--dimension (with --format detail)Shows
actionsEach action run: name, inputs, output, latency
groundingThe LLM's reasoning steps
routingMoves between subagents, and why
errorsEvery error in the session

Raw trace steps (the plan[] array), per sf-skills:

Step typeHolds
NodeEntryStateStepThe subagent entered
EnabledToolsStepWhich tools were visible (check available when)
BeforeReasoningIterationStepThe actions about to run
ReasoningStepGrounding category and reason
VariableUpdateStepEach variable's old value, new value and why it changed
PlannerResponseStepThe reply, with its safety score

If parsing fails, the trace schema may have changed: "Try "--format raw" to access unprocessed trace data."

--apex-debug on sf agent preview captures Apex debug logs during a live preview. Replay them in VS Code with the Apex Replay Debugger.

Production: Session Tracing in Data 360

Turn it on: in Setup, search for Einstein Generative AI, open Einstein Audit, Analytics, and Monitoring Setup, and turn on Agentforce Session Tracing and Audit and Feedback. Data 360 must be provisioned. Sessions are then stored in the Session Trace Data Model, queryable with Data 360 SQL (reference/data360/object-model-and-apis.md).

Object (ssot__<Name>__dlm)One row perUseful fields
AiAgentSessionConversationstart and end, channel, end type, final variables
AiAgentSessionParticipantAgent or user in itAiAgentApiName (filter on this)
AiAgentInteractionTurnTopicApiName (the subagent), timings, telemetry trace ID
AiAgentInteractionMessageMessageInput or Output, text
AiAgentInteractionStepSteptype (TOPIC_STEP, LLM_STEP, ACTION_STEP, TRUST_GUARDRAILS_STEP, SESSION_END), name, input, output, error, variables before and after
AiAgentMoment + AiAgentTagAssociation → AiAgentTagUser intentLLM summaries of request and response, a 1–5 quality score with its reasoning

The full prompt and response of each LLM step are in GenAIGatewayRequest__dlm.prompt__c and GenAIGeneration__dlm.responseText__c. They are joined on the step's gateway request and generation IDs, and filled only when Audit and Feedback is on. They can contain customer data, so treat access to them like access to the conversations.

Export one session as OpenTelemetry (beta):

  • GET /services/data/v66.0/einstein/audit/otel/{session-id} with an OAuth token from an External Client App returns OTLP ResourceSpans.
  • Only sessions that started in the last 72 hours are available, and only one session per request.
  • Salesforce Connect API rate limits apply.

Event logs: enable_enhanced_event_logs: True in the Agent Script config block, or --enrich-logs true on sf agent generate agent-spec, adds conversation data to the agent's event logs.

Alerts: Salesforce's agentforce-observe skill also manages Agent Health Monitoring alerts. The hub hasn't verified that API.

Read this document as markdown — the same bytes an agent receives.