Skip to content

feat(agents): add azd ai agent delete command #8520

@v1212

Description

@v1212

Problem

There is no CLI command to delete a hosted agent from the Foundry service. Users must manually call the REST API or use other tools to remove agents they no longer need.

The DeleteAgent API exists in Vienna (AgentController.cs) with a force query parameter to handle agents with active sessions, but no azd CLI command exposes it.

Proposed Solution

Add azd ai agent delete [name] command that:

  • Resolves agent name from azure.yaml / azd environment (same as show, invoke)
  • Calls DELETE /agents/{agentName}?api-version=v1&force={true|false}
  • Default behavior: safe delete (fails with 409 if active sessions exist)
  • --force flag: terminates active sessions and force-deletes

Acceptance Criteria

  • azd ai agent delete works with auto-resolved agent name
  • azd ai agent delete my-agent works with explicit name
  • azd ai agent delete --force force-deletes even with active sessions
  • Clear error messages for 404 (not found) and 409 (active sessions)
  • --output json returns structured response
  • Help text documents the command and all flags

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions