agents
agents copied to clipboard
Agent states management improvements
The agent states is very useful, however there are a few improvements needed.
- Use
fast-json-patchto sync states instead of sending the entire state via websocket - Add selective state sync to the client-side, to avoid sharing sensitive state data
- Add a persist flag to store states into the SQL table, to avoid frequent data write operations when updating states
With the above improvements, I can essentially use the state to store the chat messages on the backend, and send over selective messages to the client-side, while achieving good performance.
I like this concept, but I recommend it use RFC-7396 JSON Merge Patch rather than RFC-6902 JSON Patch that fast-json-patch implements for several reasons:
- JSON Merge Patch is simplier
- More efficient with bandwidth
- Most importantly, SQLite has built-in support for it and DO's storage engine is built on it.
The system I'm building right now uses it so I did my research before choosing it.