Community编程与开发github.com

AgentCore 成本估算技能

通过使用配置文件逐行计算 Amazon Bedrock AgentCore 的月度费用,并为其设置预算和使用告警。对标 AgentCore 官方费率卡定价,并明确列出未计费的服务。

AgentCore 成本估算技能 是什么?

这是一个专门为开发者与 AI 代理(如 Claude Code)设计的技能,能够根据用户提供的使用配置文件,精确估算 Amazon Bedrock AgentCore 服务的月度费用。它会逐行列出 AgentCore 费率卡涵盖的每个计费维度(包括 Gateway 调用、搜索与工具索引、身份令牌请求、Runtime vCPU 小时与 GB 小时、Memory 短期与长期记录等),并显示每行计算公式,从而让用户清楚费用的构成。此外,技能能够以 Terraform 形式生成 AWS Budget 和 CloudWatch 告警(Gateway 调用超限告警),支持在写入前进行 dry-run 预览。同时,它会主动标明未纳入估算的服务(如 Lambda、API Gateway、CloudWatch、X-Ray、DynamoDB),避免用户误将总计当作完整账单。该技能参考了最新的 AgentCore 官方费率卡,并提供价格检查日期,输出以 `CST0xx` 为标识的诊断信息。使用流程包括:构建用户配置文件、运行估算脚本、生成预算告警模块、并通过 review 工具验证。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/alexaiarchitect/agentcore-skills/tree/HEAD/skills/agentcore-cost

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

AgentCore 的费用是多少?

AgentCore 对每个服务按自身维度计费,而一个以 Gateway 为前端的 Lambda 最常使用的服务(Lambda、API Gateway、CloudWatch、X-Ray)根本不属于 AgentCore。因此一个诚实的估算应精确计算 AgentCore 费率卡所覆盖的内容,展示其计算过程,并列出未包含的项目。

${CLAUDE_SKILL_DIR} 由技能运行时自动设为此技能自身的目录。请在下文每条命令中直接使用它;同级技能的脚本位于 ${CLAUDE_SKILL_DIR}/../<skill>/scripts/。

流程

  1. 与用户一起构建配置文件。从示例开始,询问驱动成本的关键数据:每日请求数、每次请求的工具调用次数、Runtime 会话及其时长、Memory 事件和记录。字段见:usage-profile.md。

    cp ${CLAUDE_SKILL_DIR}/assets/profile.example.json ./agentcore-profile.json
    

    写入配置文件属于文件写入操作:需先获得用户确认。

  2. 估算。

    python3 ${CLAUDE_SKILL_DIR}/scripts/cost_estimate.py agentcore-profile.json
    

    使用 --as-of 2026-10-06 应用新的 Memory 费率卡;使用 --json 输出逐行数据。

  3. 报告总费用为“仅 AgentCore 行项目”,并按服务拆分,注明最大的行及其计算公式,以及未定价的列表。引用定价来源及其核查日期;所有数字均为列表价估算。

  4. 选项:预算和告警模块(免费生成);针对最大行的更廉价设计方案(例如不启用语义搜索、减少存储策略等);或不做任何操作。使用 AskUserQuestion 确认,然后:

    python3 ${CLAUDE_SKILL_DIR}/scripts/gen_budget.py <project> --monthly-usd 20 --email [email protected] --profile agentcore-profile.json --dry-run
    
  5. 验证:在写入项目后,使用 review.py 进行审查。

CST0xx 编号区域

编号严重级别触发条件
CST001warn配置文件的区域不支持 Gateway
CST002info未计费项(始终列出)
CST003infoMemory 按 2026-10-05 截止的每事件卡定价
CST004warn费率卡比 --as-of 日期早 90 天以上
CST005info页面发布的是单一费率卡,而非分区域价格
CST010info项目已存在预算

决策规则

  • 切勿将总计称为“账单”。 这只是 AgentCore 行项目的列表价合计。
  • 模型令牌使用用户提供的数据。 Bedrock 模型价格因模型和区域而异;配置文件中提供这些数据,否则就排除在外。
  • 通过 Runtime 或 Gateway 的身份验证免费;除此以外,每 1,000 次请求收费 $0.010。
  • 对于失控情况,告警优于预算。 预算存在数小时的延迟;而调用告警在一小时内即可触发。

参考

问题文件
每个定价维度及其费率与日期pricing-dimensions.md
配置文件格式,逐字段说明usage-profile.md
预算与告警模块budget-alarms.md

脚本

