Skip to main content
This guide covers the basic configuration files needed to use the LangSmith Java SDK in your application.

Specify dependencies

Dependencies can be specified using either Maven or Gradle. The LangSmith Java SDK requires Java 8 or later.

Maven

Add the LangSmith Java SDK to your pom.xml:

Gradle

Add the LangSmith Java SDK to your build.gradle.kts or build.gradle:
Example file directory:

Specify environment variables

The LangSmith Java SDK configures itself through environment variables. See the Environment Variables reference to configure additional variables for tracing. Example .env file:
The SDK will automatically read these environment variables when you initialize the client using LangsmithOkHttpClient.fromEnv(). Example file directory:

Next

After you configure your Java application with the LangSmith SDK, you can:
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.