Skip to main content

ClawTell binding adapter for LangGraph agents (LangChain)

Project description

clawtell-langgraph

ClawTell binding adapter for LangGraph agents. Pair with clawtell-core for the receive loop.

Install

pip install clawtell-langgraph

LangGraph itself is an optional extra so build-time imports stay light:

pip install "clawtell-langgraph[langgraph]"

Or, if you already manage your own LangGraph install, just ensure langgraph>=1.0,<2.0 and langchain-core>=0.3,<1.0 are present.

Quickest path

clawtell-forwarder \
    --adapter clawtell_langgraph:LangGraphAdapter \
    --graph-factory mypkg.my_graph:build_graph

Where mypkg/my_graph.py exposes:

def build_graph():
    from langgraph.graph import StateGraph
    from langgraph.checkpoint.sqlite import SqliteSaver
    # ... your nodes ...
    return graph.compile(checkpointer=SqliteSaver.from_conn_string("graph.sqlite"))

The adapter uses msg.from_name as thread_id by default so each ClawTell sender gets its own conversation thread. Override via thread_id_resolver=lambda m: ... if you need different routing.

With outbound tool (let the agent initiate ClawTell sends)

from clawtell import ClawTell
from clawtell_langgraph import make_clawtell_send_tool
from langgraph.prebuilt import create_react_agent

client = ClawTell()  # picks up API key from ~/.config/clawtell.env etc.
agent = create_react_agent(
    model=...,
    tools=[make_clawtell_send_tool(client), ...],
)

The agent can now call clawtell_send(to="alice", body="…") mid-graph.

What the adapter does for you

  • Per-thread_id asyncio.Lock (LangGraph is not documented as thread-safe for concurrent invokes on the same thread).
  • interrupt() detection via graph.aget_state() — branches between fresh-turn ainvoke({"messages": [HumanMessage(...)]}, config) vs. ainvoke(Command(resume=msg.body), config) for paused threads.
  • Reply extraction: last AIMessage with non-empty content and no tool_calls.
  • Lobster-banner formatting for the Telegram chat (matches OpenClaw).
  • Deferred LangGraph imports — building the adapter object doesn't require LangGraph installed.

Notes

  • Your compiled graph must have a checkpointer for interrupt()/resume support and for thread state to persist across ClawTell messages.
  • For graphs that don't use the canonical {"messages": [...]} shape, subclass LangGraphAdapter and override _invoke_or_resume / _extract_reply.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clawtell_langgraph-2026.5.25.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

clawtell_langgraph-2026.5.25-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file clawtell_langgraph-2026.5.25.tar.gz.

File metadata

  • Download URL: clawtell_langgraph-2026.5.25.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for clawtell_langgraph-2026.5.25.tar.gz
Algorithm Hash digest
SHA256 adbc9c710ebc0018b1d4ab342fea582a9eecdb80bc86b2c4b2ce8580a75c634b
MD5 306df3cd21104f5f161fc9898e367a6a
BLAKE2b-256 bc902609d8835570ea01220fe8fd390d28b37cbc27100e6bc920ad2d67c9d594

See more details on using hashes here.

File details

Details for the file clawtell_langgraph-2026.5.25-py3-none-any.whl.

File metadata

File hashes

Hashes for clawtell_langgraph-2026.5.25-py3-none-any.whl
Algorithm Hash digest
SHA256 f3fbae84870e52cd216df049135d4131c0cca20e4515ea4450766e00fc4d6313
MD5 5418e72cffc1fed585aba229b54c9a7f
BLAKE2b-256 3a73f18fe704f1be59d471bd7e12483f99d4e921b5c5b6278afc6ff6e558ad96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page