forgesight-adapters-langgraph
The LangGraph / LangChain adapter for ForgeSight. An unchanged LangGraph graph emits a correct ForgeSight span tree — with cost and metrics — by subscribing to LangChain's callbacks.
pip install forgesight-adapters-langgraph
import forgesight
from forgesight_adapters_langgraph import LangGraphAdapter
forgesight.configure()
LangGraphAdapter().instrument() # subscribe to LangChain/LangGraph callbacks
# Unchanged graph — now fully instrumented:
result = await my_compiled_graph.ainvoke({"task": "review PR #42"})
What it maps
| LangChain callback | ForgeSight |
|---|---|
| root chain (graph invoke) | agent_run |
| nested chain (graph node) | step |
on_chat_model_start / on_llm_* |
llm_call (+ token usage from the LLMResult) |
on_tool_* |
tool_call (execute_tool) |
*_error |
span ERROR + error.type |
Because every adapter targets the same domain model, a LangGraph agent and (say) a CrewAI
agent produce comparable agent_runs_total / cost views. Cost is derived by the runtime from
the extracted token usage — the adapter never computes cost.
No double-instrument. When a tool call is already covered by an inner span (an MCP
tools/call, feat-016), the adapter defers and does not open a second execute_tool.
Explicit handler
Auto-subscription uses LangChain's inheritable-callback hook. You can also pass the handler
per-invocation: graph.ainvoke(..., config={"callbacks": [LangGraphAdapter().handler]}).
License
Apache-2.0
Metadata
Release files for forgesight-adapters-langgraph 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| forgesight_adapters_langgraph-0.1.1.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| forgesight_adapters_langgraph-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / forgesight_adapters_langgraph-0.1.1.tar.gz
| Download URL | forgesight_adapters_langgraph-0.1.1.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43d835b1293dc752b7a2cdc32da833279eb1d88f91e6a5e578a5ef06382a2caf
|
|
BLAKE2b-256 checksum How to use checksums |
06a24aacb06a3f45a8f3c3c96b1de25d948830b68b50432b7939f00a1ca281df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / forgesight_adapters_langgraph-0.1.1-py3-none-any.whl
| Download URL | forgesight_adapters_langgraph-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24c90484cb119e05aee5db9de0873966d71228e982e8d0b144c1ece68785b5fc
|
|
BLAKE2b-256 checksum How to use checksums |
bc1e86395c9baf5f5341da7a5babc9489e8bff5c9f89243b95bb51e128a9cc9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|