Home › Studies › AI-901 › Foundry Solutions › Generative AI Apps & Agents

Generative AI Apps & Agents

System and user prompts · model catalog and deployment · playground · lightweight chat client · agents · agent client

By the tools4free.dev team · Last reviewed November 13, 2026

Practice questions for this topic →

System prompts and user prompts

PromptWhat it isExample from Learn
User promptThe end-user request or question.Where should I travel?
System prompt (system message, system instructions)Sets behavior, tone, tools, and guardrails for the assistant.You are a helpful, step-by-step tutor. Cite sources. Decline medical advice.

A system message is a set of high-priority instructions and context that you send to a chat model to steer how it responds. Learn uses "system message" interchangeably with "metaprompt" and "system prompt".

Parts of a system message

Writing guidance from Learn

TechniqueWhat the page says
Clear, concise languageClear language avoids over-complexity and misunderstanding. Shorter system messages often perform better and reduce latency.
Second personUse second person when you refer to the AI system.
Clear instructionsTelling the model the task at the beginning of the prompt, before extra context or examples, can help produce higher-quality outputs.
Examples (few-shot)Examples better condition the model to respond as desired for only the current inference. The model is not permanently changed. Prompts with no examples are zero-shot.
Clear syntaxUse clear syntax to communicate intent and make outputs easier to parse. Consider Markdown or XML.
Break the task downLLMs often perform better if the task is broken down into smaller steps.
Grounding dataGiving the model data to draw its responses from is one of the most effective ways to provide reliable answers.
Ask for citationsIf you instruct the model to cite the source material, those statements are much more likely to be grounded.

The prompt-engineering page says its techniques aren't recommended for reasoning models like gpt-5 and o-series models. It also says that even with good prompts, you still need to validate the responses the model generates.

Choose and deploy a model in Foundry

Microsoft Foundry provides an integrated environment for discovering, evaluating, deploying, and operating generative AI models. The Foundry model catalog is a central hub for discovering and using generative AI models from many providers.

Source in the catalogWhat Learn says
Models sold directly by AzureHosted by Microsoft under Microsoft Product Terms. Integration with Azure, enterprise SLAs, preconfigured security, and compliance alignment.
Models from partners and the communityOpen-source or vendor-hosted models integrated through the catalog. Support broader experimentation and are often suitable for specialized or domain-specific tasks.

Deployment

Deploying a model makes it available for use in production through a stable, scalable, and secure endpoint. Applications call it, usually through an API.

SettingMeaning
Deployment typeSuch as standard, global batch, and regional provisioned throughput. Determines where and how inference is processed.
Model versionDeployment parameter you can customize.
Tokens per minute (TPM)A higher allocation increases capacity to handle token traffic per minute. Deployment-level quotas define how much can be processed before throttling occurs.

A token is the smallest unit of text or data that a generative AI model can process. If you see throttling, lower max tokens or reduce concurrent requests in code.

Test in the playground

Lightweight chat client with the Foundry SDK

A lightweight client application is a small, minimal app whose primary job is to collect user input, call a remote service/API, and display results. State and compute stay mostly on the server because the model runs remotely. For Foundry, a lightweight chat client is often a single Python file that connects to a Foundry project endpoint and sends chat messages to a deployed model.

The Foundry SDK exposes a Project client (Foundry-native operations) and an OpenAI-compatible client for calling models through the Responses API.

Sample from the module (Python)

