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
| Prompt | What it is | Example from Learn |
|---|---|---|
| User prompt | The 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
- Role and task: what the assistant is and what it is responsible for.
- Audience and tone: who the response is for, and the expected voice.
- Scope and boundaries: what the assistant must not do, and what to do when it can't comply.
- Safety guidelines: rules that reduce harmful outputs.
- Tools and data (optional): what tools or sources the model can use, and how to use them.
Writing guidance from Learn
| Technique | What the page says |
|---|---|
| Clear, concise language | Clear language avoids over-complexity and misunderstanding. Shorter system messages often perform better and reduce latency. |
| Second person | Use second person when you refer to the AI system. |
| Clear instructions | Telling 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 syntax | Use clear syntax to communicate intent and make outputs easier to parse. Consider Markdown or XML. |
| Break the task down | LLMs often perform better if the task is broken down into smaller steps. |
| Grounding data | Giving the model data to draw its responses from is one of the most effective ways to provide reliable answers. |
| Ask for citations | If 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 catalog | What Learn says |
|---|---|
| Models sold directly by Azure | Hosted by Microsoft under Microsoft Product Terms. Integration with Azure, enterprise SLAs, preconfigured security, and compliance alignment. |
| Models from partners and the community | Open-source or vendor-hosted models integrated through the catalog. Support broader experimentation and are often suitable for specialized or domain-specific tasks. |
- Compare models: the catalog includes benchmarking results, model leaderboards (quality, safety, throughput) and side-by-side comparisons.
- Evaluators measure the quality, safety, and effectiveness of model or agent outputs. On their own they detect, scan, and score issues but do not actively resolve them.
- Foundry tools: when the use case is well defined, a Foundry tool (prebuilt models) can replace a catalog model. It gives predictable performance, built-in compliance, and fast time-to-value without custom modeling.
- GPT-4.1: all Foundry users can use it. Learn describes it as ideal for real-time chat, customer support, and interactive apps that must respond quickly at scale. Registration is currently required for the GPT-5 model family.
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.
| Setting | Meaning |
|---|---|
| Deployment type | Such as standard, global batch, and regional provisioned throughput. Determines where and how inference is processed. |
| Model version | Deployment 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
- The easiest way to interact with a deployed model is the model playground in the Foundry portal. Use it to try prompts, compare models, and capture working settings before you write code.
- Temperature controls creativity vs. determinism. The temperature parameter can be set between 0 and 2; a much lower value is recommended for a legal document.
- Max output tokens caps response length; it affects token consumption and throttling behavior.
- System instructions set the behavior and role of the model.
- The playground provides code that calls your deployment through the OpenAI-compatible Responses API. You can reuse the same system and user prompts and parameter values in your code.
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)
| Line | What 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.7 | Sets 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 agent | What it is |
|---|---|
| Model | The generative AI model the agent uses for reasoning (for example, GPT-4.1). |
| Instructions | The system prompt that defines the agent's role, behavior, style, constraints, and output rules. |
| Tools | The actions the agent can take. |
- Tools = actions. Tools let a model perform actions by calling external systems. Example: Code Interpreter (data analysis, file handling). The Foundry Tool Catalog lets you discover and manage tools.
- Knowledge = context. Knowledge lets the model access and retrieve external content (your documents, datasets, internal sites) through retrieval-augmented generation (RAG). When knowledge is used, the response includes a citation for the knowledge store the agent used.
- In the portal you pick a model, write the system instructions, add tools or knowledge, save it as an agent, then keep testing and refining it in the playground.
Agent types in Foundry Agent Service
| Type | What Learn says |
|---|---|
| Prompt agent | The fastest path. Define instructions, a model, and tools; Foundry runs it with no code or infrastructure to manage. |
| Voice-based prompt agent | Real-time voice agent whose orchestration Foundry manages. |
| Hosted agent | The 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 sample | What 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
- Get started with generative AI and agents in Azure (module)
- Module unit: Generative AI models
- Module unit: Using a generative AI model
- Module unit: Creating an agent
- Prompt engineering techniques
- Safety system messages
- What is Microsoft Foundry Agent Service?
Checked against Microsoft Learn on November 13, 2026.