How to beginner · 3 min read

How to create projects in LangSmith

Quick answer
Use the LangSmith Python SDK to create projects by initializing a Client and calling client.create_project(name). This creates a new project resource for organizing your AI workflows and traces.

PREREQUISITES

  • Python 3.8+
  • pip install langsmith
  • LangSmith API key set in environment variable LANGSMITH_API_KEY

Setup

Install the langsmith Python package and set your API key as an environment variable for authentication.

bash
pip install langsmith

Step by step

Initialize the LangSmith Client with your API key, then call create_project with a project name to create a new project. The method returns the project details including its ID.

python
import os
from langsmith import Client

# Initialize client with API key from environment
client = Client(api_key=os.environ["LANGSMITH_API_KEY"])

# Create a new project
project_name = "My LangSmith Project"
project = client.create_project(name=project_name)

print(f"Created project with ID: {project.id} and name: {project.name}")
output
Created project with ID: proj_1234567890abcdef and name: My LangSmith Project

Common variations

  • You can list existing projects using client.list_projects().
  • Projects can be updated or deleted via client.update_project() and client.delete_project().
  • Use async methods if your application requires asynchronous calls.
python
import asyncio

async def create_project_async():
    client = Client(api_key=os.environ["LANGSMITH_API_KEY"])
    project = await client.create_project(name="Async Project")
    print(f"Async created project ID: {project.id}")

asyncio.run(create_project_async())
output
Async created project ID: proj_abcdef1234567890

Troubleshooting

  • If you get authentication errors, verify your LANGSMITH_API_KEY environment variable is set correctly.
  • For permission errors, ensure your API key has rights to create projects.
  • Network errors may require checking your internet connection or proxy settings.

Key Takeaways

  • Use the LangSmith Python SDK Client to create projects programmatically.
  • Always set your API key in the LANGSMITH_API_KEY environment variable for authentication.
  • You can manage projects asynchronously or synchronously depending on your app needs.
Verified 2026-04
Verify ↗