惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
爱范儿
爱范儿
罗磊的独立博客
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
Netflix TechBlog - Medium
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
U
Unit 42
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog
H
Help Net Security
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理

LangChain Forum - Topics tagged python-help

Llama-server process has terminated: invalid argument --load-mode with Ollama client 0.32.6 and langchain-ollama 1.1.0 Langchain Certified Agent Engineer Exam - Exam link not received and no response Null-drift: A bare-metal O(1) Memory Store for continuous LangGraph agents Clarification needed: Assistant config vs context and graph initialization Proposal: a small local helper for readable run traces via PR Proxy Authentication Required 407 What is the right way to dynamically create and run a graph? Re-Implement claude code's dynamic workflow using langchian & deepagents How to define a correct state for multi-agent system Response Format Groq Model Pydantic I hope to get some recommendations for practical skills Interrupt does not work correctly in LangGraph The Qwen3.6b model in fireworks through initchatmodel reporting hugely inflated tokens For parallel execution in Node, should i use the functional API? Potential Enhancement: Django-Managed PostgresSaver Pre-interrupt() code re-runs on resume — anti-pattern, or is there a sanctioned way to detect resume? Interrupt parallel branch execution Best practices for self-hosting LangGraph Server OSS without LangGraph keys Dynamically Enabling/Disabling Graphs in a LangGraph Server at Runtime LangGraph thread copy can take 12+ minutes: recommended production pattern? Will DeltaChannel be the default for AgentState.messages, or expected to stay opt-in? Proposal: additional docs for implementing custom DB checkpointers or a guide on generic base checkpointer Prompt_cache_retention: '24h' supported in langchain agents and where to provide it, inside invoke or while creating client? Could RAG pipelines realistically cause deployment timeouts, is Render suitable for first-time RAG deployments? How do I use langchain_postgres' init_vectorstore_table correctly? Proposal: Graph-wide default error handler for StateGraph (fallback for nodes without error_handler) Support timedelta for CachePolicy.ttl, consistent with TimeoutPolicy Anyone confirms this issue that deepagent ui streaming is disturb by update in deepagent or bug issue Best Stack for Building AI Applications Seeking help regarding the connection between Websocket and tool calls
How should I provide an agent to a LangGraph server?
@pawel-tward · 2026-04-23 · via LangChain Forum - Topics tagged python-help
hi @wigging How to Provide an Agent to a LangGraph Server The user’s concern is valid - their global caching is necessary with a plain async factory function, because the server calls the factory for every request , including schema introspection (Studio refresh, get_graph , get_schema ), state reads, and actual execution. Without caching they’d pay the Azure OpenAI + MCP initialization cost on every introspection call. However, there’s a better, officially documented pattern. How the server loads your graph From langgraph_cli/schemas.py , the graphs field supports three forms: Module-level compiled object - imported once at server startup, never called again Async context manager factory - called per-request, receives RunnableConfig (legacy) or ServerRuntime (modern) Async function factory - same as above, but returns instead of yielding The server calls your factory in 4 contexts : threads.create_run (actual execution), threads.update , threads.read (state history, used by Studio’s useStream ), and assistants.read (schema introspection). This is why the caching is needed with a plain factory. The recommended modern pattern: ServerRuntime (server v0.7.30+) From langgraph_sdk/runtime.py : import contextlib from langchain.agents import create_agent from langchain_openai import AzureChatOpenAI from langchain_mcp_adapters.client import MultiServerMCPClient from langgraph_sdk.runtime import ServerRuntime llm = AzureChatOpenAI( azure_deployment="your-deployment", azure_endpoint="https://...", api_version="2024-02-01", ) # Lightweight agent for introspection - no MCP connection needed _base_agent = create_agent(llm, tools=[]) @contextlib.asynccontextmanager async def get_agent(runtime: ServerRuntime): if runtime.execution_runtime: # Only connect to MCP during actual runs async with MultiServerMCPClient({...}) as mcp: tools = await mcp.get_tools() yield create_agent(llm, tools=tools) else: # Schema reads, Studio refresh - skip expensive MCP setup yield _base_agent langgraph.json : { "graphs": { "joker_agent": { "path": "./src/joker_agent.py:get_agent", "description": "Joker agent with Azure OpenAI and MCP tools" } } } Why this is better than the global cache Concern Global cache ServerRuntime factory Avoids re-init on every call Yes (cached) Yes ( execution_runtime guard) Handles MCP disconnects No (connection held forever) Yes (fresh per run, teardown after yield) Skips MCP during introspection No Yes Proper cleanup No Yes (code after yield ) The global caching pattern is fragile for MCP specifically: connections can time out while the server keeps running, and the cached agent won’t reconnect. The ServerRuntime context manager solves this by connecting fresh per execution and tearing down cleanly. When to use each pattern Scenario Recommended pattern No async init (sync tools only) Module-level object: graph = create_agent(...) MCP tools, async resources ServerRuntime async context manager (v0.7.30+) Older server, async resources RunnableConfig async context manager Per-user graph customization ServerRuntime factory using runtime.ensure_user()