agent-bios 0.19.3 → 0.19.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/session-cost.py CHANGED
@@ -18,31 +18,61 @@ the bill: measured over two real sessions here, cache read + cache write were
18
18
  92-94% of cost and output 6-8%, so context size is the cost, and the only lever
19
19
  on it is how long a session is allowed to grow before it is reset.
20
20
  """
21
- import json, sys, glob, os, itertools, tempfile, subprocess
21
+ import json, sys, glob, os, itertools, re, tempfile, subprocess
22
22
  from datetime import datetime, timezone
23
23
 
24
24
  # $/MTok: input, output, cache_read, cache_write_5m, cache_write_1h
25
+ # Whole table re-read against the vendor pricing page on 2026-10-21. That pass added the
26
+ # 5.5 generation and corrected `claude-sonnet-5`, which carried Sonnet 4.6's rates — it
27
+ # had been overcharging every Sonnet 5 session by half since it was written.
25
28
  PRICES = {
26
29
  "claude-fable-5": (10.0, 50.0, 1.00, 12.50, 20.0),
27
- # Fable 5.1 model overview, verified 2026-09-08.
28
30
  "claude-fable-5-1": (10.0, 50.0, 0.25, 12.50, 20.0),
29
31
  "claude-mythos-5": (10.0, 50.0, 1.00, 12.50, 20.0),
32
+ "claude-opus-5-5": (4.0, 20.0, 0.20, 5.0, 8.0),
30
33
  "claude-opus-5": (5.0, 25.0, 0.50, 6.25, 10.0),
31
34
  "claude-opus-4-8": (5.0, 25.0, 0.50, 6.25, 10.0),
32
35
  "claude-opus-4-7": (5.0, 25.0, 0.50, 6.25, 10.0),
33
36
  "claude-opus-4-6": (5.0, 25.0, 0.50, 6.25, 10.0),
34
- "claude-sonnet-5": (3.0, 15.0, 0.30, 3.75, 6.0),
37
+ "claude-sonnet-5-5": (2.0, 10.0, 0.10, 2.50, 4.0),
38
+ "claude-sonnet-5": (2.0, 10.0, 0.20, 2.50, 4.0),
35
39
  "claude-sonnet-4-6": (3.0, 15.0, 0.30, 3.75, 6.0),
40
+ # Haiku 5.5 is the short-prompt rate; see TIERED below.
41
+ "claude-haiku-5-5": (0.10, 0.50, 0.01, 0.125, 0.20),
36
42
  "claude-haiku-4-5": (1.0, 5.0, 0.10, 1.25, 2.0),
37
43
  }
38
44
 
39
- def price_for(model):
40
- # Version-specific rates take precedence over their family prefix.
41
- for k, v in sorted(PRICES.items(), key=lambda item: len(item[0]), reverse=True):
42
- if model.startswith(k):
43
- return v
45
+ # Models the vendor bills at two rates by PROMPT length. A session total cannot say which
46
+ # of its requests crossed the threshold — the per-request sizes are gone by the time the
47
+ # transcript is aggregated — so the table holds the lower rate and the report says, by
48
+ # name, that the figure is a floor. Silently picking either rate would print a plausible
49
+ # number that is wrong in a direction nobody could see.
50
+ TIERED = {
51
+ "claude-haiku-5-5": "prompts over 100k tokens bill at 5x — this figure is a floor",
52
+ }
53
+
54
+ def price_key(model):
55
+ """The PRICES key this model bills under, or None. See price_for for the rule."""
56
+ if model in PRICES:
57
+ return model
58
+ for k in PRICES:
59
+ if model.startswith(k) and re.fullmatch(r"-\d{8}", model[len(k):]):
60
+ return k
44
61
  return None
45
62
 
63
+
64
+ def price_for(model):
65
+ """An exact id, or that same id carrying a release-date suffix. Nothing else.
66
+
67
+ This matched any prefix until 2026-10-21, which was wrong in the one direction that
68
+ cannot be noticed: a generation's id is a PREFIX of the next one, so `claude-opus-5-5`
69
+ priced itself at `claude-opus-5` rates and printed a plausible number. An unknown
70
+ model now returns None, which the report prints as `?` and collects under `unpriced`
71
+ — visibly missing beats quietly wrong. The accepted tail is the vendor's dated
72
+ spelling (`claude-haiku-4-5-20251001`), which is the same model at the same price."""
73
+ key = price_key(model)
74
+ return PRICES[key] if key else None
75
+
46
76
  def moment(ts):
47
77
  """A transcript timestamp as an aware datetime, or None if it is not one.
48
78
 
@@ -141,7 +171,7 @@ def report(session_path):
141
171
  sources += [(os.path.basename(f)[:-6], f)
142
172
  for f in sorted(glob.glob(os.path.join(base, "subagents", "*.jsonl")))]
143
173
  print(f"\n=== {os.path.basename(session_path)} ===")
144
- grand, unpriced = 0.0, []
174
+ grand, unpriced, tiered_seen = 0.0, [], set()
145
175
  hdr = (f"{'source':<38}{'model':<22}{'turns':>6}{'input':>9}{'output':>9}"
146
176
  f"{'cache_rd':>10}{'cache_wr':>10}{'cost$':>9}")
147
177
  print(hdr); print("-" * len(hdr))
@@ -160,6 +190,8 @@ def report(session_path):
160
190
  name = "main"
161
191
  c = cost(model, a)
162
192
  cs = f"{c:9.2f}" if c is not None else " ?"
193
+ if c is not None and price_key(model) in TIERED:
194
+ tiered_seen.add(price_key(model))
163
195
  if c is None:
164
196
  unpriced.append(model)
165
197
  else:
@@ -173,6 +205,8 @@ def report(session_path):
173
205
  print(f"\nwall clock: no usable timestamps | modeled total cost: ${grand:,.2f}")
174
206
  if unpriced:
175
207
  print(f"WARN unpriced models: {set(unpriced)}")
208
+ for key in sorted(tiered_seen):
209
+ print(f"NOTE {key}: {TIERED[key]}")
176
210
  return 0
177
211
 
178
212
  # ── context budget ────────────────────────────────────────────────────────────
@@ -388,6 +422,24 @@ def _self_test():
388
422
  if not ok:
389
423
  failures.append(name)
390
424
 
425
+ # Price lookup, which had no control at all while it silently priced one generation
426
+ # at the previous one's rates. The first case is the defect; the rest fence the rule.
427
+ # Two halves of the same rule. Once a generation HAS a row the first case can only
428
+ # ask that the rows differ; the second keeps the original defect reachable by naming
429
+ # a generation the table does not carry, where the old prefix rule billed a neighbour.
430
+ check("a generation bills at its own rate, not the previous generation's",
431
+ price_for("claude-opus-5-5") != price_for("claude-opus-5"), True)
432
+ check("a generation the table does not carry is unpriced, not billed at a neighbour",
433
+ price_for("claude-opus-5-9"), None)
434
+ check("an exact id is priced", price_for("claude-opus-5"), PRICES["claude-opus-5"])
435
+ check("a dated spelling is the same model at the same price",
436
+ price_for("claude-haiku-4-5-20251001"), PRICES["claude-haiku-4-5"])
437
+ check("a longer number is not a dated suffix", price_for("claude-opus-50"), None)
438
+ check("an unknown family is unpriced rather than guessed",
439
+ price_for("gpt-6.1-sol"), None)
440
+ check("the price table is not empty, so the cases above judge something",
441
+ len(PRICES) > 0, True)
442
+
391
443
  def write(dirpath, name, records):
392
444
  p = os.path.join(dirpath, name)
393
445
  with open(p, "w", encoding="utf-8") as fh:
@@ -24,7 +24,7 @@ Reach:
24
24
  --reach custom CODEX_HOME from --home
25
25
 
26
26
  Options:
27
- --model MODEL Main model (default gpt-5.6-sol)
27
+ --model MODEL Main model (default gpt-6.1-sol)
28
28
  --effort EFFORT Reasoning effort override (default xhigh; ultra explicitly opts in)
29
29
  --sandbox MODE Disable default bypass; use read-only | workspace-write | danger-full-access
30
30
  --cd DIR Working root for Codex (default current directory; hermetic defaults empty)
@@ -119,22 +119,22 @@ esac
119
119
 
120
120
  case "$mode" in
121
121
  auto|implement)
122
- : "${model:=gpt-5.6-sol}"
122
+ : "${model:=gpt-6.1-sol}"
123
123
  : "${effort:=xhigh}"
124
124
  : "${sandbox:=workspace-write}"
125
125
  ;;
126
126
  review)
127
- : "${model:=gpt-5.6-sol}"
127
+ : "${model:=gpt-6.1-sol}"
128
128
  : "${effort:=xhigh}"
129
129
  : "${sandbox:=read-only}"
130
130
  ;;
131
131
  scout)
132
- : "${model:=gpt-5.6-sol}"
132
+ : "${model:=gpt-6.1-sol}"
133
133
  : "${effort:=xhigh}"
134
134
  : "${sandbox:=read-only}"
135
135
  ;;
136
136
  single)
137
- : "${model:=gpt-5.6-sol}"
137
+ : "${model:=gpt-6.1-sol}"
138
138
  : "${effort:=xhigh}"
139
139
  : "${sandbox:=workspace-write}"
140
140
  fanout=0
@@ -233,7 +233,7 @@ EOF
233
233
  if [ "$fanout" -eq 1 ]; then
234
234
  cat <<EOF
235
235
  - Fan-out is authorized when delegation gates fire; do de-minimis work directly. Native multi-agent is off unless the main is explicit Ultra.
236
- - Internal roles via codex-run --profile inherit and bounded stdin packet: WORKHORSE=gpt-5.6-terra/xhigh/read-only-or-workspace-write; SWEEP=gpt-5.6-luna/max/read-only; REVIEWER=gpt-5.6-terra/xhigh/read-only.
236
+ - Internal roles via codex-run --profile inherit and bounded stdin packet: WORKHORSE=gpt-6.1-sol/high/read-only-or-workspace-write; SWEEP=gpt-6-luna/max/read-only; REVIEWER=gpt-6.1-sol/high/read-only.
237
237
  - Native spawn cannot pin role/effort. Do not use native spawn_agent for FRONTIER. Use codex-run with gpt-6-astra/read-only and task-fit effort: max default, Ultra for divisible work, lower when cost/latency dominates.
238
238
  - Internal FRONTIER command base: $codex_run --profile inherit --model gpt-6-astra --effort <effort> --multi-agent auto --sandbox read-only --cd "\$PWD" -c agents.max_threads=$max_threads -c agents.max_depth=$max_depth. The adapter enables native multi-agent only for ultra. Send a self-contained packet on stdin; never full-history resume.
239
239
  - Run independent units in parallel; respect depth/thread limits; wait and synthesize bounded reports.