yr.workspace

The active app's conversation history and programmatic state.

Each app has one workspace shared by its nested model contexts. Values stored in the variable store are available to the app's Python code but are not automatically shown to the LLM. Sub-apps receive separate workspaces by default.

The variable store intentionally implements only part of the mapping protocol. It supports subscript reads and writes, get(), set(), and membership checks. It does not support iteration, length, deletion, or keys().

Use get_messages() to inspect a copy of the conversation history. Changing the returned list does not alter the active conversation.

Examples

Store state, use a default, test membership, and inspect messages:

python
import yera as yr

yr.workspace["traveller_name"] = "Alice"

visits = yr.workspace.get("museum_visits", 0)
if "traveller_name" in yr.workspace:
    name = yr.workspace["traveller_name"]

messages = yr.workspace.get_messages()