Skip to content

feat(agents): native Activity protocol support (use-case profiles, digital-worker init/deploy)#8753

Open
Hameedkunkanoor wants to merge 3 commits into
mainfrom
feat/activity-protocol-native-azd-support
Open

feat(agents): native Activity protocol support (use-case profiles, digital-worker init/deploy)#8753
Hameedkunkanoor wants to merge 3 commits into
mainfrom
feat/activity-protocol-native-azd-support

Conversation

@Hameedkunkanoor

Copy link
Copy Markdown

Summary

Adds native Activity-protocol support to the azure.ai.agents extension, so activity agents (including M365 "digital workers") work end-to-end with azd ai agent initazd provisionazd deploy without external scripts.

What's included

Native activity protocol (commit 1)

  • Set Foundry-Features: HostedAgents=V1Preview,AgentEndpoints=V1Preview on CreateAgent/PatchAgent so the agent endpoint patch (protocols + authorization_schemes) is accepted.
  • Auto-inject the agent endpoint with protocols: [activity] and authorization_schemes: [BotServiceRbac] for activity agents (additive; does not override user config).
  • Normalize user-facing activity ↔ internal activity_protocol wire value in map.go.
  • New m365_registration.go: best-effort M365 onboarding (OAuth2 grants for MCP/APEX, blueprint owner, digital-worker publish, Teams backend config) wired into the postprovision/postdeploy hooks.

Use-case profiles + init + onboarding next-steps (commit 2)

  • agent.yaml gains activity.use_case (simple | digital_worker). ResolveActivityProfile gates activity-endpoint injection, BotServiceRbac, blueprint reference, and M365 provision/publish.
  • azd ai agent init round-trips use_case from the manifest; adds --activity-use-case and an AZD_AI_STARTER_TEMPLATE override. The preprovision hook sets ENABLE_DIGITAL_WORKER + AGENT_NAME so the starter template provisions the MAIB + Bot Service.
  • azd deploy now prints the digital-worker onboarding next steps (M365 admin-center approval, blueprint ID, Teams instance) in the visible deploy summary.

Testing

  • go vet ./... clean.
  • go test ./... green across all packages (cmd, project, agent_yaml, nextstep, doctor, ...).
  • Validated end-to-end against a live Foundry project: init → provision (creates MAIB + Bot Service) → deploy (agent active, activity endpoint + BotServiceRbac, bot messaging endpoint correct, Teams channel enabled).

Note: the digital-worker init path depends on companion infra in Azure-Samples/azd-ai-starter-basic (separate PR).

Make activity_protocol a first-class protocol so hosted activity agents deploy

end-to-end with azd provision + azd deploy (no custom scripts/hooks):

- Send Foundry-Features AgentEndpoints header on CreateAgent/PatchAgent so the

  agent_endpoint (protocols + authorization_schemes) is honored by the service.

- Auto-inject the activity endpoint protocol + BotServiceRbac auth scheme for

  activity agents when not declared in agent.yaml.

- Inject BlueprintReference from MAIB_NAME; normalize activity->activity_protocol.

- Resolve agent name from AGENT_{serviceKey}_NAME in postdeploy (fixes 404 when

  agent.yaml name differs from the azure.yaml service name).

- Add native M365 registration (best-effort): post-provision OAuth2 grants +

  blueprint owner; post-deploy digital-worker publish + Teams backend config.

- Add unit tests for the new behavior.
…, and onboarding next-steps

Builds on native activity-protocol support with use-case profiles and end-to-end azd init/provision/deploy for digital workers.

- agent_yaml: add ActivityConfig.use_case (simple|digital_worker), ActivityProfile, IsActivityProtocol(), and ResolveActivityProfile(hasBlueprintEnv). Profile gates activity-endpoint injection, BotServiceRbac, blueprint reference, and M365 provision/publish.

- service_target_agent: resolve the activity profile in prepareDeploy and gate blueprint/BotServiceRbac injection on it; ensureActivityEndpointDefaults takes the profile; append a visible digital-worker onboarding next-steps note (admin-center approval, blueprint ID, Teams instance) to the deploy artifact so it surfaces in azd deploy output.

- listen.go: digitalWorkerEnvUpdate preprovision hook sets ENABLE_DIGITAL_WORKER and AGENT_NAME so the starter-template infra provisions MAIB + Bot Service; gate M365 provision/publish on the per-service profile.

- init.go/init_from_code.go: add --activity-use-case flag and AZD_AI_STARTER_TEMPLATE override; round-trip activity use_case from manifest into agent.yaml; accept both 'activity' and 'activity_protocol' names.

