Skip to content

ENH: Add code_execute tool to unify CodeAgent & ToolCallingAgent (#1956)#1962

Open
janhaslik wants to merge 2 commits intohuggingface:mainfrom
janhaslik:enh/combine-codeagent-toolcallingagent-1956
Open

ENH: Add code_execute tool to unify CodeAgent & ToolCallingAgent (#1956)#1962
janhaslik wants to merge 2 commits intohuggingface:mainfrom
janhaslik:enh/combine-codeagent-toolcallingagent-1956

Conversation

@janhaslik
Copy link

Add support for executing code by a tool call for ToolCallingAgent.
Python code executed via code_execute has access to all tools as callable functions.

Issue: #1956

Changes:

toolcalling_agent.yml:

  • Add section that mentions the existence of a the code_execute tool and how to use it (tool calls as regular function calls)
  • Simple example

agents.py:

  • _execute_code function for executing the python code uses PythonExecutor
  • optional class params for setting and initializing the relevant parameters
  • Update to execute_tool_call function to handle the code_execute tool

test_agents.py:

  • test_toolcalling_agent_calls_code_execute (Test that the ToolCallingAgent can execute simple Python code using code_execute)
  • test_toolcalling_agent_calls_tool_from_tools_list (Test that Python code executed via code_execute can call tools from the agent's tool list)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant