Add optimization-insights reference for Foundry agent trace skill#1943
Add optimization-insights reference for Foundry agent trace skill#1943xiaomi7732 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
…mpty-results handling - Make agent name and projectId optional filters instead of prerequisites - Start with broad query (no filters) then narrow, matching trace.md conventions - Add Step 4 (Handle Empty Results) with fallback sequence: remove filters, widen time range, verify telemetry exists - Document agent name mismatch between metadata and telemetry - Add totalCount: 0 scenarios to Error Handling table Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new trace-skill reference that guides users through calling the Foundry Agent Insights API (backed by App Insights telemetry) to surface actionable optimization recommendations, and wires it into the trace skill’s entry points/triggers.
Changes:
- Expanded
trace.mdrouting/trigger phrases to include “optimization insights” and added an entry-point link to the new reference. - Added
optimization-insights.mdreference describing a broad-first workflow (token acquisition, insights call, empty-result fallbacks, and drill-down routing).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| plugin/skills/microsoft-foundry/foundry-agent/trace/trace.md | Adds “optimization insights” intent coverage and links to the new reference from the entry-points table. |
| plugin/skills/microsoft-foundry/foundry-agent/trace/references/optimization-insights.md | New step-by-step reference for retrieving and presenting optimization insights and routing to existing trace drill-down references. |
| Start with a **broad query** (no agent or project filter): | ||
|
|
||
| ```powershell | ||
| $URI = "https://eastus2euap.api.azureml.ms/notification/v1-beta1/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/microsoft.insights/components/<component-name>/:insights?startDateTimeUtc=<start>" |
There was a problem hiding this comment.
In the sample URI, the provider segment is providers/microsoft.insights. Elsewhere (and in actual App Insights ARM IDs) this is typically providers/Microsoft.Insights. Using the canonical casing here will better match the source resource ID and reduce copy/paste confusion (and potential 404s if this endpoint is case-sensitive).
| $URI = "https://eastus2euap.api.azureml.ms/notification/v1-beta1/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/microsoft.insights/components/<component-name>/:insights?startDateTimeUtc=<start>" | |
| $URI = "https://eastus2euap.api.azureml.ms/notification/v1-beta1/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Insights/components/<component-name>/:insights?startDateTimeUtc=<start>" |
| Start with a **broad query** (no agent or project filter): | ||
|
|
||
| ```powershell | ||
| $URI = "https://eastus2euap.api.azureml.ms/notification/v1-beta1/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/microsoft.insights/components/<component-name>/:insights?startDateTimeUtc=<start>" |
There was a problem hiding this comment.
The example uses startDateTimeUtc=<start> but <start> isn’t defined elsewhere and doesn’t match the parameter name in the table. Consider renaming the placeholder to something explicit (e.g., <startDateTimeUtc>) and/or showing a concrete ISO 8601 example (and optionally endDateTimeUtc) so the request can be copy/pasted without guessing the format.
| $URI = "https://eastus2euap.api.azureml.ms/notification/v1-beta1/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/microsoft.insights/components/<component-name>/:insights?startDateTimeUtc=<start>" | |
| $URI = "https://eastus2euap.api.azureml.ms/notification/v1-beta1/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/microsoft.insights/components/<component-name>/:insights?startDateTimeUtc=2025-01-01T00:00:00Z&endDateTimeUtc=2025-01-02T00:00:00Z" |
The reference file described trace-derived telemetry analysis (latency outliers, token anomalies, trends) rather than optimization actions. Rename to trace-insights to better reflect the actual API behavior. - Rename optimization-insights.md -> trace-insights.md - Update title to 'Trace Insights - Surface Agent Health from Telemetry' - Update entry point and trigger phrases in trace.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
What
Adds
optimization-insights.mdto the trace skill'sreferences/folder. This reference guides the agent through calling the Agent Insights API to surface actionable optimization insights (latency, token usage, errors, tool failures, evaluations) from Application Insights telemetry.What's in the file
The reference covers a 6-step workflow:
az account get-access-tokenwith the correcthttps://ai.azure.comaudiencetotalCountis 0: remove filters → widen time range → verify telemetry exists via Search Traces. Includes guidance on discovering actual agent names frommetadata.agentNamein results (which may differ fromagent-metadata.yaml)Also includes an error handling table covering empty results, auth errors, date format issues, and 404s, plus a note about the
eastus2euapregion limitation.Design decisions
agentandprojectIdparameters are optional, and filtering too aggressively can return 0 results when the metadata agent name doesn't match what telemetry records (e.g., hosted agents emit<name>:<version>or internal IDs). The workflow starts unfiltered and narrows on request.Affected files
plugin/skills/microsoft-foundry/foundry-agent/trace/references/optimization-insights.md(new file)Example: