← Develop AI Apps and Agents o… Latent Shelf · Ch.7

Module Study Guide · Path 2 · AI agents

Develop AI Agents with Microsoft Foundry and Visual Studio Code

An agent understands context, decides, and acts — and the Foundry Agent Service lets you build one in fewer than 50 lines of code.

— the module's promise

The agents path begins here. This module defines AI agents and the fully-managed Foundry Agent Service, the agent types and components, the two development approaches (portal and VS Code), and the security risks that agents introduce.

Foundry Agent Servicedeclarative & hostedportal vs VS Code15 quiz questions
01Agents & the service

What an agent is, and what runs it

An AI agent is a software service that uses generative AI to understand and perform tasks on behalf of users — unlike rule-following apps or plain chat models, it understands context, decides, and acts autonomously. Agents deliver automation, better decisions, scalability, and 24/7 availability across use cases (productivity, research, sales, customer service, developer agents like GitHub Copilot).

Key concept · Microsoft Foundry Agent Service

A fully managed service to securely build, deploy, and scale agents without managing compute or storage — build in fewer than 50 lines of code. It provides automatic tool calling (runs the model, invokes tools, returns results), managed conversation state (via the Responses API), an extensive tool catalog, model selection, enterprise-grade security (keyless auth, content safety), customizable storage, and built-in observability & tracing.

02Types & components

Declarative, hosted, and the parts inside

The service supports two families of agent. Declarative agents are defined by configuration: prompt-based (a single agent with a model, instructions, tools, prompts — the most common) and workflow (multi-agent orchestrations defined in YAML). Hosted agents are containerized, code-defined agents the platform hosts.

The components of a prompt-based agent.
ComponentRole
ModelThe LLM powering reasoning and responses.
InstructionsThe system prompt defining behavior, personality, and constraints.
ToolsExternal capabilities that extend the agent beyond text generation.
KnowledgeContext or data the agent can access.
Thread / conversation stateOngoing history and context across interactions.
03Building agents

Two approaches, one workflow

You can build in the Foundry portal (web UI — quick prototyping, visual config, centralized management, non-technical collaboration) or in VS Code with the Foundry extension (developer workflows, Git version control, YAML editing, local playgrounds, hosted-agent deployment). Both support the same eight-step workflow: connect → create → configure instructions → add tools → test → iterate → deploy → integrate. Many teams use both.

Key concept · Required & optional Azure resources

You always need a Foundry project and model deployments (provisioned automatically with the project). Optional services add capability as needed: Azure AI Search (Foundry IQ / file search), Azure Storage (files), Azure Key Vault (secrets), and Azure Functions (custom tools).

04Security

New autonomy, new risks

Agents' autonomy and system access expand the attack surface. Design for security from the start.

Key agent security risks (selection).
RiskExample
Prompt injectionHidden instructions in a message make the agent leak credentials.
Data leakageSummarizing internal files exposes private data in a customer reply.
Privilege escalationWeak access control lets an agent perform admin actions on a CRM.
Over-reliance on autonomyAn unconstrained agent sends payments or publishes unverified content.
Supply-chain / poisoningA compromised plugin or poisoned data corrupts agent behavior.

Key concept · Security-by-design mitigations

Enforce role-based access control and least privilege; add prompt filtering/validation; gate sensitive operations behind human-in-the-loop approvals; keep comprehensive logging and traceability; audit third-party dependencies; and retrain/validate to catch drift or poisoning.

★Test yourself

Chapter 7 quiz

Fifteen questions on agents and the Foundry Agent Service, agent types/components, development approaches, and security. Answer first, then expand Show answer.

Part A · Multiple choice

Q1

What best distinguishes an AI agent from a plain chat model?

  • A It only generates text
  • B It understands context, decides, and takes actions autonomously
  • C It never uses an LLM
  • D It requires no configuration
Show answer

B. Agents combine models with tools to act, not just generate text.

Q2

The Foundry Agent Service is best described as:

  • A A code editor
  • B A fully managed service to build/deploy/scale agents without managing compute or storage
  • C A single LLM
  • D A vector database
Show answer

B. It lets you build agents in fewer than 50 lines of code.

Q3

Which agent type is a multi-agent orchestration defined in YAML?

  • A Prompt-based declarative agent
  • B Workflow agent
  • C Hosted agent
  • D Chat model
Show answer

B — workflow agent. Prompt-based is a single declarative agent; hosted agents are containerized/code.

Q4

Which is NOT a component of a prompt-based agent?

  • A Model
  • B Instructions
  • C Billing tier
  • D Thread / conversation state
Show answer

C — Billing tier. The components are model, instructions, tools, knowledge, and thread state.

Q5

Which development approach best fits Git version control and code-first workflows?

  • A Foundry portal
  • B VS Code with the Foundry extension
  • C A REST client
  • D The Azure mobile app
Show answer

B. The portal suits visual config and prototyping; VS Code suits developer workflows.

Q6

Which two Azure resources are always required to build agents?

  • A A Foundry project and model deployments
  • B Azure AI Search and Key Vault
  • C Azure Functions and Storage
  • D A VM and a database
Show answer

A. Others (AI Search, Storage, Key Vault, Functions) are optional, added by capability.

Q7

How does the Foundry Agent Service handle tool calling?

  • A The developer must write all integration code
  • B Automatically — it runs the model, invokes tools, and returns results
  • C It doesn't support tools
  • D Only via the portal
Show answer

B. Automatic tool calling removes complex integration code.

Part B · True or false

Q8

Prompt injection is a real security risk for agents.

Show answer

True. Hidden instructions can override behavior; mitigate with prompt filtering/validation.

Q9

The portal and VS Code approaches support the same agent-development workflow.

Show answer

True. They differ in interface style, not capability.

Q10

Highly autonomous agents need no constraints because they're reliable.

Show answer

False. Over-reliance on autonomy is a risk — gate sensitive actions behind human-in-the-loop approvals.

Q11

The Foundry Agent Service manages conversation state for you via the Responses API.

Show answer

True. It removes the need for manual state management.

Part C · Short answer

Q12

Name the two families of agent the service supports.

Show answer

Declarative agents (prompt-based and workflow) and hosted agents (containerized/code).

Q13

Name the five components of a prompt-based agent.

Show answer

Model, instructions, tools, knowledge, and thread/conversation state.

Q14

Give three security-by-design mitigations for agents.

Show answer

Any three: RBAC/least privilege, prompt filtering/validation, human-in-the-loop approvals, comprehensive logging, dependency auditing, and retraining to catch drift/poisoning.

Q15

Give three of the four value dimensions agents provide.

Show answer

Any three of: automation of routine tasks, enhanced decision-making, scalability, and 24/7 availability.