Someone asked a question in the Slack in #langgraph-help here that went unanswered. I thought it was interesting to dig into to learn a bit more about LangGraph Studio. Posting Ricardo’s original questions here along with the original screenshots he provided:
Original questions
I’m trying to run this example locally: langgraphjs/examples/multi_agent/agent_supervisor.ipynb at main · langchain-ai/langgraphjs · GitHub and I have a few questions:
- Why cant I use the chat tab when I have the following Agent state?
const AgentState = Annotation.Root({
messages: Annotation<BaseMessage[]>({
reducer: (x, y) => x.concat(y),
default: () => [],
}),
// The agent node that last performed work
next: Annotation<string>({
reducer: (x, y) => y ?? x ?? END,
default: () => END,
}),
});
- What are those extra nodes?
- Why can’t I just see a way to input a simple HumanMessage?
- Why do I see this typescript error? I copied the exact code that its in the example
Proposed answers
- The
AgentState
defined in this example has additional fields beyond justmessages
(e.g.next
). The chat tab in LangGraph Studio is only available for graphs where chat is the main interface and the entire state is basically focused on chat history. - The
researcherAgent
and thechartGenAgent
are built using thecreateReactAgent
prebuilt and are not normal functions. So when LangGraph Studio runs it sees that these nodes are ReAct agents and tool calls and LLM calls get visualized in the studio because these are ordinary nodes. The “3,” “4,” and “5” nodes are just created during runtime as numbers because they are not explicitly created with.addNode
but LangGraph studio still tries to visualize what’s inside these ReAct agents. - This goes back to the way
AgentState
is constructed. It needs bothmessages
andnext
. In this case, the first message doesn’t requirenext
field but if you were to provide a simple string, the graph wouldn’t know if it should be thecontent
in theHumanMessage
or whattype
it should be. Since this supervisor example isn’t a simple chat experience, the required human input has to be the json object that the state schema requires. - Couldn’t figure out the solution for this error.