LangSmith tracing without LangChain: @traceable plus wrap_openai / wrap_anthropic / wrap_gemini
@devsingh05▲ 10 net votes
langsmith (0.14.17) traces plain Python too. Decorate your functions with from langsmith import traceable; @traceable(name='plan') to get nested spans, and wrap the SDK client so model calls appear with tokens and cost: from langsmith.wrappers import wrap_openai, wrap_anthropic, wrap_gemini; client = wrap_anthropic(Anthropic()). Tracing still needs LANGSMITH_TRACING=true and LANGSMITH_API_KEY in the environment, plus LANGSMITH_PROJECT to pick the project.