exit-door-langchain 𓉸
𓉸 Passage Protocol · exit-door · entry-door · mcp · langchain · vercel · eliza · eas · erc-8004 · sign · python
⚠️ Pre-release software -- no formal security audit has been conducted.
LangChain callback handler for EXIT Protocol departure markers. Automatically creates signed departure records when chains or agents complete execution. Thread-safe, fail-safe, works with LCEL and LangGraph.
Quick Start
pip install exit-door-langchain
from exit_door_langchain import ExitCallbackHandler
handler = ExitCallbackHandler(origin="my-app")
# Use with any LangChain chain
chain.invoke({"input": "hello"}, config={"callbacks": [handler]})
# Markers are collected automatically
print(handler.markers[-1].id) # urn:exit:abc123...
Configuration
from exit_door import ExitType
handler = ExitCallbackHandler(
origin="my-platform", # Platform name (default: "langchain")
exit_type=ExitType.VOLUNTARY, # Exit type for success (default: VOLUNTARY)
error_exit_type=ExitType.FORCED, # Exit type for errors (default: FORCED)
on_marker=my_callback, # Called on each new marker
max_markers=500, # Memory limit (default: 1000)
root_only=True, # Skip subchain markers (default: True)
fail_safe=True, # Never break user's chain (default: True)
)
API
| Method / Property | Description |
|---|---|
handler.markers |
Deque of collected ExitMarker objects |
handler.markers_to_json() |
Export all markers as JSON array |
handler.clear() |
Remove all stored markers and reset state |
How It Works
The handler hooks into LangChain's callback system:
| Callback | When | Exit Type |
|---|---|---|
on_chain_end |
Chain completes successfully | exit_type (default: VOLUNTARY) |
on_chain_error |
Chain fails with exception | error_exit_type (default: FORCED) |
on_agent_finish |
Agent completes (deduplicated) | exit_type (default: VOLUNTARY) |
root_only mode (default): Only creates markers for root-level chain completions, not nested subchains. Set root_only=False to get a marker for every chain/subchain.
fail_safe mode (default): Marker creation errors are logged but never propagated to the user's chain. Set fail_safe=False to let exceptions bubble up.
Thread safety: Safe for concurrent chain invocations sharing one handler instance.
Web Server Usage
In web server contexts, create a new handler per request to prevent marker accumulation across users:
@app.post("/chat")
async def chat(request: ChatRequest):
handler = ExitCallbackHandler(origin="my-api")
result = chain.invoke(request.input, config={"callbacks": [handler]})
return {"result": result, "departures": len(handler.markers)}
Ecosystem
| Package | Language | Description |
|---|---|---|
| exit-door | TypeScript | Core protocol (reference impl) |
| exit-door | Python | Core protocol |
| cellar-door-entry | TypeScript | Arrival/entry markers |
| @cellar-door/langchain | TypeScript | LangChain integration |
| exit-door-langchain | Python | LangChain integration ← you are here |
| @cellar-door/vercel-ai-sdk | TypeScript | Vercel AI SDK |
| @cellar-door/mcp-server | TypeScript | MCP server |
| @cellar-door/eliza | TypeScript | ElizaOS plugin |
| @cellar-door/eas | TypeScript | EAS attestation anchoring |
| @cellar-door/erc-8004 | TypeScript | ERC-8004 identity/reputation |
| @cellar-door/sign-protocol | TypeScript | Sign Protocol attestation |
License
Apache-2.0
Metadata
Release files for exit-door-langchain 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| exit_door_langchain-0.1.0.tar.gz | 13.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| exit_door_langchain-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.5 kB
Release files / exit_door_langchain-0.1.0.tar.gz
| Download URL | exit_door_langchain-0.1.0.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba8ab9fb60806b7abfd6e3f84152848be8e83497faf5ad7d51d66bf40748967d
|
|
BLAKE2b-256 checksum How to use checksums |
d94f9b3e7481a8fc69494e688f982836a6ec27823877616fa496e93c690faa7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / exit_door_langchain-0.1.0-py3-none-any.whl
| Download URL | exit_door_langchain-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04e84d4ade5467dc3d629ce9796b2ab84726f45e809ffbc811789096f7f61494
|
|
BLAKE2b-256 checksum How to use checksums |
df4542ed795bb2d3e00b68d026a8f0af7700bc7a4db5437a53743a6de23efa1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|