camel icon indicating copy to clipboard operation
camel copied to clipboard

[Feature Request] Dynamic tool loading and use tool via code execute

Open fengju0213 opened this issue 1 month ago • 1 comments

Required prerequisites

  • [x] I have searched the Issue Tracker and Discussions that this hasn't already been reported. (+1 or comment there if it has.)
  • [x] Consider asking first in a Discussion.

Motivation

With the development of MCP and the need for agents to handle long-running tasks, agents typically preload many tools, which incurs significant token overhead. Is there a way to store tool descriptions and other information in the file system, allowing the agent to dynamically load tools and use them through code execution?

reference: https://www.anthropic.com/engineering/code-execution-with-mcp

Solution

No response

Alternatives

No response

Additional context

No response

fengju0213 avatar Nov 10 '25 04:11 fengju0213

@Wendong-Fan ask for some comments

fengju0213 avatar Nov 10 '25 06:11 fengju0213

To implement this feature, we can proceed in two steps:

Step 1: First, try to achieve this through a prompt-based approach — allowing an agent equipped with a terminal to execute tools programmatically by writing code.

from camel.toolkits import SearchToolkit
from camel.toolkits import ResendToolkit

search_toolkit = SearchToolkit()
resend_toolkit = ResendToolkit()

result = search_toolkit.search_wiki("What is the capital of France?")

resend_toolkit.send_email(
    to=["[email protected]"],
    subject="Search Result",
    text=result,
)

Step 2: Then, integrate this capability natively into ChatAgent, so that the agent can autonomously invoke such tools without relying solely on prompt-based execution.

We can start with Step 1 first.

fengju0213 avatar Nov 24 '25 09:11 fengju0213