Tools on Thread Level not working #98
-
Hello, I have observed that I can't use tools at the thread level. However, they do work on agent and run level. Let's assume the following script: # create toolset with code interpreter
toolset = ToolSet()
toolset.add(CodeInterpreterTool())
# create agent, thread, message, and run
agent = agents_client.create_agent(name="Coding Assistant Tool", model="gpt-4.1")
thread = agents_client.threads.create()
message = agents_client.messages.create(thread_id=thread.id, role="user", content="Please execute 2+2 in Python.")
run = agents_client.runs.create_and_process(thread_id=thread.id, agent_id=agent.id) I could now give tool capabilities in three ways:
In the first and third case (agent and run) the thread in AI Foundry showed the use of the code interpreter tool, it did not for the second, the thread approach. That is why I am wondering: Am I using a wrong function to set the toolset on the thread? Why can't I pass a toolset but must pass the resources compared to agent and run? Additional info:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi thanks for details and confirming your SDK version
Recommended approach Stick to defining tools at the agent or run level for now. If you want thread-specific tool behavior, you’ll need to:
SDK Improvement Suggestion Please consider opening a feature request at https://github.com/orgs/azure-ai-foundry/discussions/categories/product-feedback-and-ideas You could suggest either:
|
Beta Was this translation helpful? Give feedback.
Hi thanks for details and confirming your SDK version
1.0.0b12
, even though the method signature acceptstool_resources
.agent
andrun
, which actively invoke tools during execution, thethread
object is more of a passive container for messages and context. It doesn’t trigger tool execution on its own.tool_resources
from the thread to the run, meaning the tools aren’t registered or invoked unless explicitly passed at the agent or run level.toolset
works for agent and run because: