Call agent with custom chat history #99
-
Hi, I'm building a Telegram bot using FastAgent and I need some guidance on implementing persistent chat history. I'd like to seed the agent with previous conversation history before sending new message Any recommendations on the best way to handle persistent conversation history in this context? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The simplest way is to use a prompt file. You can seralize/deserialize in either an easy-to-edit text format or MPC JSON Prompt format. You can also serve them via the It's pretty straightforward to save those in a document db too. The nice thing about this approach is when the file/document gets to a certain size it's easy to trim the first few messages, or have another agent condense it. |
Beta Was this translation helpful? Give feedback.
The simplest way is to use a prompt file.
You can seralize/deserialize in either an easy-to-edit text format or MPC JSON Prompt format. You can also serve them via the
prompt-server
(another example here).It's pretty straightforward to save those in a document db too.
The nice thing about this approach is when the file/document gets to a certain size it's easy to trim the first few messages, or have another agent condense it.