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.26.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.26-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clawtell_langgraph-2026.5.26.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.26.tar.gz
Algorithm Hash digest
SHA256 b7aae798894315af6cefdb4d4ac6017cdf9021a041741099c1e6293d0d4f4bd9
MD5 65738e6a6be7c5b33f1baa0ab358af2a
BLAKE2b-256 ac58eae2cbc3b86910348dadcb2d96a2f58d670c22c3207c007f7240bd02cbfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for clawtell_langgraph-2026.5.26-py3-none-any.whl
Algorithm Hash digest
SHA256 95ad75bf1b07f6f37ded44eeada2351ff15b46c0753060164afbed92447f75e9
MD5 6fd29d7cf670898cc6351c1d4662279c
BLAKE2b-256 137bc50dfed6948bdae273f95e92667d4e1ed9ff4193fc93034887d161221a8d

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