addDocs. The pattern is: store documents, query per turn, write new context back.
Two kinds of context live in the same index and surface through the same semantic query:
- Working context - unstructured insights drawn from conversations: preferences, tone, recurring topics, and decisions. Updated after each interaction.
- Durable context - stable facts about the user: profile, account tier, identifiers, long-standing preferences. Changes rarely.
Capture and recall loop
On each turn the agent queries the index for the most relevant context, grounds its response in it, then writes new context back withaddDocs. Subsequent turns query the
updated index.
Example (JavaScript)
Related
Live-call context
Short-term + long-term context during a call.
Cross-agent handoff
Carry context across agents and channels.