# Information is not passing in Supervisor agent

**URL:** <https://forum.langchain.com/t/information-is-not-passing-in-supervisor-agent/997>\
**Category:** LangGraph\
**Tags:** python-help\
**Created:** [August 7, 2025, 12:15pm UTC](https://forum.langchain.com/t/information-is-not-passing-in-supervisor-agent/997 "2025-08-07T12:15:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IamExperimenting](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/iamexperimenting/32/279_2.png) [@IamExperimenting](https://forum.langchain.com/u/IamExperimenting)\
**Post date:** [August 7, 2025, 12:15pm UTC](https://forum.langchain.com/t/information-is-not-passing-in-supervisor-agent/997/1 "2025-08-07T12:15:22Z")

</div>

I’m building data analyst agent using Supervisor architecture. I want to provide multi-step task to supervisor, supervisor wants to call relevant agents and tools to complete the task.

```auto
from typing import Annotated
import os, pandas as pd, json, numpy as np
from dotenv import load_dotenv
load_dotenv()
import matplotlib.pyplot as plt
from langchain_openai import AzureChatOpenAI
from langgraph.graph import StateGraph, START, END, MessagesState
from langgraph.graph.message import add_messages
from langgraph.checkpoint.memory import MemorySaver
from langchain_core.tools import InjectedToolCallId, tool
from langchain_core.messages import ToolMessage
from langgraph.prebuilt import create_react_agent
from langchain.core.messages import convert_to_messages

memory = MemorySaver()

class CustomState(MessagesState):
    input_data : pd.DataFrame
    preprocessed_data : pd.DataFrame

def read_data_func(csv_path: str, tool_call_id: Annotated[str, InjectedToolCallId]):
    """This function read a csv file from a given location."""
    df = pd.read_csv(csv_path)
    return Command(update={"messages:[ToolMessage(df.to_json(), tool_call_id=tool_call_id)],
    "input_data" : df.to_json()
    })

def preprocess_func(state: MessagesState, tool_call_id: Annotated[str, InjectedToolCallId]):
    """This function preprocess a given dataframe."""
    state_dict = json.loads(state['input_data'])
    df = pd.DataFrames(state_dict)
    df = df[['col1', 'col2']]
    return Command(update={"messages:[ToolMessage(df.to_json(), tool_call_id=tool_call_id)],
    "input_data" : df.to_json()
    })

preprocess_agent = create_react_agent(
    model="openai:gpt-4.1",
    tools=[read_data_func, preprocess_func],
    prompt=(
        "You are a preprocessor agent.\n\n"
        "INSTRUCTIONS:\n"
        "- Assist ONLY with preprocessing-related tasks\n"
        "- After you're done with your tasks, respond to the supervisor directly\n"
        "- Respond ONLY with the results of your work, do NOT include ANY other text."
    ),
    name="preprocess_agent",
)

def graph_gen_func(state: MessagesState, tool_call_id: Annotated[str, InjectedToolCallId]):
    state_dict = json.loads(state['input_data'])
    df = pd.DataFrames(state_dict)
    df.set_index('time_stamp', inplace=True)
    plt.figure(figsize=(12,6))
    plt.plot(df.index, df['data_points'],marker='o')
    plt.xlabel('timestamp')
    plt.ylabel('data_points')
    plt.title('timeseries graph')
    plt.grid(True)
    plt.tight_layout()
    plt.show()

graph_generation_agent = create_react_agent(
    model="openai:gpt-4.1",
    tools=[graph_gen_func],
    prompt=(
        "You are a graph generation agent.\n\n"
        "INSTRUCTIONS:\n"
        "- Assist ONLY with garph plotting-related tasks\n"
        "- After you're done with your tasks, respond to the supervisor directly\n"
        "- Respond ONLY with the results of your work, do NOT include ANY other text."
    ),
    name="graph_generation_agent ",
)

from langgraph_supervisor import create_supervisor

supervisor = create_superviso(
    model="openai:gpt-4.1",
    agents=[preprocess_agent, graph_generation_agent],
    prompt=(
        "You are a supervisor managing two agent.\n\n"
         "- a preprocess agent. Assign preprocessing-related tasks to this agent\n"
        "- a graph generation agent. Assign graph plotting-related tasks to this agent\n"
        "Assign work to one agent at a time, do not call agents in parallel.\n"
        "Do not do any work yourself."
    ),
    add_handoff_back_messages=True,
    output_mode = "full_history"
).compile()

for chunk in supervisor.stream(
    {
        "messages": [
            {
                "role": "user",
                "content": "can you please read the file ../data/income_data.csv?",
            }
        ]
    },
):
    pretty_print_messages(chunk, last_message=True)

final_message_history = chunk["supervisor"]["messages"]

for chunk in supervisor.stream(
    {
        "messages": [
            {
                "role": "user",
                "content": "can you please preprocess the given data?",
            }
        ]
    },
):
    pretty_print_messages(chunk, last_message=True)

final_message_history = chunk["supervisor"]["messages"]

for chunk in supervisor.stream(
    {
        "messages": [
            {
                "role": "user",
                "content": "can you please plot graph using preprocessed data?",
            }
        ]
    },
):
    pretty_print_messages(chunk, last_message=True)

final_message_history = chunk["supervisor"]["messages"]

```

Here, I’m not able to pass information from one tool to other tools and from one agent to other agent. can you please help me? @marco

---

<div class="post-metadata">

**Author:** ![IamExperimenting](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/iamexperimenting/32/279_2.png) [@IamExperimenting](https://forum.langchain.com/u/IamExperimenting)\
**Post date:** [August 12, 2025, 1:21pm UTC](https://forum.langchain.com/t/information-is-not-passing-in-supervisor-agent/997/2 "2025-08-12T13:21:50Z")

</div>

hi @marco can you please help me to fix this?

---

<div class="post-metadata">

**Author:** ![MartijnLeplae](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/martijnleplae/32/664_2.png) [@MartijnLeplae](https://forum.langchain.com/u/MartijnLeplae)\
**Post date:** [August 20, 2025, 2:52pm UTC](https://forum.langchain.com/t/information-is-not-passing-in-supervisor-agent/997/3 "2025-08-20T14:52:12Z")

</div>

Could you share traces of LangSmith when executing this code?  
I think a good check would be to see if the output of the first tool-call is still in the message history when the second message streamed.

At first sight I would think you still need to provide the `final_message_history` to the `invoke` and not only the new message.
