Skip to main content

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

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

langchain_fathom-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_fathom-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

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

Hashes for langchain_fathom-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8758ddf4c0897e1c6b4800e2cdec63772b21b9dafd3cf2bd02c178661d2ef093
MD5 7286b0e5b614176061bf71dbcb1e04b4
BLAKE2b-256 e514ac39b9f46dc16a0b6d2051bdea3d49ed0c290212a27575e229904340e3ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_fathom-0.1.0.tar.gz:

Publisher: release.yml on ERA-Fathom/langchain-fathom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_fathom-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_fathom-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cecee727ba7c09896b4760ee6e9a4ea052350e47529569d59d532d723e77d62
MD5 d8b7a1a6fd0177e8958c1de2c7210a19
BLAKE2b-256 4bdbf0a66a25cccdd167916cf6ae8450b1793fedff1df567b667d28568ac8827

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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