fix[evals] remove braintrust api key requirement (#2145)

Merged
MI
6mo ago
+215-11

why

Evals should be able to run without the braintrust dependency

what changed

  • Added hasBraintrustApiKey() and made tracedSpan() a passthrough when no key.
  • AISdkClientWrapped falls back to the plain ai SDK when braintrust wrapping isn’t available; introduced a WrappedAI type and lazy load keyed on BRAINTRUST_API_KEY.

test plan

  • Added tests for key-present/absent paths and updated core-runner test to set a dummy key; fixes for test stability and build.

Summary by cubic

Make Braintrust optional for evals. Evals run without BRAINTRUST_API_KEY and skip sending logs; behavior is unchanged when a key is set.

  • Bug Fixes
    • Added hasBraintrustApiKey() and made tracedSpan() a passthrough when no key.
    • Runner now passes noSendLogs: true to Eval and skips flush() without a key; sends logs and flushes when present.
    • AISdkClientWrapped falls back to the plain ai SDK when braintrust wrapping isn’t available; introduced a WrappedAI type and lazy load keyed on BRAINTRUST_API_KEY.
    • Added tests for key-present/absent paths and updated core-runner test to set a dummy key; fixes for test stability and build.