Skip to content
Open
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
21 changes: 21 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@
"version": "1.0.0",
"source": "./skills/trace-claude-code",
"category": "observability"
},
{
"name": "setup-braintrust-sdk",
"description": "Set up Braintrust SDK instrumentation in your codebase. Installs SDK, discovers integrations, and instruments LLM providers.",
"version": "2.0.0",
"source": "./skills/setup-braintrust-sdk",
"category": "development"
},
{
"name": "discover-sdk-integrations",
"description": "Discover LLM providers and AI frameworks in a codebase that can be instrumented with Braintrust.",
"version": "1.0.0",
"source": "./skills/discover-sdk-integrations",
"category": "development"
},
{
"name": "install-sdk-integration",
"description": "Add Braintrust instrumentation to LLM providers and AI frameworks. Wraps clients and adds initialization.",
"version": "1.0.0",
"source": "./skills/install-sdk-integration",
"category": "development"
}
]
}
9 changes: 9 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"permissions": {
"allow": [
"WebSearch",
"WebFetch(domain:www.braintrust.dev)",
"WebFetch(domain:github.com)"
]
}
}
66 changes: 66 additions & 0 deletions skills/discover-sdk-integrations/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: discover-sdk-integrations
description: |
Discover LLM providers and AI frameworks in a codebase that can be instrumented
with Braintrust tracing.
version: 1.0.0
allowed-tools:
- Read
- Glob
- Grep
- WebFetch
---

# Discover Braintrust Integrations

This skill discovers LLM providers and AI frameworks in a codebase that can be instrumented with Braintrust.

## When to Use This Skill

Use when:
- User asks to "find what can be traced" or "discover integrations"
- Called by the setup-braintrust-sdk orchestrator skill
- User wants to know what LLM libraries are in their codebase

## Workflow

### Step 1: Detect Language

Search for dependency files to detect which language(s) are in use:

| Language | Dependency Files |
|----------|------------------|
| Python | `requirements.txt`, `pyproject.toml`, `setup.py`, `Pipfile` |
| TypeScript/JS | `package.json` |
| Go | `go.mod` |
| Java | `pom.xml`, `build.gradle`, `build.gradle.kts` |
| Ruby | `Gemfile` |

### Step 2: Search for Known Libraries

See the language reference for libraries to search for. **These lists are not exhaustive.**

### Step 3: Fetch Latest Supported Integrations

Always check the Braintrust documentation for the current list of supported integrations:
- https://www.braintrust.dev/docs/guides/tracing/wrap-ai-sdk
- https://www.braintrust.dev/docs/guides/tracing/integrate-frameworks

### Step 4: Report Findings

Report to the user:
1. Which LLM providers were found (e.g., OpenAI, Anthropic)
2. Which AI frameworks were found (e.g., LangChain, LlamaIndex)
3. Where they are used in the codebase (file paths)

### Step 5: Confirm with User

Ask the user which integrations they want to instrument. Don't assume all should be instrumented.

## Language References

- [Python](references/python.md)
- [TypeScript/JavaScript](references/typescript.md)
- [Go](references/go.md)
- [Java](references/java.md)
- [Ruby](references/ruby.md)
17 changes: 17 additions & 0 deletions skills/discover-sdk-integrations/references/go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Go Integrations to Discover

Search `go.mod` for these packages.

## AI Providers

- `github.com/sashabaranov/go-openai`
- `github.com/anthropics/anthropic-sdk-go`
- `github.com/google/generative-ai-go`

## Documentation

Check these URLs for the current list of supported integrations:
- [Go SDK reference](https://www.braintrust.dev/docs/reference/go)
- [pkg.go.dev](https://pkg.go.dev/github.com/braintrustdata/braintrust-sdk-go)

**This list may not be complete.** Always check the documentation for updates.
16 changes: 16 additions & 0 deletions skills/discover-sdk-integrations/references/java.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Java Integrations to Discover

Search `pom.xml` or `build.gradle` for these dependencies.

## AI Providers

- `com.openai:openai-java`
- `com.anthropic:anthropic-java`

## Documentation

Check these URLs for the current list of supported integrations:
- [Java SDK reference](https://www.braintrust.dev/docs/reference/java)
- [GitHub repo](https://github.com/braintrustdata/braintrust-java)

**This list may not be complete.** Always check the documentation for updates.
38 changes: 38 additions & 0 deletions skills/discover-sdk-integrations/references/python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Python Integrations to Discover

Search `requirements.txt`, `pyproject.toml`, or `Pipfile` for these packages.

## AI Providers

- `openai`
- `anthropic`
- `google-generativeai`
- `boto3` (for Bedrock)
- `azure-openai`
- `mistralai`
- `groq`
- `together`
- `replicate`
- `cohere`
- `fireworks-ai`
- `cerebras`

## Frameworks

- `langchain` / `langchain-core`
- `llama-index`
- `dspy` / `dspy-ai`
- `litellm`
- `instructor`
- `pydantic-ai`
- `crewai`
- `autogen` / `pyautogen`

## Documentation

Check these URLs for the current list of supported integrations:
- [Wrap AI providers](https://www.braintrust.dev/docs/guides/tracing/wrap-ai-sdk)
- [Framework integrations](https://www.braintrust.dev/docs/guides/tracing/integrate-frameworks)
- [Python SDK reference](https://www.braintrust.dev/docs/reference/python)

**This list may not be complete.** Always check the documentation for updates.
17 changes: 17 additions & 0 deletions skills/discover-sdk-integrations/references/ruby.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ruby Integrations to Discover

Search `Gemfile` for these gems.

## AI Providers

- `ruby-openai`
- `anthropic`

## Documentation

Check these URLs for the current list of supported integrations:
- [Ruby SDK reference](https://www.braintrust.dev/docs/reference/ruby)
- [gemdocs](https://gemdocs.org/gems/braintrust/)
- [GitHub repo](https://github.com/braintrustdata/braintrust-sdk-ruby)

**This list may not be complete.** Always check the documentation for updates.
33 changes: 33 additions & 0 deletions skills/discover-sdk-integrations/references/typescript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# TypeScript/JavaScript Integrations to Discover

Search `package.json` dependencies for these packages.

## AI Providers

- `openai`
- `@anthropic-ai/sdk`
- `@google/generative-ai`
- `@aws-sdk/client-bedrock-runtime`
- `@azure/openai`
- `@mistralai/mistralai`
- `groq-sdk`
- `together-ai`
- `replicate`
- `cohere-ai`

## Frameworks

- `langchain` / `@langchain/core`
- `llamaindex`
- `ai` (Vercel AI SDK)
- `litellm`
- `instructor`

## Documentation

Check these URLs for the current list of supported integrations:
- [Wrap AI providers](https://www.braintrust.dev/docs/guides/tracing/wrap-ai-sdk)
- [Framework integrations](https://www.braintrust.dev/docs/guides/tracing/integrate-frameworks)
- [TypeScript SDK reference](https://www.braintrust.dev/docs/reference/typescript)

**This list may not be complete.** Always check the documentation for updates.
91 changes: 91 additions & 0 deletions skills/install-sdk-integration/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: install-sdk-integration
description: |
Add Braintrust instrumentation to LLM providers and AI frameworks.
Wraps clients and adds initialization code.
version: 1.0.0
allowed-tools:
- Read
- Glob
- Grep
- WebFetch
- Edit
- Write
- Bash
---

# Instrument with Braintrust

This skill adds Braintrust instrumentation to LLM providers and AI frameworks in a codebase.

## When to Use This Skill

Use when:
- User asks to "instrument" or "add tracing" to their code
- Called by the setup-braintrust-sdk orchestrator skill
- User wants to wrap specific LLM clients with Braintrust

## Important Principles

1. **Only add Braintrust code** - Do not refactor, improve, or change anything else
2. **Fetch latest docs** - Always check documentation for correct wrapper patterns
3. **Verify imports** - Test wrapper function exists before using it

## Workflow

### Step 1: Confirm Entry Point

Ask the user to confirm the main entry point file where initialization should be added.

### Step 2: Confirm Project Name

Ask the user what Braintrust project name to use. This will be passed to `init_logger(project="<name>")`.
- Suggest using the app/repo name as default
- The project will be created automatically if it doesn't exist

### Step 3: Fetch Instrumentation Docs

**REQUIRED**: Fetch the Braintrust documentation to get the correct wrapper patterns.

See language reference for documentation URLs.

### Step 4: Add Initialization Code

Add `init_logger()` call to the entry point file with the project name.

### Step 5: Wrap LLM Clients

For each library the user confirmed:
1. Find where the client is created
2. Wrap it with the appropriate Braintrust wrapper
3. Verify the wrapper import works

### Step 6: Configure Environment Variable

Ask the user which option they prefer:

**Option A: Add to .env file**
```
BRAINTRUST_API_KEY=<your-api-key-here>
```

**Option B: Provide instructions only**
Tell them to set the environment variable manually.

Always inform user:
- Get API key from: [Braintrust API Keys](https://www.braintrust.dev/app/settings/api-keys)

## Language References

- [Python](references/python.md)
- [TypeScript/JavaScript](references/typescript.md)
- [Go](references/go.md)
- [Java](references/java.md)
- [Ruby](references/ruby.md)

## What NOT to Do

- Do not refactor existing code
- Do not add error handling beyond what's needed
- Do not add type annotations or documentation
- Do not modify code unrelated to Braintrust
33 changes: 33 additions & 0 deletions skills/install-sdk-integration/references/go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Go Instrumentation

## Documentation URLs

**Always fetch these before writing instrumentation code:**
- [Go SDK reference](https://www.braintrust.dev/docs/reference/go)
- [pkg.go.dev](https://pkg.go.dev/github.com/braintrustdata/braintrust-sdk-go)
- [Tracing guide](https://www.braintrust.dev/docs/guides/tracing)
- [GitHub repo](https://github.com/braintrustdata/braintrust-sdk-go)

## Initialization

Add to entry point:

```go
import "github.com/braintrustdata/braintrust-sdk-go"

logger := braintrust.InitLogger(braintrust.InitLoggerParams{
Project: "<project-name>",
})
```

## Common Patterns

**Note:** These patterns may be outdated. Always fetch the latest documentation.

Check the pkg.go.dev documentation for available wrapper functions.

## Environment Variable

```
BRAINTRUST_API_KEY=<your-api-key>
```
32 changes: 32 additions & 0 deletions skills/install-sdk-integration/references/java.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Java Instrumentation

## Documentation URLs

**Always fetch these before writing instrumentation code:**
- [Java SDK reference](https://www.braintrust.dev/docs/reference/java)
- [GitHub repo](https://github.com/braintrustdata/braintrust-java)
- [Tracing guide](https://www.braintrust.dev/docs/guides/tracing)

## Initialization

Add to entry point:

```java
import com.braintrust.Braintrust;

Braintrust.initLogger(new InitLoggerParams.Builder()
.project("<project-name>")
.build());
```

## Common Patterns

**Note:** These patterns may be outdated. Always fetch the latest documentation.

Check the GitHub repo and SDK reference for available wrapper methods.

## Environment Variable

```
BRAINTRUST_API_KEY=<your-api-key>
```
Loading