AI-901 ยท Building agents in Foundry
What does a lightweight Python client for a Foundry agent do?
Reading lightweight Python that connects to a project, references an existing agent, starts a conversation, sends user input and reads the agent's reply.
Key points
- It creates an AIProjectClient from azure-ai-projects with the project endpoint and DefaultAzureCredential, gets an OpenAI client bound to the agent by name, creates a conversation, sends user input with responses.create (passing the conversation id) and reads the reply from output_text.
- Reusing the same conversation id keeps history across turns.
Source: https://learn.microsoft.com/en-us/azure/foundry/quickstarts/get-started-code
Practice questions
Which Python package provides the AIProjectClient class used to connect to a Foundry project?
- azure-identity
- azure-ai-projects
- azure-storage-blob
- azure-mgmt-resource
Show answer
Answer: B. azure-ai-projects
AIProjectClient comes from azure-ai-projects. azure-identity supplies credentials such as DefaultAzureCredential, but not the project client.
Which items does a lightweight Python client need to talk to an existing Foundry agent?
- The Foundry project endpoint URL
- A credential such as DefaultAzureCredential
- The name of the agent to call
- A storage account access key
- The dataset the model was trained on
Show answer
Answer: A. The Foundry project endpoint URL, B. A credential such as DefaultAzureCredential, C. The name of the agent to call
The client needs the project endpoint, a credential and the agent's name. A storage key or a training dataset has nothing to do with calling an agent.
True or false: to chat with an agent that already exists, the client must first call create_version every time it starts.
Show answer
Answer: False
False. create_version publishes a new agent version. A client that only talks to an existing agent just references it by name.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
