setSessionMetadata
Merge metadata into a session, creating the entry if it does not exist.
Automatically triggers cleanup
when the metadata map exceeds 1000 entries.
Two call signatures are supported for Python SDK compatibility:
- Bulk merge (TS-native):
setSessionMetadata(sessionId, metadata)— merges every key in themetadataobject into the session, returningvoid. - Single key/value (Python-compatible):
setSessionMetadata(sessionId, key, value)— sets a single key, returningtruefor parity with Python.
Both forms merge into any existing metadata; they do not replace.
Parameters
sessionId
The session identifier.
metadataOrKey
A metadata record to merge into the session (bulk-merge form), or a single
string key (three-argument form).
value
The value to set when metadataOrKey is a string key. Only used by the
three-argument form.
Returns
void for the bulk-merge form; boolean (true) for the three-argument,
Python-compatible form.