observing-agentforce

Analyze production Agentforce agent behavior using session traces and Data Cloud queries.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/amanpraaj/sf-skill-hub --skill observing-agentforce-amanpraaj
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: observing-agentforce
Source: https://github.com/amanpraaj/sf-skill-hub/tree/main/skills/salesforce/observing-agentforce
Command: npx skills add https://github.com/amanpraaj/sf-skill-hub --skill observing-agentforce-amanpraaj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Production Agentforce agents fail silently: subagents misroute, actions never fire, and instruction adherence drops, but there is no built-in way to see why. This Skill turns raw session trace data into diagnosed root causes, reproduced failures, and verified fixes. ## Core Features & Use Cases - Session Trace Analysis: Query STDM (Session Trace Data Model) records in Data Cloud via a bundled Apex helper class to reconstruct turn-by-turn conversations, detect action errors, misroutes, and LOW instruction adherence. - Live Reproduction: Re-run failing utterances through sf agent preview with local trace files, classifying each issue as CONFIRMED, INTERMITTENT, or NOT REPRODUCED across three runs. - Guided Remediation: Edit the .agent file directly with mapped fixes, then validate, publish, verify against traces, and create regression test cases in Testing Center format. - Use Case: A support agent stops routing billing questions correctly after a publish. Use this Skill to query the last 7 days of sessions, confirm the misroute in preview, tighten the subagent description, republish, and add a regression test. ## Quick Start Ask the agent to analyze recent production sessions for your Agentforce agent in a given org and diagnose any routing or action failures.

Frequently Asked Questions about observing-agentforce

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze Agentforce agent session traces in production?▼

Deploy the bundled AgentforceOptimizeService Apex class, then run its findSessions and getMultipleConversationDetails methods via anonymous Apex to query STDM Data Cloud objects. The Skill parses the debug log output into turn-by-turn conversation timelines for issue classification.

How to reproduce an Agentforce agent failure locally?▼

Use sf agent preview with the --authoring-bundle flag to compile from the local .agent file and generate trace files under .sfdx/agents. Run each failing utterance three times and classify the result as CONFIRMED, INTERMITTENT, or NOT REPRODUCED.

Does this work if my org does not have Data Cloud STDM enabled?▼

Yes. When the STDM prerequisite check fails, the Skill switches to a fallback path that runs existing agent test suites and sf agent preview sessions, then diagnoses issues from local trace JSON files instead of production session data.

Why does my Agentforce agent give generic answers despite detailed instructions?▼

This usually indicates publish drift, where the bundle was deployed but never properly published, or identical reasoning instructions copied across subagents. The Skill cross-references STDM symptoms against the .agent file structure to confirm the root cause.

What are the limitations of sf agent preview for testing agents?▼

Preview sessions use simulated conversations with no real user data, and the root topic field often shows DefaultTopic even when routing works correctly. The deploy plus activate fallback also does not propagate reasoning actions to live metadata, so publish is preferred.