Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build and deploy AI applications on Azure AI Foundry using Microsoft's model catalog and AI services
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/agent-metadata-contract.md
1# Agent Metadata Contract23Use this contract for Microsoft Foundry agent folders. In azd projects, `.foundry/agent-metadata*.yaml` is an overlay/cache, not the source of truth for azd-owned deployment context.45## Local Layout67```text8<agent-root>/9.foundry/10agent-metadata.yaml11agent-metadata.<env>.yaml12suites/13datasets/14evaluators/15results/16```1718- `agent-metadata.yaml` is the preferred local/dev overlay.19- Optional `agent-metadata.<env>.yaml` files can hold a single prod or CI-targeted overlay.20- `suites/`, `datasets/`, `evaluators/`, and `results/` are local cache/result folders. Ask before overwriting user-edited files.2122## Effective Context Model2324Resolve deployment and evaluation context by layering sources in this order:2526| Value | Preferred source | Fallbacks | Metadata write behavior |27|-------|------------------|-----------|-------------------------|28| Agent root | `azure.yaml` service `project` for `host: azure.ai.agent` | `.foundry` discovery, user path | Do not write except to initialize cache |29| Environment | user/session, then azd env/default | metadata `defaultEnvironment` | Store azd binding only when useful |30| Project endpoint | `azd env get-values` | metadata, user input | Do not duplicate azd values |31| Agent name/version | azd `AGENT_<SERVICE>_*` vars | `agent.yaml`, metadata, user input | Do not duplicate azd values |32| ACR | azd registry vars | metadata, user input | Do not duplicate azd values |33| Observability | azd App Insights vars | metadata, user input | Do not copy secrets if azd has them |34| Local eval draft | `eval.yaml` | metadata, user input | Sync to `.foundry` only after remote lookup/registration |35| Remote suite/cache refs | metadata | Foundry lookups | Persist in `.foundry` |3637If azd and metadata both provide the same value and differ, stop and ask which source is authoritative. If they match, use the azd value and omit the duplicate on future metadata rewrites.3839## Environment Overlay Model4041| Field | Required when | Purpose |42|-------|---------------|---------|43| `defaultEnvironment` | Any metadata file exists | Default key inside this overlay file |44| `environments.<env>.azd.environmentName` | Optional | Binds overlay to an azd environment |45| `environments.<env>.azd.service` | Optional | Binds overlay to an `azure.yaml` service |46| `environments.<env>.projectEndpoint` | Required for non-azd/manual workflows | Explicit override when azd cannot resolve it |47| `environments.<env>.agentName` / `agentVersion` | `agentName` required for non-azd/manual workflows; `agentVersion` optional | Explicit override when azd cannot resolve it |48| `environments.<env>.azureContainerRegistry` | Required for non-azd/manual hosted-agent Docker/ACR deploy flow | Explicit override when azd cannot resolve it |49| `environments.<env>.observability.*` | Required only for trace workflows when azd cannot resolve observability | Trace lookup config when azd cannot resolve it |50| `environments.<env>.evaluationSuites[]` | Required after evaluation setup/sync | Remote suite/dataset/evaluator refs plus local cache paths |51| `environments.<env>.lastEval` | Optional | Last local result summary and result file path |5253## Example azd Overlay5455```yaml56defaultEnvironment: dev57environments:58dev:59azd:60environmentName: <azd-env-name>61service: <azure-yaml-service-name>62evaluationSuites:63- id: smoke-core64suiteName: <foundry-suite-name>65suiteVersion: "1"66generationSource: eval-yaml67tags:68tier: smoke69purpose: baseline70suiteFile: .foundry/suites/<suite>-v1.json71dataset: <dataset-name>72datasetVersion: "1"73datasetFile: .foundry/datasets/<agent>-<dataset>-v1.ref.json74datasetUri: <foundry-dataset-uri>75evaluators:76- name: <evaluator-name>77version: "1"78threshold: 479definitionFile: .foundry/evaluators/<evaluator>-v1.json80```8182## Example Manual Overlay8384```yaml85defaultEnvironment: dev86environments:87dev:88projectEndpoint: https://<account>.services.ai.azure.com/api/projects/<project>89agentName: <agent-name>90azureContainerRegistry: <registry>.azurecr.io91evaluationSuites:92- id: smoke-core93datasetFile: .foundry/datasets/<agent>-smoke-v1.ref.json94evaluators:95- name: relevance96threshold: 497```9899## eval.yaml Mapping100101When `eval.yaml` exists in the selected agent root, treat it as local evaluation intent, not proof of a Foundry suite.102103| eval.yaml field | Use |104|-----------------|-----|105| `agent.name` | Candidate target agent; verify it matches selected context |106| `dataset.local_uri` | Local seed dataset candidate |107| `dataset.name`, `dataset.version` | Registered dataset candidate |108| `validation_dataset` | Optional validation dataset candidate |109| `evaluators[]` | Candidate evaluator names; verify with `evaluator_catalog_get` |110| `name` | Candidate eval/suite name; verify remotely before storing as `suiteName` |111| `options.eval_model` | Candidate judge/generation deployment |112| `options.optimization_model` | Candidate optimizer reasoning deployment |113| `options.max_candidates` | Candidate optimization iteration limit |114| `options.optimization_config.model_search_space` | Candidate target model search space |115| `options.pass_threshold` | Candidate evaluator threshold/default pass gate |116| `max_samples`, `trace_days`, `generation_instruction` | Suite setup defaults |117118Legacy `dataset_file`, `dataset_reference`, and `validation_reference` keys may be normalized in memory when reading older files, but new files should use `dataset` and `validation_dataset`.119120Persist eval.yaml-derived suite metadata only after the relevant dataset/evaluator/suite has been registered or found in Foundry. Use `generationSource: eval-yaml` for synced suite entries created from local eval config.121122## Workflow Rules1231241. Prefer azd service discovery before `.foundry` discovery when `azure.yaml` has `host: azure.ai.agent`.1252. Once an agent root is selected, use only that root's `.foundry`, source tree, `agent.yaml`, and `eval.yaml` unless the user switches roots.1263. Select metadata files in this order: explicit file/path, environment sidecar, `.foundry/agent-metadata.yaml`, then prompt if ambiguous.1274. Resolve environment from user/session, azd env/default, single-environment metadata, then `defaultEnvironment`.1285. Keep the selected root, environment, metadata overlay file, and primary context source visible in deploy/eval/trace summaries.1296. Treat metadata deployment fields as overrides when azd cannot resolve the value.1307. Treat `evaluationSuites[]` as the canonical synced suite model; normalize legacy fields in memory before use.1318. Writes target only the selected metadata file and selected environment. Never merge sibling metadata files automatically.1329. On metadata rewrites for azd projects, persist non-derivable overlay/cache state and omit azd-owned deployment duplicates.13310. Never silently overwrite cache files or metadata. Show a summary before refreshing, pruning duplicate fields, or replacing suite refs.134135## Legacy Compatibility136137If the selected environment has `testSuites[]` but no `evaluationSuites[]`, treat `testSuites[]` as the current suite source and migrate it on the next metadata write. If it has only legacy `testCases[]`, normalize that list the same way.138139Preserve `id`, `suiteName`, `suiteVersion`, `generationJobId`, `generationSource`, `dataset`, `datasetVersion`, `datasetFile`, `datasetUri`, `evaluators`, and existing `tags`. Map legacy `priority` to `tags.tier` only when `tags.tier` is missing: `P0` -> `smoke`, `P1` -> `regression`, `P2` -> `coverage`.140141## Evaluation Suite Guidance142143Use `tags` as freeform key/value metadata. Suggested keys: `tier` (`smoke`, `regression`, `coverage`), `purpose` (`baseline`, `safety`, `tools`, `quality`), and `stage` (`local`, `generated`, `traces`, `curated`, `prod`).144145Each synced suite should point to one dataset and one or more evaluators with thresholds. Store stable remote names separately from versions, keep local cache filenames versioned, and persist `suiteFile`, `datasetFile`, `datasetContentPath`, `datasetUri`, and evaluator `definitionFile` when available. Local dataset filenames should start with the effective Foundry agent name. Use evaluation-suite IDs in evaluation names, result folders, and regression summaries.146147For generated Foundry suites, persist `suiteName`, `suiteVersion`, `generationJobId`, and `generationSource`. `suiteName` must start with a letter (`A-Z` or `a-z`); prefix derived numeric names with an alphabetic label such as `suite-`. A suite with `suiteName` still runs batch eval through `evaluation_agent_batch_eval_create`; use `evaluation_suite_get` only to resolve reviewed dataset/evaluator metadata.148