langchain-fathom
A coherence read for LangChain agents, as an agent middleware.
A long-running agent loses coherence with its own decisions. It renames a field at one step, then writes the old name at a later one. It marks a record done that it never wrote. The run reports success, and the contradiction ships. langchain-fathom watches the agent run and, when it finishes, names the step where a later action contradicts an earlier commitment.
The middleware observes the agent and does not change what it does. It maps the tool calls in the message history to a committed-state op stream, sends that stream to the Fathom read, and reports the findings. The read is deterministic and needs no model access.
Install
pip install langchain-fathom
Use
from langchain.agents import create_agent
from langchain_fathom import FathomMiddleware
agent = create_agent(
model="gpt-5.5",
tools=[...],
middleware=[FathomMiddleware()],
)
result = agent.invoke({"messages": [...]})
By default the middleware logs any findings through the fathom logger. Two other modes fit a test suite or a pipeline.
FathomMiddleware(on_finding="raise") # raise FathomCoherenceError when a run is not coherent
FathomMiddleware(on_finding="store") # put the verdict on agent state under the "fathom" key
If the run is a rename or a migration, tell the read which token replaced which, so it also reports records left on the old value at the end.
FathomMiddleware(supersede=[("guest_id", "customer_id")])
What it finds
| Finding | The agent... |
|---|---|
stale_reference |
acts on a record it already removed or renamed away |
superseded_value |
writes a value it already replaced |
residual |
ends the run with a record still carrying a value it replaced elsewhere |
duplicate_commit |
adds an entity a collection already holds |
post_commit_mutation |
changes a record after committing it |
A coherent run returns coherent and the middleware reports nothing else.
Your own tool names
The read knows common state-writing tool names. For tools with your own names, map them once and pass the file.
FathomMiddleware(mapping_path="tools.json")
{"save_decision": {"op": "set", "kind": "decision", "key": "topic", "value": "text"},
"confirm_booking": {"op": "commit", "kind": "flight", "key": "booking"}}
The read and the repair
The middleware is the read. It tells you where coherence broke. Embedded Risk Analytics also runs a hosted service that acts on what the read finds and re-grounds the agent before the contradiction ships. Write to contact@embeddedriskanalytics.com for a key that lifts the demo rate limit, or to run the read on a workflow of your own.
Links
- fathom-read, the read and its adapters for LangGraph, CrewAI, Letta, OpenInference, DBOS, and coding-agent edit logs
- Coherence census, every framework the read has run on, with a trace per row
- Research and the paper, SSRN 6683578
MIT licensed.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_fathom-0.1.0.tar.gz.
File metadata
- Download URL: langchain_fathom-0.1.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8758ddf4c0897e1c6b4800e2cdec63772b21b9dafd3cf2bd02c178661d2ef093
|
|
| MD5 |
7286b0e5b614176061bf71dbcb1e04b4
|
|
| BLAKE2b-256 |
e514ac39b9f46dc16a0b6d2051bdea3d49ed0c290212a27575e229904340e3ae
|
Provenance
The following attestation bundles were made for langchain_fathom-0.1.0.tar.gz:
Publisher:
release.yml on ERA-Fathom/langchain-fathom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_fathom-0.1.0.tar.gz -
Subject digest:
8758ddf4c0897e1c6b4800e2cdec63772b21b9dafd3cf2bd02c178661d2ef093 - Sigstore transparency entry: 2700790279
- Sigstore integration time:
-
Permalink:
ERA-Fathom/langchain-fathom@e23527d72d6e382d1d577bad331331166d259b76 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ERA-Fathom
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e23527d72d6e382d1d577bad331331166d259b76 -
Trigger Event:
release
-
Statement type:
File details
Details for the file langchain_fathom-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_fathom-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cecee727ba7c09896b4760ee6e9a4ea052350e47529569d59d532d723e77d62
|
|
| MD5 |
d8b7a1a6fd0177e8958c1de2c7210a19
|
|
| BLAKE2b-256 |
4bdbf0a66a25cccdd167916cf6ae8450b1793fedff1df567b667d28568ac8827
|
Provenance
The following attestation bundles were made for langchain_fathom-0.1.0-py3-none-any.whl:
Publisher:
release.yml on ERA-Fathom/langchain-fathom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_fathom-0.1.0-py3-none-any.whl -
Subject digest:
0cecee727ba7c09896b4760ee6e9a4ea052350e47529569d59d532d723e77d62 - Sigstore transparency entry: 2700790348
- Sigstore integration time:
-
Permalink:
ERA-Fathom/langchain-fathom@e23527d72d6e382d1d577bad331331166d259b76 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ERA-Fathom
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e23527d72d6e382d1d577bad331331166d259b76 -
Trigger Event:
release
-
Statement type: