# Understand usage and limits

Track customer charges, reservations, uncertainty, and the account policies applied to every run.

## Price semantics

Customer charges and reservations are recorded for each run. A pending or changed provider assignment may make pricing unavailable until it is ready.

The SDK exposes the recorded customer amount. It does not calculate charges in the browser. Amounts already admitted remain associated with their run through settlement and reconciliation.

Money is integer micro-USD: 1,000,000 units = $1. Public `usage.cost_microusd`, run maximums, account monthly budgets, and reservations are customer amounts.

### Python

```python
result = await run.result()
usage = result.run.usage
if usage.cost_microusd is None:
    print("Cost is unresolved; do not display zero.")
else:
    print("Customer micro-USD:", usage.cost_microusd)
print("Source:", usage.source, "Settlement:", usage.status)
```

### TypeScript

Read the result after the run reaches a terminal state. `run.result()` rejects while the run is active.

```typescript
const result = await run.result()
const usage = result.usage
if (usage.cost_microusd === null) {
  console.log("Cost is unresolved; do not display zero.")
} else {
  console.log("Customer micro-USD:", usage.cost_microusd)
}
console.log("Source:", usage.source, "Settlement:", usage.status)
```

## Provenance and settlement

`source` is `provider_reported`, `estimated`, `simulated`, or `unknown`. An estimated amount is calculated from available runtime/catalog evidence. It is not a verified supplier invoice. A catalog discovery alone does not prove that a provider freshly confirmed those prices.

`status` is `reserved`, `settled`, or `pending_reconciliation`. Missing final usage remains unknown and keeps its reservation. Simulated amounts remain separate from real charges. An operator may reconcile a final amount with a reason. The service records an immutable settlement.

## Account policies

The operator sets the monthly customer budget, monthly run count, concurrent-run maximum, and maximum execution duration. Admission checks settled spend plus reservations atomically with those limits. A run cannot bypass them with a larger profile budget.

This profile sets a customer maximum of $0.30 per run.

### Python

```python
profile = await agents.profiles.create(
    name="Bounded reviewer",
    instructions="Review the supplied content concisely.",
    max_cost_microusd=300_000,
    timeout_seconds=120,
)
```

### TypeScript

```typescript
const profile = await agents.profiles.create({
  name: "Bounded reviewer",
  instructions: "Review the supplied content concisely.",
  max_cost_microusd: 300_000,
  timeout_seconds: 120,
})
```

Thresholds are admission, reservation, and stop controls. External requests already in flight may exceed a stop threshold. These controls do not guarantee that a supplier invoice will end at an exact amount. Unknown reservations are retained rather than concealed.

## Availability

Verified identity, active account, enabled assigned provider, permitted model, known pricing, and limits are all required for new work. A pending, suspended, or rejected owner can still inspect status and history. Suspension blocks new work. Cancellation of already admitted work is explicit.

If the provider, credential/config revision, or assignment changes, continuing a bound session may return `session_configuration_changed`. Start a new session. The customer cannot choose another provider or silently reuse the earlier execution history under new routing.

## Numeric precision

### Python

Python and Go retain wider JSON numeric representations. Encode exact decimal values and large business identifiers as strings when exchanging them with JavaScript. The SDK does not silently substitute rounded money.

### TypeScript

The JavaScript SDK rejects non-finite values and integers outside its safe range, including nested tool data. Encode large business identifiers and exact decimal values as strings. The SDK does not silently substitute rounded money.
