update_thread_resources(
self,
agent: Union[CompiledStateGraph, PromptBasedAgentNode],
tool_resources: Any
) -> | Name | Type | Description |
|---|---|---|
agent* | Union[CompiledStateGraph, PromptBasedAgentNode] | |
tool_resources* | Any |
Update tool resources on the active conversation thread of an agent.
Use this method to add or replace file resources (e.g. for
CodeInterpreterTool) on an already-running conversation thread,
enabling mid-conversation file uploads.
The CompiledStateGraph (returned by create_prompt_agent)
or the PromptBasedAgentNode (returned by
create_prompt_agent_node) whose thread to update.
The tool resources to set on the thread. For example, to expose additional files to the code interpreter::
from azure.ai.agents.models import (
CodeInterpreterToolResource,
ToolResources,
)
factory.update_thread_resources(
agent,
ToolResources(
code_interpreter=CodeInterpreterToolResource(
file_ids=[new_file.id]
)
)
)