Introduction

AI Agents extend traditional AI chat experiences by combining language-model reasoning with the ability to select and
execute tools. Instead of only generating text, an agent can interpret a user's request, decide which approved operation is
relevant, call a function or API, use the returned data, and explain the result.
This guide outlines an Employee Assistance AI Agent built with an Angular frontend and an ASP.NET Core Web API
backend. Azure OpenAI provides the language model, while Microsoft Agent Framework provides the agent abstraction and
tool integration. SQL Server, internal APIs and document repositories can supply trusted business information.

Project objectives

• Build an Angular chat interface for natural-language interaction.
• Expose a secure ASP.NET Core API that receives questions and invokes the agent.
• Connect the agent to business functions such as employee lookup, leave balance and project status.
• Add conversation context, document retrieval and multi-agent workflows as later enhancements.

Proposed application architecture

ANGULAR FRONTEND
Chat interface · User input · Response display
HTTP / REST API
JSON request and response
ASP.NET CORE WEB API
Controllers · Services · Authentication · Dependency Injection
MICROSOFT AGENT FRAMEWORK
Agent instructions · Tool calling · Conversation context · Workflows
CONNECTED CAPABILITIES
Azure OpenAI · SQL Server · Internal APIs · Documents / knowledge sources

Architecture overview

Angular sends the user's question to the backend over HTTPS. ASP.NET Core validates the request, applies authentication
and authorization, and calls the agent service. The agent uses the configured model and may invoke approved C# tools.
Those tools access business systems and return structured results for the agent to explain.
User request
Expected agent behaviour
Who am I?
Retrieve the authenticated employee's profile from an employee service.
Show my leave balance
Call an authorized leave-balance function or API.
Apply for leave
Collect required details, validate them and request confirmation before submission.
What is my project status?
Retrieve project information from an approved project service.
Explain this error log
Analyze supplied log content and summarize likely causes.
How do I configure an API?
Retrieve relevant technical documentation or knowledge-base content.

1. APPLICATION OVERVIEW

The example application is an Employee Assistance AI Agent. It demonstrates how an agent can route different requests to
specific business capabilities rather than treating every request as a general question.

User request

Expected agent behaviour

Who am I?

Retrieve the authenticated employee's profile from an employee service.

Show my leave balance

Call an authorized leave-balance function or API.

Apply for leave

Collect required details, validate them and request confirmation before submission.

What is my project status?

Retrieve project information from an approved project service.

Explain this error log

Analyze supplied log content and summarize likely causes.

How do I configure an API?

Retrieve relevant technical documentation or knowledge-base content.

Technology stack

Layer

Technology / responsibility

Frontend

Angular 18+; chat UI, user input, loading state and response display.

Backend

ASP.NET Core Web API; endpoints, validation, dependency injection and security.

Agent framework

Microsoft Agent Framework; agent instructions, tool calling, context and workflows.

Model

Azure OpenAI deployment; language understanding and response generation.

Data

SQL Server and internal REST APIs; trusted business records.

Identity

Microsoft Entra ID or JWT-based authentication and authorization.

Deployment

Azure App Service or an organization's approved hosting platform.

Why use an agent framework?
A direct model call is useful for simple question-and-answer scenarios. An agent framework becomes valuable when the
application needs tools, multi-turn context, orchestration or multiple cooperating agents. Tool execution must remain
constrained by backend authorization and business rules; the model must not be treated as an authorization authority.
Layer
Technology / responsibility
Frontend
Angular 18+; chat UI, user input, loading state and response display.
Backend
ASP.NET Core Web API; endpoints, validation, dependency injection and security.
Agent framework
Microsoft Agent Framework; agent instructions, tool calling, context and workflows.
Model
Azure OpenAI deployment; language understanding and response generation.
Data
SQL Server and internal REST APIs; trusted business records.
Identity
Microsoft Entra ID or JWT-based authentication and authorization.
Deployment
Azure App Service or an organization's approved hosting platform.
BACKEND IMPLEMENTATION – ASP.NET CORE

Step 1: Create the Web API project

dotnet new webapi -n IntelligentAgent.API
cd IntelligentAgent.API

