fix(atlas): fail-closed on missing input, real token cost, remove dev scaffolding [Bug-1210]

Story 1210Epic None8 files · +214/−101

PR #41 · pramaan-io/pramaan-agents · merged 2026-06-11

Why this matters

When a real client opens a case, but the agent's notebook is still in demo mode.

the cost of a notebook that lies

Demo scaffolding in production = a notebook that lies.

The fix — No real filing, no transcript. No real tokens, no fake price.

How it flows

sequenceDiagram
  autonumber
  participant client as client
  participant atlas as atlas clerk
  participant baml as BAML
  participant transcript as transcript
  client->>atlas: request (empty input)
  atlas->>atlas: ValueError — fail-closed
  client->>atlas: valid request
  atlas->>baml: open transcript
  baml->>baml: invoke Bedrock Kimi K2.5
  baml-->>atlas: real tokens used
  atlas->>transcript: log real USD

app/atlas/config.py + runtime.py

Methodin → outwhat it does
token_cost_usd(model_id, input_tokens, output_tokens) → floatconverts real Bedrock token counts to billed USD via Kimi K2.5 on-demand rates
_stamp_cost(stamp, config, collector) → Nonewrites real token usage onto every event before it lands in the transcript

What changed, file by file

Atlas model pricing module — adds Kimi K2.5 on-demand rates and a helper that turns real token counts into billed USD.

new methodsignature
token_cost_usd(model_id, input_tokens, output_tokens) → float

Atlas turn runtime — records real Bedrock token usage onto every emitted event via the BAML collector, replacing 'TBD' with a real number.

new methodsignature
_stamp_cost(stamp, config, collector) → None

Atlas agent entry point — threads a BAML collector parameter through stream_atlas_turn so real token usage actually reaches the transcript.

New fields: collector : _baml_py.Collector | None

Files changed (8)

File±
app/AGENTS.md+6 −5
app/atlas/AGENTS.md+8 −8
app/atlas/agent.py+13 −2
app/atlas/config.py ★+25
app/atlas/main.py ★+17 −80
app/atlas/runtime.py ★+25 −6
app/atlas/tests/test_atlas_entrypoint.py+87
app/atlas/tests/test_atlas_runtime.py+33