Skip to main content

Using your self-hosted instance of LangSmith

This guide will walk you through the process of using your self-hosted instance of LangSmith.

Self-Hosted LangSmith Instance Required

This guide assumes you have already deployed a self-hosted LangSmith instance. If you have not, please refer to the kubernetes deployment guide or the docker deployment guide.

Configuring the application you want to use with LangSmith

LangSmith has two APIs: One for interacting with the LangChain Hub/prompts and one for interacting with the backend of the LangSmith application. Each exists at its own URL and in a self-hosted environment are set via the LANGCHAIN_HUB_API_URL and LANGSMITH_ENDPOINT environment variables, respectively, and have their own separate SDKs.

  1. Once you have deployed your instance, you can access the LangSmith UI at http://<host>.
  2. The backend API will be available at http://<host>/api
  3. The hub/prompts API will be available at http://<host>/api-hub.

To use the LangSmith API, you will need to set the following environment variables in your application:

LANGSMITH_ENDPOINT=http://<host>/api
LANGCHAIN_HUB_API_URL=http://<host>/api-hub
LANGSMITH_API_KEY=foo # Set to a legitimate API key if using OAuth

You can also configure these variables directly in the LangSmith SDK client:

import langsmith

langsmith_client = langsmith.Client(
api_key='<api_key>',
api_url='http://<host>/api',
)

import langchainhub

langchainhub.Client(
api_key='<api_key>',
api_url='http://<host>/api-hub'
)

After setting the above, you should be able to run your code and see the results in your self-hosted instance. We recommend running through the quickstart guide to get a feel for how to use LangSmith.


Was this page helpful?


You can leave detailed feedback on GitHub.