OpenAI Context Demo¶
If you want to understand each argument step by step, start here first:
Start with the minimal script:
python3.13 -m venv .venv-user
source .venv-user/bin/activate
python -m pip install --upgrade pip
python -m pip install -e packages/context_core -e packages/provider_openai -e packages/sdk
python examples/openai_context_demo/embedding_example.py
What it shows:
- a real
messages = [...]transcript with inline tool call/result events StatePlaneSession(...)session.transform(...)- candidate ids before compilation
- selected and excluded ids after compilation
- the exact OpenAI call shape
The example also includes retrieved_context=[...] so you can see how retrieved snippets are
kept separate from the transcript before StatePlane renders the final OpenAI payload.
The key line is:
That is the product boundary. Your app still calls OpenAI. StatePlane decides what belongs in that call first.
If you want the same flow in a notebook, open:
examples/notebooks/openai_context_demo.ipynb
That notebook is now the interactive companion to the parameter tutorial.
If you want the heavier comparison harness, use:
examples/openai_context_demo/comparison_example.py
That advanced example is for deeper inspection. It is not the default onboarding path.