Adapters record a run without decorating your own code. Instead of wrapping your agent in @capture.agent, you hand the framework a callback and it emits the same capture file — same span tree, same versioned envelope, same gate, sampling, redaction, and hygiene.
## LangChain
EvalShiftCallbackHandler is a LangChain BaseCallbackHandler. Drop it into any callbacks=[...] list and the root chain, model/chat calls, tools, and retrievers are all recorded into one capture, finalized when the root run ends.
# the adapter needs the optional langchain extra uv add 'evalshift-sdk[langchain]' # or: pip install "evalshift-sdk[langchain]"
from langchain.agents import AgentExecutor
from evalshift.adapters.langchain import EvalShiftCallbackHandler
handler = EvalShiftCallbackHandler(suite="support_agent")
# pass it anywhere LangChain takes callbacks — per call or per object
agent: AgentExecutor = build_agent()
agent.invoke({"input": "my refund hasn't arrived"}, config={"callbacks": [handler]})The only required argument is suite. Add code_version to stamp the envelope, and redact to override the process-wide redactor for this handler — if it raises, the capture is dropped rather than written unredacted (fail-closed).
from evalshift import default_redactor
# redact= overrides any process-wide configure(redact=...); fail-closed
handler = EvalShiftCallbackHandler(
suite="support_agent",
code_version="git-sha-or-tag", # optional, stamped into the envelope
redact=default_redactor,
)One handler instance is safe to reuse across many invocations and across threads: per-run state is keyed by the LangChain run_id and lock-guarded. Parentage is resolved from each callback’s parent_run_id chain (LangChain callbacks fire flat, not nested), so tool and model spans land under the right enclosing tool.
@capture.tool records it twice — use one or the other.[langchain] extra installed does not fail, and the SDK stays stdlib-only at runtime.## Roadmap
These adapters are planned but not built yet:
- +LlamaIndex — capture query engines and agents via its callback/instrumentation hooks.
- +OpenAI Agents SDK — capture runs without manual decorators.
Until then, instrument those agents directly with the decorators and helpers.