max_total_tokens: count the conversation's growth, not every resent prompt (low priority)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- ai-infra-agents
Research direction
Start in the ExecutionTracker module, add the new record_turn_usage(prompt, output) method alongside the existing record_turn(tokens) method, and update the token counting logic to track the largest prompt seen so far plus total model-generated output instead of summing all prompt resend parts per turn. Run the execution tracker's test suite to verify the new behavior is linear, monotonic, and avoids double-counting outputs.
Written by the indexing model from the issue text.
Description
Follow-up to #226, which was resolved by documenting the current behaviour.
Today: each turn adds its whole prompt (input + cache_read + cache_write) plus its output to ExecutionTracker::tokens_used. The prompt resends the conversation, so the total grows with turns × context. The 1M default is reached around turn 16 at a 60K-token context, whether or not the prompt is cached. As a ceiling on work done, that's coherent, and it's now documented. As a budget it surprises people: "1M tokens" sounds like far more than 16 turns.
Idea: count what the conversation actually accumulates:
tokens used = the largest prompt seen so far + everything the model has generated
- Provider-independent: cached and uncached runs count the same.
- Linear: it grows with the conversation, so a long session can use its
max_turns. - Monotonic: compaction doesn't lower it.
- Avoids a double count: a naive "new input + output per turn" would count each output twice, since an output reappears in the next prompt.
API: additive. Add an ExecutionTracker::record_turn_usage(prompt, output) and keep record_turn(tokens).
Behaviour change: runs hit the cap later, so anyone using it as a strict cost ceiling would spend more before it trips. It belongs in a minor release, or behind an option.
Priority: low. Nothing is broken, the behaviour is documented, and callers can raise the cap or set it to usize::MAX.
- Dominant language
- Rust
- Stars
- 327
- Forks
- 46
- Avg merge
- 2h 30m
- Merged PRs (30d)
- 143
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from yologdev/yoagent
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
yologdev/yoagent#223 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
yologdev/yoagent#198 · 1 comment ·
Maintainers usually reply within 1 day
-
P3
Difficulty 4/5 3-5 days Newbie friendliness 68/100
yologdev/yoagent#150 · 3 comments ·
Maintainers usually reply within 1 day
All issues in yologdev/yoagent
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 3 days
-
Zellij doesn't validate hex colors correctly and crashesPossibly taken @ymcx claimed this today. Opensuspected bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
zellij-org/zellij#5732 ·
Maintainers usually reply within 1 day
-
bug rust
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jonathanong/no-mistakes#2267 ·
Maintainers usually reply within 1 day
-
BASEPRI needs an ISBOpen
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
rust-embedded/cortex-m#702 · 1 comment ·
-
Make major, minor, and makedev safe on solarish targetsPossibly taken @xtqqczze claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day