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
}
],
"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
"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