Motivation
LangChain is the most popular framework for building LLM-powered agents. Adding a provenance callback handler would let LangChain users add audit trails to their agents with a single line of code:
from datafund_provenance.integrations.langchain import ProvenanceCallbackHandler
handler = ProvenanceCallbackHandler(gateway_url="https://provenance-gateway.datafund.io")
llm = ChatOpenAI(callbacks=[handler])
This unlocks:
- "One-line audit trails for LangChain agents" narrative (blog post + co-marketing with LangChain team)
- Discovery via LangChain's integrations docs and community
- Natural entry point for developers already building agents
Part of the fellowship marketing plan (Month 2, Week 5-6).
Requirements
Callback Handler
Packaging
Testing
Documentation
Reference
Motivation
LangChain is the most popular framework for building LLM-powered agents. Adding a provenance callback handler would let LangChain users add audit trails to their agents with a single line of code:
This unlocks:
Part of the fellowship marketing plan (Month 2, Week 5-6).
Requirements
Callback Handler
ProvenanceCallbackHandlerextending LangChain'sBaseCallbackHandleron_llm_start/on_llm_end— capture prompts, completions, model info, token usageon_chain_start/on_chain_end— capture chain execution with inputs/outputson_tool_start/on_tool_end— capture tool calls and resultson_agent_action/on_agent_finish— capture agent reasoning stepsPackaging
pip install swarm-provenance-cli[langchain]swarm_provenance_uploader/integrations/langchain.pyTesting
@pytest.mark.integration)Documentation
examples/directoryReference
swarm_provenance_uploader/core/gateway_client.pyGatewayClientfor uploads