Cost optimization is an AI agent skill from the GitHub repository aws-samples/sample-agent-greenhouse. Analyze and optimize costs for AI agent workloads on AWS — model selection, caching, memory pricing, scaling strategies. Use when the user asks about costs, pricing, or optimization.
Lazy skill loading: only load full SKILL.md when needed (not in system prompt)
Memory compaction: CompactionHook to summarize long conversations
Session pooling: reuse agent instances across invocations
Tiered model routing: use cheap model for triage, expensive for complex tasks
Caching: cache tool results (e.g., API calls) to avoid redundant work
Memory Cost Control
STM events: minimize event size (don't store large payloads)
LTM strategies: 4 strategies × extraction cost per event
Retrieval: semantic search has per-query cost
Tip: use explicit save_memory for important facts only, don't over-index
Monitoring Costs
CloudWatch metrics for invocation count, duration, token usage
Set billing alarms for unexpected spikes
Track per-user usage for chargeback models
Use this skill with your AI agent:Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.