Documentation / Getting started

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 variantNative featuresCandidate versionAdditional runtime
baseNone0.1.0None
persistencepersistence0.1.0+native.persistenceSupported storage; CPython 3.14
expressionexpression-provider0.1.0+native.expressionNone
wasmtimewasmtime-provider0.1.0+native.wasmtimeWasmtime Python 51.0.0
referencereference-providers0.1.0+native.referenceWasmtime Python 51.0.0
persistence-expressionPersistence and expression0.1.0+native.persistence.expressionSupported storage; CPython 3.14
persistence-wasmtimePersistence and Wasmtime0.1.0+native.persistence.wasmtimeSupported storage; CPython 3.14; Wasmtime 51.0.0
persistence-referencePersistence and both providers0.1.0+native.persistence.referenceSupported 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

SymptomCheck
maturin develop requires an environmentActivate a virtual environment; use the interpreter that will run the example.
Rust/C compiler or Python headers are missingInstall the native source-build prerequisites, or obtain a reviewed compatible wheel.
No matching wheel / extension import failsMatch CPython minor, platform, architecture and native variant; do not substitute an abi3, PyPy or free-threaded build.
PersistenceUnavailableError or no provider factoryInspect persistence_available() and available_provider_implementations(); install a wheel compiled with the required feature. Extras cannot fix this.
An optional framework import failsInstall that integration's extra into the same environment. The base SDK deliberately omits it.
Durable creation rejects a path or filesystemFollow ownership/storage requirements, including supported temp paths; do not disable checks.
Combined extras change shared packagesResolve 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.