Skip to content

Commit 3288760

Browse files
committed
Updated code sample
1 parent c7a28c5 commit 3288760

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

learn-pr/wwl-data-ai/develop-ai-agent-with-semantic-kernel/includes/3-create-azure-ai-agent.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Here's the code that illustrates how to create an AzureAIAgent:
1616

1717
```python
1818
from azure.identity.aio import DefaultAzureCredential
19-
from semantic_kernel.agents import AzureAIAgent, AzureAIAgentSettings
19+
from semantic_kernel.agents import AzureAIAgent, AzureAIAgentThread, AzureAIAgentSettings
2020

2121
# Create an AzureAIAgentSettings object
2222
ai_agent_settings = AzureAIAgentSettings.create()
@@ -43,11 +43,11 @@ async with (@
4343
Once your agent is defined, you can create a thread to interact with your agent and invoke responses for inputs. For example:
4444

4545
```python
46-
# Use the client agent service to create a thread
47-
thread = await client.agents.create_thread()
46+
# Create the agent thread
47+
thread: AzureAIAgentThread = AzureAIAgentThread(client=client)
4848

4949
try:
50-
# Create prompts
50+
# Create prompts
5151
prompt_messages = ["What are the largest semiconductor manufacturing companies?"]
5252

5353
# Invoke a response from the agent
@@ -57,7 +57,7 @@ try:
5757
print(response)
5858
finally:
5959
# Clean up the thread
60-
await client.agents.delete_thread(thread.id)
60+
await thread.delete() if thread else None
6161
```
6262

6363
### AzureAIAgent key components

0 commit comments

Comments
 (0)