Skip to content

Concept Budget Ceiling

Reese Hodge edited this page Nov 15, 2026 · 22 revisions

Budget Ceiling

Budget ceiling is constitution principle P2. The budget is a hard project rule. For 003-architecture-review, use Source-Agent-Infra-Deployment-Review: A5 applies there. The $5 headroom/$11-$15 profile is approved, but P2's amendment and concurrent-spend enforcement remain unfinished.

The constitution sets the concrete limit at $10/month and requires automated enforcement:

  • AWS Budgets email alarms must fire at $5 and $8.
  • A hard-stop mechanism must activate at $10, blocking all spend-bearing paths, including the new signed-in path.
  • A per-session token cap must be enforced.
  • No feature ships without a documented cost model.

In BudgetStack, the $5, $8 and $10 notifications each email the owner, and only the $10 one publishes to the hard-stop topic. Until 2026-10-03 every threshold went to that topic and nobody was emailed, so a $5 warning would have revoked guest access (issue #56). The $8 soft-degrade (FR-016) has a frontend consumer but nothing produces it yet. This is verified against synthesized templates only, because nothing has been deployed. See Component-Infra-Stacks.

The quality gate adds another concrete threshold: every feature must include a cost estimate before implementation begins, and any feature that pushes the projected monthly total above $8 must include a mitigation plan.

For someone writing code, this changes what "done" means. A new agent call, TTS path, memory operation, hosted asset workflow, or AWS resource is not just a technical change; it is a cost-model change. The implementation must preserve the cap, expose enough telemetry to prove usage, and fail closed before runaway spend.

This is why Concept-Cloud-Only-Inference centralizes AI work on AWS: one path can be metered and stopped. It is also why Concept-Credential-Hygiene avoids credential mechanisms that create unnecessary account-level cost or blast radius.

Practical rules:

  • Do not add a recurring cloud resource without an explicit cost model.
  • Do not bypass per-session limits for convenience in tests or demos.
  • Do not treat free-tier assumptions as permanent facts; verify them before acting.
  • Prefer mechanisms that can be disabled automatically when the cap is reached.

The project is a personal, non-commercial fan project. Budget control is a product requirement, not an afterthought.

What to watch in reviews

Budget risk is not limited to obvious infrastructure. Reviewers should look for:

  • New model calls, retries, background jobs, or scheduled prompts.
  • Longer prompts, larger context windows, or unbounded memory reads.
  • TTS generation that can be repeated without a session cap.
  • Hosted assets or logs whose storage grows without a lifecycle policy.
  • Any test, demo, or script that can accidentally call paid cloud services.
  • Framework defaults that add model calls. A library default is a cost decision nobody wrote down. The Strands harness, for instance, turns on reasoning, a background subagent, a summarizing model behind web_fetch and background memory extraction unless each is disabled (Source-Strands-Harness-Docs); SDK hooks can retry a model call or resume an invocation (Source-Strands-Harness-SDK-Docs).

If a feature is useful but pushes the projected monthly total above $8, the mitigation plan must be written before implementation proceeds. If the hard cap would be exceeded, the feature is out of scope until the design changes.

Cost estimates do not need false precision, but they do need enough detail for another contributor to verify the assumption later.

Published rates to check against

Source-AWS-Infrastructure-Pricing records the 2026-11-01 primary-source lookup for spec 003 T138: Oregon infrastructure rates, ongoing allowances and CloudFront's distinct pay-as-you-go and flat-rate plans. Automated rate verification is not workload sizing or the spec's required human confirmation.

Until 2026-09-29 this page carried no numbers, so a design could not actually be checked against the ceiling — only argued about. The AgentCore rate card now lives on Source-AgentCore-Pricing. Three figures from it change how the ceiling should be applied:

  • Web search costs $7.00 per 1,000 queries. One thousand searches is 70% of the entire monthly budget. Any design putting search on a hot path needs a per-session cap decided up front, not added later.
  • Memory is the component most likely to breach $10. AWS's own worked example — 100,000 short-term events, 10,000 stored records, 20,000 retrievals — came to $42.50/month on 2026-09-29. After short-term pricing changed on 2026-10-06, AWS recomputed it at $18.97/month (read 2026-10-30), mostly long-term storage and retrieval. Spec 003 plans to ship Memory in the first deployment, so its sizing is a decision we still get to make deliberately. The strategy kind also moves the bill: built-in strategies include extraction, while overrides bill it as Bedrock usage. See Source-AgentCore-Pricing and Source-AgentCore-Long-Term-Memory.
  • Runtime v2 is not free. It costs about 42% more CPU-hour and 79% more GB-hour than v1. Decision-AgentCore-Runtime-V2 chose v2 for fast cold starts without recording a premium, because the premium was not known here.

The corresponding saving is unproven. Bedrock prompt caching (cacheConfig: { strategy: 'auto' }) is supported by the SDK and unused, and our system prompt and tool definitions are resent on every turn — but a cache checkpoint has a 4,096-token minimum, and our system prompt is only about 2,990 tokens. It does not qualify on its own. Whether it clears the floor combined with the tool definitions is unverified. Until someone checks, this is an unproven saving rather than an unexploited one. Tracked as issue #49. See Source-Strands-Harness-SDK-Docs and Decision-LLM-Model-Selection.

Rate cards price one service at a time. Source-AWS-Pricing-Calculator prices a whole stack, and is how the as-built architecture will be checked against a month of measured spend. The public calculator excludes Free Tier, so it prices gross. That is the right basis for a credit-funded account, whose real cost is invisible net of credits. It is an estimate, not a quote: any service left out of it, such as log storage or data transfer, is simply missing from the total.

The per-session cap is currently advisory, not enforced

The constitution requires a per-session token cap, and checkSessionCaps implements one — 20k tokens, 50 turns, 30 minutes, returning 429 with session_cap_exceeded. That machinery works. What it bounds is a cooperative client.

sessionId is read straight from the request body of POST /invocations, with no authentication and no binding to the caller. So the budget is reset on demand: omit the field and the handler mints a fresh session record with a fresh allowance, every turn. Supplying a known sessionId likewise joins that session's record. There is no rate limiting and no authorization on the route — the only endpoints are /ping and /invocations.

The same pattern is latent one layer down, and worse there. actorId is also client-supplied, and memoryAdapter.ts uses it directly as the memory namespace (/max-height/${actorId}/). It is not reachable today — src/index.ts does not import the memory adapter and the wipe/list handlers are on no route, which follows from the Memory construct being unbuilt (deviation C4). But wiring memory into the invocation path without settling this would turn it into cross-tenant read and wipe.

This is recorded rather than patched because every plausible fix — server-issued signed session tokens, capping by caller identity, or edge rate limiting — is a behavioral change against a constitutional limit, and the last of those is a new AWS resource and therefore a cost-model change. That is Spec Kit territory, and it is scoped as issue #55 for the re-architecture run. The related Math.random() weakness in the generated id was a genuine one-line fix and went in separately as #54.

The practical reading for the $10 ceiling: the per-session cap is a guard against accidental runaway usage, not against a deliberate one. The $5/$8 Budgets notifications are warnings, not limits. The $10 hard stop is not enforced by the current code, either: CognitoStack passes the literal policy name CognitoUnauthRoleDefaultPolicy to BudgetStack, but CDK appends a hash to the policy's actual name. The hard-stop Lambda treats NoSuchEntityException as "already detached" and returns success. Even if the name were fixed, it only targets the guest role and not the WebSocket Lambda's spend path. The redesigned stop and an in-path breaker belong to spec 003's Q6 (#61); no deployed enforcement has been demonstrated. See Component-Infra-Stacks.

What AWS Budgets can see, and when

Spec 003's plan checked how Budgets measures spend (discrepancies D6 and D7). Three properties make the $10 hard stop a lagging backstop, not a limit:

  • Credits are included by default. CostTypes.IncludeCredit defaults to true (AWS CloudFormation reference, read 2026-10-11), and BudgetStack sets no cost types. On an account funded by Free-plan credits, the budget sees spend net of credits, close to zero, and never fires. Measuring gross means setting IncludeCredit, and the refund and discount flags, to false. The Free plan ends in December 2026, and remaining credits carry over to the Paid plan (Decision-AWS-Account-Plan), so this still applies after the upgrade.
  • Data lags by hours. "AWS Budgets information is updated up to three times a day. Updates typically occur between 8 to 12 hours after the previous update" (Budgets console help). Spend can run for most of a day before any threshold sees it.
  • An ACTUAL alert fires once per budget per period (Budgets best practices). If the hard stop trips and someone recovers mid-month, the same budget cannot fire again until next month. A mid-month recovery leaves no hard stop.

Cost-allocation tags lag too. A new user-defined key appears on the Billing page only after a resource carries it, which takes up to 24 hours, and activation takes up to 24 more (AWS re:Post).

Spec 003 plans an in-path breaker for all three. The runtime adds each turn's estimated cost to a monthly tally in a control table, and refuses a turn once the tally reaches a trip limit of $10 minus the projected fixed monthly cost. That is a plan, not code. See Source-Spec-003.

Planned: the ceiling moves to $20 (not yet in force)

On 2026-11-02 the builder decided to raise the monthly ceiling from $10 to $20, because nobody knows yet whether an AI agent can run for $10. Spec 003 recorded the decision in its 2026-11-02 clarifications. It takes effect only when constitution amendment A5 merges (task T153). Until then P2 and gate 1 as written ($10, $5/$8, an $8 gate) govern, and no threshold above $10 may go into code or infrastructure.

Control Today (constitution v1.5.0) After A5
Ceiling $10 hard cap $20 hard cap; hard stop at 100%, a rule not a target
Owner emails $5 and $8 $10 and $16 (50% and 80%)
Soft-degrade $8 − F $16 − F
In-path breaker trip $10 − F $20 − F
Gate 1 mitigation threshold $8 $16

F is the projected fixed monthly cost, still unsized (spec 003 T005a, T138). The gate-1 projection for conversation lines alone, before F, is $9.56 for the average case and $16.52 for the full case, so the average case passes the new gate and the full case still needs a mitigation plan (Decision-LLM-Model-Selection).

$20 is provisional. After the measured month (SC-019) the gross spend is recorded, and if it fits under $10 the builder proposes lowering P2 back by amendment (T156). There is no mandatory voice cut, but the unused viseme call (#47) must be settled before the first deployment (T154).

AWS's own spend limit (new accounts only, minimum $20, pauses the project at the cap) is not being adopted: see Source-AWS-New-Account-Experience and Decision-AWS-Account-Plan.

The voice path is free, but on a timer

Polly Neural is $16.00 per 1M characters, and Speech Marks requests are billed at the same rate — so our dual audio-plus-viseme call bills every reply twice. One session of 50 maximum ~1,000-character replies is 100,000 billed characters, $1.60 before free tier; this says nothing about how many sessions occur in a month. R0's ~$0.011 per turn / $0.56 per 50-turn session and 16/53 sessions per month counted only one Polly call; the assumptions and corrected illustrative per-session arithmetic are on Decision-LLM-Model-Selection. Monthly cost is unresolved without a traffic assumption, free-tier eligibility/usage and other AWS costs.

The Neural tier covers 1M characters/month for the account's first 12 months only. If the account is eligible and has enough unused allowance, that example session would cost $0 for voice; neither condition was audited. This is exactly the case the rule above warns about — do not treat free-tier assumptions as permanent facts. Tracked as issue #47, which also asks whether the unused viseme call should be deferred. See Source-Amazon-Polly and Decision-Polly-Voice.

Any successor that bills continuously rather than per character would change the shape of this risk — but not necessarily its size. Source-Nova-Sonic now carries published rates and a worked comparison, and the speech-to-speech option came out slightly cheaper than Polly's double-billed dual call.

A model you never touched can get more expensive

Every risk above needs something to happen — more traffic, a new feature, a bigger prompt. This one does not.

Under the Bedrock lifecycle policy that governs all our models, a model moved to Legacy enters public extended access after about three months, and AWS's own wording is that you "should expect higher pricing, which will be set by the model provider." No code change, no traffic growth and no new resource is required to trigger it.

So the review question "what could push us over $10?" has an answer that is not in our control, and the clock that matters after a Legacy announcement is three months, not the six months to removal. Claude Haiku 4.5 is currently Active, so nothing is pending — but this is the cheapest possible thing to monitor and the most annoying to discover late. Full story on Source-Bedrock-Model-Lifecycle.

A related wrinkle when reading a bill rather than forecasting one: Claude is billed through AWS Marketplace, so it appears in Cost Explorer under the model provider rather than under Amazon Bedrock. The account-wide budget still counts it, provided the budget measures gross of credits (see above), but a spend investigation filtered on "Bedrock" will silently omit the largest AI line item. Amazon's own Nova models do not have this split — see Source-Amazon-Nova-Lite.

One leak that used to sit here is now closed: the runtime cancels the invocation when a guest disconnects, so an abandoned turn no longer bills to completion. See Component-Agent-Runtime.

See also: Source-Constitution, Concept-Observability, Source-AgentCore-Pricing, Source-Amazon-Polly.

Clone this wiki locally