Framework Auto-Instrumentation
Install
Install only the framework you use:
pip install "briefcase-ai[langchain]==4.4.0"Extras also exist for crewai, llamaindex, autogen, ag2, pageindex,
and openai-agents.
Instrument and undo
from briefcase.auto import auto, undofrom briefcase.exporters import JSONLFileExporter
handler = auto( "langchain", exporter=JSONLFileExporter("decisions.jsonl"), context_version="release-2026-08",)
# Framework calls now emit the shared 10-field decision-record schema.undo("langchain")Calling auto() twice for the same framework returns the existing handler and
does not patch again. undo(framework) removes one integration; undo()
restores every active patch.
Supported frameworks
| Name | Integration point |
|---|---|
langchain | Injects a callback through runnable configuration |
llamaindex | Adds a handler to the global callback manager |
crewai | Registers a CrewAI event listener |
autogen and ag2 | Instruments agent creation and event hooks |
openai-agents | Installs the OpenAI Agents trace processor |
pageindex | Wraps PageIndex chat completions |
Limits
- Instrumentation is process-global. Install it during startup and undo it in tests that share an interpreter.
- A missing framework package raises
ImportError; an unknown name raisesValueErrorwith the supported values. - Records follow the common wire schema, but each framework exposes different event detail.
API reference
briefcase.auto has the full auto() and undo()
signatures and the supported framework names.
Where this fits
Auto-instrumentation is an entry point into the Capture act for applications that build framework callbacks somewhere you cannot reach.
Next · Capture: Exporters Choose where the captured records go.
Capture: Decision Recording The record schema every framework handler emits.
Control & Route: Invocation Controls Gate framework calls on quota and deadline before they run.