This release is a pre-release and may not be stable for production use.
by-framework-langgraph
LangGraph integration for by-framework. Provides two integration modes:
- Adapter Mode — Plug existing LangGraph graphs into by-framework with one line
- Native Mode — Build LangGraph workers with native
call_agent/ask_user/resumesupport
Installation
uv add by-framework-langgraph
Quick Start
Adapter Mode — Plug in existing graphs
from by_framework.worker import ByaiWorker
from by_framework_langgraph import LangGraphAdapter
class MyWorker(ByaiWorker):
def get_agent_types(self):
return ["my-agent"]
async def process_command(self, command, context):
graph = build_my_existing_graph() # your existing LangGraph
adapter = LangGraphAdapter(graph, context)
return await adapter.run(command)
Native Mode — Framework-native LangGraph workers
from by_framework_langgraph import LangGraphWorker, make_remote_agent_tool, make_ask_user_tool
class OrchestratorWorker(LangGraphWorker):
def get_agent_types(self):
return ["orchestrator"]
def build_graph(self, context, command):
poet = make_remote_agent_tool(context, "invoke_poet", "poet-agent", "调度诗人创作")
ask = make_ask_user_tool(context)
llm = ChatOpenAI(model="gpt-4o").bind_tools([poet, ask])
# ... build and return compiled graph
Common Pitfalls
Both of these fail silently — no exception, just wrong or empty results — so they're easy to lose time to.
add_messages must be imported as a function, not written as a string
from langgraph.graph.message import add_messages
# Correct — the reducer actually runs; messages accumulate across nodes.
messages: Annotated[list, add_messages]
# Wrong — looks plausible (some older LangGraph docs used this form), but
# the reducer silently does nothing: each node only sees its own output,
# not the accumulated history. Your agent node ends up calling the model
# with just the latest ToolMessage and no prior context, and typically
# returns an empty or confused reply.
messages: Annotated[list, "add_messages"]
A routing function must return the END constant, not the string "end"
from langgraph.graph import END
# Correct — the graph terminates properly; the agent node's final
# AIMessage is saved to state before the graph stops.
def should_continue(state):
...
return END
# Wrong — "end" looks like it should work as a node name, but LangGraph
# only recognizes the END constant (whose actual value is "__end__").
# LangGraph logs "wrote to unknown channel branch:to:end, ignoring it."
# and the graph doesn't route there — the agent's last turn is dropped,
# and `state["messages"][-1]` after execution can end up being something
# other than the model's real final answer (e.g. a stale ToolMessage from
# an earlier step), not the reply you expected.
def should_continue(state):
...
return "end"
Metadata
Release files for by-framework-langgraph 0.0.3.dev4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| by_framework_langgraph-0.0.3.dev4.tar.gz | 19.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| by_framework_langgraph-0.0.3.dev4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.6 kB
Release files / by_framework_langgraph-0.0.3.dev4.tar.gz
| Download URL | by_framework_langgraph-0.0.3.dev4.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ead2c594e39fc2c5c0b8fc29a64450739c03bdcb085fc41bd385bcedaccbdca
|
|
BLAKE2b-256 checksum How to use checksums |
b5871ec8699d9777624a3e887829a6e7575d9b7f473736a05ee26bda8a25c7e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / by_framework_langgraph-0.0.3.dev4-py3-none-any.whl
| Download URL | by_framework_langgraph-0.0.3.dev4-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1be645520f67c1192b2e9c20e9b2f3e37b26969b3a6ba4c75e667083f17f432
|
|
BLAKE2b-256 checksum How to use checksums |
a72215df77ebaebeacb211e2f6c847b085a56311b2fe36a4b1cb5e4ef983e960
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency log