Track retries and model invocations in AI workloads
On this page
Review existing telemetry for each model invocation and retry attempt. Label loops, tool calls, and evaluations as event types, then count a model-cost event only when available telemetry shows another model invocation or metered operation.
Why this is worth a look
AWS documents retries after transient errors or throttling, controlled by retry mode and maximum attempts. Amazon Bedrock agent metrics distinguish API invocations from model invocations and expose token, latency, throttle, and error metrics in CloudWatch. Microsoft describes attribution challenges in native Azure OpenAI telemetry and a gateway option for identity or custom identifiers with model and token data. Bedrock judge jobs require an evaluator model and may use a generator model. Foundry can run evaluations against test data, while dataset evaluations can score preexisting outputs without rerunning them. Compare these signals with billing data available for the same scope, without assuming a cross-cloud row-level join.
Run this check
CHECKLISTInventory existing application, SDK, gateway, provider-metric, evaluation, and billing data without changing retry settings, deploying code, or starting an evaluation.
1. Confirm the execution surface and review window.
- Choose one explicitly scoped account or subscription, service, region or location, and time window.
- Read existing application, SDK, gateway, provider-metric, evaluation, and billing data for that scope.
- Keep this review read-only. Do not change retry settings, deploy code, or start an evaluation.
2. Map fields that already exist, then record gaps for a later implementation plan.
- Look for request and trace identifiers, attempt number, retry reason or mode, maximum attempts, loop iteration, and stop reason.
- Look for model or deployment ID, API operation, status, error code, latency, and available input, output, cached-input, or total-token fields. Record each field's documented unit or definition when available.
- Look for tool name or type and tool-call count, plus evaluation and job or run identifiers, dataset version, generator or judge model, metric name, and sample count.
- Look for application, feature, environment, team, tenant or customer pseudonym, and business transaction identifiers. Mark absent fields as gaps. Do not treat this list as provider-guaranteed columns.
3. Read documented provider metrics and evaluation metadata separately.
- For Amazon Bedrock agents, review CloudWatch namespace AWS/Bedrock/Agents: InvocationCount, ModelInvocationCount, InputTokenCount, OutputTokenCount, latency, throttle, and client- and server-error metrics. Review the documented Operation, ModelId, and AgentAliasArn dimensions.
- For Bedrock LLM-as-a-judge evaluations, read the job scope, generator and evaluator models, prompt dataset bucket, and output bucket from the job configuration.
- For Azure Foundry or Azure OpenAI workloads, review existing gateway telemetry when present. Microsoft describes gateway capture of client identity or custom business-unit, tenant, or application identifiers with model and token data.
4. Compare and classify the results.
- Compare consistently scoped service telemetry with the billing data available for the same account or subscription, service, region or location, and time window. Verify the identifiers, time basis, units, and granularity in your enabled data before comparing.
- Mark unmatched records for investigation rather than treating the comparison as guaranteed reconciliation.
- Label retries, loops, tool calls, and evaluations as telemetry event types. Count another model-cost event only when the available telemetry shows another model invocation or another metered operation.How to confirm it
- 01
Define the review window and scope
Choose one account or subscription, service, region or location, and time window. Read existing application, SDK, gateway, provider-metric, evaluation, and billing data for that scope. Do not change settings, deploy code, or start an evaluation.
- 02
Map existing fields and gaps
Inventory fields already present for request and trace IDs, attempts, retry details, model or deployment ID, tokens, status, errors, latency, tools, evaluations, and application or tenant attribution. Record documented units or definitions, and list missing fields for a later implementation plan.
- 03
Read provider metrics separately
For Amazon Bedrock agents, review CloudWatch metrics in AWS/Bedrock/Agents, including InvocationCount, ModelInvocationCount, InputTokenCount, OutputTokenCount, latency, throttle, and error metrics with their documented dimensions. For Azure workloads, review gateway identity or custom identifiers when that telemetry already exists.
- 04
Compare and classify results
Compare service telemetry with the billing data available for the same scope and time window. Verify identifiers, time basis, units, and granularity in your enabled data. Keep retries, loops, tool calls, and evaluations as event types, and count another model-cost event only when telemetry shows another model invocation or metered operation.
Before making changes
This assumes read access to existing application, gateway, relevant provider metrics, evaluation metadata, and billing data for the same scope and time window. Missing fields require a separate implementation plan and may need application, SDK, gateway, or pipeline changes. AWS retry behavior varies by SDK, language, mode, and configuration. Bedrock metrics use AWS/Bedrock/Agents and describe Bedrock agent and model activity, so review downstream services separately. Azure gateway attribution is a design option, not a requirement for every workload.