just a thought… though depends if you are running staging in debug vs release…
<ItemGroup>
<PackageReference Include="Umbraco.AI.Agent.Copilot" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
or if you are passing in the environment to the build process..
dotnet publish "%DEPLOYMENT_SOURCE%\Project\Project.Web.csproj" -c Release -r win-x64 -f net10.0 -p:PublishSingleFile=false -p:EnvironmentName=%ASPNETCORE_ENVIRONMENT%
<ItemGroup>
<!-- Exclude the package if the environment is Production -->
<PackageReference Include="Umbraco.AI.Agent.Copilot" Condition=" '$(EnvironmentName)' != 'Production'" />
</ItemGroup>