SuperAPI AI Directory

agentcore-pricing

Deployment & operations

View repository

Updated 10-15 17:22

About this skill

AgentCore Pricing

Critical Rules

  • NEVER use training data for prices. All prices must come from cached JSON files at runtime.
  • NEVER implement billing formulas manually. Always use calculate_agentcore_cost() and calculate_evaluation_cost().
  • Only include components explicitly requested. If user says "run in AC Runtime," add ONLY Runtime — do not auto-add Gateway, Memory, etc.
  • STM reads are free — only writes are billed.
  • vCPU is free during I/O wait — do not apply I/O wait discount to BrowserTool or CodeInterpreter.

Prerequisites

  • Cache file ~/bedrock_pricing_agentcore.json must exist
  • If missing or stale (>7 days), instruct user to refresh:
    # If USE_IN_KIRO or USE_IN_CLAUDE_CODE is set:
    python3 tco_bva_capacity_skills/skills/bedrock-pricing/scripts/bedrock_pricing.py --refresh
    # Otherwise (Quick):
    python3 ~/.quickwork/skills/bedrock-pricing/scripts/bedrock_pricing.py --refresh
    

Workflow

1. Load the Pricing Script

import sys, os
sys.argv = ['bedrock_pricing.py']

if os.environ.get("USE_IN_KIRO") or os.environ.get("USE_IN_CLAUDE_CODE"):
    script = "tco_bva_capacity_skills/skills/bedrock-pricing/scripts/bedrock_pricing.py"
else:
    script = os.path.expanduser("~/.quickwork/skills/bedrock-pricing/scripts/bedrock_pricing.py")

if not os.path.exists(script):
    raise RuntimeError(
        f"bedrock_pricing.py not found at: {script}\n"
        f"If using Kiro/Claude Code, set USE_IN_KIRO=1 or USE_IN_CLAUDE_CODE=1.\n"
        f"If using Quick, ensure the script is installed at the expected path."
    )

exec(open(script).read())

2. Look Up AgentCore Prices

home = os.path.expanduser("~")
ac_prices = query_agentcore_pricing(home, region_filter="us-east-1")
  • If user needs a combined estimate (model + infrastructure), also call query_model_pricing() for the model prices
  • If user does not specify a region, ask which region they want

3. Present Assumptions

Show all parameters and their values. Ask the user to confirm before calculating. Key parameters to surface:

  • Questions per month and per session
  • Tools invoked per question
  • vCPU count and memory allocation
  • I/O wait percentage
  • Which components are included (Runtime, Gateway, Memory, BrowserTool, CodeInterpreter, Evaluations)

4. Calculate AgentCore Cost

result = calculate_agentcore_cost(
    runtime_vcpu_price_hr=0.0895,    # from cache
    runtime_mem_price_hr=0.00945,    # from cache
    gateway_invocation_price=5e-6,   # from cache
    gateway_search_price=2.5e-5,     # from cache
    gateway_indexing_price=0.0002,   # from cache
    stm_event_price=0.00025,         # from cache
    ltm_storage_price=0.00075,       # from cache
    ltm_retrieval_price=0.0005,      # from cache
    # Optional: BrowserTool (None = not included)
    browser_vcpu_price_hr=None,
    browser_mem_price_hr=None,
    # Optional: CodeInterpreter (None = not included)
    ci_vcpu_price_hr=None,
    ci_mem_price_hr=None,
    # Workload
    questions_per_month=1_000_000,
    questions_per_session=5,
    tools_invoked=5,
    tools_indexed=50,
    # Runtime
    num_vcpus=2,
    peak_memory_gb=4,
    io_wait_pct=0.70,
    idle_time_between_questions_s=30,
)
# Returns: runtime, gateway, memory, browser, code_interpreter, total_monthly, total_annual

5. Calculate Evaluations (if requested)

