Skip to main content
During a live interaction you typically query two indexes:
  • Long-term context - a persistent cloud index of durable knowledge and account facts (FAQs, policies, profile). You load it once at the start of the call with load_index().
  • Short-term context - a session holding the current conversation, which you build up with add_docs() as turns arrive.
Both run locally once loaded, so each turn can query the knowledge index and the session without a network round trip, then pass the combined results to the model.

A single agent turn

A caller turn reaches an agent, which updates a short-term session, queries recent context and long-term cloud knowledge, then respondsA caller turn reaches an agent, which updates a short-term session, queries recent context and long-term cloud knowledge, then responds

How it works

1

Load the long-term index

load_index("support-faqs") loads the persistent knowledge index into memory for querying.
2

Open a session for the call

client.session(call_id) returns a local SessionIndex. If an index with that name already exists in the cloud it is loaded; otherwise the session starts empty.
3

Index transcript turns

Call add_docs as turns arrive; documents are embedded and indexed locally.
4

Query both indexes per turn

Query the loaded knowledge index and the session, and pass both result sets to the model.
5

Persist the session

session.push_index() writes the session to the cloud so a later interaction can resume it.

Example

Two kinds of context

Data hydration and sync

At call start the long-term index and the session are loaded from the cloud (no re-embedding); during the call the long-term index can stay current with auto_refresh; and session.push_index() writes the session back. See Data hydration & sync for the load/refresh model and refresh-interval tuning.

Sessions

The session lifecycle and API.

Real-time local indexing

How local sessions work.