命令功能退出码
scripts/cost_estimate.py <profile.json> [--as-of DATE] [--json]逐行估算0 估算成功,2 配置文件错误
scripts/gen_budget.py <project> --monthly-usd N [--email E] [--profile P] [--dry-run] [--force] [--json]预算 + 调用告警模块0 已规划/已写入,1 无操作,2 参数错误

完成检查清单

  • 配置文件的数字来源于用户,并在确认后写入文件。
  • 估算结果作为“仅 AgentCore 行项目”报告,并附有未定价列表。
  • 已引用定价来源及核查日期;已应用 Memory 费率卡的日期。
  • 任何预算模块均以写入计划形式展示,并在写入前获得确认。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

alexaiarchitect/agentcore-skills

>- Put Amazon Bedrock AgentCore infrastructure behind a plan-only CI gate. Generates a GitHub Actions workflow that, on pull requests touching the infrastructure, runs the static AgentCore review (`ACR0xx`), `terraform fmt -check`, `init`, `validate`, a saved `plan` (Terraform or Terragrunt) with a read-only OIDC role, `show -json`, and the plan policy (`CI0xx`: no delete or replace of memories, gateways, credential providers, workload identities, user pools or tables without an explicit per-address allowance; no `*` on `*`; no gateway with `authorizer_type = NONE`; pinned MCP revisions), then uploads the plan JSON. Nothing in it applies. The plugin's stdlib-only library is vendored into `ci/agentcore/` so the job needs nothing from the plugin, and action pins are reused from the repository's own SHA-pinned workflows. `policy_check.py` also runs locally on any saved plan. Use when asked to "add CI for the AgentCore Terraform", "gate the plan", "block destructive changes", "policy check the plan", "plan on ...

alexaiarchitect/agentcore-skills

>- Scaffold Amazon Bedrock AgentCore resources as infrastructure as code: a Runtime (ECR repository, service role, `aws_bedrockagentcore_agent_runtime` with a JWT authorizer and lifecycle settings), a Gateway (role, JWT authorizer, pinned MCP revisions, one target), Identity (Cognito M2M client plus an OAuth2 credential provider with write-only secrets) or Memory (memory, strategies, customer-managed key). Terraform modules are the default and the recommendation; a TypeScript CDK stack with the `aws-bedrockagentcore` L1 constructs and the AgentCore CLI (`@aws/agentcore`) commands are offered for teams already on them. Every write is shown as a plan first (`--dry-run`), existing files are never overwritten without `--force`, and nothing is planned or applied. Use when asked to "create an AgentCore runtime", "scaffold a gateway", "add AgentCore memory", "write the Terraform for AgentCore", "start a new AgentCore stack", or "give me the CDK for this". Don't use for a gateway in front of an existing Lambda, HT...

alexaiarchitect/agentcore-skills

>- Plan the deployment of Amazon Bedrock AgentCore infrastructure and its rollback, and hand the user the exact commands — never running them. Finds the root module (or Terragrunt stack) that actually reaches the AgentCore resources, orders what comes up (identity and roles, then gateway, runtime and memory, then targets and strategies, then log delivery), flags where a first apply trips (IAM propagation, creation-only semantic search, Transaction Search before TRACES delivery, an old provider lock, no remote backend), checks published quotas (targets per gateway, tools per target), and emits init / validate / plan-to-file / show -json / policy check / apply of that saved plan, the post-apply checks, and the rollback for each kind of change. Findings are the `DPL0xx` band; the cost tier is `aws` because the commands create billable resources. Use when asked to "deploy the gateway", "apply this", "what order do I apply in", "how do I roll back", "will this hit a quota", "give me the terraform commands". Don...

alexaiarchitect/agentcore-skills

>- Inventory a project for Amazon Bedrock AgentCore work and report before advising. Finds existing AgentCore resources and which tool owns them (Terraform `aws_bedrockagentcore_*`/`awscc_*`, CDK constructs, the AgentCore CLI's `agentcore.json`, the deprecated starter toolkit's `.bedrock_agentcore.yaml`, boto3 `bedrock-agentcore` clients, the AgentCore Python SDK and `@requires_access_token`), the agent framework (Strands, LangGraph, LangChain, Claude Agent SDK, CrewAI, OpenAI Agents, ADK, raw), MCP servers and the API Gateway routes and Lambdas behind `/mcp`, Cognito pools, clients and JWT authorizers, the AWS region and per-service availability there, the hashicorp/aws constraint and lock, Terragrunt, and Lambda tracing. Read-only; findings are the `DSC0xx` band. Use when asked "what do I have", "is this on AgentCore", "inventory this repo", "which region are we in", "is AgentCore available in eu-central-1", "what framework is this agent", or before any other AgentCore skill on an unfamiliar project. Don...

相关技能