Add the agent and model integration packages that match the Microsoft Agent Framework and Azure OpenAI versions
selected for your solution. Verify package names, namespaces and API signatures against the official documentation for the
version you install.

dotnet add package Microsoft.Agents.AI
dotnet add package OpenAI
dotnet add package Azure.Identity

Step 2: Configure Azure OpenAI

Set the endpoint and model deployment name through environment variables or a managed configuration provider. Do not
commit credentials to source control. For local development, authenticate with Azure CLI and ensure the signed-in identity
has permission to invoke the model deployment.

AZURE_OPENAI_ENDPOINT=https://YOUR-RESOURCE.openai.azure.com/openai/v1/
AZURE_OPENAI_DEPLOYMENT_NAME=YOUR-MODEL-DEPLOYMENT
az login

Step 3: Create the agent service

Create a Services folder and add an AIEmployeeAgent service. The following illustrates the intended integration pattern:
create a model client, adapt it to an AIAgent, provide clear instructions, and invoke the agent from a service method.
Confirm the exact overloads and credential configuration supported by your installed SDK versions before compiling.

using Microsoft.Agents.AI;
using OpenAI;
using Azure.Identity;
namespace IntelligentAgent.API.Services;
public class AIEmployeeAgent
{
private readonly AIAgent _agent;
public AIEmployeeAgent()
{
var endpoint = Environment.GetEnvironmentVariable(
"AZURE_OPENAI_ENDPOINT")!;
var deployment = Environment.GetEnvironmentVariable(
"AZURE_OPENAI_DEPLOYMENT_NAME")!;
var credential = new AzureCliCredential();
// Configure the OpenAI/Azure OpenAI client using
// the authentication approach supported by your SDK.
var client = new OpenAIClient(
new BearerTokenPolicy(
credential,
"https://ai.azure.com/.default"),
new OpenAIClientOptions
{
Endpoint = new Uri(endpoint)
});
_agent = client.GetResponsesClient().AsAIAgent(
model: deployment,
name: "EmployeeAssistant",
instructions: """
You are an employee assistance agent.
Help with employee information, leave,
project information and technical questions.
Never invent employee or business data.
""");
}
public async Task<string> AskAsync(string question)
{
var response = await _agent.RunAsync(question);
return response.ToString();
}
}

Implementation note: This is a starter example, not a guaranteed drop-in implementation for every package release. Check the current Microsoft
Agent Framework quickstart and SDK reference for precise client construction and authentication APIs.
ENDPOINT AND APPLICATION CONFIGURATION

Step 4: Create the chat controller

The controller accepts a question, performs basic input validation, invokes the agent service and returns a JSON response.
In production, derive employee identity from the authenticated user rather than accepting a client-supplied employee ID.

using Microsoft.AspNetCore.Mvc;
using IntelligentAgent.API.Services;
namespace IntelligentAgent.API.Controllers;
[ApiController]
[Route("api/[controller]")]
public class AgentController : ControllerBase
{
private readonly AIEmployeeAgent _agent;
public AgentController(AIEmployeeAgent agent)
{
_agent = agent;
}
[HttpPost("chat")]
public async Task<IActionResult> Chat(
[FromBody] ChatRequest request)
{
if (string.IsNullOrWhiteSpace(request.Question))
return BadRequest("Question is required.");
var answer = await _agent.AskAsync(request.Question);
return Ok(new
{
Question = request.Question,
Answer = answer
});
}
}
public class ChatRequest
{
public string Question { get; set; } = string.Empty;
}

Step 5: Register services and configure CORS

using IntelligentAgent.API.Services;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

builder.Services.AddSingleton<AIEmployeeAgent>();

builder.Services.AddCors(options =>

{

options.AddPolicy("AngularPolicy", policy =>

{

policy.WithOrigins("http://localhost:4200")

.AllowAnyHeader()

.AllowAnyMethod();

});

});

var app = builder.Build();

app.UseCors("AngularPolicy");

app.MapControllers();

app.Run();

Step 6: Run and test the API

