Braintrust에서 Confident AI로 전환하기

Braintrust에서 Confident AI로 전환하기

confident-trace로 Braintrust에서 Confident AI로 트레이스를 옮겨요. OpenTelemetry 스팬, 프로바이더 클라이언트, 프레임워크는 그대로 둬요.

출처: 문서

본문

개요

Braintrust는 프로젝트 로거와 감싼 프로바이더 클라이언트로 로그해요. confident-trace는 둘을 하나의 init() 호출과 OpenTelemetry 자동 인스트루먼테이션으로 대체하므로 전환이 작아요: 로거와 래퍼를 버리고, 데코레이터 이름을 바꾸고, 오늘 내보내는 모든 스팬을 유지하면 돼요.

이 가이드에서 배울 것:

  • confident-trace 설치하고 Braintrust 키들을 하나의 CONFIDENT_API_KEY로 교체해요.
  • 클라이언트 설정을 init()으로 교체해서 자동 인스트루먼테이션이 스팬을 내보내게 해요.
  • @traced를 @span으로 이름 변경해서 모든 트레이스가 이름·입력·출력을 갖게 해요.
  • 무엇이 바뀌는지 확인 — 트레이스가 Confident AI에 들어오면: 모든 트레이스의 평가, 프로덕션에서 큐레이션된 데이터셋, 품질 하락 시 알림이에요.

사전 준비

  • Project API Key, CONFIDENT_API_KEY(예: confident_us_proj_...). 여기서 가져오세요.
  • Python SDK용 Python 3.10+ 또는 TypeScript SDK용 Node.js 22+.
  • 기존 Braintrust 설정. 아래 Before 스니펫은 2026년 9월 기준 Braintrust 퀵스타트를 따릅니다.

Python용 confident-trace는 PyPI에서 안정 릴리스예요. TypeScript용 confident-trace는 npm에서 알파 릴리스입니다. TypeScript 스니펫은 알파 API를 따릅니다.

전환하기

confident-trace 설치하기

패키지 하나예요. 프로바이더 SDK는 선택적 피어로 남아요. CONFIDENT_API_KEY가 BRAINTRUST_API_KEY를 대체해요. EU 리전이면 CONFIDENT_OTEL_ENDPOINT=https://eu.otel.confident-ai.com/v1/traces도 설정해요.

pip install confident-trace
export CONFIDENT_API_KEY=...
# replaces BRAINTRUST_API_KEY
npm install confident-trace
export CONFIDENT_API_KEY=...
# replaces BRAINTRUST_API_KEY
node --import confident-trace/register dist/index.js

init_logger와 wrap_openai를 init()으로 교체하기

로거와 래퍼를 버려요. 자동 인스트루먼테이션이 평범한 클라이언트에서 스팬을 내보내요.

Python

from braintrust import init_logger, wrap_openai
from openai import OpenAI

logger = init_logger(project="My Project")
client = wrap_openai(OpenAI())

response = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[{"role": "user", "content": "Hello"}],
)
from confident_trace import init
from openai import OpenAI

init()
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[{"role": "user", "content": "Hello"}],
)

TypeScript (alpha)

import { initLogger, wrapOpenAI } from "braintrust";
import OpenAI from "openai";

const logger = initLogger({ projectName: "My Project" });
const client = wrapOpenAI(new OpenAI());

const response = await client.chat.completions.create({
  model: "gpt-4.1-mini",
  messages: [{ role: "user", content: "Hello" }],
});
import { init } from "confident-trace";
import OpenAI from "openai";

const tracing = init();
const client = new OpenAI();

const response = await client.chat.completions.create({
  model: "gpt-4.1-mini",
  messages: [{ role: "user", content: "Hello" }],
});

@traced를 @span으로 이름 변경하기

형태는 같아요. 입력과 출력이 스팬에 담겨요.

Python

from braintrust import traced

@traced
def answer(question: str) -> str:
    return client.chat.completions.create(
        model="gpt-4.1-mini",
        messages=[{"role": "user", "content": question}],
    ).choices[0].message.content
from confident_trace import span

@span
def answer(question: str) -> str:
    return client.chat.completions.create(
        model="gpt-4.1-mini",
        messages=[{"role": "user", "content": question}],
    ).choices[0].message.content

