feat(agents): export Agent Insights as JSON - #9937
feat(agents): export Agent Insights as JSON#9937Ilya Matiach (imatiach-msft) wants to merge 7 commits into
Conversation
Add a PowerShell-friendly Agent Insights export command with filtering, full cursor pagination, sensitive-detail handling, and PR-bundle documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0181e33-e234-4d7f-8307-59d76779378e
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0181e33-e234-4d7f-8307-59d76779378e
There was a problem hiding this comment.
🟡 Changes recommended
Environment selection and combined service-name/endpoint resolution can target the wrong agent or project.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds JSON export automation for Foundry Agent Insights.
Changes:
- Adds the
insights exportcommand with filters and file output. - Introduces a paginated Insights API client and tests.
- Documents and registers the command.
File summaries
| File | Description |
|---|---|
README.md |
Documents Insights export. |
models.go |
Defines API paging models. |
client.go |
Implements Insights API requests. |
client_test.go |
Tests client behavior. |
codes.go |
Adds structured error codes. |
root.go |
Registers the command. |
insights.go |
Implements export orchestration. |
insights_test.go |
Tests export behavior. |
eval.go |
Generalizes endpoint flag helper. |
eval_show.go |
Uses renamed helper. |
eval_list.go |
Uses renamed helper. |
extension.yaml |
Adds an extension example. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
Insights requests omit the required Foundry preview feature header.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 1
- Review effort level: Balanced
Add the required Agent Insights preview header and honor explicit azd environment selection for both agent and project endpoint resolution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0181e33-e234-4d7f-8307-59d76779378e
There was a problem hiding this comment.
🟡 Changes recommended
Endpoint fallback can combine an agent from one environment with another project and export the wrong sensitive insights.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 1
- Review effort level: Balanced
Require environment-bound exports to use the selected azd environment endpoint unless explicitly overridden. Fail on missing endpoints and environment read errors instead of consulting unrelated project defaults. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0181e33-e234-4d7f-8307-59d76779378e
There was a problem hiding this comment.
🔵 Needs a closer look
The required preview-header regression tests bypass the production client configuration they are intended to protect.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/insights_api/client_test.go:37
- This test injects
foundryFeaturesPolicyinto its own pipeline, so it does not verify thatNewClientactually installs the required header policy; deleting the production policy atclient.go:54would leave both request tests green. Please construct the test client through the production pipeline with an injectable transport/options seam so this regression coverage exercises the real wiring.
- Files reviewed: 16/16 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Preserve environment selection alongside updated deployed-agent metadata resolution and retain both README additions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0181e33-e234-4d7f-8307-59d76779378e
Inject only the HTTP transport into NewClient so preview-header regression tests verify production policy registration over TLS, including authentication and cursor requests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0181e33-e234-4d7f-8307-59d76779378e
|
Addressed the production-pipeline regression coverage finding in cc869fa. The tests now construct the client through I temporarily removed the policy from the production constructor and confirmed both header tests failed, then restored it and confirmed they pass. The tests now detect precisely the regression identified in the review. Also merged latest |
There was a problem hiding this comment.
🟡 Changes recommended
The new command lacks the required interactive tester scenario coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 1
- Review effort level: Balanced
Add cmd:insights help and invalid-severity scenarios and map Insights changes to their regression tag. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f0181e33-e234-4d7f-8307-59d76779378e
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the stated behavior and includes comprehensive regression coverage for the previously identified risks.
Review details
- Files reviewed: 20/20 changed files
- Comments generated: 0 new
- Review effort level: Balanced
|
/azp run |
|
Commenter does not have sufficient privileges for PR 9937 in repo Azure/azure-dev |
|
/azp run |
|
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
|
/azp run "azure-dev - cli" |
|
No pipelines are associated with this pull request. |
|
/azp run azure-dev - cli |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
|
/azp run azure-dev - ext - microsoft.azd.extensions |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
|
/azp run azure-dev - ext - azure.ai.agents |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
azure.ai.agents PR buildNote This is an unsigned development build. Install it only if you trust this PR. Install the extension: azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/9937/azure-ai-agents.zip"
|
Closes #9955
Summary
azd ai agent insights export [name]to the Foundry Agents extension.--out-filefor PowerShell and CI automation.Customer scenario
This provides a supported automation surface for teams that currently review Insights in the portal and need to archive, filter, or feed the findings into an engineering workflow.
For durable UTF-8 output:
The extension PR bundle has not yet been published. Use the pipeline-generated
azd ext installcommand once a bundle is available.Validation
go test ./... -shortgo build ./...Review follow-up
Foundry-Features: AgentInsights=V1Previewheader on API requests.--environmentfor both deployed-agent and endpoint resolution.--project-endpointis supplied; outside a project, the positional argument is the remote agent name.FOUNDRY_PROJECT_ENDPOINTvalues fail rather than using a global or shell fallback. An explicit--project-endpointremains an intentional override.cmd:insightsscenariostier0/0.17-insights-export-help.yamlandtier0/0.18-insights-export-validate-severity.yaml, plus PR impact mapping. Scenarios are statically validated, not executed; usefoundry-extension-scenario-orchestratorto run them.