langchain-webhooks-events

Installation
SKILL.md

LangChain Webhooks and Event Dispatch (Python)

Overview

A team wires per-tool webhook dispatch from their LangChain agent via FastAPI BackgroundTasks — analytics is always N seconds late because BackgroundTasks fire after the HTTP response closes, not during the stream (P60). Worse: the BaseCallbackHandler they attached via .with_config(callbacks=[h]) fires on the outer agent but is dark on the subagent's tool calls — custom callbacks are not inherited by LangGraph subgraphs (P28), they must be passed via config["callbacks"] at invoke time.

Pain-catalog anchors handled here:

  • P28 — Callbacks via with_config don't propagate to subgraphs
  • P46 — SSE streams dropped by buffering proxies (see langchain-langgraph-streaming)
  • P47 — astream_events(v2) emits thousands of events; never forward raw
  • P48 — Sync invoke() inside async endpoint blocks the event loop
  • P60 — BackgroundTasks fire post-response; wrong for per-event dispatch
Installs
27
GitHub Stars
2.8K
First Seen
Feb 18, 2026