Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Pin a Pricing Snapshot Before an AI Agent Run

Description and use

When launching complex AI agents, a pricing snapshot is pinned and attached to every model call, ensuring accurate and reproducible billing.

Problem

Long-running AI agents incur multiple model calls, making it hard to know which pricing catalog applied at run start, leading to billing mismatches.

Outcome

By pinning a pricing snapshot at run start, the system avoids billing errors, provides a clear audit trail, and simplifies support reviews.

Workflow

  • Fetch a fresh pricing snapshot from the public endpoint
  • Resolve the user’s effective billing group
  • Estimate initial context size
  • Select allowed routes and calculate a budget envelope
  • Create an agent_run record with snapshot version and budget limits
  • Reject or downscope runs that exceed budget
  • During the run, attach snapshot info to each model call record
  • Use the snapshot for later invoice generation and support review

Evidence

The gateway should pin a pricing snapshot, calculate a budget envelope, record the selected billing group, and attach those facts to every model call that belongs to the run.

Source

Use one run record and many request records. The run record pins policy.

Source

  • Record date: 2026-09-05T18:23:05.768Z