Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .agents/skills/sdk-integrations/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Declarative setup on the `BaseIntegration` subclass: `name`, `import_names`, `pa
- Instrumentation failures (extraction, normalization) must never raise into the user's call path. But do not wrap `span.log(...)` / `span.set_attributes(...)` in try/except — they are boundary-safe.
- Treat provider inputs/results/events/headers as untrusted. Don't mutate third-party objects.
- Only instrument AI-generation-relevant ops (LLM calls, embeddings, tool exec, media gen, agent runs).
- Explicit provider batch tracing helpers (`start_<provider>_batch_trace`, `complete_<provider>_batch_trace`, etc.) MUST be exported from `braintrust.integrations.<provider>` (not re-exported from top-level `py/src/braintrust/__init__.py`).
- Do not over-serialize. `span.log` already runs `bt_safe_deep_copy` (pydantic, dataclasses, attachments). Log readable dicts/lists/scalars and materialized attachments; no JSON dumps/loads or recursive conversion in tracing code.
- Every `llm` span has `metadata.model` and `metadata.provider` (whose pricing applies, not the framework name).
- Before writing a usage mapper in a framework integration, check the underlying provider's `tracing.py` for a compatible parser. Reuse it when the payload shape matches, and verify reported usage details against the recording. For example, the OpenAI parser maps Responses `cache_write_tokens` to `prompt_cache_creation_tokens`.
Expand Down
8 changes: 8 additions & 0 deletions py/src/braintrust/integrations/anthropic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import warnings

from .batch import (
complete_anthropic_batch_trace,
complete_anthropic_batch_trace_async,
start_anthropic_batch_trace,
)
from .integration import AnthropicIntegration
from .tracing import _wrap_anthropic

Expand All @@ -18,6 +23,9 @@ def wrap_anthropic_client(client):

__all__ = [
"AnthropicIntegration",
"complete_anthropic_batch_trace",
"complete_anthropic_batch_trace_async",
"start_anthropic_batch_trace",
"wrap_anthropic",
"wrap_anthropic_client",
]
Loading