Different between CodeAgent and ToolCallingAgent

Hi,

I’m reading the guided tour for Smolagents. I learned we have two ways to call a tool:
CodeAgent and ToolCallingAgent. It mentioned that ToolCallingAgent doesn’t execute code here:

We also support the widely-used way of writing actions as JSON-like blobs: this is ToolCallingAgent, it works much in the same way like CodeAgent, of course without additional_authorized_imports since it doesn’t execute code:

But on a different page, it shows that we can provide tools for the ToolCallingAgent, which I assume can call the code.

web_agent = ToolCallingAgent(
    tools=[DuckDuckGoSearchTool(), visit_webpage],
    model=model,
    max_steps=10,
    name="search",
    description="Runs web searches for you. Give it your query as an argument.",
)

Ref: Orchestrate a multi-agent system 🤖🤝🤖

I’m not really sure what’s the different between these two and when to use what. Thanks!

1 Like

The person developing the smolagents on HF Discord said in summary, “If you’re not sure, I recommend CodeAgent”, so we’ll use CodeAgent.

Thanks John! I’m still curious, though, when to use the ToolCallingAgent. Any insight on this?

*I’ll join the Discord as well!

1 Like

I have no idea. I suppose there must be a plan for separating the functions… or maybe they were separate to begin with and have since been effectively integrated.

Well, asking questions on Discord is quicker. The smolagents developers and course operators are both present.:sweat_smile:

Thanks! I really appreciate it!

1 Like