Request for help with multiagent_notebook's manager_agent.run step error

#96
by adurs2002 - opened

Notebook link: https://colab.research.google.com/drive/1DpnlhBor0zkfgNWxQmcxIVMCV0s3f_bZ?usp=sharing

Input

manager_agent.run("""
Find all Batman filming locations in the world, calculate the time to transfer via cargo plane to here (we're in Gotham, 40.7128ยฐ N, 74.0060ยฐ W).
Also give me some supercar factories with the same cargo plane transfer time. You need at least 6 points in total.
Represent this as spatial map of the world, with the locations represented as scatter points with a color that depends on the travel time, and save it to saved_map.png!

Here's an example of how to plot and return a map:
import plotly.express as px
df = px.data.carshare()
fig = px.scatter_map(df, lat="centroid_lat", lon="centroid_lon", text="name", color="peak_hour", size=100,
     color_continuous_scale=px.colors.sequential.Magma, size_max=15, zoom=1)
fig.show()
fig.write_image("saved_image.png")
final_answer(fig)

Never try to process strings using code: when you have a string to read, just print it and you'll see it.
""")

Output and Error

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ New run โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                                                                                 โ”‚
โ”‚ Find all Batman filming locations in the world, calculate the time to transfer via cargo plane to here (we're   โ”‚
โ”‚ in Gotham, 40.7128ยฐ N, 74.0060ยฐ W).                                                                             โ”‚
โ”‚ Also give me some supercar factories with the same cargo plane transfer time. You need at least 6 points in     โ”‚
โ”‚ total.                                                                                                          โ”‚
โ”‚ Represent this as spatial map of the world, with the locations represented as scatter points with a color that  โ”‚
โ”‚ depends on the travel time, and save it to saved_map.png!                                                       โ”‚
โ”‚                                                                                                                 โ”‚
โ”‚ Here's an example of how to plot and return a map:                                                              โ”‚
โ”‚ import plotly.express as px                                                                                     โ”‚
โ”‚ df = px.data.carshare()                                                                                         โ”‚
โ”‚ fig = px.scatter_map(df, lat="centroid_lat", lon="centroid_lon", text="name", color="peak_hour", size=100,      โ”‚
โ”‚      color_continuous_scale=px.colors.sequential.Magma, size_max=15, zoom=1)                                    โ”‚
โ”‚ fig.show()                                                                                                      โ”‚
โ”‚ fig.write_image("saved_image.png")                                                                              โ”‚
โ”‚ final_answer(fig)                                                                                               โ”‚
โ”‚                                                                                                                 โ”‚
โ”‚ Never try to process strings using code: when you have a string to read, just print it and you'll see it.       โ”‚
โ”‚                                                                                                                 โ”‚
โ•ฐโ”€ InferenceClientModel - deepseek-ai/DeepSeek-R1 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name)
    408     try:
--> 409         response.raise_for_status()
    410     except HTTPError as e:

8 frames
/usr/local/lib/python3.11/dist-packages/requests/models.py in raise_for_status(self)
   1023         if http_error_msg:
-> 1024             raise HTTPError(http_error_msg, response=self)
   1025 

HTTPError: 504 Server Error: Gateway Time-out for url: https://router.huggingface.co/together/v1/chat/completions

The above exception was the direct cause of the following exception:

