Unit 1: Foundations of AI Agents and Azure AI Foundry

CSE476 — Agentic Ai And Intelligent Automation 11 min read

I. Orientation — The Agentic AI Paradigm

Agentic AI studies systems that perceive an environment, reason about objectives, and perform actions with some degree of autonomy. Unlike a model that produces a single prediction, an AI agent operates through a continuing feedback loop in which observations influence actions and action results become new observations.

A. Introduction to AI agents

An AI agent is a computational entity that selects actions from perceptual information to achieve specified goals.

  • Agent function: The abstract agent function maps a percept history to an action.
TEXT
f: P* -> A
  • f is the agent function.
  • P* is the set of all possible sequences of percepts.
  • A is the set of actions available to the agent.
  • Core loop: A practical agent repeatedly observes, decides, acts, and evaluates.
TEXT
while goal_not_reached:
    observation = perceive(environment)
    action = decide(observation, memory, goal)
    result = execute(action)
    update(memory, result)
  • Autonomy: The agent can make bounded decisions without requiring a human instruction for every step.
  • Environment: Agents may operate in software environments, such as databases and APIs, or physical environments, such as robots and sensor networks.
  • Rationality: A rational agent chooses the action expected to maximize its performance measure, given its knowledge and available resources.
  • Agency boundary: Permissions, tools, policies, budgets, and approval rules determine what the agent is allowed to do.

II. Agent Structures — From Stimulus to Deliberate Action

Agent architecture defines how perception, internal state, goals, reasoning, and action-selection mechanisms are organized.

A. Intelligent agent architectures

An intelligent agent architecture is the structural design that connects an agent's inputs, decision processes, memory, and outputs.

  • Simple reflex architecture: Condition-action rules directly map a current percept to an action, such as IF temperature > 30°C THEN start_fan.
  • Model-based architecture: An internal state represents environmental facts that are not immediately observable.
  • Goal-based architecture: Candidate actions are evaluated according to whether they move the system toward a defined goal.
  • Utility-based architecture: A utility function ranks outcomes when several actions can satisfy the goal.
TEXT
a* = argmax U(Result(s, a))
  • s is the current state.
  • a is a candidate action.
  • Result(s, a) is the predicted resulting state.
  • U is the utility assigned to that state.
  • a* is the preferred action.
  • Learning architecture: Feedback changes the agent's policy, model, or knowledge so that future decisions improve.
  • Hybrid architecture: Enterprise agents commonly combine rapid rules, language-model reasoning, retrieval, memory, and deterministic workflows.

B. Reactive and goal-based agents

Reactive and goal-based agents differ mainly in whether they respond to immediate conditions or reason about future states.

  1. Reactive agents:

    • Decision basis: Current percepts or recent state determine the response.
    • Strength: Low latency suits spam filtering, threshold alerts, and automatic routing.
    • Limitation: A fixed rule such as IF payment_failed THEN notify_customer does not evaluate long-term consequences.
  2. Goal-based agents:

    • Decision basis: The agent searches for actions that produce a desired state, such as resolving a support case.
    • Strength: Planning permits multistep behavior and adaptation when an action fails.
    • Limitation: Search, model calls, and tool use increase cost, latency, and the possibility of error.
  • Explicit contrast: A reactive thermostat immediately switches heating on; a goal-based energy agent may consider forecasts, tariffs, occupancy, and a target temperature before scheduling heating.

C. Perception and action models

Perception and action models describe how an agent interprets environmental inputs and changes the environment through available tools.

  • Perception model: Raw input is converted into an internal representation, such as extracting an order number from an email.
  • Multimodal perception: Inputs can include text, speech, images, video, telemetry, or structured API responses.
  • State estimation: The agent combines observations with memory to infer facts that are not directly visible.
  • Action model: Each tool should define its name, parameters, preconditions, expected result, and possible failures.
  • Tool grounding: A language model may select get_order_status(order_id="A1042"), but application code validates and executes the call.
  • Feedback: Tool output becomes a new observation, allowing the agent to confirm success or revise its next action.
  • Safety boundary: High-impact actions, such as issuing refunds, should use authorization checks, value limits, audit logs, and human approval.

III. Interaction and Cognition — Language, Planning, and Reasoning

