Subchapter 47.119
foundry-agent/validate/validate.mdMarkdown7 KBView on GitHub
Review every Microsoft Foundry hosted agent under agentPath against deployment, security, reliability, observability, evaluation, and design practices without changes.
Read-only: Never provision, deploy, run the application or agent, or change Azure resources.
Use only when the user explicitly asks to validate Microsoft Foundry hosted-agent code against best practices or invoke this sub-skill. Never invoke it proactively during creation, deployment, invocation, troubleshooting, optimization, or general review.
Define:
workspacePath: current path.agentPath: caller-provided exact path, otherwise workspacePath.outputPath: caller value resolved from workspacePath when relative, otherwise <workspacePath>/.foundry/validation.reportId: caller value or current UTC timestamp (YYYYMMDDTHHMMSSZ). A caller value must match ^(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9._-]*[A-Za-z0-9])$; otherwise report the error and stop. Reuse it for every report in the run.agentPath recursively for azure.yaml.host is exactly azure.ai.agent as one agent. Manifest fields only discover and describe it; never derive agentPath from project or other fields.azure.yaml path, then by their key under services.no-hosted-agents and stop without creating outputPath or generating files.agentName: read name only from the selected service object under services; otherwise use its exact service key. Never use top-level manifest name.normalizedAgentName: lowercase agentName, replace non-alphanumeric sequences with -, and trim -. If assigned, append the lowest available suffix starting at -1.Select default rules, <agentPath>/.foundry/agent-validation-rules.yaml when present, and caller rulesFile when supplied (resolve relative paths from agentPath).
Validate each custom rule file against rules-schema.json. If any file is invalid, list all errors and stop.
Build a map keyed by id: add default, agent, then caller rules. Each later match replaces the entire rule. Use one value per id; precedence is caller > agent > default.
Note: An agent-path or caller-provided custom rule can skip a default rule by using the same
idand awhencondition that never applies.
Create outputPath if it does not exist. If it cannot be written, report the error and stop.
Serialize the merged rules as valid YAML to <outputPath>/agent-validation-<reportId>-rules.yaml. Quote strings or use block scalars when plain syntax is ambiguous, including values containing : . Read it back, parse it, and validate it against rules-schema.json. Compare every parsed rule field-for-field with its highest-precedence source object (caller > agent > default), including new custom IDs, without changing merged order. On any parse, schema, or content mismatch, rewrite and revalidate before Step 4; if it still fails, report the error and stop.
For every agent, process the merged rules in order:
when does not apply, use skipped. Otherwise, perform checks using code, configuration, infrastructure, and shared dependencies related to that agent within agentPath.statusCriteria: use pass or fail only when proved; otherwise use inconclusive.ruleId, title, level, rationale, and guidance; preserve legacy guidance strings.status selected above.details containing result-specific evidence with file:line when available, missing evidence for inconclusive, or the reason for skipped.recommendedAction containing the concrete change needed for fail. Omit it for other statuses.sourceCode array containing relevant, redacted, agentPath-relative source locations as plain strings. Use file:line for one line or file:start-end for a range. Do not use Markdown links.For each agent, in the order established in Step 2:
generatedAt to the current date-time in ISO 8601 UTC format.reportId, generatedAt, target.serviceName=agentName, final results, and resolved markdownPath. Verify target.serviceName equals the selected service object’s name, or its exact service key when absent; never use top-level manifest name, and correct any mismatch before writing. Set compatibility field target.agentRoot to unchanged agentPath, never a manifest-derived path.results into four complete lists for fail, pass, inconclusive, and skipped. Use each list’s exact length for Summary; never reuse a count from a partial result list. Require the four lengths to sum to both results.length and the merged-rule count.(level rank, merged-rule index) using error=0, warning=1, and recommendation=2.fail for the failed-results table and render every result exactly once in its matching status section.<outputPath>/validation-<reportId>-<normalizedAgentName>.json<outputPath>/validation-<reportId>-<normalizedAgentName>.md- **Rule:** blocks and replace any differing Summary count. Extract rule IDs from the failed-results table and each section; compare them with the corresponding sorted list and correct any difference. Recheck all counts and order before returning paths.agentPath and limited to files relevant to its selected service. Inspect repository instructions and ignore files, .azure metadata, IaC, CI, evaluation assets, and documentation only when needed to assess that service.azd or any other CLI command, execute target code, install dependencies, sign in, or query Azure.