Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cockpit/chat/a2ui/python/src/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,11 @@ async def generate_title(state: MessagesState, config) -> dict:
thread_id = (config.get("configurable") or {}).get("thread_id")
if not thread_id:
return {}
sdk_url = os.environ.get("LANGGRAPH_API_URL", "http://localhost:2024")
# url=None lets the SDK use its in-process ASGI transport when the
# call originates from inside a LangGraph server graph (always the
# case here). The old fallback to localhost:2024 forced an HTTP
# round-trip that fails on the prod runtime container. See PR #493.
sdk_url = os.environ.get("LANGGRAPH_API_URL")
try:
client = get_client(url=sdk_url)
thread = await client.threads.get(thread_id)
Expand Down
7 changes: 6 additions & 1 deletion cockpit/chat/threads/python/src/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ async def generate_title(state: MessagesState, config) -> dict:
thread_id = (config.get("configurable") or {}).get("thread_id")
if not thread_id:
return {}
sdk_url = os.environ.get("LANGGRAPH_API_URL", "http://localhost:2024")
# url=None lets the SDK use its in-process ASGI transport when the
# call originates from inside a LangGraph server graph (always the
# case here). The old fallback to localhost:2024 forced an HTTP
# round-trip that fails on the prod runtime container. See PR #492
# for the diagnosis trail.
sdk_url = os.environ.get("LANGGRAPH_API_URL")
try:
client = get_client(url=sdk_url)
thread = await client.threads.get(thread_id)
Expand Down
10 changes: 9 additions & 1 deletion examples/chat/python/src/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,15 @@ async def _maybe_write_thread_title(state: "State", config: RunnableConfig) -> d
"""
global _threads_client
thread_id = (config.get("configurable") or {}).get("thread_id")
sdk_url = os.environ.get("LANGGRAPH_API_URL", "http://localhost:2024")
# url=None lets the SDK use its in-process ASGI transport when the
# call originates from inside a LangGraph server graph (which is
# always the case here). The old fallback to http://localhost:2024
# PREVENTED that path: it always forced an HTTP round-trip to a
# port that doesn't exist on the prod runtime container (it does
# locally because `langgraph dev` listens on 2024 — which is why
# this only broke in prod). LANGGRAPH_API_URL is only honoured
# when explicitly set, e.g. for cross-process callbacks.
sdk_url = os.environ.get("LANGGRAPH_API_URL")
if not isinstance(thread_id, str) or not thread_id:
return {"skipped": "no thread_id in config"}

Expand Down