The MultiStepAgent base class supports multi-agent hierarchies through its managed_agents parameter. Any agent can act as an orchestrator by receiving a list of sub-agents; each sub-agent is exposed to the parent as a callable tool with a standardised signature (task: str, additional_args: object).
Agents can be serialised to disk (agent.save(output_dir)) or pushed to a Hugging Face Hub Space repo (agent.push_to_hub(repo_id)). The save format produces:
agent.json— model + tool + metadata dictprompts.yaml— all prompt templatestools/<name>.py— one file per toolmanaged_agents/<name>/— recursively saved sub-agentsapp.py— auto-generated Gradio UI entry pointrequirements.txt— inferred from tool imports
Loading is via MultiStepAgent.from_hub(repo_id, trust_remote_code=True) or MultiStepAgent.from_folder(path).
src/smolagents/agents.py