Agent intelligence depends on communicating clearly, decomposing objectives, selecting tools, and checking whether intermediate results support the goal.

A. Conversational AI fundamentals

Conversational AI enables users and systems to exchange natural-language messages while preserving relevant context across turns.

  • Language understanding: The system identifies intent, entities, constraints, and sentiment; “move my booking to Friday” contains an action, an object, and a date.
  • Dialogue state: Structured state records confirmed facts instead of relying only on the complete chat transcript.
  • Context management: Recent messages, retrieved records, summaries, and system instructions must fit within the model's context window.
  • Response generation: Answers should be grounded in authoritative data and adapted to the user's role and channel.
  • Conversation repair: When essential information is missing, the agent asks a targeted clarification rather than guessing.
  • Quality measures: Task completion, factual correctness, containment rate, latency, user satisfaction, and safe escalation provide more useful evidence than fluency alone.

B. Planning and reasoning

Planning determines a sequence of actions, while reasoning evaluates information and selects the next justified step.

  • Task decomposition: A broad objective such as “prepare a sales briefing” can become customer retrieval, recent-order analysis, risk identification, and summary generation.
  • Plan representation: Plans may be ordered lists, dependency graphs, workflow states, or dynamically selected tool calls.
  • Reasoning pattern: The agent can alternate between model decisions and external observations.
TEXT
state = initial_observation
while not complete(state):
    next_action = choose_action(goal, state, available_tools)
    observation = run(next_action)
    state = revise(state, observation)
  • Grounding: Retrieval-augmented generation supplies relevant enterprise documents before the model produces a conclusion.
  • Verification: Deterministic code should check calculations, schemas, citations, and business rules when possible.
  • Recovery: Timeouts, invalid parameters, and empty search results require bounded retries or alternative actions.
  • Control: Maximum steps, token budgets, tool allowlists, and stopping conditions prevent uncontrolled execution.

IV. Azure Foundations — Platform and Services

Azure provides managed models, search, language, vision, speech, safety, monitoring, identity, and application services for constructing enterprise AI systems.

A. Introduction to Azure AI Foundry

Azure AI Foundry is Microsoft's Azure environment for discovering models and building, evaluating, deploying, and governing generative AI applications and agents.

  • Model catalog: Developers can evaluate models from Microsoft, OpenAI, and other providers according to capability, cost, and deployment requirements.
  • Projects: Project resources organize models, data connections, deployments, evaluations, and team access.
  • Playgrounds: Interactive interfaces support prompt experimentation before prompts are integrated into application code.
  • Agent capabilities: Azure AI Agent Service supports managed agent development with model selection, instructions, tool connections, threads, and runs.
  • Evaluation: Built-in and custom evaluators can assess groundedness, relevance, coherence, safety, and task-specific outcomes.
  • Operations: Tracing and monitoring expose model calls, tool use, latency, failures, and token consumption.
  • Security: Microsoft Entra ID, role-based access control, managed identities, private networking, and content filters support enterprise deployment.

B. AI services in Azure

Azure AI services provide specialized capabilities that agents can call rather than implementing every intelligence function independently.

  • Azure OpenAI Service: Supplies supported generative and embedding models through Azure-managed endpoints.
  • Azure AI Search: Provides keyword, vector, semantic, and hybrid retrieval for grounding responses in enterprise content.
  • Azure AI Content Safety: Detects categories of harmful text and images and supports configurable safety controls.
  • Language services: Named-entity recognition, classification, summarization, translation, and question answering process text.
  • Speech services: Speech-to-text and text-to-speech enable voice-based agents.
  • Vision and Document Intelligence: Image analysis and document extraction convert visual business content into structured information.
  • Azure Machine Learning: Supports training, deployment, experiment tracking, and lifecycle management for custom machine-learning models.

C. Overview of Microsoft AI ecosystem

The Microsoft AI ecosystem combines development platforms, productivity products, data services, and extensibility frameworks.

  • Azure AI Foundry: Provides model and agent engineering capabilities for professional development teams.
  • Microsoft Copilot Studio: Offers low-code tools for creating copilots, topics, actions, connectors, and organizational deployments.
  • Semantic Kernel: An open-source SDK coordinates prompts, plugins, memory, and agent workflows in application code.
  • AutoGen: An open-source framework supports experimental multi-agent conversations and orchestration patterns.
  • Microsoft 365 Copilot: Brings AI assistance into applications such as Word, Excel, Outlook, and Teams.
  • Power Platform: Power Automate and connectors allow agents to participate in governed business workflows.
  • Microsoft Fabric: Integrates enterprise data engineering, analytics, and governance that can supply grounded agent context.

V. Engineering Agents — Lifecycle, Prompts, and Design

Reliable agents require iterative engineering across requirements, implementation, evaluation, deployment, and operational governance.

A. AI agent lifecycle

The AI agent lifecycle is the controlled progression from a business objective to a monitored and continuously improved production system.

  • Define: Specify the user, goal, success metric, prohibited behavior, and escalation conditions.
  • Design: Select the model, tools, memory, knowledge sources, orchestration pattern, and permission boundaries.
  • Build: Implement prompts, retrieval, tool schemas, validation, identity, and error handling.
  • Evaluate: Test representative and adversarial datasets for accuracy, safety, latency, cost, and task completion.
  • Deploy: Use versioned configurations, staged releases, least-privilege identities, and rollback mechanisms.
  • Monitor: Record traces, tool failures, policy violations, token use, user feedback, and outcome metrics.
  • Improve: Analyze failures, update prompts or data, rerun evaluations, and promote only validated changes.

B. Prompt engineering basics

Prompt engineering structures instructions and context so that a model produces useful, constrained, and testable behavior.

  • Role and objective: State the task directly, such as “Classify the support case and recommend the next approved action.”
  • Context: Supply only relevant facts, retrieved evidence, tool results, and policy excerpts.
  • Constraints: Define prohibited actions, required citations, length, tone, and escalation rules.
  • Output contract: A JSON schema makes responses easier to validate programmatically.
JSON
{
  "category": "billing",
  "confidence": 0.91,
  "next_action": "request_invoice_id"
}
  • Examples: A small number of high-quality input-output examples can clarify labels and formatting.
  • Instruction hierarchy: System and developer controls should remain separate from untrusted user content and retrieved documents.
  • Testing: Prompt versions require evaluation against fixed datasets; a persuasive response is not evidence of factual correctness.

C. Agent design principles

Agent design principles align autonomy with reliability, security, observability, and business value.

  • Least privilege: Give each tool only the permissions needed for its specific operation.
  • Determinism at boundaries: Use code for authorization, arithmetic, schema validation, financial limits, and irreversible transactions.
  • Human oversight: Require approval for high-risk, ambiguous, or legally significant actions.
  • Grounded decisions: Connect responses to current, authorized sources and retain evidence used for important conclusions.
  • Bounded autonomy: Define maximum steps, spending limits, timeout rules, and explicit completion criteria.
  • Modularity: Separate orchestration, prompts, tools, data access, and policy enforcement so each can be tested independently.
  • Observability: Capture structured traces without exposing credentials, private prompts, or unnecessary personal data.
  • Graceful failure: The agent should report limitations, preserve state, and transfer context during escalation.

VI. Enterprise Application — Agents in Business Processes

Enterprise agents are most valuable when they combine natural-language interaction with governed access to organizational systems and knowledge.

A. Use cases of enterprise AI agents

Enterprise AI agents can automate bounded knowledge work while preserving accountability and human control.

  • Customer service: An agent retrieves account data, answers policy-grounded questions, drafts responses, and routes exceptional cases.
  • IT operations: Agents classify incidents, search runbooks, gather diagnostics, and execute approved remediation workflows.
  • Sales support: An agent summarizes customer history, identifies open opportunities, and prepares meeting briefs from authorized CRM data.
  • Finance: Agents extract invoice fields, compare them with purchase orders, flag mismatches, and request approval without independently releasing payment.
  • Human resources: Policy assistants answer employee questions while enforcing access restrictions around personal records.
  • Software engineering: Agents can explain repositories, propose patches, run tests, and summarize failures within controlled development environments.
  • Compliance: Agents monitor documents or transactions against defined rules and provide evidence for human review.
  • Selection criteria: Strong candidates have measurable outcomes, reliable data, clear tool boundaries, repetitive decisions, and a feasible escalation path.
  • Risk factors: Poor data quality, prompt injection, excessive permissions, automation bias, and unclear ownership can outweigh expected productivity gains.