Observed since 20 Oct, 20:47 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
aerograph-langchain
LangChain callback adapter for AeroGraph — automatically record LangChain traces.
LangChain callback adapter for AeroGraph.
Automatically records LangChain chain, LLM, tool, and retriever events as AeroGraph trace events.
When published, you can install the adapter via pip:
pip install aerograph-langchain
For local testing or development, install the packages in editable mode from the repository root:
# Install the core SDK first
pip install -e python/aerograph-sdk
# Install the LangChain adapter
pip install -e python/aerograph-langchain
Integrating AeroGraphCallbackHandler into your existing LangChain codebase is simple. Setup a FlightRecorder, initialize the handler, and pass it to your chain or model invocations.
import asyncio
from langchain_core.messages import HumanMessage
from langchain_openai import ChatOpenAI
from aerograph_sdk.recorder import FlightRecorder
from aerograph_langchain.handler import AeroGraphCallbackHandler
async def main():
# 1. Initialize the FlightRecorder pointing to your collector
recorder = FlightRecorder(
endpoint="http://localhost:4317",
project_id="travel-app", # Optional: Routes traces to a specific project (creates it if new)
actor={"id": "my-agent", "name": "TravelPlanner"}
)
# 2. Initialize the AeroGraph callback handler
handler = AeroGraphCallbackHandler(recorder)
# 3. Create your LangChain chat model
model = ChatOpenAI(model="gpt-4o")
# 4. Invoke the model and pass the handler in callbacks
response = await model.ainvoke(
[HumanMessage(content="What are 3 fun things to do in San Francisco?")],
config={"callbacks": [handler]}
)
print(response.content)
if __name__ == "__main__":
asyncio.run(main())
You can attach the callback handler at the chain execution level. LangChain automatically propagates the callbacks down to all sub-chains, LLMs, retrievers, and tool invocations.
# Pass the handler to the chain invoke call
result = rag_chain.invoke(
"How do I configure the server?",
config={"callbacks": [handler]}
)
The callback adapter automatically intercepts LangChain execution signals and translates them to canonical AeroGraph TraceEvent types:
on_llm_start, on_chat_model_start) $\rightarrow$ PromptEvent (captures prompt text, model.name, model.provider)on_llm_end) $\rightarrow$ ResponseEvent (captures completion text, streaming telemetry, usage token counts, and duration_ms)on_tool_start) $\rightarrow$ ToolCallEventon_tool_end) $\rightarrow$ ToolResultEvent (captures output and duration_ms)on_retriever_start, on_retriever_end) $\rightarrow$ RetrieverEvent (captures source documents, queries, and metadata)on_llm_error, on_tool_error, on_chain_error) $\rightarrow$ ErrorEventon_chain_start, on_chain_end with langgraph_node metadata) $\rightarrow$ NoteEvent (automatically captures state_before inputs, state_update outputs, step, triggers, path, and checkpoint_ns)on_custom_event) $\rightarrow$ StateSnapshotEvent and CheckpointEvent for LangGraph nodesApache-2.0
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
aerograph-sdkEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | aerograph-sdk>=0.3.0 | runtime |
langchain-coreEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | langchain-core>=0.2.0 | runtime |
langchain-coreEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | langchain-core>=0.2.0; extra == "dev" | runtime |
langchainEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | langchain>=0.2.0; extra == "dev" | runtime |
pytest-asyncioEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | pytest-asyncio>=0.24.0; extra == "dev" | runtime |
pytestEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | pytest>=8.0.0; extra == "dev" | runtime |
langgraphEnvironment{
"extras": "",
"marker": "extra == \"langgraph\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | langgraph>=0.1.0; extra == "langgraph" | runtime |
bdist_wheel · 10.62 KB · Python py3
sdist · 11.83 KB · Python source
Observed since 20 Oct, 20:47 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:09b9b59ff8ed9bba36589f8bb0ac0bb3ce8db4d76ec3bcdc67852f35f1791ed9