langgraph/tutorials/multi_agent/multi-agent-collaboration/ Bedrock multiagent support #952
-
Hi everyone, I have been trying to implement the tutorial for multiagent on claude using AWS bedrock but I am getting the following error when agent 1 tries to pass information to agent 2.
Is bedrock not supported by langgraph's multimodel agent? Or am I doing something wrong here? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
The graph used in this example seems to send an assistant message as the final message, which Bedrock does not support. So the exact graph used in this example is not supported at the moment, but you can probably modify the graph slightly to avoid this and make it work |
Beta Was this translation helpful? Give feedback.
-
`from langchain_core.messages import ( llm = ChatBedrockConverse( llm = ChatOpenAI(model="gpt-4-1106-preview")def create__generation_agent(llm, tools, system_message: str): def create_reviewer_agent(llm, tools, system_message: str): This defines the object that is passed between each nodein the graph. We will create different nodes for each agent and toolclass AgentState(TypedDict): import functools from langchain_core.messages import AIMessage Helper function to create a node for a given agentdef agent_node(state, agent, name): Research agent and nodegenerator_agent = create__generation_agent( chart_generatorreviewer_agent = create_reviewer_agent( from typing import Literal def router(state) -> Literal["call_tool", "end", "continue"]: workflow = StateGraph(AgentState) workflow.add_node("generator", generator_node) workflow.add_conditional_edges( workflow.add_conditional_edges( events = graph.stream( when calling the Converse operation: A conversation must alternate between user and assistant roles. Make sure the conversation alternates between user and assistant roles and try again. i got this error ? |
Beta Was this translation helpful? Give feedback.
I am able to continue with the following "work-around" - instead of always wrapping the result as AIMessage, we wrap it only when it's a result with tool_calls. Can you try on your end @invalidexplorer ?