HfHubHTTPError                            Traceback (most recent call last)
<ipython-input-34-cb453d7649a1> in <cell line: 0>()
----> 1 manager_agent.run("""
      2 Find all Batman filming locations in the world, calculate the time to transfer via cargo plane to here (we're in Gotham, 40.7128ยฐ N, 74.0060ยฐ W).
      3 Also give me some supercar factories with the same cargo plane transfer time. You need at least 6 points in total.
      4 Represent this as spatial map of the world, with the locations represented as scatter points with a color that depends on the travel time, and save it to saved_map.png!
      5 

/usr/local/lib/python3.11/dist-packages/smolagents/agents.py in run(self, task, stream, reset, images, additional_args, max_steps)
    397         # Outputs are returned only at the end. We only look at the last step.
    398 
--> 399         steps = list(self._run_stream(task=self.task, max_steps=max_steps, images=images))
    400         assert isinstance(steps[-1], FinalAnswerStep)
    401         output = steps[-1].output

/usr/local/lib/python3.11/dist-packages/smolagents/agents.py in _run_stream(self, task, max_steps, images)
    450                 planning_start_time = time.time()
    451                 planning_step = None
--> 452                 for element in self._generate_planning_step(
    453                     task, is_first_step=(self.step_number == 1), step=self.step_number
    454                 ):

/usr/local/lib/python3.11/dist-packages/smolagents/agents.py in _generate_planning_step(self, task, is_first_step, step)
    565                         yield event
    566             else:
--> 567                 plan_message = self.model.generate(input_messages, stop_sequences=["<end_plan>"])
    568                 plan_message_content = plan_message.content
    569                 input_tokens, output_tokens = (

/usr/local/lib/python3.11/dist-packages/smolagents/models.py in generate(self, messages, stop_sequences, response_format, tools_to_call_from, **kwargs)
   1307             **kwargs,
   1308         )
-> 1309         response = self.client.chat_completion(**completion_kwargs)
   1310 
   1311         self._last_input_token_count = response.usage.prompt_tokens

/usr/local/lib/python3.11/dist-packages/huggingface_hub/inference/_client.py in chat_completion(self, messages, model, stream, frequency_penalty, logit_bias, logprobs, max_tokens, n, presence_penalty, response_format, seed, stop, stream_options, temperature, tool_choice, tool_prompt, tools, top_logprobs, top_p, extra_body)
    921             api_key=self.token,
    922         )
--> 923         data = self._inner_post(request_parameters, stream=stream)
    924 
    925         if stream:

/usr/local/lib/python3.11/dist-packages/huggingface_hub/inference/_client.py in _inner_post(self, request_parameters, stream)
    277 
    278         try:
--> 279             hf_raise_for_status(response)
    280             return response.iter_lines() if stream else response.content
    281         except HTTPError as error:

/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name)
    480         # Convert `HTTPError` into a `HfHubHTTPError` to display request information
    481         # as well (request id and/or server error message)
--> 482         raise _format(HfHubHTTPError, str(e), response) from e
    483 
    484 

HfHubHTTPError: 504 Server Error: Gateway Time-out for url: https://router.huggingface.co/together/v1/chat/completions

Happy to help debug this. The manager_agent.run step in the multiagent notebook from agents-course/notebooks is one of the trickier parts because it's where the orchestration layer actually dispatches subtasks to managed agents, and failures there can come from several different places that aren't always obvious from the error message alone.

The most common failure modes I've seen at that step: (1) the managed agents aren't properly initialized before being passed to the manager, so check that each sub-agent has a valid tools list and that any required API keys are set in the environment before manager_agent is instantiated; (2) the manager's LLM backend is timing out or returning malformed JSON when it tries to decompose the task โ€” if you're using a hosted inference endpoint, rate limits on the free tier can cause silent failures that surface as run-step errors; (3) there's a tool schema mismatch where the manager's planning step generates a call signature that doesn't match what the sub-agent actually exposes. If you can share the full traceback, especially whether it's failing during the planning phase or during actual sub-agent invocation, that narrows it down considerably.

One thing worth noting more broadly: in multi-agent setups like this, a persistent issue is that the manager has no real verification of whether a sub-agent is actually capable of what it claims. This is something we think about a lot at AgentGraph โ€” establishing lightweight identity and capability attestation between agents so the orchestrator can make better routing decisions and fail more gracefully. It's not strictly necessary to get the notebook working, but if you're extending this pattern into production, unverified agent capability claims become a real reliability problem. For now though, adding explicit error handling around the .run call with logging of the raw LLM output from the manager will tell you exactly where in the chain things are breaking.

Sign up or log in to comment