# Different between CodeAgent and ToolCallingAgent

**URL:** <https://discuss.huggingface.co/t/different-between-codeagent-and-toolcallingagent/141551>\
**Category:** Beginners\
**Created:** [February 18, 2025, 9:31am UTC](https://discuss.huggingface.co/t/different-between-codeagent-and-toolcallingagent/141551 "2025-02-18T09:31:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tukemon](https://avatars.discourse-cdn.com/v4/letter/t/b487fb/32.png) [@tukemon](https://discuss.huggingface.co/u/tukemon)\
**Post date:** [February 18, 2025, 9:31am UTC](https://discuss.huggingface.co/t/different-between-codeagent-and-toolcallingagent/141551/1 "2025-02-18T09:31:35Z")

</div>

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.

```auto
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 🤖🤝🤖](https://huggingface.co/docs/smolagents/examples/multiagents)

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

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [February 18, 2025, 2:31pm UTC](https://discuss.huggingface.co/t/different-between-codeagent-and-toolcallingagent/141551/2 "2025-02-18T14:31:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tukemon](https://avatars.discourse-cdn.com/v4/letter/t/b487fb/32.png) [@tukemon](https://discuss.huggingface.co/u/tukemon)\
**Post date:** [February 18, 2025, 8:17pm UTC](https://discuss.huggingface.co/t/different-between-codeagent-and-toolcallingagent/141551/3 "2025-02-18T20:17:37Z")

</div>

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

\*I’ll join the Discord as well!

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [February 19, 2025, 5:07am UTC](https://discuss.huggingface.co/t/different-between-codeagent-and-toolcallingagent/141551/4 "2025-02-19T05:07:39Z")

</div>

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.😅

---

<div class="post-metadata">

**Author:** ![tukemon](https://avatars.discourse-cdn.com/v4/letter/t/b487fb/32.png) [@tukemon](https://discuss.huggingface.co/u/tukemon)\
**Post date:** [February 19, 2025, 5:20am UTC](https://discuss.huggingface.co/t/different-between-codeagent-and-toolcallingagent/141551/5 "2025-02-19T05:20:26Z")

</div>

Thanks! I really appreciate it!