eval_result = calculate_evaluation_cost(
    questions_per_month=1_000_000,
    sessions_per_month=200_000,
    sampling_rate=0.10,
    num_builtin_evaluators=3,
    builtin_input_price=2.40,    # from cache
    builtin_output_price=12.00,  # from cache
)

6. For Combined Estimates (Model + Infrastructure)

  • Load bedrock-pricing to get model inference costs via calculate_agent_cost_with_incremental_caching()
  • Sum model cost + AgentCore cost for the grand total
  • Present per-component breakdown showing where spend goes

7. Present Results

  1. Show per-component breakdown as a markdown table (Runtime, Gateway, Memory, etc.)
  2. Show monthly and annual totals
  3. Highlight the I/O wait benefit: "vCPU is free during I/O wait — {io_wait_pct}% of runtime is idle"
  4. Offer: "Want to see the step-by-step breakdown?"
  • If user asks, read result["explanation"] (already computed) and format as markdown

Multi-Agent Architecture

When user describes parent + sub-agents, calculate model inference for each agent separately:

Agent Default Config
Parent (router) All questions, no tools, cheap model (Nova Lite), 1 turn/Q
Sub-agents Their fraction of questions, own model/tools/caching profile
Shared Runtime Scale vCPU/memory proportionally (e.g., 3 agents × 2 vCPU = 6 vCPU)

Present each agent's cost individually, then sum for the architecture total.

Defaults

Parameter Default Notes
Questions/session 5 Ask user if not specified
Tools invoked/question 5 Ask user if not specified
Tools indexed 50 Flat monthly fee
vCPUs 2 Default microVM
Peak memory 4 GB Default microVM
I/O wait % 70% vCPU is FREE during I/O wait
Idle time between Qs 30 sec User think time
STM events/question 2 Question + response
LTM records/session 3 Built-in extraction
LTM retrievals/question 1 Context lookup
Eval sampling rate 10% Main cost lever
Eval built-in evaluators 3 Helpfulness, Correctness, Safety

Cache Key Reference

Component Cache Key Pattern
Runtime vCPU Runtime:Consumption-based:vCPU → per vCPU-Hour
Runtime Memory Runtime:Consumption-based:Memory → per GB-Hour
Gateway Invocations Gateway:Consumption-based:API-Invocations
Gateway Search Gateway:Consumption-based:Search-API
Gateway Indexing Gateway:Consumption-based:Tool-Indexing
STM Memory:Consumption-based:Short-Term-Memory
LTM Storage Memory:Consumption-based:Long-Term-Memory-Storage:Built-in-memory
LTM Retrieval Memory:Consumption-based:Long-Term-Memory-Retrieval
BrowserTool vCPU BrowserTool:Consumption-based:vCPU
BrowserTool Memory BrowserTool:Consumption-based:Memory
CodeInterpreter vCPU CodeInterpreter:Consumption-based:vCPU
CodeInterpreter Memory CodeInterpreter:Consumption-based:Memory
Evaluations Built-in Input Evaluations:Consumption-based:BuiltIn-Input:Tier1
Evaluations Built-in Output Evaluations:Consumption-based:BuiltIn-Output:Tier1
Evaluations Custom Evaluations:Consumption-based:CustomEvaluators:Tier1

Explanation Rendering

result["explanation"] contains these sections:

Section What it shows
session_profile Session duration and active time
runtime vCPU + memory cost breakdown
gateway Invocations, search, indexing costs
memory STM + LTM costs
grand_total Sum of all components
cost_composition Percentage breakdown by component

Rules for rendering:

  • Default: show summary table only, offer breakdown on demand
  • Always use markdown — never HTML artifacts or <details> tags
  • Never re-compute — the explanation dict is already in memory

Related Skills

Skill When to load
bedrock-pricing Need model inference prices for combined estimates
bedrock-capacity User asks about RPM/TPM limits or provisioned throughput
agent-business-value User wants ROI, productivity gains, or FTE equivalents