You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a CallbackPatcher base primitive and use it to model LangChain as an SDK integration that installs a default Braintrust callback handler. Export the LangChain integration, wire it into auto_instrument(), and add focused setup and auto-instrument tests.
Also document CallbackPatcher usage in the sdk-integrations skill so future integrations can use the same pattern for setup-only side effects.
Copy file name to clipboardExpand all lines: .agents/skills/sdk-integrations/SKILL.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -224,6 +224,8 @@ Use `CompositeFunctionWrapperPatcher` when several closely related targets shoul
224
224
- sync and async variants of the same method
225
225
- the same logical surface patched across multiple modules
226
226
227
+
Use `CallbackPatcher` when the integration only needs a setup side effect after applicability succeeds, not in-place wrapping or class replacement. Good fits include registering a global callback handler, invoking a provider-owned configure hook, or installing default integration state. Gate it with `target_module` when the side effect depends on an optional module, and use `state_getter` when idempotence should be derived from integration-managed state instead of a marker on the imported root.
228
+
227
229
Set `target_module` when the patch target lives outside the module named by `import_names`, especially for optional or deep submodules. Failed `target_module` imports should make the patcher skip cleanly through `applies()`.
228
230
229
231
Use `superseded_by` for version-conditional mutual exclusion. Express fallback relationships declaratively instead of reproducing `hasattr` logic in custom `applies()` methods whenever possible.
0 commit comments