azureazure-aimulti-agent

Azure AI Agent returns "ValueError: Toolset is not available in the client." when using function tools across modules


I'm working with Azure AI Agents and trying to use custom functions within an agent. I've defined several user-defined functions and wrapped them using FunctionTool, then added them to a ToolSet. Here's how I've structured my code:

    {
        func1, 
        func2, 
        func3, 
        func4, 
        func5
    })

   func_fetching_toolset = ToolSet() 
   func_fetching_toolset.add(functions_tool)

    agent = project_client.agents.create_agent(
        model=os.environ.get("AZURE_AOAI_CHAT_MODEL_NAME_DEPLOYMENT_ID"),
        name="func-fetching-agent", 
        instructions="""        
                You are an advanced assistant capable of calling user-defined functions when necessary. 
            """,
        toolset=func_fetching_toolset,
    )

When I create a thread and run it, I encounter the following error:

ValueError: Toolset is not available in the client.

Observations:

My Question:

What I've Tried:


Solution

  • I too was having this very issue and the thing that solved it for me was passing the toolset while creating the run.

    project_client.agents.create_and_process_run(thread_id=thread.id, assistant_id=agent.id, toolset=toolset)