LineWhat it does
response = client.responses.create(Calls the Responses API for the deployed model.
input=[{"role": "system", ...}, {"role": "user", ...}]Sends a system message and a user message.
max_output_tokens=300,Caps the length of the response.
temperature=0.7Sets the creativity vs. determinism parameter.
print(response.output_text)Displays the model's text response.

In the module sample the model argument is set from the environment variable DEPLOYMENT_NAME, so the call targets your deployment.

Agents in Foundry

Agents are applications built with generative AI models. Agentic AI moves beyond one-off prompts and defines a consistent, workflow-like behavior that can be reused across apps, experiences, and services. Models are raw intelligence; agents are packaged, task-oriented workers built on top of it.

Part of an agentWhat it is
ModelThe generative AI model the agent uses for reasoning (for example, GPT-4.1).
InstructionsThe system prompt that defines the agent's role, behavior, style, constraints, and output rules.
ToolsThe actions the agent can take.

Agent types in Foundry Agent Service

TypeWhat Learn says
Prompt agentThe fastest path. Define instructions, a model, and tools; Foundry runs it with no code or infrastructure to manage.
Voice-based prompt agentReal-time voice agent whose orchestration Foundry manages.
Hosted agentThe most control. Bring your own code and framework; Foundry runs it as a container with a managed endpoint, scaling, and identity.

Calling the Responses API directly from your own code builds an ephemeral agent: its definition (instructions, tools, and model) lives in your application code, not as a saved Foundry resource.

Client application for an agent

A client application uses the Foundry Projects SDK to connect to the project and calls the agent through the Project API. The Project API lets you integrate agents into web apps, bots, or backend workflows. To call the agent programmatically you need the agent-id of your agent, found in the agent's code view in the playground.

Line in the module sampleWhat it does
project_client = AIProjectClient(Connects to the project with its endpoint and a credential.
credential=DefaultAzureCredential(),Authenticates with Azure identity.
agent = project_client.agents.get(agent_name=myAgent)Gets an existing agent by name.
openai_client = project_client.get_openai_client()Gets an OpenAI-compatible client from the project.
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},Tells the Responses call to use the agent.
print(f"Response output: {response.output_text}")Displays the agent's text response.

Exam Tips

Tick each tip once you can answer it without looking.

“Set the role, tone, tools and guardrails for the whole assistant” → System prompt (system message / system instructions). Trap: The user prompt is the end-user's request or question, such as "Where should I travel?".

“The question a customer types into the chat” → User prompt. Trap: A system prompt sets behavior, tone, tools, and guardrails; it is not the end-user request.

“Make output more creative or more deterministic” → Temperature. Trap: Max output tokens caps response length; it does not control creativity.

“Cap how long a response can be (and its token use)” → Max output tokens. Trap: Temperature controls creativity vs. determinism, not length.

“Make answers rely on your own data and cite it” → Provide grounding data; ask the model to cite sources. Trap: The page says system message inputs such as "only write true facts" or "don't fabricate information" might not be adequate mitigations.

“Add example input/output pairs to the prompt” → Few-shot; it conditions the model for the current inference only. Trap: It does not permanently change the model. A prompt with no examples is zero-shot.

“Models hosted by Microsoft under Microsoft Product Terms, with enterprise SLAs” → Models sold directly by Azure. Trap: Models from partners and the community are open-source or vendor-hosted models integrated through the catalog.

“Well-defined use case; want prebuilt models and no custom modeling” → A Foundry tool. Trap: Picking and deploying a model from the model catalog is the choice when you need to select a model yourself.

“Deployment is throttled” → Lower max tokens or reduce concurrent requests; a higher TPM allocation adds capacity. Trap: Evaluators detect, scan and score issues; they do not resolve them.

“Try prompts and settings before writing code” → The model playground in the Foundry portal; reuse the same prompts and parameters in code. Trap: The playground code calls the deployment through the OpenAI-compatible Responses API, not a separate service.

“A small app that collects input, calls the model, and prints the result” → A lightweight client application (often a single Python file). Trap: The model runs remotely; the client keeps state and compute mostly on the server side, not locally.

“What does an agent in Foundry bring together?” → A model, instructions (the system prompt), and tools. Trap: A bare model is raw intelligence; the agent adds instructions and tools.

“Agent must act (run code, call an API) versus use your documents” → Tools = actions; knowledge (RAG) = context, with a citation in the response. Trap: Do not swap them: knowledge retrieves content, tools call external systems.

“Fastest path, Foundry runs the agent, no code or infrastructure” → Prompt agent. Trap: A hosted agent is for your own code and framework, run as a container; it gives the most control.

“Call an existing Foundry agent from an app” → Foundry Projects SDK plus the Project API; you need the agent-id. Trap: The playground chat is for testing; calling a model alone uses the Responses API without an agent.

“Few-shot or chain-of-thought tips for gpt-5 or o-series models” → Not recommended for reasoning models on the page. Trap: Do not assume they carry over: the page also says each model behaves differently, and chain-of-thought is only for non-reasoning models.

Sources

Checked against Microsoft Learn on November 13, 2026.

← Foundry Solutions overviewText & Speech Solutions →