- Tests: new activity_profile_test.go; updated profile-aware endpoint/deploy-note tests and fixed map_test call sites. go vet + go test ./... green.
Add CHANGELOG entry for native Activity-protocol support (#8753).
@Hameedkunkanoor Hameedkunkanoor marked this pull request as ready for review June 21, 2026 07:39
Copilot AI review requested due to automatic review settings June 21, 2026 07:39
@github-actions github-actions Bot added the ext-agents azure.ai.agents extension label Jun 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the azure.ai.agents azd extension to support Foundry’s Activity protocol end-to-end (including M365 “digital worker” scenarios) across azd ai agent initazd provisionazd deploy, including endpoint/protocol normalization, blueprint wiring, and best-effort M365 onboarding steps.

Changes:

  • Add Activity protocol support end-to-end: wire-level feature header, protocol name normalization (activityactivity_protocol), endpoint display/config output, and default endpoint injection (incl. BotServiceRbac for digital workers).
  • Introduce activity.use_case profiles (simple vs digital_worker) and propagate/use them across init/provision/deploy flows (including setting infra-driving env vars and printing onboarding next steps).
  • Add best-effort M365 registration/publish + Teams backend configuration logic with unit tests.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
cli/azd/extensions/azure.ai.agents/version.txt Bump extension version.
cli/azd/extensions/azure.ai.agents/extension.yaml Keep extension manifest version in sync with version.txt.
cli/azd/extensions/azure.ai.agents/CHANGELOG.md Add release notes describing Activity protocol + use-case profiles changes.
cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go Inject Activity endpoint defaults, blueprint reference injection, protocol display normalization, and deploy “next steps” note augmentation.
cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent_test.go Add/adjust tests for activity endpoint display, artifacts, endpoint defaults, and deploy note next steps.
cli/azd/extensions/azure.ai.agents/internal/project/m365_registration.go Add best-effort Graph/AzureML/Teams calls for blueprint provisioning and digital-worker publish flows.
cli/azd/extensions/azure.ai.agents/internal/project/m365_registration_test.go Add unit tests for the internal authenticated HTTP client helpers.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/yaml.go Add activity config, activity.use_case resolution, and blueprint reference schema + helpers.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/map.go Normalize activity protocol for API requests and map blueprint references into CreateAgent requests.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/map_test.go Add tests for activity protocol normalization and blueprint reference mapping.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/activity_profile_test.go Add test coverage for activity protocol detection and profile resolution.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations.go Set Foundry feature header for Create/Patch to ensure agent_endpoint fields are honored.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations_test.go Add test ensuring PatchAgent sets the AgentEndpoints feature header.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/models.go Extend CreateAgentVersionRequest with blueprint_reference.
cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go Hook M365 provisioning/publish into lifecycle handlers and set digital-worker infra-driving env vars.
cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go Clarify Activity protocol is not invocable; point users to endpoint show.
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go Add --activity-use-case and starter-template override via AZD_AI_STARTER_TEMPLATE.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go Add activity protocol support to init-from-code flow, including activity-only skip of model prompts and profile recording.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code_test.go Add tests for activity protocol selection/normalization and activity-only gating helpers.
cli/azd/extensions/azure.ai.agents/internal/cmd/helpers.go Improve invocation error suggestion text for non-invocable protocols.

Comment on lines +391 to 395
apiProtocol := agent_api.AgentProtocol(protocol.Protocol)
if apiProtocol == "activity" {
apiProtocol = agent_api.AgentProtocolActivityProtocol
}
protocolVersions = append(protocolVersions, agent_api.ProtocolVersionRecord{
Comment on lines +1254 to +1258
// Resolve the activity deployment profile. The use case comes from
// agent.yaml's activity.use_case when set; otherwise it falls back to the
// environment (a provisioned blueprint/MAIB implies a digital worker).
hasBlueprintEnv := azdEnv["MAIB_NAME"] != "" || azdEnv["AGENT_IDENTITY_BLUEPRINT_ID"] != ""
activityProfile := agentDef.ResolveActivityProfile(hasBlueprintEnv)
Comment on lines +425 to +430
if versionObj.AgentGUID != "" {
if def, ok := loadContainerAgentForService(args.Project, svc); ok &&
def.ResolveActivityProfile(hasBlueprintEnv).M365Publish {
agentGUIDs[agentName] = versionObj.AgentGUID
}
}
Comment on lines +1518 to +1523
// Template defaults to the published starter. AZD_AI_STARTER_TEMPLATE allows
// pointing at a local clone or fork for testing infra changes before they
// land upstream (azd init -t accepts a local directory path).
starterTemplate := "Azure-Samples/azd-ai-starter-basic"
if override := os.Getenv("AZD_AI_STARTER_TEMPLATE"); override != "" {
starterTemplate = override
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.agents extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants