Skip to main content
If you use LLM provider libraries (such as OpenAI, Anthropic, Cohere, or Mistral) in your application, autopatching is Weave’s way of taking care of tracing all your LLM calls for you. When you call weave.init(), Weave automatically intercepts (patches) supported LLM client libraries. Your application code stays unchanged: you use the provider SDK as usual, and each request is recorded as a Weave Call. You get full tracing with minimal setup. This page describes when and how to change that behavior: turning automatic tracking off, limiting it to specific providers, or post-processing inputs and outputs (for example, to redact PII).

Default behavior

By default, Weave automatically patches and tracks calls to common LLM libraries such as openai and anthropic. Call weave.init(...) at the start of your program and use those libraries normally. Their calls will appear in your project’s Traces.

Configure autopatching

The autopatch_settings argument is deprecated. Use implicitly_patch_integrations=False to disable implicit patching, or call specific patch functions like patch_openai(settings={...}) to configure settings per integration.
Weave provides automatic implicit patching for all supported integrations by default:Implicit Patching (Automatic): Libraries are automatically patched regardless of when they are imported.
Disabling Implicit Patching: You can disable automatic patching if you prefer explicit control.
Explicit Patching (Manual): You can explicitly patch integrations for fine-grained control.

Post-process inputs and outputs

You can customize how inputs and outputs are recorded (for example, to redact PII or secrets) by passing settings to the patch function:
For more on handling sensitive data, see How to use Weave with PII data.