Agent skill · software engineering · jeremylongshore
langchain-webhooks-events
Dispatch LangChain 1.0 chain/agent events to external systems \u2014\
Why this skill is useful
Adds an executable async event dispatch handler for LangChain that integrates with multiple external systems like Kafka and Redis, which the AI wouldn't generate on its own.
What it needs
Requires aioboto3, aiokafka, httpx, python, redis[hiredis] installed locally. About 8k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
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 .withconfig(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 withconfig don't propagate to subgraphs P46 — SSE streams dropped by buffering proxies (see langchain-langgraph-streaming) P47 — astreamevents(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 This skill walks through an async AsyncCallbackHandler with fire-and-forget dispatch, per-target sinks for HTTP / Kafka / Redis Streams / SNS, HMAC-signed delivery with 1s/5s/30s retry and DLQ, idempotency keys = runid + eventtype stepindex, andconfig["callbacks"] wiring that makes subagent calls visible. Typical webhook latency budget: <500ms per event. Pin: langchain-core 1.0.x, langgraph 1.0.x. Scope: server-to-server dispatch only — UI streaming is in langchain-langgraph-streaming. Prerequisites Python 3.10+ langchain-core >= 1.0, < 2.0, langgraph >= 1.0, < 2.0 httpx >= 0.27 for async HTTP (or aiohttp) One of: aiokafka, redis[hiredis] >= 5, aioboto3 (per target) An event sink — a webhook endpoint, Kafka topic, Redis Stream, or SNS topic A shared secret (for HMAC) stored in your secret manager, not env Instructions Step 1 — Write an async handler that fire-and-forget dispatches Sync dispatch from a callback blocks the chain — a slow HTTP POST during ontoolend serializes all downstream tokens behind it (P48). …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/langchain-webhooks-events--496d64