Open source · Context coherence engine

Context changes.
Coherence holds.

Keep concurrent AI agents consistent as their context evolves. Track dependencies, reject stale results and selectively recompute affected work.

›python -m pip install context-coherence

v0.1.0 on PyPI · Rust powered · Python native · Framework agnostic

Co2 / context in motion
Revision01
Valid4/4
Pending0
Rejected0
Valid Stale Executing Blocked
Event stream

→ All artifacts are coherent

Illustrative lending scenario / simulated execution
3.

Dependency strategies

4.

Framework adapters

Rust.

Incremental computation core

Python.

Native developer SDK

01 / Context coherence

Context changes while
agents are still thinking.

Explore the architecture

Agents work with shared and evolving information. A change to an input should not invalidate everything, and an outdated result should not silently become the current one.

Dependency awareness

Capture the relationship between context versions, executions and their resulting artifacts.

Explore dependencies

Late-result protection

Validate the complete captured context before publishing results. Reject work that arrives after its inputs change.

See validation

Selective recomputation

Preserve valid outputs and identify affected work. The host executes only what policy permits.

Explore planning

Transitive invalidation

Propagate invalidation through dependent artifacts and identify downstream work that is no longer coherent.

See the architecture

02 / How it works

Your agents execute.
Co2 tracks what remains valid.

A coherence layer alongside your existing agent runtime, with execution ownership staying in your application.

01 / Capture

Understand dependencies.

Record versioned context and invocation-level or structured dependencies. Conservatively account for runtime-observed context.

02 / Validate

Detect what has changed.

Identify stale artifacts, propagate invalidation and validate arriving results against the captured context.

03 / Plan

Decide what happens next.

Derive dispositions such as reuse, recompute, block or revalidate. The host chooses and executes eligible work.

Host Agent FrameworkExecution · orchestration
↔
Co2 Python SDKValidation · coherence planning
→
Rust CoreIncremental dependency engine

Explicit dependencies · Versioned artifacts · Conservative defaults

Co2 does not orchestrate agents, schedule work, route requests or execute tools. Plans classify work; they do not authorize external actions.

03 / Incremental execution

Change the input.
Not the entire computation.

When one dependency changes, independent work can remain reusable. Follow the dependency graph to see how a change propagates.

Full recomputation

32 / 32

Artifacts recomputed

Rerun every artifact in this scenario.

Dependency-aware recomputation

12 / 32

Artifacts affected by input 1

20 artifacts remain valid.

Illustrative dependency scenario · Not a performance benchmark

04 / Get started

Add coherence
to your agents.

Install the Python package and try the synthetic coherence example.

Terminal / Python environment
python -m venv .venv
. .venv/bin/activate
python -m pip install context-coherence
python -c "from co2 import Coherence; print(Coherence)"

Requires CPython 3.11–3.14. Native wheels support Linux x86_64, Linux ARM64 and Apple Silicon macOS. Source builds require Rust/Cargo 1.95+.

Installation guide
Python / minimal example
from co2 import Coherence, ExecutionKind, IdentityKind, LifecycleConfig, StaleDependencyError

with Coherence(LifecycleConfig.bounded()) as core:
    core.register_resource("status", "v1")
    attempt, artifact = core.new_identities([IdentityKind.ATTEMPT, IdentityKind.ARTIFACT])
    core.begin(attempt.value, "eligibility", resources=["status"],
               execution=ExecutionKind.DETERMINISTIC)
    core.complete(attempt.value, artifact.value, b"eligible")

    late, result = core.new_identities([IdentityKind.ATTEMPT, IdentityKind.ARTIFACT])
    core.begin(late.value, "assessment", resources=["status"],
               execution=ExecutionKind.DETERMINISTIC)
    core.register_resource("status", "v2")
    try:
        core.complete(late.value, result.value, b"late result")
    except StaleDependencyError:
        core.abandon(late.value)
        print("Stale result rejected")
    for step in core.plan_actions().steps:
        print(step.computation, step.action.value)

Co2 validates publication and plans affected work. Your application runs eligible recomputations.

05 / See it run

When context changes
during execution.

A synthetic lending workflow changes status while an agent is working.

Example / lending quickstart

Agent executionCaptured status
Concurrent updateNew status version
Old result arrivesRejected
Independent credit artifactReused
Affected workRecomputation plan
View simulation
View runnable example

06 / Framework agnostic

Keep your agents.
Keep your orchestration.

Co2 integrates alongside agent frameworks. Your runtime owns execution, tools and routing; Co2 tracks dependency validity and plans.

Framework integrations are available as optional Python extras.

07 / Open source

Build Co2.

Explore the architecture, experiment with agent workloads and contribute to the project.

Explore the project