Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ agentClient.Administration.DeleteAgent(agentId: agent.Id);

The following code sample begins by setting up the necessary imports, getting the relevant MCP server configuration, and initializing the AI Project client. It then creates an agent, adds a message to a thread, and runs the agent.

> [!NOTE]
> To run the following code, `azure.ai.projects==1.1.0b4` and `azure.ai.agents==1.2.0b4` are required.

```python
# Import necessary libraries
Expand Down Expand Up @@ -343,19 +345,19 @@ curl --request POST \
--url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d "{
-d '{
"instructions": "You are a customer support chatbot. Use the tools provided and your knowledge base to best respond to customer queries.",
"tools": [
{
"type": "mcp",
"server_label": "<unique name for your MCP server>",
"server_url": "<your MCP server URL>",
"allowed_tools": ["<tool_name>"], # optional
}
],
"name": "my-assistant",
"model": "gpt-4o",
}"
{
"type": "mcp",
"server_label": "<unique name for your MCP server>",
"server_url": "<your MCP server URL>",
"allowed_tools": ["<tool_name>"] # optional
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON does not support comments with #. Consider removing the comment or moving it outside the JSON structure to maintain valid JSON syntax.

Suggested change
"allowed_tools": ["<tool_name>"] # optional
"allowed_tools": ["<tool_name>"]

Copilot uses AI. Check for mistakes.
}
],
"name": "my-assistant",
"model": "gpt-4o"
}'
```

## Create a thread
Expand Down Expand Up @@ -400,17 +402,16 @@ curl --request POST \
-d '{
"assistant_id": "<agent_id>",
"tool_resources": {
"mcp": [
{
"server_label": "<the same unique name you provided during agent creation>",
"require_approval": "always" #always by default
"headers": {
"Authorization": "Bearer <token>",
}

"mcp": [
{
"server_label": "<the same unique name you provided during agent creation>",
"require_approval": "always", #always by default
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON does not support comments with #. Consider removing the comment or moving it outside the JSON structure to maintain valid JSON syntax.

Suggested change
"require_approval": "always", #always by default
"require_approval": "always",

Copilot uses AI. Check for mistakes.
"headers": {
"Authorization": "Bearer <token>"
}
]
},
}
]
}
}'
```

Expand Down Expand Up @@ -470,15 +471,15 @@ curl --request POST \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"tool_approvals": [
{
"tool_call_id": "call_abc123",
"approve": true,
"headers": {
}
"tool_approvals": [
{
"tool_call_id": "call_abc123",
"approve": true,
"headers": {
}
}
]
}
}'
```

## Retrieve the agent response
Expand Down