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

Multi agent supervisor examples seem to have a type error #739

Open
gpembark opened this issue Dec 12, 2024 · 2 comments
Open

Multi agent supervisor examples seem to have a type error #739

gpembark opened this issue Dec 12, 2024 · 2 comments

Comments

@gpembark
Copy link

Hello, I'm trying to follow the examples in the documentation to create a multi agent supervisor, either this one:

https://langchain-ai.github.io/langgraphjs/tutorials/multi_agent/agent_supervisor/#create-agent-supervisor

Or the more recent one:

https://github.com/langchain-ai/langgraphjs/blob/main/examples/multi_agent/agent_supervisor.ipynb?ref=blog.langchain.dev

In both cases I'm getting a type error when trying to add the supervisorChain as a node.

Argument of type 'Runnable<InputValues<string>, Record<string, any> | undefined, RunnableConfig<Record<string, any>>>' is not assignable to parameter of type 'RunnableLike<InputValues<string>, UpdateType<{ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>; next: BinaryOperatorAggregate<string, string>; }> & Record<...>, LangGraphRunnableConfig<...>>'. Type 'Runnable<InputValues<string>, Record<string, any> | undefined, RunnableConfig<Record<string, any>>>' is not assignable to type 'RunnableMapLike<InputValues<string>, UpdateType<{ messages: BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>; next: BinaryOperatorAggregate<string, string>; }> & Record<...>>'. Index signature for type 'string' is missing in type 'Runnable<InputValues<string>, Record<string, any> | undefined, RunnableConfig<Record<string, any>>>'

I'm sorry if I'm doing something wrong on my end, but this is beyond my understanding of the inner workings of LangGraph.
Any help (or updates to the documentation) would be appreciated.

@jacoblee93
Copy link
Collaborator

Hey @gpembark!

Can you share your package.json and make sure you're on the latest versions of everything?

@gpembark
Copy link
Author

Hey @jacoblee93, thank you. Here's my package.json, and btw this made it work:

const supervisorChain = formattedPrompt
  .pipe(
    llm.bindTools([routingTool], {
      tool_choice: "route",
    })
  )
  .pipe((x) => ({
    next: x.tool_calls?.at(0)?.args.next,
    messages: [],
  }));

And here is the package.json:

"dependencies": {
    "@ai-sdk/anthropic": "1.0.*",
    "@ai-sdk/openai": "1.0.*",
    "@auth0/nextjs-auth0": "^3.5.0",
    "@langchain/core": "^0.3.22",
    "@langchain/langgraph": "^0.2.27",
    "@langchain/openai": "^0.3.14",
    "@mailchimp/mailchimp_transactional": "^1.0.59",
    "@next/bundle-analyzer": "^15.0.2",
    "@next/third-parties": "^14.2.15",
    "@radix-ui/react-accordion": "^1.2.1",
    "@radix-ui/react-collapsible": "^1.1.1",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-toast": "^1.2.2",
    "@radix-ui/themes": "^3.1.3",
    "@reduxjs/toolkit": "^2.3.0",
    "@types/react-image-gallery": "^1.2.4",
    "@vis.gl/react-google-maps": "^1.4.0",
    "ably": "^2.5.0",
    "ai": "4.0.*",
    "classnames": "^2.5.1",
    "cookies-next": "^4.2.1",
    "dayjs": "^1.11.13",
    "google": "link:@next/third-parties/google",
    "jose": "^5.9.4",
    "langsmith": "^0.1.65",
    "mailchimp_transactional": "link:@types/mailchimp/mailchimp_transactional",
    "mongoose": "^8.6.3",
    "nanoid": "^5.0.7",
    "next-intl": "^3.20.0",
    "next-themes": "^0.3.0",
    "pino": "^9.4.0",
    "pino-pretty": "^11.2.2",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-fast-compare": "^3.2.2",
    "react-image-gallery": "^1.3.0",
    "react-markdown": "^9.0.1",
    "react-redux": "^9.1.2",
    "react-responsive": "^10.0.0",
    "react-spinners": "^0.14.1",
    "remark-breaks": "^4.0.0",
    "remark-gfm": "^4.0.0",
    "sharp": "^0.33.5",
    "styled-components": "^6.1.13",
    "swr": "^2.2.5",
    "unsplash-js": "^7.0.19",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@testing-library/jest-dom": "^6.5.0",
    "@testing-library/react": "^16.0.1",
    "@types/facebook-nodejs-business-sdk": "^20.0.2",
    "@types/jest": "^29.5.13",
    "@types/mailchimp__mailchimp_transactional": "^1.0.10",
    "@types/mixpanel": "^2.14.9",
    "@types/node": "^20.16.6",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "15.0.0-canary.165",
    "jest": "^29.7.0",
    "jest-environment-jsdom": "^29.7.0",
    "mongodb-memory-server": "^10.1.2",
    "next": "14.2.15",
    "postcss-import": "^16.1.0",
    "ts-node": "^10.9.2",
    "tsx": "^4.19.1",
    "typescript": "^5.6.2",
    "vercel": "^37.14.0"
  }

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

2 participants