Skip to content

[bot] Replicate JS SDK (replicate) not instrumented — no tracing for prediction-based model execution #2046

@braintrust-bot

Description

@braintrust-bot

Summary

The Replicate JavaScript SDK (replicate on npm) provides execution APIs for running arbitrary ML models via a prediction-based API that is not OpenAI-compatible. This repository has zero instrumentation for any Replicate SDK surface — no wrapper, no channels, no plugin, no auto-instrumentation config. Users who call the replicate npm SDK directly get no Braintrust spans.

What instrumentation is missing

The replicate npm package exposes these execution surfaces, none of which are instrumented:

SDK Method Description
replicate.run(model, { input }) Convenience method: creates a prediction, waits for completion, returns output
replicate.predictions.create({ version, input }) Create an asynchronous prediction (returns immediately)
replicate.predictions.get(id) Poll a prediction's current status
replicate.wait(prediction) Block until a prediction completes
replicate.stream(model, { input }) Stream model output as an AsyncGenerator

The Replicate API uses a prediction model distinct from any chat completions or embeddings pattern. Users call arbitrary ML models — image generation (FLUX, Stable Diffusion), audio (Whisper), video, LLMs — via the same prediction surface. This cannot be covered by wrapOpenAI() or any existing plugin.

No coverage in any instrumentation layer:

  • No wrapper function (e.g. wrapReplicate())
  • No diagnostics channels for Replicate methods
  • No plugin handler in js/src/instrumentation/plugins/
  • No auto-instrumentation config in js/src/auto-instrumentations/configs/
  • No e2e test scenarios

A grep for replicate across js/src/ returns zero matches.

Indirect coverage does not exist:

The Braintrust docs page at https://www.braintrust.dev/docs/integrations/ai-providers/replicate shows a gateway approach using the openai npm SDK pointed at https://gateway.braintrust.dev/v1. This only covers Replicate-hosted LLMs accessible via OpenAI-compatible chat completions through the gateway. Users who call replicate.run() or replicate.predictions.create() directly — which is the primary documented SDK usage and covers the full range of Replicate models — get no Braintrust spans at all.

Braintrust docs status

not_found for direct SDK instrumentation. The Braintrust integrations page lists Replicate as a supported provider, but the documented approach uses the openai package with the Braintrust gateway rather than instrumenting the replicate npm package itself.

Upstream references

Local files inspected

  • js/src/auto-instrumentations/configs/ — no Replicate config entry; full list: anthropic.ts, openai.ts, ai-sdk.ts, groq.ts, mistral.ts, cohere.ts, huggingface.ts, google-genai.ts, google-adk.ts, genkit.ts, openai-agents.ts, openrouter.ts, openrouter-agent.ts, claude-agent-sdk.ts, cursor-sdk.ts, github-copilot.ts, openai-codex.ts, flue.ts
  • js/src/instrumentation/plugins/ — no Replicate channels or plugin file
  • js/src/wrappers/ — no replicate.ts wrapper
  • e2e/scenarios/ — no Replicate test scenarios
  • Full repo grep for replicate in js/src/ — zero matches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions