aws-samples / aws-samples/sample-autonomous-cloud-coding-agents

feat(agent): adaptive / complexity-aware model router

Open
#439 1 comment 0 reactions 0 assignees View on GitHub
agent-runtime cost-finops enhancement
Dominant language
TypeScript
Stars
143
Forks
46
Avg merge
3d 9h
Merged PRs (30d)
20

Description

**Context:** ROADMAP.md → Adaptive model router + Complexity-aware model router (Cost governance)

---

## Component

Agent (Python runtime)

## Describe the feature

**Per-turn model selection** by task complexity: cheaper models for reads/simple edits, stronger models for complex reasoning—while honoring `max_budget_usd` and Cedar policy. Target ~30–40% cost reduction.

## Use case

Using Opus-class models for every turn is expensive. Many turns are file reads or trivial edits that a smaller model handles well.

## Proposed solution

1. Router heuristic or lightweight classifier (turn type, diff size, tool invoked).
2. Blueprint: allowed model set + routing policy.
3. Fallback to strong model on failure or low confidence.
4. Emit per-turn model choice in telemetry for cost attribution (#215).
5. A/B measure cost vs merge rate in evaluation pipeline.

## Other information

- Single issue covers both roadmap entries (compute + cost governance).
- Design context: `docs/design/COST_MODEL.md`, `agent/src/runner.py`.

- [ ] This might be a breaking change

Contributor guide

Open the contributing guide

Research direction

Start with docs/design/COST_MODEL.md, then inspect agent/src/runner.py to understand the current per-turn model flow. Define how complexity, allowed models, max_budget_usd, Cedar policy, fallback behavior, telemetry, and evaluation fit together. Done means the router is measured for cost and merge-rate impact without violating policy or budget.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.