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
36 changes: 18 additions & 18 deletions Instructions/09-integrate-agent-with-foundry-iq.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ When creating an agent, it will deploy the default model (like `gpt-4.1`). Once
Now you'll configure your agent that uses Foundry IQ to search the knowledge base.

1. First, give your agent the following instructions:
```
```
You are a helpful AI assistant for Contoso, specializing in outdoor camping and hiking products.
You must ALWAYS search the knowledge base to answer questions about our products or product
catalog. Provide detailed, accurate information and always cite your sources.
If you don't find relevant information in the knowledge base, say so clearly.
```
```

1. Select **Save** to save your current agent configuration.
1. Then, in the **Knowledge** section, expand the **Add** dropdown, and select **Connect to Foundry IQ**.
Expand Down Expand Up @@ -201,7 +201,7 @@ Now you'll create a Python application to interact with your agent programmatica

> **Tip**: Be careful to maintain the correct indentation level.

```python
```python
# Connect to the project and agent
credential = DefaultAzureCredential(
exclude_environment_credential=True,
Expand All @@ -222,11 +222,11 @@ Now you'll create a Python application to interact with your agent programmatica
# Create a new conversation
conversation = openai_client.conversations.create(items=[])
print(f"Created conversation (id: {conversation.id})\n")
```
```

1. Find the second **TODO** comment inside the `send_message_to_agent()` function and add the following code to send messages and handle responses, including MCP approval requests:

```python
```python
# Add user message to the conversation
openai_client.conversations.items.create(
conversation_id=conversation.id,
Expand Down Expand Up @@ -302,7 +302,7 @@ Now you'll create a Python application to interact with your agent programmatica
input=""
)

```
```

1. After you've added the code, use the **CTRL+S** command to save your changes.

Expand All @@ -323,9 +323,9 @@ Now you'll run your application and test the agent's ability to retrieve informa

1. In the cloud shell command-line pane, enter the following command to sign into Azure.

```
```
az login
```
```

**<font color="red">You must sign into Azure - even though the cloud shell session is already authenticated.</font>**

Expand All @@ -342,37 +342,37 @@ Now you'll run your application and test the agent's ability to retrieve informa
1. When the application starts, test the agent with the following queries:

**Query 1 - Product Categories:**
```
```
What types of outdoor products does Contoso offer?
```
```

When prompted for approval, type **yes** to allow the agent to search the knowledge base. Observe how the agent retrieves information from multiple documents in the knowledge base.

**Query 2 - Specific Product Details:**
```
```
Tell me about the weatherproof features of your tents.
```
```

Approve the request and notice how the agent provides specific details from the tents catalog.

**Query 3 - Product Comparisons:**
```
```
What's the difference between your daypacks and expedition backpacks?
```
```

Approve the request and see how the agent can synthesize information from the backpacks guide.

**Query 4 - Accessories and Add-ons:**
```
```
What camping accessories would you recommend for a weekend hiking trip?
```
```

Approve the request and observe the agent's ability to provide recommendations based on the knowledge base.

**Query 5 - Follow-up Question:**
```
```
How much do those items typically cost?
```
```

Notice how the agent maintains conversation context from your previous query.

Expand Down