Azure / Azure/azure-dev

azure.ai.projects: own the azure.ai.project service block in azure.yaml

Open
#9,085 3 comments 0 reactions 1 assignee Claimed by @huimiu View on GitHub
ext-projects
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

## Summary

Give `azure.ai.projects` ownership of its `host: azure.ai.project` service block in `azure.yaml` - authoring, reading, and reconciling it - instead of `azure.ai.agents` authoring it on the project's behalf.

## Background

Each Foundry resource should map to one `azure.yaml` service entry, keyed by the resource name, with `host: azure.ai.`, authored and read by the extension that owns that kind. Today `azure.ai.agents` authors the sibling service blocks for other resources, so adopting one capability pulls in the agents extension's knowledge of every other resource's shape, and composable adoption is blocked. This work item covers the `azure.ai.project` host.

## Current state

- `azure.ai.projects` registers a service-target for `host: azure.ai.project` (reconcile on `azd up`/`provision`/`deploy`) but does not author or read the block.
- `azure.ai.agents` writes the block in `resource_services.go` (`emitResourceServices`, host const `AiProjectHost`) and reads it back (`collectProjectDeployments`), with a fallback to config bundled on the agent service.

## Proposed

- `azure.ai.projects` authors and updates its own block through the azd extension framework (`AddService`, `SetServiceConfigSection`/`SetServiceConfigValue`), reads it (`Get`, `GetServiceConfigSection`), and continues to reconcile it through its existing service-target. Authoring is driven from the extension's own commands (for example `project set`, provision).
- `azure.ai.agents` stops authoring `azure.ai.project` and declares the dependency with `uses:` instead. Its adopt/scan recognizes the block generically rather than hardcoding its shape.

The block carries: endpoint, model deployments.

```yaml
services:
my-project:
host: azure.ai.project
endpoint: https://my-proj.services.ai.azure.com/api/projects/my-project
# model deployments
```

## Acceptance criteria

- [ ] `azure.ai.projects` authors its `host: azure.ai.project` block (create + idempotent update) through the azd extension framework.
- [ ] `azure.ai.projects` reads its own block for provision/deploy instead of relying on `azure.ai.agents`.
- [ ] `azure.ai.agents` no longer authors `azure.ai.project`; it declares the dependency via `uses:` only.
- [ ] `azure.ai.agents` adopt/scan recognizes the block via generic host handling (no hardcoded shape).
- [ ] A developer can add the project block to `azure.yaml` without the agents extension authoring it.
- [ ] A pre-split `azure.yaml` still provisions (back-compat retained).

## References

- Centralized authoring to remove: `cli/azd/extensions/azure.ai.agents/internal/cmd/resource_services.go` (`emitResourceServices` writes `azure.ai.project`; `collectProjectDeployments` reads it; host const `AiProjectHost`).
- Adopt scan: `cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go` (`foundryServiceHosts`).
- Reconcile registration (stays): `cli/azd/extensions/azure.ai.projects/internal/cmd/root.go` (`host.WithServiceTarget(aiProjectHost, ...)`).
- azd extension framework: `cli/azd/pkg/azdext/project_grpc.pb.go` (`Get`, `AddService`, `GetServiceConfigSection`, `SetServiceConfigSection`, `SetServiceConfigValue`).

## Part of

Per-extension `azure.yaml` ownership: each AI extension owns its host kind in `azure.yaml` instead of `azure.ai.agents` authoring all of them. Sibling work items: `azure.ai.connections`, `azure.ai.toolboxes`, `azure.ai.skills`, `azure.ai.routines`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.