Hello!! I am running into the most silly of the problems: I am not making Command work at all
// index.ts
import { Annotation, Command, END, START, StateGraph } from "@langchain/langgraph";
export const main = async () => {
const agent = new StateGraph(Annotation.Root({}))
.addNode("node1", (): Command => {
console.log('Node 1: Starting execution');
// Send command to jump to end
return new Command({ goto: END });
}, { ends: [END] })
.addNode("node2", async () => {
console.log('Node 2: Starting execution');
})
.addNode("node3", async () => {
console.log('Node 3: Starting execution');
})
.addNode("node4", async () => {
console.log('Node 4: Starting execution');
})
// Start with node1
.addEdge(START, "node1")
// Normal flow: node1 -> node2 -> node3 -> node4 -> END
.addEdge("node1", "node2")
.addEdge("node2", "node3")
.addEdge("node3", "node4")
.addEdge("node4", END)
.compile();
return agent.invoke({});
};
main();
my package.json
{
"name": "playground",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "",
"license": "ISC",
"dependencies": {
"@langchain/langgraph": "^1.0.1"
}
}
also tried with "@langchain/langgraph": "^0.4.5" to no success
Anyone else seeing this??