Co2 — Context Coherence
Dependency-aware context validity and selective recomputation for AI agents and long-running workflows.
Install context-coherence, import co2.
Co2 tracks which computational results depend on changing inputs. When those inputs change, it identifies stale results and produces an explainable plan for what can be reused, refreshed, recomputed or reviewed. Your application keeps control of execution, agent orchestration and external actions.
The typed Python SDK delegates to an authoritative Rust core. The base package runs in memory and requires no database service, agent framework or model provider.
Install
python -m pip install context-coherence
To pin this release:
python -m pip install 'context-coherence==0.1.0'
Use standard GIL-enabled CPython 3.11–3.14. Version 0.1.0 provides native wheels for:
| Platform | Architecture | Wheel compatibility |
|---|---|---|
| Linux | x86_64 | glibc 2.34 or later |
| Linux | ARM64 / aarch64 | glibc 2.34 or later |
| macOS | Apple Silicon / ARM64 | macosx_11_0_arm64 deployment target |
The macOS deployment target is a binary compatibility tag, not a claim of testing every macOS release. Windows, Intel macOS, Alpine/musl, PyPy and free-threaded Python are outside this wheel matrix. Source builds require Rust/Cargo 1.95 or later, a native C toolchain and the pinned Maturin build backend.
Track changing context
This standalone example uses synthetic values and no network services:
from co2 import Coherence, ExecutionKind, IdentityKind, PlanAction
with Coherence() as coherence:
coherence.register_resource("customer-status", "active-v1")
attempt, artifact = coherence.new_identities(
[IdentityKind.ATTEMPT, IdentityKind.ARTIFACT]
)
coherence.begin(
attempt.value,
"eligibility",
resources=["customer-status"],
execution=ExecutionKind.DETERMINISTIC,
)
coherence.complete(attempt.value, artifact.value, b"eligible")
assert coherence.plan_actions().steps[0].action is PlanAction.REUSE
coherence.register_resource("customer-status", "inactive-v2")
step = coherence.plan_actions().steps[0]
assert step.action is PlanAction.RECOMPUTE
print(step.action.value) # recompute
Co2 does not run that computation again. The host consumes the plan, obtains current source data, executes permitted work and registers a new result with new attempt and artifact identities. A result arriving after its captured inputs change is rejected atomically.
Recompute only affected work
In a synthetic lending workflow:
- Eligibility depends on customer status.
- Credit assessment depends on credit history.
- A recommendation depends on both assessment artifacts.
Changing customer status invalidates eligibility and the derived recommendation. The credit assessment can remain reusable under an accurate dependency contract. The host can execute the affected work and retain the unaffected artifact.
Dependency provenance remains explicit even when two computations return equal bytes. The host supplies accurate resource versions and complete accessible context; Co2 cannot discover unreported external changes.
Plan according to execution semantics
| Disposition | Host response |
|---|---|
REUSE |
Reuse an existing valid artifact. |
REFRESH |
Refresh eligible read-only observations. |
RECOMPUTE |
Execute eligible stale reasoning or deterministic work. |
REVALIDATE |
Obtain renewed human validation. |
BLOCK |
Stop automatic continuation. |
ESCALATE |
Obtain explicit review for irreversible work. |
Probabilistic reasoning requires an explicit recomputation policy. Stale side-effecting operations are blocked, irreversible operations require escalation, and human decisions require revalidation. Unknown execution classifications fail conservatively.
A plan is a point-in-time classification, not an execution authorization or a transaction over external systems.
Choose dependency confidence
- Invocation level: the conservative default retains the complete context supplied by the host.
- Explicit structured: independently identifiable outputs can use distinct trusted developer-declared dependency sets. Missing, untrusted or incomplete declarations fall back conservatively.
- Runtime observed: controlled reads record access, but ordinary host observation does not prove isolation.
RuntimeObservedFallbackretains conservative dependencies. - Scoped runtime enforced: reviewed native providers can submit broker-bound evidence for their approved execution profiles. These optional native builds are separate from the public base wheel.
Publication validates the complete captured invocation snapshot before accepting results, regardless of the effective dependency set used for later invalidation.
Integrate with an existing framework
Install only the optional dependencies your application uses:
python -m pip install 'context-coherence[langgraph]'
python -m pip install 'context-coherence[openai-agents]'
python -m pip install 'context-coherence[google-adk]'
python -m pip install 'context-coherence[claude-agents]'
The adapters use the public SDK. Frameworks retain scheduling and execution; Co2 owns dependency validity and atomic artifact publication. Model credentials and live provider usage are application responsibilities. The Claude integration also has CLI/runtime prerequisites described in its integration guide.
The llm-example extra supports the optional synthetic comparison harness. Installing an extra does not change compiled native features.
Understand the base package
The public 0.1.0 base wheel includes in-memory coherence, resource/version tracking, immutable artifact provenance, selective invalidation, execution-aware planning, lifecycle controls and the typed SDK.
SQLite durability and native runtime-enforcement providers require explicit feature builds with distinct private +native.* versions. They are not enabled by Python extras and are not included in the base wheel. Co2 owns neither sandbox infrastructure nor provider execution environments.
Coherence instances serialize authority mutations and atomically validate result registration. Computation executes outside that authority lock. The SDK supports concurrent callers sharing an instance within the documented single-process boundary; persistence, fork and recovery constraints depend on the chosen native build.
Learn more
- Documentation
- Installation and native variants
- Synthetic lending quickstart
- Architecture and trust boundaries
- Supported configurations and limitations
- Source and issue tracker
Licensed under Apache-2.0. The package includes the project licence, notice and third-party attribution files.
Metadata
Release files for context-coherence 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| context_coherence-0.1.0.tar.gz | 1.2 MB | With provenance | Details for context_coherence-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 14.8 MB
Release files / context_coherence-0.1.0.tar.gz
| Download URL | context_coherence-0.1.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f667659818ed49b9298a5fa4eecaf0e3120d9fedce807be926244398755f9758
|
|
BLAKE2b-256 checksum How to use checksums |
0bbb59fb7091253a596286cc891be60fba61e5e52ef925b0f0fea6b395f2969a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp314-cp314-manylinux_2_34_x86_64.whl
| Download URL | context_coherence-0.1.0-cp314-cp314-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.14 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
da8b9b0e5ac7859714e620d65f059d8bec49572339f82ba1b57b1864d7b6bf41
|
|
BLAKE2b-256 checksum How to use checksums |
f29e64475c3a3fb3ddba86f2f87b25a430c179b2f7310fe9ce898477ee0fba82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp314-cp314-manylinux_2_34_aarch64.whl
| Download URL | context_coherence-0.1.0-cp314-cp314-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.14 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
db589222bc4653117a224cc25390010d492faa4211395b84ab64bc2b8e20f7ed
|
|
BLAKE2b-256 checksum How to use checksums |
e3fc279e9ff1801a435ace2114ba18e2014d677930ceb40edb73c6ebe4f9fe39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | context_coherence-0.1.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
277ebddfc0708d991858d9903a0f08c0ad6e8b904dfb68a6f91e4acbf025ac0d
|
|
BLAKE2b-256 checksum How to use checksums |
f965dca18da44c4d8d3caa666246186bcb02529dd54b81d90b9d5e8582196887
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
| Download URL | context_coherence-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.13 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
25c8033c7d6165b36c2a79d733b15504a0cd8203b32c0d20991bd565d88fedc7
|
|
BLAKE2b-256 checksum How to use checksums |
3f718c319daedc41ace6b1b8a3e1071b62145239e8a8aabb2fd8d2d9be801325
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp313-cp313-manylinux_2_34_aarch64.whl
| Download URL | context_coherence-0.1.0-cp313-cp313-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.13 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
49a12ef46e8209cd742c00e74859704d4a645ead57b8e97714ffde459e39853c
|
|
BLAKE2b-256 checksum How to use checksums |
3afb74c763fe018f4876f5700c41fe8bef3c9dfbffa30d3bebbf68d7d4ad6511
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | context_coherence-0.1.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
374b5d0b716e048851a04742eaac0cf55fd4c8beec4306a9ddd1d49708ba2b9a
|
|
BLAKE2b-256 checksum How to use checksums |
72e38722c75b55c1e710ef109c617b8e7712c9c6719b5d5e4db81bcdff6898c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | context_coherence-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
9d0f328128f9cfc7a4854ee5edb8f523df012bbca96cad97ff266892c5f614a7
|
|
BLAKE2b-256 checksum How to use checksums |
4d1ac395134f564e924926c788048aec5ef26c172be3b1d6c1fb655122004d80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp312-cp312-manylinux_2_34_aarch64.whl
| Download URL | context_coherence-0.1.0-cp312-cp312-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
8b4e2cd84eb29bc5e95b8e99fb99d7357b0cf7450a0043e656080a8adafdb879
|
|
BLAKE2b-256 checksum How to use checksums |
211e30bb941eeb544e36dba6768c2fbc2979f1e1101f36e0eb12ece87c8bbe8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | context_coherence-0.1.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
80c74ec25af69b55617906927a6e6ef485f40e240d0dc9b69329158ce8f8fa5d
|
|
BLAKE2b-256 checksum How to use checksums |
84e8bb5664d1f08c6a2e79355709944ff3d1012e4f78481581af12caddd344d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | context_coherence-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
dcd35e4b7e60faf916ba0bd0f95cd26240ef1977dff3b97244672c16e376f30a
|
|
BLAKE2b-256 checksum How to use checksums |
014f2c4c85d331b5f0c20c1776663ced6b4a2c9a617ab3141cf9cbf54c2a5d00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp311-cp311-manylinux_2_34_aarch64.whl
| Download URL | context_coherence-0.1.0-cp311-cp311-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
f7bdadc7624c2aa8b4356aea6f2b38f9382605de8b98be91eba64c040018c2d1
|
|
BLAKE2b-256 checksum How to use checksums |
796afebd6785d9e2e2350e65dd914ccadbbbee88672cabc6e5eecefabc41b136
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / context_coherence-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | context_coherence-0.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
59d3e775bc3c5d286373b6911ad3f8b87127caddca9951c07afadb5218027d88
|
|
BLAKE2b-256 checksum How to use checksums |
cda7e847a908434a1532db7dbd7a4bf0f15cd23d10bff51b8148c6304ed66fe2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logSecurity for context-coherence 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 13 files in this release have been uploaded with provenance metadata.
Attestation for context_coherence-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.