Skip to main content

Developer Setup

This guide will continue from the hub quickstart, using the Python or TypeScript SDK to interact with the hub instead of the Playground UI.

This guide assumes you've gone through the Hub Quick Start including login-required steps.

If you don't yet have an account, you'll only be able to pull public objects.

1. Install/upgrade packages

Note: You likely need to upgrade even if they're already installed!

pip install -U langchain langchainhub

2. Configuring environment variables

Get an API key for your Personal organization if you have not yet. The hub will not work with your non-personal organization's api key!

export LANGCHAIN_HUB_API_KEY="ls_..."

If you already have LANGCHAIN_API_KEY set to a personal organization’s api key from LangSmith, you can skip this.

3. Pull an object from the hub and use it

from langchain import hub

# pull a chat prompt
prompt = hub.pull("efriis/my-first-prompt")

# create a model to use it with
from langchain.chat_models import ChatOpenAI
model = ChatOpenAI()

# use it in a runnable
runnable = prompt | model
"profession": "biologist",
"question": "What is special about parrots?",

4. Push a prompt to your personal organization

For this step, you'll need the handle for your account!

from langchain import hub
from import ChatPromptTemplate

prompt = ChatPromptTemplate.from_template("tell me a joke about {topic}")

hub.push("<handle>/topic-joke-generator", prompt)