Bitzu

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

Single choice

Which Python package provides the AIProjectClient class used to connect to a Foundry project?

  1. azure-identity
  2. azure-ai-projects
  3. azure-storage-blob
  4. 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.

Select all that apply

Which items does a lightweight Python client need to talk to an existing Foundry agent?

  1. The Foundry project endpoint URL
  2. A credential such as DefaultAzureCredential
  3. The name of the agent to call
  4. A storage account access key
  5. 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

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.

Download on the App StoreGet it on Google Play

More AI-901 topics in this module