bland-table-56977
10/06/2025, 2:45 PMthis.session.chatCtx.addMessage(...), a followup call to this.session.chatCtx.toJSON() does not include that item, also not later. This is very intransparent. Can someone help me please?early-fall-57331
10/06/2025, 3:39 PMthis.session.chatCtx returns a new copy every time you read/get that property (don't ask me why), so making any changes to it won't affect the agent/session at all.
This is how I ended up manually adding a message (not sure if works for multi-agent use case though):
// Same as session.chatCtx, but just being explicit
const chatCtx = session.currentAgent.chatCtx.copy();
chatCtx.addMessage(...);
// This is what makes the message be part of future LLM completions
await session.currentAgent.updateChatCtx(chatCtx);