dotnet run
Request – POST /api/agent/chat
{
"question": "Explain what an AI Agent is"
}
Example response shape
{
"question": "Explain what an AI Agent is",
"answer": "An AI Agent is an intelligent system..."
}

Use the actual HTTPS URL and port printed by the application. Test the endpoint with Swagger UI, Postman or another API
client before connecting Angular.

4. ANGULAR FRONTEND IMPLEMENTATION

Step 1: Create the Angular application

ng new intelligent-agent-ui\ncd intelligent-agent-ui\nng serve

Open http://localhost:4200. Generate the chat component and API service:

ng generate component components/ai-chat\nng generate service services/ai-agent

Step 2: Create the API service

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
export interface ChatResponse {
question: string;
answer: string;
}
@Injectable({ providedIn: 'root' })
export class AiAgentService {
private apiUrl = 'https://localhost:7001/api/agent';
constructor(private http: HttpClient) {}
sendMessage(question: string):
Observable<ChatResponse> {
return this.http.post<ChatResponse>(
${this.apiUrl}/chat, { question }
);
}
}

Replace the sample URL with the actual backend URL. For production, use Angular environment configuration rather than hard-coding an
endpoint.

Step 3: Register HttpClient

import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
export const appConfig: ApplicationConfig = {
providers: [provideHttpClient()]
};

Step 4: Implement the chat component

import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AiAgentService } from
'../../services/ai-agent.service';
@Component({
selector: 'app-ai-chat',
standalone: true,
imports: [CommonModule, FormsModule],
templateUrl: './ai-chat.component.html'
})
export class AiChatComponent {
question = '';
answer = '';
loading = false;
constructor(private aiService: AiAgentService) {}
sendMessage() {
if (!this.question.trim() || this.loading) return;
this.loading = true;
this.answer = '';
this.aiService.sendMessage(this.question).subscribe({
next: response => {
this.answer = response.answer;
this.loading = false;
},
error: error => {
this.answer = 'Unable to connect. Please try again.';
console.error(error);
this.loading = false;
}
});
}
}

5. CHAT INTERFACE AND AGENT TOOL EXECUTION

Step 5: Create the chat interface
<div class="chat-container">
<h2>AI Employee Assistant</h2>
<div class="chat-box">
<textarea [(ngModel)]="question"
placeholder="Ask something..." rows="4">
</textarea>
<button (click)="sendMessage()" [disabled]="loading">
{{ loading ? 'Thinking...' : 'Ask AI' }}
</button>
<div class="response" *ngIf="answer">
<h3>AI Agent Response</h3>
<p>{{ answer }}</p>
</div>
</div>
</div>

The UI can be enhanced with message history, timestamps, typing indicators, retry handling, Markdown rendering and a
conversation identifier. Treat AI-generated content as untrusted text; do not render it as raw HTML.

What makes this an agent? Function calling and tools

The initial chat integration sends a question to a model-backed agent and displays its response. To deliver useful business
actions, expose narrowly scoped C# functions as tools. The agent can select an appropriate tool based on the user's intent,
while the backend enforces identity, permissions, validation and business rules.
ANGULAR FRONTEND
Chat interface · User input · Response display
HTTP / REST API
JSON request and response
ASP.NET CORE WEB API
Controllers · Services · Authentication · Dependency Injection
MICROSOFT AGENT FRAMEWORK
Agent instructions · Tool calling · Conversation context · Workflows
CONNECTED CAPABILITIES
Azure OpenAI · SQL Server · Internal APIs · Documents / knowledge sources

Example: checking leave balance

Stage
What happens
1. User request
The employee asks: “Can you check my leave balance?”
2. Intent selection
The agent determines that leave-balance information is needed.
3. Tool invocation
The agent selects an exposed GetLeaveBalance function.
4. Business operation
The C# tool obtains the authenticated employee's identity and calls the leave API or database.
5. Tool result
The business service returns the actual available leave values.
6. Agent response
The agent explains the returned values in natural language.
Illustrative response: “You currently have 12 annual leave days and 5 sick leave days remaining.” These figures are sample values only; a real
application must use the authenticated employee's live records.

Tool design guidance

• Expose only the functions required for the use case; do not give the agent unrestricted database or system access.
• Validate every tool argument on the server and authorize each operation for the current user.
• Use confirmation or human approval before submitting leave, changing records or performing consequential actions.
• Log tool name, authenticated actor, request correlation ID, outcome and duration without unnecessarily logging sensitive
data.

6. PROJECT STRUCTURE AND DEVELOPMENT ROADMAP

Phase
Implementation
Expected outcome
1
Angular + ASP.NET Core + Azure OpenAI
Working AI chat experience.
2
Microsoft Agent Framework + C# tools
Agent can invoke approved business functions.
3
SQL Server + internal REST APIs
Responses grounded in live business data.
4
RAG + conversation memory
Context-aware answers using approved documents and
conversation context.
5 Multiple agents + approval workflows
Specialized agents and controlled business processes.

Recommended solution structure

IntelligentAgentSolution/
|
+-- IntelligentAgent.API/
| +-- Controllers/
| | +-- AgentController.cs
| +-- Services/
| | +-- AIEmployeeAgent.cs
| +-- Tools/
| | +-- EmployeeTools.cs
| | +-- LeaveTools.cs
| | +-- ProjectTools.cs
| +-- Models/
| | +-- ChatRequest.cs
| +-- Program.cs
|
+-- intelligent-agent-ui/
+-- src/app/
+-- components/ai-chat/
+-- services/ai-agent.service.ts
+-- app.config.ts

Development roadmap

Phase

Implementation

Expected outcome

1

Angular + ASP.NET Core + Azure OpenAI

Working AI chat experience.

2

Microsoft Agent Framework + C# tools

Agent can invoke approved business functions.

3

SQL Server + internal REST APIs

Responses grounded in live business data.

4

RAG + conversation memory

Context-aware answers using approved documents and

conversation context.

5 Multiple agents + approval workflows

Specialized agents and controlled business processes.

Suggested future enhancements

Capability

Purpose

Multi-turn conversation

Maintain a conversation session so follow-up questions can use prior context.

Agent memory

Retain selected useful information according to explicit privacy and retention policies.

Retrieval-Augmented Generation

(RAG)

Retrieve relevant passages from company documents and provide grounded answers.

Multiple agents

Separate responsibilities such as HR support, technical support and project assistance.

Human approval

Pause sensitive operations until an authorized person confirms the action.

7. SECURITY AND PRODUCTION CONSIDERATIONS

• Authentication: Protect APIs with Microsoft Entra ID or a suitable JWT-based identity solution.
• Authorization: Enforce role- and resource-level permissions in backend services, not in prompts.
• Identity binding: Derive employee identity from the authenticated principal; do not trust a user ID supplied in chat text.
• Input and output validation: Validate tool arguments, constrain output formats and safely render generated content.
• Secrets: Store credentials in a secure configuration service such as Azure Key Vault; avoid source-control secrets.
• Resilience: Add timeouts, cancellation, retries where appropriate, rate limits and graceful error handling.
• Observability: Track latency, token usage, tool calls, failures and correlation IDs while minimizing sensitive logging.
• Human oversight: Require explicit confirmation for actions that change records, submit requests or affect employee
entitlements.
The code samples in this guide are starter examples. Before production deployment, align SDK versions, validate current
framework APIs, add automated tests, configure TLS and secrets management, and complete your organization's security

CONCLUSION

Combining Angular with ASP.NET Core Web API provides a clear separation between the user experience and the AI
orchestration layer. Angular offers an interactive chat interface, while the backend controls authentication, business logic,
tool execution and access to enterprise data. Azure OpenAI supplies the model capability, and Microsoft Agent Framework
helps organize agent behaviour and tool use.
The key step from a basic AI chatbot to an Agentic AI application is the addition of well-designed tools. Those tools allow the
agent to retrieve trusted information and initiate approved operations. The application remains responsible for security,
authorization, validation and human approval.
For an initial implementation, begin with a single employee-assistance agent and one read-only tool, such as retrieving a
leave balance. Once that flow is tested end to end, add additional tools, conversation sessions, document retrieval and
more advanced workflows.