Skip to content

[bot] Add instrumentation support for langchain-rust LLM framework #46

@braintrust-bot

Description

@braintrust-bot

Summary

The Braintrust Rust SDK has no instrumentation support for langchain-rust, the most widely adopted LangChain implementation for Rust. Braintrust already wraps LangChain in four other language SDKs — Python (langchain-core), TypeScript (callback handler), Go (langchaingo), and Java (langchain4j) — but the Rust SDK has no equivalent.

What is missing

The langchain-rust crate provides execution-oriented API surfaces that could be instrumented to automatically capture spans:

  • ChainsLLMChain, ConversationalChain, SequentialChain, and other chain types that compose LLM calls
  • Agents — agent execution with tool calling and multi-step reasoning
  • LLM calls — direct model invocations across providers (OpenAI, Anthropic Claude, Azure OpenAI, Ollama, MistralAI)
  • Embeddings — embedding generation across providers (OpenAI, Azure OpenAI, Ollama, FastEmbed, MistralAI)
  • Retrievers — retrieval operations for RAG workflows

Braintrust's other SDKs instrument LangChain via callback handlers that capture chains, agents, retrievers, tools, and individual LLM calls as traced spans.

Library significance

  • 1.3k GitHub stars, 532 commits on main branch
  • 123k+ total downloads on crates.io
  • Active community with 55 open issues and 28 pull requests
  • Latest version: 4.6.0
  • Supports multiple LLM providers (OpenAI, Anthropic, Azure, Ollama, MistralAI) and vector stores (OpenSearch, Postgres, Qdrant, SQLite, SurrealDB)
  • Official docs: https://docs.rs/langchain-rust

Braintrust docs status

supported (in other languages) — Braintrust documents LangChain integration for Python (langchain-core ≥ 0.3.28), Go (langchaingo ≥ 0.1.13), Java (langchain4j ≥ 1.8.0), and TypeScript (callback handler). Rust is not listed as a supported language for LangChain tracing.

Upstream sources

Local files inspected

  • src/extractors.rs — only OpenAI and Anthropic usage extractors; no LangChain-related code
  • src/stream.rs — stream aggregator for OpenAI Chat Completions format only; no callback handler
  • src/lib.rs — public API exports; no LangChain references
  • Cargo.toml — no langchain-rust dependency
  • Full codebase grep for "langchain", "chain", "agent", "callback" — zero results related to LangChain integration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions