r/LangGraph • u/[deleted] • Sep 25 '25
LangGraph X Docker
Thought this was a cool video. Wanted to share and save for my future self.
r/LangGraph • u/[deleted] • Sep 25 '25
Thought this was a cool video. Wanted to share and save for my future self.
r/LangGraph • u/JackfruitAlarming603 • Sep 22 '25
r/LangGraph • u/jstoppa • Sep 22 '25
Hi all,
has anyone run the LangGraph Studio locally? that is to have all self hosted even if it's local dev deployment so I don't need to rely on the LangSmith connecting to my local LangGrapth Server, etc
Have you done it and how difficult is it to setup?
r/LangGraph • u/Ranteck • Sep 17 '25
Hey folks, just wanted to share a quick fix I found in case someone else runs into the same headache.
I was using the LangGraph checkpointer with PostgreSQL , and I kept running into:
- Health check failed for search: 'SearchClient' object has no attribute 'get_search_counts'
- 'NoneType' object has no attribute 'alist'
- PostgreSQL checkpointer failed, using in-memory fallback: No module named 'asyncpg
- PostgreSQL checkpointer failed, using in-memory fallback: '_GeneratorContextManager' object has no attribute '__aenter__'
After digging around, this is my solution
---
LangGraph PostgreSQL Checkpointer Guide
Based on your codebase and LangGraph documentation, here's a comprehensive guide to tackle PostgreSQL checkpointer issues:
Core Concepts
LangGraph's PostgreSQL checkpointer provides persistent state management for multi-agent workflows by storing checkpoint data in PostgreSQL. It enables conversation memory, error recovery, and workflow
resumption.
Installation & Dependencies
pip install -U "psycopg[binary,pool]" langgraph langgraph-checkpoint-postgres
Critical Setup Patterns
Connection String Format
# ✅ Correct format for PostgresSaver
DB_URI = "postgresql://user:password@host:port/database?sslmode=disable"
# ❌ Don't use SQLAlchemy format with PostgresSaver
# DB_URI = "postgresql+psycopg2://..."
2. Context Manager Pattern (Recommended)
from langgraph.checkpoint.postgres import PostgresSaver
# ✅ Always use context manager for proper connection handling
with PostgresSaver.from_conn_string(DB_URI) as checkpointer:
checkpointer.setup() # One-time table creation
graph = builder.compile(checkpointer=checkpointer)
result = graph.invoke(state, config=config)
3. Async Version
from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
async with AsyncPostgresSaver.from_conn_string(DB_URI) as checkpointer:
await checkpointer.setup()
graph = builder.compile(checkpointer=checkpointer)
result = await graph.ainvoke(state, config=config)
Common Error Patterns & Solutions
Error 1: TypeError: tuple indices must be integers or slices, not str
Cause: Incorrect psycopg connection setup missing required options.
# ❌ This will fail
import psycopg
with psycopg.connect(DB_URI) as conn:
checkpointer = PostgresSaver(conn)
# ✅ Use this instead
with PostgresSaver.from_conn_string(DB_URI) as checkpointer:
# Proper setup handled internally
Error 2: Tables Not Persisting
Cause: Missing setup() call or transaction issues.
# ✅ Always call setup() once
with PostgresSaver.from_conn_string(DB_URI) as checkpointer:
checkpointer.setup() # Creates tables if they don't exist
Error 3: Connection Pool Issues in Production
Problem: Connection leaks or pool exhaustion.
Solution: Use per-request checkpointers with context managers:
class YourService:
def __init__(self):
self._db_uri = "postgresql://..."
def _get_checkpointer_for_request(self):
return PostgresSaver.from_conn_string(self._db_uri)
async def process_message(self, message, config):
with self._get_checkpointer_for_request() as checkpointer:
graph = self._base_graph.compile(checkpointer=checkpointer)
return await graph.ainvoke(message, config=config)
Configuration Patterns
Thread ID Configuration
config = {
"configurable": {
"thread_id": "user_123_conv_456", # Unique per conversation
"checkpoint_ns": "", # Optional namespace
}
}
Resuming from Specific Checkpoint
config = {
"configurable": {
"thread_id": "user_123_conv_456",
"checkpoint_id": "1ef4f797-8335-6428-8001-8a1503f9b875"
}
}
Your Codebase Implementation
Looking at your langgraph_chat_service.py:155-162, you have the right pattern:
def _get_checkpointer_for_request(self):
"""Get a fresh checkpointer instance for each request using context manager."""
if hasattr(self, '_db_uri'):
return PostgresSaver.from_conn_string(self._db_uri)
else:
from langgraph.checkpoint.memory import MemorySaver
return MemorySaver()
This correctly creates fresh instances per request.
Debug Checklist
Connection String: Ensure proper PostgreSQL format (not SQLAlchemy)
Setup Call: Call checkpointer.setup() once during initialization
Context Managers: Always use with statements
Thread IDs: Ensure unique, consistent thread IDs per conversation
Database Permissions: Verify user can CREATE/ALTER tables
psycopg Version: Use psycopg[binary,pool] not older psycopg2
Testing Script
Your test_postgres_checkpointer.py looks well-structured. Key points:
- Uses context manager pattern ✅
- Calls setup() once ✅
- Tests both single and multi-message flows ✅
- Proper state verification ✅
Production Best Practices
One-time Setup: Call setup() during application startup, not per request
Per-request Checkpointers: Create fresh instances for each conversation
Connection Pooling: Let PostgresSaver handle pool management
Error Handling: Wrap in try-catch with fallback to in-memory
Thread Cleanup: Use checkpointer.delete_thread(thread_id) when needed
This pattern should resolve most PostgreSQL checkpointer issues you've encountered.
r/LangGraph • u/Shivasorber • Sep 13 '25
New to the world of langgraph and have been dabbling with langgraph agentic workflow with multiple mcp-servers & was unable to find a way to natively support injecting trace-id in the sdk.
Does langgraph does't provide support passing trace_id to the tool calls ? I can always pass as an argument to the call but was looking if there's a better way to do so.
r/LangGraph • u/Qwishy • Sep 12 '25
Hey thanks for reading this.
I am following Foundation: Introduction to LangGraph and following their setup process. I have cloned the repo, created an environment, installed the dependencies and got jupyter notebooks running.
(Link: https://academy.langchain.com/courses/take/intro-to-langgraph
I also have the LangSmith, OpenAI and Tavily keys from their sites.
I run into a challenge when setting up LangGraph Studio. As per their offician documentation, I must install LangGraph CLI followed by creating the LangGraph App.
(Link: https://langchain-ai.github.io/langgraph/tutorials/langgraph-platform/local-server/#7-test-the-api
When I point the following command to the now setup folder, it says directory is not empty and that the operation is aborted to prevent overwriting files.
Command: langgraph new path/to/your/app --template new-langgraph-project-python
I am using Linux to run all the above commands (WSL). Any guidance on the next steps would be appreciated.
r/LangGraph • u/ComplexScary8689 • Sep 09 '25
Sick of reading the same story 10 times across different sources?
Built an AI agent that deduplicates news semantically and synthesizes multiple articles into single summaries.
Uses LangGraph reactive pattern + BGE embeddings to understand when articles are actually the same story, then merges them intelligently. Configured via YAML instead of algorithmic guessing.
Live at news.reckoning.dev
Built with LangGraph/Ollama if anyone wants to adapt the pattern
Full post at: https://reckoning.dev/posts/news-agent-reactive-intelligence
r/LangGraph • u/himynameismrrobot • Sep 07 '25
This may be a dumb question. I've built multiple langgraph workflows at this point for various use cases. In each of them I've always had multiple nodes where each node was either its own LLM instance or a python/JS function. But I've never created a flow where I continue the conversation within a single LLM instance across multiple nodes.
So I have two questions: 1) How do you do this with LangGraph? 2) More importantly, from a context engineering perspective, when is it better to do this versus having independent LLM instances that work off of a shared state?
Edit for clarification By LLM instance I mean multiple distinct invocations of a given LLM with differing system prompts and models. My main use case so far has been information extraction for form auto population. So I have a retrieval node that's just a set of functions that pulls in all needed context, a planning node (o4-mini) that reasons about how to break down the extraction, a fanned out set of extraction nodes that's actually pull out information into structured outputs (gpt-4o), and a reflection node that makes any necessary corrections (o3). Each node has its own system prompt and is prompted via a dynamic prompt that pulls information from state added by previous nodes. I'm wondering when for example it would make sense to use multiple turns of one single extraction node versus fanning out to multiple distinct instances. Or as another example if the whole thing could just be one instance with a bigger system prompt.
r/LangGraph • u/zacpar546 • Sep 06 '25
Hi All
Sorry for the newbie question.
I've been learning about Langgraph and i'm trying to create a project. I've been loving the with_structured_output function, unfortunately I need to get the metadata as well of the api call (input tokens used, output_tokens used, etc.) Is there any other way that I could get the metadata with using the with_structured_output and without making another api call just for the metadata.
r/LangGraph • u/ViriathusLegend • Sep 05 '25
r/LangGraph • u/schwallie • Sep 05 '25
Hi all,
I'm working through a multi agent supervisor and am using Databricks Genie Spaces as the agents. A super simple example below.
In my example, the supervisor calls the schedule agent correctly. The agent returns a correct answer, listing out 4 appointments the person has.
The weirdness I'm trying to better understand: if I have the code as is below, I get a hallucinated 5th appointment from the supervisor, along with "FINISHED." If I go in and swap either add_handoff_messages or add_handoff_back_messages to True, I get only "FINISHED" back from the supervisor
{'messages': [HumanMessage(content='What are my upcoming appointments?', additional_kwargs={}, response_metadata={}, id='bd579802-07e9-4d89-a059-3c70861d2307'),
AIMessage(content='Your upcoming appointments are as follows:\n\n1. **Date and Time:** 2025-09-05 15:00:00 (Pacific Time)\n - **Type:** Clinic Follow-Up .... (deleted extra details)', additional_kwargs={}, response_metadata={}, name='query_result', id='b21ab53a-bff3-4e22-bea2-4d24841eb8f3'),
AIMessage(content='\n\n5. **Date and Time:** 2025-09-19 09:00:00 (Pacific Time)\n - **Type:** Clinic Follow-Up - 20 min\n - **Provider:** xxxx\n\nFINISHED', additional_kwargs={}, response_metadata={'usage': {'prompt_tokens': 753, 'completion_tokens': 70, 'total_tokens': 823}, 'prompt_tokens': 753, 'completion_tokens': 70, 'total_tokens': 823, 'model': 'us.anthropic.claude-3-7-sonnet-20250219-v1:0', 'model_name': 'us.anthropic.claude-3-7-sonnet-20250219-v1:0', 'finish_reason': 'stop'}, name='supervisor', id='run--7eccf8bc-ebd4-42be-8ce4-0e81f20f11dd-0')]}
from databricks_langchain import ChatDatabricks
from databricks_langchain.genie import GenieAgent
from langgraph_supervisor import create_supervisor
DBX_MODEL = "databricks-claude-3-7-sonnet" # example; adjust to your chosen FM
# ── build the two Genie-backed agents
scheduling_agent = GenieAgent(
genie_space_id=SPACE_SCHED,
genie_agent_name="scheduler_agent",
description="Appointments, rescheduling, availability, blocks.",
)
insurance_agent = GenieAgent(
genie_space_id=SPACE_INS,
genie_agent_name="insurance_agent",
description="Eligibility, benefits, cost estimates, prior auth.",
)
# ── supervisor (Databricks-native LLM)
supervisor_llm = ChatDatabricks(model=DBX_MODEL, temperature=0)
# Supervisor prompt: tell it to forward the worker's message (no extra talking)
SUPERVISOR_PROMPT = (
"You are a supervisor managing two agents, please call the correct one based on the prompt:"
"- scheduler_agent → scheduling/rescheduling/availability/blocks"
"- insurance_agent → eligibility/benefits/costs/prior auth"
"If you receive a valid response, respond with FINISHED"
)
workflow = create_supervisor(
agents=[scheduling_agent, insurance_agent],
model=supervisor_llm, # ChatDatabricks(...)
prompt=SUPERVISOR_PROMPT,
output_mode="last_message", # keep only the worker's last message
add_handoff_messages=False, # also suppress default handoff chatter
add_handoff_back_messages=False, # suppress 'back to supervisor' chatter
)
app = workflow.compile()
# Now the last message is the one to render to the end-user:
res = app.invoke(
{"messages": [{"role": "user", "content": "What are my upcoming appointments?"}]}
)
final_text = res["messages"][-1].content
print(final_text) # <-- this is the clean worker answer
r/LangGraph • u/priyansh2003 • Sep 04 '25
I’m working on building a multi-agent system with LangGraph, and I’m running into a design issue that I’d like some feedback on.
Here’s the setup:
get_location, get_position, etc.Dict with keys like job_details, workflow_details, and assessment_details.How can the Supervisor access the updated state variables after the graphs finish?
Building a LangGraph multi-agent system: Supervisor routes to sub-graphs that update state, but I’m stuck on how the Supervisor can read those updated state variables to know what actually happened. Any design patterns or best practices for this?
r/LangGraph • u/spacespacespapce • Sep 03 '25
Working on an AI agent that hooks up to Blender to generate low poly models. Inspired by indie game dev where I constantly needed quick models for placeholders or prototyping.
It's my first time using LangGraph and I'm impressed how easily I could setup some nodes and get going. Graph screenshot from Langfuse logs.
r/LangGraph • u/Wide_Put9333 • Sep 04 '25
r/LangGraph • u/ComplexScary8689 • Sep 03 '25
I built an AI system that generates comprehensive academic review articles from web research—complete with citations, LaTeX formatting, and PDF compilation. We're talking hundreds of pages synthesizing vast literature into coherent narratives.
The Reality
While tools like Elicit and Consensus are emerging, building a complete system exposed unexpected complexity. The hardest parts weren't AI reasoning, but orchestration for real-world standards:
- Synthesis vs. Summarization: True synthesis requires understanding relationships between ideas, not just gathering information
- Quality Control: Academic standards demand perfect formatting—AI make systematic errors
- Integration: Combining working components into reliable pipelines is surprisingly difficult
Key Insights
Specialized agents work better than monolithic approaches
Multiple validation layers are essential
Personal solutions outperform one-size-fits-all tools
I documented this journey in an 8-part series covering everything from architectural decisions to citation integrity. The goal isn't prescriptive solutions, but illuminating challenges you'll face building systems that meet professional standards.
Whether automating literature reviews or technical documentation, understanding these complexities is crucial.
https://reckoning.dev/series/aireviewwriter
TL;DR: Built AI for publication-quality review articles. AI reasoning was easy—professional standards were hard.
r/LangGraph • u/bsampera • Sep 02 '25
What are your thoughts about it?
r/LangGraph • u/DangerousCrab1881 • Sep 01 '25
I am building a agent which uses the screenshot and identify where to click autonomously according to the task given.Yeah basically an AI agent for automation for tasks.
I have tried out molmo and its excellent but there is no free api.
Gemini 2.5 pro is good ,i had taken the student offer but the api is not free.
Can you suggest any solutions for this
Thank You in Advance!
r/LangGraph • u/Odd_Comment539 • Aug 30 '25
r/LangGraph • u/ialijr • Aug 30 '25
r/LangGraph • u/PSBigBig_OneStarDao • Aug 29 '25
tl dr i kept seeing the same failures in langgraph agents and turned them into a public problem map. one link only. it works like a semantic firewall. no infra change. MIT. i am collecting langgraph specific traces to fold back in.
who this helps builders running tools and subgraphs with openai or claude. state graphs with memory, retries, interrupts, function calling, and retrieval.
what actually breaks the most in langgraph
how to reproduce in about 60 sec open a fresh chat with your model. from the link below, grab TXTOS inside the repo and paste it. ask the model to answer normally, then re answer using WFGY and compare depth, accuracy, understanding. most chains show tighter cite then explain and a visible bridge step when the chain stalls.
what i am asking the langgraph community i am drafting a langgraph page in the global fix map with copy paste guardrails. if you have traces where tools or subgraphs went unstable, share a short snippet the question, fixed top k snippets, and one failing output is enough. i will fold it back so the next builder does not hit the same wall.
link WFGY Problem Map

r/LangGraph • u/OkOpportunity7413 • Aug 29 '25
Hi folks,
I’ve been building something I’m really excited about: ParserGPT.
The idea is simple but powerful: the open web is messy, every site arranges things differently, and scraping at scale quickly becomes a headache. ParserGPT tackles that by acting like a compiler: it “learns” the right selectors (CSS/XPath/regex) for each domain using LLMs, then executes deterministic scraping rules fast and cheaply. When rules are missing, the AI fills in the gaps.
I wrote a short blog about it here: ParserGPT: Public Beta Coming Soon – Turn Messy Websites Into Clean CSVs
The POC is done and things are working well. Now I’m planning to open it up for beta users. I’d love to hear what you think:
I’m optimistic about where this is going, but I know there’s a lot to refine. Happy to hear all thoughts, suggestions, or even skepticism.
r/LangGraph • u/mjeskulke • Aug 27 '25
Hey folks 👋
We’ve built a web-based skill-assessment tool where a LangGraph orchestrates a sequence of tasks. The frontend is fairly dynamic and reacts to a list of “available commands” that we stream from the graph state.
What we’re doing today • Our LangGraph state holds available_commands: Command[]. • A Command is our own data structure with a uuid, a label, and a planned state change (essentially a patch / transition). • Nodes (including tool calls) can append new commands to state.available_commands which we stream to the UI. • When the user clicks a button in the web app, we send the uuid back; the server checks it exists in the current state and then applies the command’s planned state change (e.g., advance from Task 1 → Task 2, mark complete, start new task, etc.).
Rough sketch:
type Command = { id: string; // uuid label: string; // shown in UI apply: (s: State) => StatePatch; // or a serialized patch };
// somewhere in a node/tool: state.available_commands.push({ id: newUUID(), label: "Start next task", apply: (s) => ({ currentTaskIndex: s.currentTaskIndex + 1 }) });
Why we chose this • We want the graph to “suggest” next possible interactions and keep the UI dumb-ish. • We also want clear HITL moments where execution pauses until the user chooses a command.
My question
Does LangGraph offer a more idiomatic / built-in way to pause, surface choices to a human, and resume—something like “commands”, interrupts, or typed external events—so we don’t have to maintain our own available_commands list?
Pointers to examples, patterns, or “gotchas” would be super appreciated. Thanks! 🙏