-H "X-API-Key: $YUKTA_API_KEY" if your server has keys.
Steps
1
Wire load, model, append
A chat turn is a
SESSION_MEMORY node in load mode, the model, and a SESSION_MEMORY node in append mode. Save as session.json (this one uses a local Ollama through its OpenAI-compatible endpoint):session.json
loadaddshistory: [{role, content}]to the payload, the newestmaxTurnsturns (default 20).appendrecords the user turn and the model’s reply (default${payload.content}); itssessionIddefaults to${metadata.sessionId}.messagesis an expression on purpose: a${...}reference would turn the list into text.- With Ollama, set
YUKTA_SECRET_LLM_API_KEYto any non-empty value, or dropapiKey.
2
Send two turns with the same conversation id
payload.sessionId here (user-42). It is not the Yukta session chat. Each conversation id has its own history.3
Forget a conversation
Use
mode: delete with the conversation id to remove its history, for example from a separate workflow wired to a “new chat” button:Verify it worked
Read the result of the second run:payload.content answers along the lines of “Your name is Ada”. If it does not know, the first run did not finish before the second started, or you used a different payload.sessionId.
Variations
- Memory is per server process. It lives in memory and a restart clears it. Plan for that if conversations must outlive a restart.
- Trim long chats. Lower
maxTurnson both memory nodes to bound the prompt size and the token cost: Set token budgets. - Several agents. Give each agent its own conversation id (or a prefix) so they do not share history.
Related
- AI plugins reference for
SESSION_MEMORYoptions. - Example 09.