What happened?
Multi-agent orchestrator agents work correctly through the LibreChat web UI but fail with a 500 error when called through the Agents API endpoints (/api/agents/v1/chat/completions and
/api/agents/v1/responses).
Error:
Error: Found edge ending at unknown node agent_q3Yf1J3NqKONncExJKt0F
at StateGraph.validate (node_modules/@langchain/langgraph/dist/graph/graph.cjs:317:23)
at StateGraph.compile (node_modules/@langchain/langgraph/dist/graph/state.cjs:398:14)
at MultiAgentGraph.createWorkflow (node_modules/@librechat/agents/dist/cjs/graphs/MultiAgentGraph.cjs:907:24)
at Run.createMultiAgentGraph (node_modules/@librechat/agents/dist/cjs/run.cjs:126:32)
at Run.create (node_modules/@librechat/agents/dist/cjs/run.cjs:136:16)
Root cause:
The UI path (api/server/services/Endpoints/agents/initialize.js, ~lines 170-240) performs BFS edge discovery via createEdgeCollector(), loading and initializing all sub-agents referenced in the
orchestrator's edges before passing the full agents array to createRun().
The API controllers (api/server/controllers/agents/openai.js and responses.js) skip this entirely. They only load the primary agent and pass agents: [primaryConfig] to createRun(). However, the
primary agent's edges still reference sub-agent IDs. When createRun() detects edges, it sets the graph type to multi-agent and builds a MultiAgentGraph. The graph builder only adds nodes for agents
in the array (just the primary), but the edges point to sub-agent IDs that were never registered as nodes. StateGraph.validate() then fails.
Environment:
- LibreChat version: 0.8.4
- Node.js: 20.20.1
- Deployment: Kubernetes
Version Information
Environment:
- LibreChat version: 0.8.4
- Node.js: 20.20.1
- Deployment: Kubernetes
Steps to Reproduce
Steps to reproduce:
- Create a multi-agent orchestrator (Agent A) that delegates to sub-agents (Agent B, Agent C) via edges
- Verify it works through the LibreChat web UI
- Call Agent A through the Agents API:
POST /api/agents/v1/chat/completions
Authorization: Bearer <api_key>
{"model": "<agent_a_id>", "messages": [{"role": "user", "content": "Hello"}], "stream": true}
- Returns HTTP 500 with the Found edge ending at unknown node error
What browsers are you seeing the problem on?
No response
Relevant log output
Error: Found edge ending at unknown node `agent_q3Yf1J3NqKONncExJKt0F`
at StateGraph.validate (node_modules/@langchain/langgraph/dist/graph/graph.cjs:317:23)
at StateGraph.compile (node_modules/@langchain/langgraph/dist/graph/state.cjs:398:14)
at MultiAgentGraph.createWorkflow (node_modules/@librechat/agents/dist/cjs/graphs/MultiAgentGraph.cjs:907:24)
at Run.createMultiAgentGraph (node_modules/@librechat/agents/dist/cjs/run.cjs:126:32)
at Run.create (node_modules/@librechat/agents/dist/cjs/run.cjs:136:16)
Screenshots
No response
Code of Conduct
What happened?
Multi-agent orchestrator agents work correctly through the LibreChat web UI but fail with a 500 error when called through the Agents API endpoints (/api/agents/v1/chat/completions and
/api/agents/v1/responses).
Error:
Error: Found edge ending at unknown node
agent_q3Yf1J3NqKONncExJKt0Fat StateGraph.validate (node_modules/@langchain/langgraph/dist/graph/graph.cjs:317:23)
at StateGraph.compile (node_modules/@langchain/langgraph/dist/graph/state.cjs:398:14)
at MultiAgentGraph.createWorkflow (node_modules/@librechat/agents/dist/cjs/graphs/MultiAgentGraph.cjs:907:24)
at Run.createMultiAgentGraph (node_modules/@librechat/agents/dist/cjs/run.cjs:126:32)
at Run.create (node_modules/@librechat/agents/dist/cjs/run.cjs:136:16)
Root cause:
The UI path (api/server/services/Endpoints/agents/initialize.js, ~lines 170-240) performs BFS edge discovery via createEdgeCollector(), loading and initializing all sub-agents referenced in the
orchestrator's edges before passing the full agents array to createRun().
The API controllers (api/server/controllers/agents/openai.js and responses.js) skip this entirely. They only load the primary agent and pass agents: [primaryConfig] to createRun(). However, the
primary agent's edges still reference sub-agent IDs. When createRun() detects edges, it sets the graph type to multi-agent and builds a MultiAgentGraph. The graph builder only adds nodes for agents
in the array (just the primary), but the edges point to sub-agent IDs that were never registered as nodes. StateGraph.validate() then fails.
Environment:
Version Information
Environment:
Steps to Reproduce
Steps to reproduce:
POST /api/agents/v1/chat/completions
Authorization: Bearer <api_key>
{"model": "<agent_a_id>", "messages": [{"role": "user", "content": "Hello"}], "stream": true}
What browsers are you seeing the problem on?
No response
Relevant log output
Error: Found edge ending at unknown node `agent_q3Yf1J3NqKONncExJKt0F` at StateGraph.validate (node_modules/@langchain/langgraph/dist/graph/graph.cjs:317:23) at StateGraph.compile (node_modules/@langchain/langgraph/dist/graph/state.cjs:398:14) at MultiAgentGraph.createWorkflow (node_modules/@librechat/agents/dist/cjs/graphs/MultiAgentGraph.cjs:907:24) at Run.createMultiAgentGraph (node_modules/@librechat/agents/dist/cjs/run.cjs:126:32) at Run.create (node_modules/@librechat/agents/dist/cjs/run.cjs:136:16)Screenshots
No response
Code of Conduct