Skip to content

Truncation of message histories and individual messages to prevent context window overflows #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

janspoerer
Copy link
Contributor

This PR aims to add max_context_length_per_message and max_context_length_total as parameters to the FastAgent configuration.

…cp_agent/llm/providers/augmented_llm_google_native.py, line 520, in _truncate_message_history if self.max_context_length_per_message is not None
@janspoerer
Copy link
Contributor Author

Work in progress: File /Users/janspoerer/code/agents/fast-agent/src/m…cp_agent/llm/providers/augmented_llm_google_native.py, line 520, in _truncate_message_history if self.max_context_length_per_message is not None

@janspoerer
Copy link
Contributor Author

Some help would be appreciated. I am stuck correctly passing the arguments down to the Google Provider.

Also, I would like to implement this for all providers, if possible. But we can also start with only one.

@evalstate
Copy link
Owner

Sorry, I missed this message yesterday. Can you take a look at release 0.2.34 as this is intended to make Usage, Context info. etc easy to work with auto-truncation etc. etc! hop on to discord if you want to chat.

@janspoerer
Copy link
Contributor Author

Thanks for pointing this out. Missed that feature around context management.

I'd very much like to chat and will ping you when I come online on Discord (maybe later today or sometime over the week).

@evalstate
Copy link
Owner

It was only finished a couple of hours ago :) If you're using Anthropic models, I'd appreciate if you could try running with the feat/anthropic-cache branch if possible.

@janspoerer janspoerer mentioned this pull request Jun 22, 2025
@janspoerer
Copy link
Contributor Author

Oh great, we had similar thoughts about useful next features :-)

I responded here: #247

I may be available on Discord this week, but cannot yet say when exactly. I have some travel this week (to an AI conference, of course :-) ).

Hope to talk to you soon!

@evalstate Looks great, I can't wait to try the new tracking feature.
If I see this correctly, the usage is mainly there for informational purposes.
Is there also a truncation step anywhere that truncates either individual very long messages or that removes entire messages?
Or is this something that we should discuss on Discord as a next step?
(Refers to our short exchange in PR #246.)

@janspoerer
Copy link
Contributor Author

If you're using Anthropic models, I'd appreciate if you could try running with the feat/anthropic-cache branch if possible.

Just to clarify: I should merge the feat/anthropic-cache branch into this one and see if this works?

@evalstate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants