The Python portion of Microsoft AI-901 is about recognizing how a lightweight application interacts with a model, not about building a large backend framework. A client needs a supported endpoint, authentication, a deployment name, correctly structured messages and a way to handle the response or an error. That simple contract is easy to obscure when examples combine resource creation, multiple libraries and agent orchestration in one file.
Imagine a campus help desk that wants a prototype assistant to explain a fictional list of computer lab rules. The first version should read one user question and return a short answer. It does not need to search the internet, send email or control a student account. By keeping the scope narrow, a beginner can learn what the SDK performs and what the application must still validate.
Identify the client-side responsibilities
The client obtains configuration from a protected source, authenticates using a supported method, sends the request to the designated model or project service and handles the result. A deployment name tells the inference service which deployed model should receive the request. It is not an API credential. A project endpoint identifies a service access route; it is not the same as a model card in the catalog.
Different current Foundry APIs and SDK versions can expose different client classes or method signatures. Use the Microsoft code tab for the actual deployment and read the package version in the official documentation. The Foundry deployment tutorial explains what must exist before a client can make a successful inference call. Do not copy a legacy Azure AI example into a newer project and assume endpoint formats are interchangeable.
Prefer controlled credential handling
Microsoft Entra authentication can be appropriate for an application running under a supported identity. An API key may also be supported for a specific endpoint, but it must be treated as a secret. Use local environment configuration for learning and approved secret storage for deployment. Never paste keys into a public repository, documentation screenshot or error report. A role assignment is still required when authenticating with Entra, and having an Azure account does not automatically confer permission to call every model.
An authentication error should be diagnosed separately from an inference problem. Verify the signed-in identity, tenant, endpoint type and resource permissions before changing prompts. If a model deployment is healthy but the caller lacks access, no amount of prompt refinement will solve a 401 or 403 response. If the request addresses a missing deployment, check the name and region instead.
Understand the message structure
A chat request typically includes the target model deployment and a sequence of messages. A system instruction can establish the assistant’s role, while a user message holds the actual question. The application may specify supported output limits or formats. Responses include generated content and may expose usage or diagnostic metadata depending on the API; the client should not assume every response contains a nonempty text string.
For a simple help-desk prototype, the system instruction can say to answer only from the supplied published rules and to note when information is missing. The user can ask about laboratory hours. The application can display the answer as text, but it should not treat the generated response as authoritative confirmation that an account was unlocked or a lab reservation was created. Those operations require independent services with permission checks.
Sketch the smallest safe Python workflow
Conceptually, the program imports the supported client and identity package, reads the project endpoint and deployment name from configuration, creates the client, sends one structured user message and prints the returned text. It also catches errors and avoids leaking secrets in logs. The exact SDK method should be copied from the relevant current Microsoft documentation for the selected Foundry resource rather than reconstructed from memory.
As a practical study exercise, write pseudocode first: obtain credential; create client with endpoint; set instructions and user message; request a response from a deployed model; check success and output; display it; handle errors. Each line corresponds to an operational dependency that might be the subject of a scenario question. The official Foundry Python prompt-agent quickstart is a useful reference for the project’s endpoint and credentials, though an agent adds additional steps beyond this direct-model example.
Handle errors based on their cause
A missing environment variable is a local configuration problem. An invalid credential or role is an access problem. A 404 may indicate a wrong endpoint or deployment name. Throttling may indicate a rate limit, while a timeout can mean an unavailable service or network condition. A rejected unsafe request may follow a content-safety or policy path. Treat these as separate categories rather than retrying every failure indefinitely.
Add a bounded retry only when the error is transient and retrying is appropriate. User-facing messages should distinguish temporary unavailability from a missing rule in the knowledge source. Keep logs to request identifiers, safe timings and failure categories; avoid dumping private prompts, credentials or sensitive tool output into ordinary error traces.
Test the same question against a controlled baseline
Build ten synthetic questions about fictional campus lab access, each with a reviewer-approved answer or an explicit “not specified.” Compare outputs for completeness, unsupported claims and compliance with the instructions. Then change the question wording while preserving intent and see whether the response remains grounded. A successful single request does not prove the client is production-ready, but repeatable tests demonstrate useful beginner engineering judgment.
Try an ambiguous request such as “Can I use the lab tonight?” when multiple campuses have different hours. The right response may ask which campus the user means. Add a prompt-injection attempt in an untrusted quoted passage and verify that no security-sensitive operation is available. The prompt design and instruction boundaries covers this as an instruction-boundary problem rather than a Python-specific trick.
Know when the chat client becomes an agent
A direct model call answers a prompt. An agent adds a defined purpose, optional tools and stateful task behavior; it may choose among actions or coordinate a response. A help-desk system that only explains opening hours does not necessarily need an agent. A system that checks authenticated user reservations and proposes a change may benefit from one, provided the actual database operation remains controlled.
The single-agent client lab shows why tool permissions and agent definitions matter. In an exam question, distinguish a model deployed for inference from an agent definition that references that model. When comparing SDK examples, identify whether the code calls a model endpoint or creates/invokes an agent resource.
Preserve a reproducible lab and clean it up
Document the exact tutorial version, SDK package and deployment type used. Record successful and failed requests without exposing keys. Remove temporary credentials and resources when the exercise is complete. If a sample library changes, use Microsoft’s up-to-date SDK documentation instead of presenting an old import as a timeless pattern.
A beginner who can explain configuration, credential, deployment selection, messages, response parsing and failure handling understands the important client path for AI-901. The objective is transferable: those roles remain even when the API surface changes. That foundation also prepares the learner for later, deeper AI-103 development work without requiring advanced agent frameworks on the fundamentals exam.