
02 - Get started
Explore documentation · Previous: 01 - Discover · Next: 03 - Understand
Choose the base SDK to learn selective recomputation. Add a framework when integrating an existing agent application; add native providers or persistence only for their specific execution or recovery requirements. No separate database service is needed.
The base Python distribution is context-coherence and its import namespace is co2. Install a wheel matching standard GIL-enabled CPython 3.11–3.14, operating system and architecture; consult the configuration matrix.
Install from PyPI
Co2 v0.1.0 is available on PyPI.
python -m venv .venv
. .venv/bin/activate
python -m pip install context-coherence
Pin a release when you need a fixed application environment:
python -m pip install 'context-coherence==0.1.0'
python -c "import co2; print(co2.Coherence)"
Compatible wheels require no Rust compiler. The base installation has no mandatory Python runtime dependencies and includes neither SQLite persistence, native runtime providers nor agent frameworks. The standalone example runs without a repository checkout.
Run example
From a source checkout, after installing the SDK:
python examples/quickstart.py
Expected counters are eligibility 2, credit 1, recommendation 2, with credit reuse and a late-result rejection. The guided quickstart explains the workflow. It needs no model credentials or optional packages.
For an editable development installation:
python -m pip install maturin==1.10.2
maturin develop --locked
Source builds need Rust/Cargo 1.95+, a working native C toolchain and Python development headers/libraries. First-time compilation needs the pinned Cargo crates and build backend and can take several minutes.
Build Base Memory Mode
Use standard GIL-enabled CPython 3.11–3.14, Rust/Cargo 1.95 or later and a native C toolchain. The qualified compiler is Rust 1.95.0. From a reviewed source checkout or extracted source distribution:
python -m pip install maturin==1.10.2
python tools/build_release.py --variant base --out wheels/base
Install the single matching file printed by the builder into a separate environment:
python -m venv sdk-env
sdk-env/bin/python -m pip install /path/to/the/matching.whl
sdk-env/bin/python tools/verify_installation.py --variant base --wheel /path/to/the/matching.whl
sdk-env/bin/python examples/quickstart.py
The verifier rejects an editable source import. Base mode needs neither SQLite, Wasmtime nor an agent framework. The library does not start a service or execute plans.
Choose Native Features
All variants own the same co2 module through one distribution, context-coherence. Install one variant per environment. Feature wheels use distinct private local versions; only base wheels and the source distribution belong on the public package index.
| Builder variant | Native features | Candidate version | Additional runtime |
|---|---|---|---|
base | None | 0.1.0 | None |
persistence | persistence | 0.1.0+native.persistence | Supported storage; CPython 3.14 |
expression | expression-provider | 0.1.0+native.expression | None |
wasmtime | wasmtime-provider | 0.1.0+native.wasmtime | Wasmtime Python 51.0.0 |
reference | reference-providers | 0.1.0+native.reference | Wasmtime Python 51.0.0 |
persistence-expression | Persistence and expression | 0.1.0+native.persistence.expression | Supported storage; CPython 3.14 |
persistence-wasmtime | Persistence and Wasmtime | 0.1.0+native.persistence.wasmtime | Supported storage; CPython 3.14; Wasmtime 51.0.0 |
persistence-reference | Persistence and both providers | 0.1.0+native.persistence.reference | Supported storage; CPython 3.14; Wasmtime 51.0.0 |
For example:
python tools/build_release.py --variant persistence --out wheels/persistence
python tools/build_release.py --variant reference --out wheels/reference
Install the Wasmtime runtime explicitly, or request the wasmtime-reference extra on the matching local wheel. Python extras install Python dependencies; they cannot enable native features absent from that wheel. co2.persistence_available() reports the compiled persistence flag. co2.runtime.available_provider_implementations() reports compiled factories; installation/execution checks the actual runtime separately.
The builder rejects raw feature overrides that could produce indistinguishable wheels. maturin develop --features ... remains a local development option; its editable installation is not a distributable release candidate. Use the reviewed builder when sharing artifacts.
Pin Feature Builds & Upgrade
PEP 440 local versions distinguish private source rebuilds. They are not separate overlapping distributions and must not be uploaded as upstream public-index releases. See the packaging specification.
Pin the complete local version, such as context-coherence==0.1.0+native.persistence, and retain its exact wheel/hash. An unqualified upgrade can select a future base build; it does not preserve custom native features. Keep variant artifacts separate, install an explicit matching file, and run the verifier with the intended variant after every upgrade. Do not put competing feature builds in a shared index and rely on their lexical ordering.
Stop application processes and close authorities before replacing a native extension. Rebuild the same variant for the new source version, install into a clean environment, restart and reconcile durable sources/providers. Never hot-reload different native implementations into one process. Existing stored schema/record/identity codecs and provider SPI remain unchanged; recovery still fences unfinished attempts and does not restore live provider trust or framework sessions.
Add Framework Dependencies
After verifying the native SDK, install the existing optional extra for LangGraph, OpenAI Agents, Google ADK or Claude Agents using the chosen wheel/version. Follow the corresponding Build tutorials. For example:
python -m pip install 'context-coherence[langgraph]==0.1.0'
python -m pip install 'context-coherence[openai-agents]==0.1.0'
python -m pip install 'context-coherence[google-adk]==0.1.0'
python -m pip install 'context-coherence[claude-agents]==0.1.0'
For local development, maturin develop --locked --extras langgraph installs the LangGraph extra.
For a reviewed wheel, use python -m pip install "/path/to/the/matching.whl[langgraph]", substituting the actual filename; use the corresponding openai-agents, google-adk or claude-agents extra when needed. Keep the full native variant identity when selecting a file. Ordinary tests and synthetic examples need no model API credentials.
CLI requirements, bounded execution settings and optional live calls remain integration-specific.
See durable storage requirements, provider enrollment, public contracts and distribution review.
Native Linux x86_64 wheels are qualified on the recorded Debian 12/glibc host for standard CPython 3.11–3.14 memory mode and 3.14 native variants. Durable x86_64 validation uses dedicated EBS-backed ext4 with supported temporary paths. This is a process-recovery qualification; neither the wheel nor a successful filesystem check certifies physical storage or power-loss behavior.
Resolve installation problems
| Symptom | Check |
|---|---|
maturin develop requires an environment | Activate a virtual environment; use the interpreter that will run the example. |
| Rust/C compiler or Python headers are missing | Install the native source-build prerequisites, or obtain a reviewed compatible wheel. |
| No matching wheel / extension import fails | Match CPython minor, platform, architecture and native variant; do not substitute an abi3, PyPy or free-threaded build. |
PersistenceUnavailableError or no provider factory | Inspect persistence_available() and available_provider_implementations(); install a wheel compiled with the required feature. Extras cannot fix this. |
| An optional framework import fails | Install that integration's extra into the same environment. The base SDK deliberately omits it. |
| Durable creation rejects a path or filesystem | Follow ownership/storage requirements, including supported temp paths; do not disable checks. |
| Combined extras change shared packages | Resolve in a clean environment and run python -m pip check; review ADK constraints. |
For Rust-only use, run cargo run --locked --example selective_plan from the repository root. See Rust API and build features. For next steps choose 03 - Understand or 04 - Build.

