PyCharm 2026.2 Help

LangSmith

PyCharm provides dedicated support for projects that use LangSmith, LangChain, or LangGraph. It analyzes LangSmith-related configuration in environment files, LangGraph configuration files, run configurations, and Python code.

LangSmith environment variables

LangSmith uses environment variables to configure tracing, authentication, and service endpoints. These variables can be stored in .env and .env.example files.

PyCharm recognizes LangSmith environment variables in these files and checks their names and values. For example:

LANGCHAIN_API_KEY=lsv2_sk_... LANGCHAIN_TRACING_V2=True LANGCHAIN_ENDPOINT=https://eu.smith.langchain.com

In this example, PyCharm detects deprecated LANGCHAIN_* variable names and suggests replacing them with the corresponding LANGSMITH_* names.

Deprecated LangSmith environment variable

Use the Rename all deprecated LangSmith keys quick-fix to replace all supported deprecated variable names in the file.

PyCharm also validates LangSmith-specific values. For example, it detects an invalid tracing value or an unrecognized LangSmith endpoint host and suggests valid replacements.

Invalid tracing value

LangGraph environment files

LangGraph projects can declare an environment file in the env property of langgraph.json. For example:

{ "dependencies": ["."], "graphs": { "agent": "./my_agent/agent.py:graph" }, "env": ".env" }

PyCharm analyzes this property and checks that the referenced environment file exists. If the file does not exist, PyCharm highlights its path.

LangGraph environment file does not exist

PyCharm also checks whether the environment file that is declared in langgraph.json is attached to a Python run configuration.

If the file is not attached, PyCharm displays a warning in the run configuration settings. Click Fix to add the environment file automatically.

LangGraph environment file not attached

Hardcoded LangSmith API keys

PyCharm detects LangSmith API keys that are passed directly to the LangSmith client in Python code. For example:

from langsmith import Client client = Client(api_key="lsv2_sk_...")

In this example, PyCharm highlights the API key and reports that it is hardcoded in source code. The inspection recommends storing the key in an environment variable instead.

Hardcoded LangSmith API key

Environment loading order

PyCharm detects cases where load_dotenv() is called after importing LangChain or LangSmith modules. In this case, environment variables from the .env file might be loaded too late to affect LangSmith configuration.

from langchain_openai import ChatOpenAI from dotenv import load_dotenv load_dotenv() model = ChatOpenAI()

In this example, PyCharm highlights the load_dotenv() call and suggests the Move load_dotenv() above LangChain imports quick-fix.

LangSmith environment loading order

The quick-fix moves the dotenv import and the load_dotenv() call before the LangChain or LangSmith imports.

24 August 2026