Skip to content

Commit 449b3af

Browse files
authored
Merge pull request #18 from runcycles/claude/analyze-spring-issue-29-vBIY9
Claude/analyze spring issue 29 v biy9
2 parents 2df74f9 + 5caefaa commit 449b3af

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ result = call_llm("Hello", tokens=100)
5959
> ```
6060
> The key (e.g. `cyc_live_abc123...`) is shown only once — save it immediately. For key rotation and lifecycle details, see [API Key Management](https://runcycles.io/how-to/api-key-management-in-cycles).
6161
62+
### Budget lifecycle
63+
64+
The `@cycles` decorator wraps your function in a reserve → execute → commit/release lifecycle:
65+
66+
| Scenario | Outcome | Detail |
67+
|---|---|---|
68+
| Reservation denied | **Neither** | `BudgetExceededError`, `OverdraftLimitExceededError`, or `DebtOutstandingError` raised; function never executes |
69+
| `dry_run=True`, any decision | **Neither** | Returns `DryRunResult` or raises; no real reservation created |
70+
| Function returns successfully | **Commit** | Actual amount charged; unused remainder auto-released |
71+
| Function raises any exception | **Release** | Full reserved amount returned to budget; exception re-raised |
72+
| Commit fails (5xx / network) | **Retry** | Exponential backoff with configurable attempts |
73+
| Commit fails (non-retryable 4xx) | **Release** | Reservation released after non-retryable client error |
74+
| Commit gets RESERVATION_EXPIRED | **Neither** | Server already reclaimed budget on TTL expiry |
75+
| Commit gets RESERVATION_FINALIZED | **Neither** | Already committed or released (idempotent replay) |
76+
| Commit gets IDEMPOTENCY_MISMATCH | **Neither** | Previous commit already processed; no release attempted |
77+
78+
All raised exceptions from the guarded function trigger release. See [How Reserve-Commit Works](https://runcycles.io/protocol/how-reserve-commit-works-in-cycles) for the full protocol-level explanation.
79+
6280
### Programmatic client
6381
6482
```python

0 commit comments

Comments
 (0)