Skip to main content

fathom-sdk

Python SDK for Fathom — a typed client for the agent gateway over HTTP + SSE. Sync and async.

Install

pip install fathom-sdk
# or uv pip install / poetry add / pdm add

Quick start (sync)

from fathom import Fathom

with Fathom(base_url="http://localhost:8790", token="...") as f:
    thread = f.threads.create()
    reply = f.threads.send(thread["id"], "What's the weather in NYC?")
    print(reply["agent_message"]["content"])

base_url and token can also come from FATHOM_BASE_URL and FATHOM_TOKEN env vars. If both are set you can call Fathom() with no args.

Async

import asyncio
from fathom import AsyncFathom

async def main() -> None:
    async with AsyncFathom() as f:  # picks up FATHOM_* env vars
        thread = await f.threads.create()
        async for evt in f.threads.stream(thread["id"]):
            if evt["type"] == "agent_done":
                print(evt["message"]["content"])
                break

asyncio.run(main())

Sync streaming works the same with a regular for loop:

for evt in f.threads.stream(thread["id"]):
    if evt["type"] == "agent_thinking":
        print("⏳ agent is working…")
    elif evt["type"] == "agent_done":
        print("✅", evt["message"]["content"])
        break

Pairing (for headless / CLI use)

If you don't have a token — say a one-shot CLI pairing against a relay-hosted gateway — call pair() once:

with Fathom(base_url="https://relay.darklake.ai/c/<rid>") as f:
    claim = f.pair(code="123456", device_name="ci-bot")
    authed = f.with_token(claim["token"])
    threads = authed.threads.list()

pair() is the only method that doesn't require a token; everything else raises PairingRequiredError.

Error handling

from fathom import Fathom, UnauthorizedError, HttpError

with Fathom() as f:
    try:
        f.threads.list()
    except UnauthorizedError:
        # token expired or wrong — re-pair / refresh
        ...
    except HttpError as err:
        print(err.status, err.body)

All errors derive from FathomError. Specific subclasses: UnauthorizedError, HttpError, PairingRequiredError, MalformedResponseError.

Reference

Method Description
f.threads.list() All non-deleted threads, newest first.
f.threads.get(id) One thread + its message history.
f.threads.create(title="") New thread; auto-titles on first message if blank.
f.threads.send(id, text) Send a user message, return user + agent reply.
f.threads.delete(id) Soft-delete (restorable).
f.threads.restore(id) Undo a soft-delete.
f.threads.stream(id) Iterator (sync) / AsyncIterator (async) of SSE events.
f.pair(code=..., device_name=...) Claim a pairing code, returns token.
f.with_token(token) Returns a new client with a different token, sharing connection pool.

Requirements

  • Python 3.10+
  • Depends on httpx — single dependency.

License

MIT — see LICENSE.

Metadata

Release files for fathom-sdk 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 fathom-sdk 0.1.0
File Size Uploaded Provenance Actions
fathom_sdk-0.1.0.tar.gz 9.3 kB Without provenance Details for fathom_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fathom-sdk 0.1.0
File Interpreter ABI Platform Actions
fathom_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for fathom_sdk-0.1.0-py3-none-any.whl

Total release size: 21.4 kB

Release files / fathom_sdk-0.1.0.tar.gz

Download URL fathom_sdk-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8026289d972216690e712c58d47f49997216171e7d9cb19c426d48cfa9802eb3
BLAKE2b-256 checksum
How to use checksums
c85bf11b05f9729904ecec3ea08d057740643f520b13f17098253b6495aa22e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

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

Download URL fathom_sdk-0.1.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2ff00fad31912f13bb709c26d446dd63133759ada3b0d527a279c46489c44b8
BLAKE2b-256 checksum
How to use checksums
cd79e0c5c3bae013079035ed741961f8295526cd699a9b3cf3f7c1de28d4b56a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for fathom-sdk 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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