Skip to main content

bioma-langchain

Context apoptosis for LangChain: prune stale, low-value history with the B.I.O.M.A. Rust kernel (~1 µs decision) before messages reach the model.

Custom LangChain agents that resend a growing history are exactly where the kernel measured −84% input tokens (and up to −97.6% on bloated sessions) with answer quality at parity — see the repo's honest benchmark report, including where it does not help.

Install

pip install bioma-langchain

Use

from bioma_langchain import BiomaDehydrator
from langchain_core.messages import HumanMessage

dehydrator = BiomaDehydrator()      # tool-calling default: safe_threshold=0.2

# LCEL — drop it right before the model:
chain = dehydrator | llm

# or call it directly:
lean_history = dehydrator.invoke(messages)
print(dehydrator.last_audit)        # tokens_before/after, reduction, µs

Durable values must be marked to survive forever (the usage contract):

HumanMessage("The rollback token is RBK-5521.",
             additional_kwargs={"bioma": "fact"})

Class mapping

LangChain message Kernel class Behavior
SystemMessage SYSTEM never purged
additional_kwargs={"bioma": "fact"} FACT never purged
HumanMessage / AIMessage USER/ASSISTANT decay by recency
ToolMessage, tool-call-only AIMessage TOOL dehydrates first

Declared limit: an old, untagged value decays below the threshold and is purged by design — tag durable info as fact.

Metadata

Release files for bioma-langchain 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bioma-langchain 0.1.0
File Size Uploaded
bioma_langchain-0.1.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bioma-langchain 0.1.0
File Interpreter ABI Platform
bioma_langchain-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / bioma_langchain-0.1.0.tar.gz

Download URL bioma_langchain-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
400a883cb246cea239dc35f2dc035fd404769f8749b49f057a718b352842b79a
BLAKE2b-256 checksum
How to use checksums
63a1b5ba47d91cfab711639dee37ddfc17f5691f06efea2398d5d2a5678fd059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release files / bioma_langchain-0.1.0-py3-none-any.whl

Download URL bioma_langchain-0.1.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccb6343dda6f2c22d6979888fa247754a9d5d54d84e6b1d59753b2a569863ef0
BLAKE2b-256 checksum
How to use checksums
0877c2fbeed2432358fb0b091629506ba1b79657d1e0f35556b04957e560b25d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page