Remove ManagedAgent from doc (#563)

This commit is contained in:
Aymeric Roucher 2025-02-13 11:21:39 +01:00 committed by GitHub
parent b20da6a747
commit 3316dd7b11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 11 deletions

View File

@ -358,7 +358,8 @@ It empirically yields better performance on most benchmarks. The reason for this
You can easily build hierarchical multi-agent systems with `smolagents`. You can easily build hierarchical multi-agent systems with `smolagents`.
To create a managed agent, give your `CodeAgent` or `ToolCallingAgent` the attributes `name` and `description` - these are mandatory to make the agent callable by its manager agent. The manager agent will receive the managed agent via its managed_agents argument during initialization. To do so, just ensure your agent has `name` and`description` attributes, which will then be embedded in the manager agent's system prompt to let it know how to call this managed agent, as we also do for tools.
Then you can pass this managed agent in the parameter managed_agents upon initialization of the manager agent.
Here's an example of making an agent that managed a specific web search agent using our [`DuckDuckGoSearchTool`]: Here's an example of making an agent that managed a specific web search agent using our [`DuckDuckGoSearchTool`]:
@ -367,7 +368,7 @@ from smolagents import CodeAgent, HfApiModel, DuckDuckGoSearchTool
model = HfApiModel() model = HfApiModel()
managed_web_agent = CodeAgent( web_agent = CodeAgent(
tools=[DuckDuckGoSearchTool()], tools=[DuckDuckGoSearchTool()],
model=model, model=model,
name="web_search", name="web_search",
@ -375,7 +376,7 @@ managed_web_agent = CodeAgent(
) )
manager_agent = CodeAgent( manager_agent = CodeAgent(
tools=[], model=model, managed_agents=[managed_web_agent] tools=[], model=model, managed_agents=[web_agent]
) )
manager_agent.run("Who is the CEO of Hugging Face?") manager_agent.run("Who is the CEO of Hugging Face?")

View File

@ -42,10 +42,9 @@ Agents और tools के बारे में अधिक जानने
[[autodoc]] ToolCallingAgent [[autodoc]] ToolCallingAgent
### ManagedAgent ### ManagedAgent
[[autodoc]] ManagedAgent _This class is deprecated since 1.8.0: now you just need to pass name and description attributes to an agent to directly use it as previously done with a ManagedAgent._
### stream_to_gradio ### stream_to_gradio

View File

@ -71,7 +71,6 @@ SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
from smolagents import ( from smolagents import (
CodeAgent, CodeAgent,
ToolCallingAgent, ToolCallingAgent,
ManagedAgent,
DuckDuckGoSearchTool, DuckDuckGoSearchTool,
VisitWebpageTool, VisitWebpageTool,
HfApiModel, HfApiModel,
@ -79,15 +78,13 @@ from smolagents import (
model = HfApiModel() model = HfApiModel()
agent = ToolCallingAgent( managed_agent = ToolCallingAgent(
tools=[DuckDuckGoSearchTool(), VisitWebpageTool()], tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
model=model, model=model,
)
managed_agent = ManagedAgent(
agent=agent,
name="managed_agent", name="managed_agent",
description="This is an agent that can do web search.", description="This is an agent that can do web search.",
) )
manager_agent = CodeAgent( manager_agent = CodeAgent(
tools=[], tools=[],
model=model, model=model,

View File

@ -47,7 +47,7 @@ Both require arguments `model` and list of tools `tools` at initialization.
### ManagedAgent ### ManagedAgent
_This class is deprecated since 1.8.0: now you just need to pass name and description attributes to an agent to use it as a ManagedAgent._ _This class is deprecated since 1.8.0: now you just need to pass name and description attributes to an agent to directly use it as previously done with a ManagedAgent._
### stream_to_gradio ### stream_to_gradio