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.6.0.tar.gz (7.1 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.6.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clawtell_langgraph-2026.6.0.tar.gz
  • Upload date:
  • Size: 7.1 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.6.0.tar.gz
Algorithm Hash digest
SHA256 dff1e6de985949f593414ef82015e91714325c04c78dcb85a9a0ca512d52fe05
MD5 51f9186ad999682285dc31de00584fce
BLAKE2b-256 968a0388034ce5547c14c66711d624cfa497b25db866eaa0babab5c595c4ba80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for clawtell_langgraph-2026.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d06cf7fcf7cd8eb30ab5044b7d52ca31530092e4c4897986f19815d6f3b3de9
MD5 66a1bba6f52f3458c8573b7ddb5164bf
BLAKE2b-256 e814e34fa66bd68edded962075c128ad29ca94340f4e9db8a3d9af537d48e8ab

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