Fetching prompts from prompt registry at runtime on a thread level #5957
Unanswered
yaro-slawa
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm new to LangGraph and LangSmith frameworks, I work on a chatbot project, and I struggle to find a solution for dynamically getting the prompts from the registry at a thread level.
Problem Overview
I deployed my graph with LangSmith, but all prompts were hardcoded. Now I’d like to use different prompts for different threads (conversations) — i.e., specify a prompt name in the registry, fetch it once when the thread is created, and reuse it for all subsequent messages in that thread.
I saw the Context example in the docs (https://docs.langchain.com/oss/python/use-graph-api#extended-example-specifying-llm-at-runtime), but that pattern still requires static definitions (Anthropic / OpenAI) and doesn’t solve the dynamic registry prompt issue.
What I've tried
One of the possible solutions would be to add prompt names into the context, and then inside the node get the name and pull the prompt:
But this pulls the prompt every run, meaning for each message in the conversation. I only want to fetch it once per thread, when it’s first created.
Is there a recommended way to:
Any advice or examples would be greatly appreciated — thank you!
Beta Was this translation helpful? Give feedback.
All reactions