Skip to main content
Runtime state mirroring lets sessions remember lightweight per-turn execution artefacts (tool call IDs, transcript slices) so the native runtime and plugin harnesses can hand off, replay, or debug each other’s turns.
The user hands off between native and plugin runtimes; mirrored state preserves tool IDs and transcript slices each turn.

Quick Start

1

Enable mirroring

2

Read what was mirrored

How It Works

Configuration

Set on SessionConfig — typically via GatewayConfig(session_config=...).

Store API

On-disk shape

Shape: {runtime_id: {turn_id: state}}.

Common patterns

Best Practices

Aim for ≤1 KB per turn and ≤10 KB per runtime. Store IDs and transcript slices — not full tool outputs or full conversation history.
Remove API keys, credentials, and PII before calling set_runtime_state.
Leave mirror_runtime_state=False unless something reads the data — mirroring is off by default to avoid session file bloat.
Use clear_runtime_state(session_id, runtime_id="...") instead of letting unbounded turn maps grow.
Older session files without runtime_state load as {}. A JSON null value is also coerced to {}.

Gateway

Configure SessionConfig on the gateway

Persistence overview

Session storage and resume