Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
// ------------------------------------------------------------------------------------------------

namespace System.Agents;
using System.Environment.Consumption;

codeunit 4333 "Agent Consumption Overview"
{
InherentEntitlements = X;
InherentPermissions = X;
Permissions = tabledata "Agent Task" = r,
tabledata "User AI Consumption Data" = r;
Permissions = tabledata "Agent Task" = r;
Comment thread
qutreson marked this conversation as resolved.

/// <summary>
/// Gets the total Copilot credits consumed by the agent task.
Expand All @@ -20,11 +18,9 @@ codeunit 4333 "Agent Consumption Overview"
/// <returns>The total Copilot credits consumed by the agent task.</returns>
procedure GetCopilotCreditsConsumed(TaskId: BigInteger): Decimal
var
UserAIConsumptionData: Record "User AI Consumption Data";
AgentUtilities: Codeunit "Agent Utilities";
begin
UserAIConsumptionData.SetRange("Agent Task Id", TaskId);
UserAIConsumptionData.CalcSums("Copilot Credits");
exit(UserAIConsumptionData."Copilot Credits");
exit(AgentUtilities.GetConsumedCopilotCredits(TaskId));
end;

/// <summary>
Expand Down
Loading