You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vector stores created using thread helpers (like `tool_resources.file_search.vector_stores` in Threads or `message.attachments` in Messages) have a default expiration policy of seven days after they were last active (defined as the last time the vector store was part of a run).
171
166
172
-
When a vector store expires, the runs on that thread fail. To fix this issue, you can recreate a new vector_store with the same files and reattach it to the thread.
167
+
When a vector store expires, the runs on that thread fail. To fix this issue, you can recreate a new vector_store with the same files and reattach it to the thread.
173
168
174
-
###Supported file types
169
+
## Supported file types
175
170
176
171
> [!NOTE]
177
172
> For text/ MIME types, the encoding must be either utf-8, utf-16, or ASCII.
To add the MCP server to the agent, use the following example, which takes the MCP server label and URL from the last step. You can also add or remove allowed tools dynamically through the `allow_tool` parameter.
43
+
## Set up the tool
44
+
45
+
To add the MCP server to the agent, use the following example, which takes the MCP server label and URL from the previous step. You can also add or remove allowed tools dynamically through the `allow_tool` parameter.
Set the MCP server update headers and optionally disable tool approval requirements.
100
+
Set the MCP server update headers and optionally disable tool approval requirements:
97
101
98
102
```python
99
103
mcp_tool.update_headers("SuperSecret", "123456")
100
-
# mcp_tool.set_approval_mode("never") # Uncomment to disable approval requirement
104
+
# mcp_tool.set_approval_mode("never") # Uncomment to disable approval requirements
101
105
run = agents_client.runs.create(thread_id=thread.id, agent_id=agent.id, tool_resources=mcp_tool.resources)
102
106
print(f"Created run, ID: {run.id}")
103
107
```
104
108
105
-
106
109
## Create a run and check the output
107
-
Create the run, check the output, and examine what tools were called during the run.
110
+
111
+
Create the run, check the output, and examine what tools were called during the run:
108
112
109
113
```python
110
114
# Create and automatically process the run, handling tool calls internally
@@ -133,9 +137,9 @@ Create the run, check the output, and examine what tools were called during the
133
137
print()
134
138
```
135
139
140
+
## Perform cleanup
136
141
137
-
## Cleanup
138
-
After the interaction is complete, the script performs cleanup by deleting the created agent resource using `agents_client.delete_agent()` to avoid leaving unused resources. It also fetches and prints the entire message history from the thread using `agents_client.list_messages()` for review or logging.
142
+
After the interaction is complete, the script performs cleanup by deleting the created agent resource via `agents_client.delete_agent()` to avoid leaving unused resources. It also fetches and prints the entire message history from the thread by using `agents_client.list_messages()` for review or logging.
139
143
140
144
```python
141
145
# Delete the agent resource to clean up
@@ -152,24 +156,24 @@ After the interaction is complete, the script performs cleanup by deleting the c
152
156
153
157
:::zone pivot="rest"
154
158
155
-
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api#api-call-information) to set the right values for the environment variables `AGENT_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT`, and `API_VERSION`.
159
+
Follow the [REST API quickstart](../../quickstart.md?pivots=rest-api#api-call-information) to set the right values for the environment variables `AGENT_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT`, and `API_VERSION`.
156
160
161
+
## Create an agent with the MCP tool enabled
157
162
158
-
## Create an Agent with the MCP tool enabled
163
+
To make the MCP tool available to your agent, initialize a tool with the server endpoint, server label, and more:
159
164
160
-
To make the MCP tool available to your agent, initialize a tool with the server endpoint, server label and more
"instructions": "You are a customer support chatbot. Use the tools provided and your knowledge base to best respond to customer queries.",
168
-
"tools": [
171
+
"instructions": "You are a customer support chatbot. Use the tools provided and your knowledge base to best respond to customer queries.",
172
+
"tools": [
169
173
{
170
174
"type": "mcp",
171
175
"server_label": "<unique name for your MCP server>",
172
-
"server_url": "<your MCP server url>",
176
+
"server_url": "<your MCP server URL>",
173
177
"allowed_tools": ["<tool_name>"], # optional
174
178
}
175
179
],
@@ -203,26 +207,27 @@ curl --request POST \
203
207
204
208
## Create a run and check the output
205
209
206
-
Create a run to pass headers for the tool and observe that the model uses the Grounding with Bing Search tool to provide a response to the user's question.
207
-
`require_approval` parameter is optional. If not provided, `always` is the default value, meaning each time developer needs to approve before calling. Supported values:
210
+
Create a run to pass headers for the tool. Observe that the model uses the Grounding with Bing Search tool to provide a response to the user's question.
211
+
212
+
The `require_approval` parameter is optional. Supported values are:
208
213
209
-
-`always` by default
210
-
-`never` meaning no approval is required
211
-
-`{"never":[<tool_name_1>, <tool_name_2>]}` you can also provide a list of tools without required approval
212
-
-`{"always":[<tool_name_1>, <tool_name_2>]}` you can provide a list of tools with required approval
214
+
-`always`: A developer needs to provide approval for every call. If you don't provide a value, this one is the default.
215
+
-`never`: No approval is required.
216
+
-`{"never":[<tool_name_1>, <tool_name_2>]}`: You provide a list of tools that don't require approval.
217
+
-`{"always":[<tool_name_1>, <tool_name_2>]}`: You provide a list of tools that require approval.
0 commit comments