TypeScript (alpha)

import { wrapTraced } from "braintrust";

const answer = wrapTraced(async function answer(question: string) {
  const response = await client.chat.completions.create({
    model: "gpt-4.1-mini",
    messages: [{ role: "user", content: question }],
  });
  return response.choices[0].message.content;
});
import { span } from "confident-trace";

const answer = span({ name: "answer" }, async (question: string) => {
  const response = await client.chat.completions.create({
    model: "gpt-4.1-mini",
    messages: [{ role: "user", content: question }],
  });
  return response.choices[0].message.content;
});

앱을 한 번 실행해 보세요. 트레이스가 몇 초 안에 프로젝트의 Observatory에 나타나요. 나타나지 않으면 같은 프로세스에서 CONFIDENT_API_KEY가 설정됐는지, 앱이 종료 전에 플러시하는지 확인해요.

무엇이 바뀌나요

트레이싱이 시작점이에요. 평가가 성과가 나는 지점이죠. 모든 트레이스가 점수를 받아요. 낮은 점수는 데이터셋 행이 되고, 데이터셋 행은 회귀 테스트가 되며, 다음 릴리스는 실제 프로덕션 실패에 맞춰 출시됩니다.

Capability Braintrust Confident AI
OpenTelemetry ingestion Yes OTLP over HTTP and gRPC
Auto-instrumented providers OpenAI, Anthropic, Gemini, Mistral, Cohere OpenAI, Anthropic, Google GenAI, Bedrock, 5 gateways, 16 frameworks
Built-in eval metrics Autoevals, about 20 scorers 50+ research-backed metrics through DeepEval
Online evals on traces, spans and threads Sampled, 1 to 10 percent suggested at volume Every trace, no sampling
Quality-aware alerting on eval scores Slack, webhook Email, Slack, Discord, Teams
Prompt and use case drift detection No Yes
Automatic dataset curation from production Manual add to dataset Ingestion tasks, filtered and tagged
End-to-end app testing over HTTP No Yes
Multi-turn simulation No Yes
Git-based prompt management No Branches, PRs, approvals, eval actions
Cross-functional workflows, no code Limited PMs and QA run evals over HTTP
Regression testing and CI gates Yes Yes
Safety monitoring No Toxicity, bias, PII on production traffic

마이그레이션 질문

인스트루먼테이션을 다시 써야 하나요?

아니요. confident-trace는 표준 OTLP로 내보내요. 프레임워크에서 온 기존 OpenTelemetry 스팬이 그대로 내보내집니다.

전환 중에 둘 다 실행할 수 있나요?

네. OpenTelemetry Collector를 두 엔드포인트 모두에 지정하고 전환 전에 일주일 비교해요. CONFIDENT_OTEL_ENDPOINT는 Collector URL을 받아요.

내 Braintrust 로그, 데이터셋, 프롬프트는요?

bt CLI가 로그와 실험을 NDJSON 파일로 가져와요. 데이터셋은 btql로 조회합니다. 내보내기를 마이그레이션 콜에 가져오면 우리가 매핑해 줘요.

$200은 어떻게 받나요?

콜을 예약하세요. 콜 후 조직의 첫 유료 인보이스에 $200 쿠폰을 적용해 드려요. 조직당 보상 하나예요.

TypeScript SDK는 준비됐나요?

Python SDK는 PyPI에서 안정적이에요. TypeScript SDK는 npm에서 알파 릴리스입니다. 이 가이드의 TypeScript 스니펫은 알파 API를 따릅니다.

관련

OpenTelemetry 통합

플랫폼이 읽는 속성 키와 함께, 어떤 SDK나 Collector에서든 OTLP 트레이스를 Confident AI로 보내요.

트레이스에서 테스트 런 만들기

출시 전에 프로덕션 트레이스를 평가된 테스트 런으로 바꿔요.

LLM Observability

모든 트레이스의 평가, 드리프트 감지, 알림, 프로덕션에서 큐레이션된 데이터셋이에요.

GitHub의 confident-trace

Python과 TypeScript용 통합 25개를 가진 OpenTelemetry 네이티브 트레이싱 SDK예요.

더 알아보기