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:
<dependency>
  <groupId>com.langchain.smith</groupId>
  <artifactId>langsmith-java</artifactId>
  <version>0.1.0-alpha.17</version>
</dependency>
Example file directory:
my-app/
└── pom.xml # Maven dependencies

Gradle

Add the LangSmith Java SDK to your build.gradle.kts or build.gradle:
implementation("com.langchain.smith:langsmith-java:0.1.0-alpha.17")
Example file directory:
my-app/
└── build.gradle.kts # Gradle dependencies

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:
# Required: LangSmith API Key
LANGSMITH_API_KEY=lsv2_...

# Optional: Custom LangSmith API endpoint
# LANGSMITH_ENDPOINT=https://api.smith.langchain.com

# Optional: Organization and tenant settings
# LANGSMITH_ORGANIZATION_ID=your-org-id
# LANGSMITH_TENANT_ID=your-tenant-id
The SDK will automatically read these environment variables when you initialize the client using LangsmithOkHttpClient.fromEnv(). Example file directory:
my-app/
├── pom.xml # or build.gradle.kts
└── .env # environment variables

Next

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