Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Wrong graph visualization in studio with the new Command #753

Open
DaniSevAzu opened this issue Dec 21, 2024 · 3 comments
Open

Bug: Wrong graph visualization in studio with the new Command #753

DaniSevAzu opened this issue Dec 21, 2024 · 3 comments

Comments

@DaniSevAzu
Copy link

DaniSevAzu commented Dec 21, 2024

Steps to simulate de bug:

1.- implement the Graph from the new Command documentation example: https://langchain-ai.github.io/langgraphjs/how-tos/command/#define-graph
2.- Open the Studio url witn langgraph up.
3.- The Graph representation is not correct as you can see at the attached image:

CleanShot 2024-12-21 at 19 26 51

@jacoblee93
Copy link
Collaborator

Hey @DaniSevAzu, can you share your graph?

We may need to update the Studio image CC @dqbd

@lakshyaag12
Copy link

This is still occurring on 0.0.35

@dqbd
Copy link
Contributor

dqbd commented Jan 17, 2025

Hello! @jacoblee93 managed to replicate the issue using this graph

import { Annotation, Command, StateGraph } from "@langchain/langgraph";


const StateAnnotation = Annotation.Root({  foo: Annotation<string> });

const nodeA = async (_state: typeof StateAnnotation.State) => {
  console.log("Called A");
  const goto = Math.random() > 0.5 ? "nodeB" : "nodeC";
  return new Command({
    update: { foo: "a" },
    goto,
  });
};

const nodeB = async (state: typeof StateAnnotation.State) => {
  return { foo: state.foo + "|b" };
};

const nodeC = async (state: typeof StateAnnotation.State) => {
  return { foo: state.foo + "|c" };
};

export const graph = new StateGraph(StateAnnotation)
  .addNode("nodeA", nodeA, { ends: ["nodeB", "nodeC"] })
  .addNode("nodeB", nodeB)
  .addNode("nodeC", nodeC)
  .addEdge("__start__", "nodeA")
  .compile();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants