Courseiva

AI-102 Implement an agentic solution Practice Question

You are building an agent using Azure AI Agent Service that must execute code in a sandbox environment. The code should be able to install Python packages. Which action type should you use?

⚠ Common exam trap

AI-102 often tests the differences between action types; candidates may confuse code_interpreter with function or httpRequest, but only code_interpreter provides a sandbox for executing code and installing packages.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

code_interpreter

The code_interpreter action type in Azure AI Agent Service provides a sandboxed environment where code can be executed, and it supports installing Python packages via pip. This allows the agent to run code that requires additional libraries not pre-installed.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    function

    Why it's wrong here

    A function action invokes a defined tool or API callback; it cannot execute arbitrary Python in a managed sandbox or install packages. It is tempting because functions extend agent behaviour, but it would be correct when the agent must call a specific pre-built function rather than run code.

  • ✓

    code_interpreter

    Why this is correct

    The code_interpreter action type runs Python in a Microsoft-managed sandbox, satisfying the requirement to execute code safely. It supports installing packages at runtime via pip within that sandbox, so dependencies can be added dynamically. This directly meets the stem's constraint that the agent install Python packages during execution.

  • ✗

    openApi

    Why it's wrong here

    An openApi action invokes operations described by an OpenAPI specification; it runs no Python and installs no packages. It is tempting because it connects the agent to documented APIs, but it would be correct when the agent must call a defined REST interface rather than execute sandboxed code.

  • ✗

    httpRequest

    Why it's wrong here

    An httpRequest action calls an external HTTP endpoint; it provides no sandboxed Python runtime and cannot install packages. It is tempting because it integrates external services, but it would be correct when the agent must invoke a REST API rather than execute code.

About these practice questions

This AI-102 question is part of Courseiva's 761-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Microsoft exam blueprint

This AI-102 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI-102 exam.