Skip to content

Migrate multi-agent cookbooks to modern smolagents API (Fixes #316, #291) - #378

Closed
ahmedshahrukhali wants to merge 1 commit into
huggingface:mainfrom
ahmedshahrukhali:fix/smolagents-multiagent-recipes
Closed

ahmedshahrukhali wants to merge 1 commit into
huggingface:mainfrom
ahmedshahrukhali:fix/smolagents-multiagent-recipes

Conversation

@ahmedshahrukhali

Copy link
Copy Markdown

What does this PR do?

In smolagents >= 1.8.0, the ManagedAgent wrapper class was deprecated and removed. Modern smolagents configures sub-agents by defining their name and description directly on the agent instance and passing them directly into managed_agents=[...].

Because of this removal, running these multi-agent recipes resulted in:

ImportError: cannot import name 'ManagedAgent' from 'smolagents'

This PR migrates all three multi-agent cookbooks to the modern smolagents API:

  1. notebooks/en/multiagent_web_assistant.ipynb (Fixes Execution Error in Agents recipes #316):
    • Removed ManagedAgent from imports.
    • Assigned name and description directly to web_agent.
    • Passed web_agent directly into manager_agent's managed_agents.
    • Updated introductory markdown to describe direct sub-agent delegation.
  2. notebooks/en/mongodb_smolagents_multi_micro_agents.ipynb (Fixes mongodb_smolagents_multi_micro_agents.ipynb #291):
    • Removed ManagedAgent from imports.
    • Defined name and description directly on inventory_agent, order_agent, and delivery_agent.
    • Passed the sub-agent instances directly into self.managed_agents.
  3. notebooks/en/multiagent_rag_system.ipynb:
    • Removed ManagedAgent from imports and wrapper instantiations.
    • Assigned name and description directly to web_agent, retriever_agent, and image_generation_agent.
    • Passed the sub-agents directly into manager_agent's managed_agents.
    • Updated intermediate markdown cells explaining the pattern.

Fixes #316
Fixes #291

Who can review?

@merveenoyan @stevhliu

…ggingface#316, huggingface#291)

In smolagents >= 1.8.0, ManagedAgent was removed in favor of configuring sub-agents directly with name and description and passing them into managed_agents.

Fixes huggingface#316

Fixes huggingface#291
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ahmedshahrukhali
ahmedshahrukhali marked this pull request as draft September 28, 2026 18:15
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

Successfully merging this pull request may close these issues.

Execution Error in Agents recipes mongodb_smolagents_multi_micro_agents.ipynb

1 participant