A multi-client Student Management System built with .NET, SQL Server, Angular, WPF, ASP.NET Core MVC, and ASP.NET Core Web API, extended with an AI-powered Student Management Copilot using Microsoft Agent Framework.
The project demonstrates traditional application architecture together with AI tool calling, Human-in-the-Loop approval, persistent agent sessions, Retrieval-Augmented Generation (RAG), Qdrant, Agent Skills, and observability.
- Overview
- Features
- Architecture
- Projects
- Technology Stack
- Data Access Strategy
- Authentication
- AI Copilot
- Human-in-the-Loop
- Persistent Sessions
- RAG and Qdrant
- Agent Skills
- Observability
- Prerequisites
- SQL Server Setup
- Docker and Qdrant Setup
- Configuration
- Running the Project
- Testing the Copilot
- Project Status
The solution was created to learn and demonstrate multiple .NET application types and data-access approaches while sharing the same Student Management domain.
It currently includes:
- Console application
- ASP.NET Core MVC application
- ASP.NET Core Web API
- WPF desktop client
- Angular standalone client
- SQL Server
- ADO.NET
- Entity Framework Core
- Dapper
- Stored Procedures
- JWT authentication
- Microsoft Agent Framework
- OpenRouter LLM integration
- AI tools
- Human-in-the-Loop approval
- SQL-backed agent sessions
- RAG over institutional documents
- Qdrant vector database
- Local embeddings
- Agent Skills
- AI/tool/RAG/request timing
The existing application services remain the authoritative source for operational data. The AI layer calls those services through controlled tools instead of directly becoming another database-access layer.
- Student CRUD
- Search students by name
- Retrieve students by ID
- Retrieve students by roll number
- Course CRUD
- Retrieve course by ID
- Retrieve course by code
- List courses
- Update course details and pricing
- Enroll students
- Retrieve student enrollments
- Retrieve enrollment by ID
- Record attendance
- Mark attendance for "today"
- Update attendance
- Retrieve attendance records
- Generate attendance summaries
Date-sensitive operations use an application-configured timezone rather than depending on the server machine's local date.
- Retrieve fee records
- Retrieve fee statements
- Process payments
- Track amount due
- Track amount paid
- Track remaining balance
- Track payment status
- Registration and login
- JWT authentication
- Protected API endpoints
- Angular authentication
- WPF API authentication
The Copilot can use:
- live SQL-backed application data,
- institutional policies retrieved through RAG,
- controlled write tools,
- Human-in-the-Loop approval,
- persistent sessions,
- Agent Skills.
Example questions:
Show me all courses.
Get the fee statement for student ID 1 in course ID 5.
Is student ID 1 eligible to sit the final examination based on attendance?
Review the fee status for student ID 1 in course ID 5 and tell me whether institutional policy indicates any eligibility issue.
Angular / WPF / MVC
|
v
ASP.NET Core Web API
|
+----------+----------+
| |
v v
Application Services StudentManagement.AI
| |
v v
SQL Server Microsoft Agent Framework
|
+---------+---------+
| | |
v v v
AI Tools Skills RAG
| |
v v
Application Services Qdrant
|
v
Institutional Knowledge
The AI layer sits on top of the existing application architecture. It does not replace the normal services or database layer.
Shared domain models, interfaces, and application/service abstractions.
ADO.NET infrastructure used for direct SQL/data-access learning.
Entity Framework Core infrastructure used by the MVC path.
ASP.NET Core Web API responsible for:
- REST endpoints
- authentication
- dependency injection
- Copilot endpoints
- agent-session persistence
- application configuration
Development endpoints:
https://localhost:7202
http://localhost:5164
Desktop client consuming the Web API.
Angular standalone frontend consuming the Web API.
ASP.NET Core MVC implementation.
Contains the Copilot implementation.
Major areas include:
StudentManagement.AI/
├── Agents/
├── Configuration/
├── Context/
├── Extensions/
├── Observability/
├── RAG/
├── Services/
├── Sessions/
├── Skills/
└── Tools/
Responsibilities include:
- agent creation,
- OpenRouter chat-client configuration,
- AI tools,
- approval-required tools,
- RAG,
- Agent Skills,
- authenticated-user context,
- sessions,
- observability.
| Area | Technology |
|---|---|
| Runtime | .NET |
| Backend | ASP.NET Core Web API |
| Web UI | ASP.NET Core MVC |
| Desktop | WPF |
| Frontend | Angular |
| Database | SQL Server |
| ORM | Entity Framework Core |
| Other Data Access | Dapper, ADO.NET, Stored Procedures |
| Authentication | JWT |
| AI Framework | Microsoft Agent Framework |
| AI Abstractions | Microsoft.Extensions.AI |
| LLM Provider | OpenRouter |
| Vector Database | Qdrant |
| Embeddings | Local embedding generator |
| Containers | Docker |
| API Testing | Swagger / OpenAPI |
The solution intentionally uses several approaches for learning.
| Application / Layer | Data Access |
|---|---|
| Console | ADO.NET |
| MVC | Entity Framework Core |
| WPF | Web API |
| Angular | Web API |
| Web API | EF Core + Dapper |
| AI Copilot | Existing application services through AI tools |
| Institutional RAG | Qdrant |
Live student, course, enrollment, attendance, and fee information must come from the application's service layer.
The Web API uses JWT authentication.
The Angular client can authenticate through the API, while the WPF application consumes protected endpoints through its API client.
The Copilot also receives authenticated-user context so AI requests remain associated with the current application user.
The Copilot uses Microsoft Agent Framework.
User Prompt
|
v
CopilotController
|
v
CopilotService
|
v
AIAgent
|
v
LLM
|
+----> Application AI Tools ----> Services ----> SQL Server
|
+----> Agent Skills
|
+----> SearchInstitutionalKnowledge ----> Qdrant
The agent is instructed to:
- only state application facts it can verify,
- avoid inventing student or institutional data,
- never infer roll numbers from student IDs,
- never infer course codes from course IDs,
- gather all required evidence for multi-part questions,
- separate live data from institutional policy,
- validate exact records before writes,
- check
SuccessandFoundvalues, - avoid policy conclusions unsupported by retrieved policy,
- use authoritative calculated values returned by tools.
The project uses OpenRouter through its OpenAI-compatible API.
Example:
{
"OpenRouter": {
"BaseUrl": "https://openrouter.ai/api/v1",
"Model": "openrouter/free",
"TimeoutSeconds": 85
}
}Never commit the OpenRouter API key to source control.
Use User Secrets, environment variables, or another secure secret store.
Examples of tools exposed to the agent include:
GetStudentById
GetStudentByRollNumber
SearchStudentsByName
GetCourseById
GetCourseByCode
GetAllCourses
GetEnrollmentsByStudent
GetEnrollmentById
EnrollStudent
GetAttendanceForStudent
GetAttendanceForCourseOnDate
GetAttendanceById
GetAttendanceSummaryForStudent
MarkAttendanceToday
UpdateAttendance
GetFeeById
GetFeeStatement
ProcessStudentPayment
SearchInstitutionalKnowledge
Write operations are protected by approval-required functions where appropriate.
Sensitive write operations use ApprovalRequiredAIFunction.
User requests modification
|
v
Agent validates target
|
v
Agent requests approval-required tool
|
v
Execution pauses
|
v
API returns approval request
|
v
User approves/rejects
|
v
Persisted agent session resumes
|
v
Tool executes only when approved
This is used for operations such as:
- student enrollment,
- attendance writes,
- payment processing,
- student updates/deletion,
- course updates/deletion.
The agent does not ask for an extra conversational confirmation when application-level approval will handle confirmation.
Agent sessions are persisted in SQL Server.
AgentSessions stores information including:
- session ID,
- user ID,
- serialized session,
- creation/update timestamps,
- expiration,
- pending approval request ID,
- pending function name,
- pending function call ID,
- pending arguments.
Flow:
HTTP Request
|
v
Load persisted session
|
v
Run / resume agent
|
v
Handle tools / approval
|
v
Serialize session
|
v
Save session to SQL Server
This allows conversations and Human-in-the-Loop workflows to continue across HTTP requests.
Institutional policies are retrieved using Retrieval-Augmented Generation.
The system deliberately separates live data from policy knowledge.
Live application data:
SQL Server -> Services -> AI Tools
Institutional knowledge:
Documents -> Chunking/Ingestion -> Embeddings -> Qdrant
|
v
SearchInstitutionalKnowledge
For example, attendance eligibility can require:
- live attendance from SQL-backed tools,
- attendance policy from Qdrant,
- an evidence-based conclusion using both.
The agent must not invent policies or infer consequences that the retrieved policy does not explicitly establish.
QdrantKnowledgeStore performs vector retrieval.
Its query flow is:
Initialize local embedding generator
|
v
Generate query embedding
|
v
Query Qdrant
|
v
Filter and map results
|
v
Return institutional knowledge
The RAG pipeline can retrieve chunks from institutional material such as the student handbook.
The Copilot supports Agent Skills for reusable task-specific workflows.
Current examples include:
attendance-eligibility
fee-status-review
Example runtime logs:
Agent requested skill loading. Arguments: [skillName, attendance-eligibility]
Agent requested skill loading. Arguments: [skillName, fee-status-review]
Skills are useful for workflows that require a repeatable sequence of tools and evidence checks without placing every task-specific instruction in the global agent prompt.
The project contains an Observability layer for measuring AI latency.
Wraps IChatClient and logs LLM duration:
LLM call finished in 3446 ms.
Wraps selected tools:
AI tool GetAttendanceSummaryForStudent finished in 32 ms.
AI tool SearchInstitutionalKnowledge finished in 7691 ms.
QdrantKnowledgeStore logs stages such as:
Local embedding generator initialized in ... ms.
Query embedding generated in ... ms.
Qdrant query returned ... results in ... ms.
Qdrant results filtered and mapped in ... ms.
Knowledge search finished in ... ms.
Agent execution finished after ... ms.
Copilot HTTP request finished after ... ms.
This helps identify whether latency comes from the LLM, tools, embedding generation, Qdrant, orchestration, or HTTP/database work.
Install:
- .NET SDK required by the solution
- SQL Server or SQL Server Express
- Visual Studio or another .NET IDE
- Node.js
- Angular CLI compatible with the project
- Docker Desktop
- Git
AI features additionally require:
- OpenRouter API key
- Qdrant
- institutional documents indexed into Qdrant
Development uses SQL Server Express:
localhost\SQLEXPRESS
with Windows Authentication.
Example connection string:
{
"ConnectionStrings": {
"SchoolDB": "Server=localhost\\SQLEXPRESS;Database=SchoolDB;Trusted_Connection=True;TrustServerCertificate=True;"
}
}Change this configuration for your own SQL Server environment.
Apply the required database setup/migrations before starting the application.
Qdrant runs locally in Docker.
Start Docker Desktop, then run:
docker --version
docker psdocker pull qdrant/qdrantPowerShell:
docker run -d `
--name student-management-qdrant `
-p 6333:6333 `
-p 6334:6334 `
-v qdrant_storage:/qdrant/storage `
qdrant/qdrant| Port | Purpose |
|---|---|
6333 |
HTTP/REST API and dashboard |
6334 |
gRPC |
The named qdrant_storage volume persists vectors across container recreation.
docker psQdrant REST endpoint:
http://localhost:6333
Qdrant dashboard:
http://localhost:6333/dashboard
docker stop student-management-qdrantdocker start student-management-qdrantdocker stop student-management-qdrant
docker rm student-management-qdrantThe named volume remains unless explicitly deleted.
To delete Qdrant's persisted vector data:
docker volume rm qdrant_storageWarning: deleting the volume removes the indexed vectors. Institutional documents must then be indexed again.
Create docker-compose.yml at repository root:
services:
qdrant:
image: qdrant/qdrant
container_name: student-management-qdrant
ports:
- "6333:6333"
- "6334:6334"
volumes:
- qdrant_storage:/qdrant/storage
restart: unless-stopped
volumes:
qdrant_storage:Start:
docker compose up -dCheck:
docker compose psStop:
docker compose downDelete the container and volume:
docker compose down -vExample User Secrets setup from the Web API project:
dotnet user-secrets init
dotnet user-secrets set "OpenRouter:ApiKey" "YOUR_OPENROUTER_API_KEY"Do not commit real secrets.
Example:
{
"Application": {
"TimeZoneId": "Pakistan Standard Time"
}
}This is used for date-sensitive operations such as "mark attendance today".
For local Docker development, Qdrant is normally available at:
http://localhost:6333
Use the exact Qdrant option/property names already defined in the project configuration.
The collection's embedding dimensions/configuration must match the embedding model used during both ingestion and querying.
git clone <repository-url>
cd StudentManagementSystemdotnet restoreMake sure the configured SQL Server instance and application database are available.
docker start student-management-qdrantor:
docker compose up -dAdd the API key through User Secrets or environment variables.
Make sure the institutional documents have been ingested into the configured Qdrant collection.
If the Qdrant volume was deleted, run the project's ingestion/indexing process again before testing policy questions.
From repository root:
dotnet builddotnet run --project StudentManagementApp.WebApiDevelopment URLs:
https://localhost:7202
http://localhost:5164
From the Angular project:
npm install
ng serveSelect the required startup project in Visual Studio and run it normally.
A typical Copilot request:
{
"message": "Is student ID 1 eligible to sit the final examination based on attendance?",
"sessionId": null
}Typical response shape:
{
"response": "...",
"sessionId": "...",
"requiresApproval": false,
"approval": null
}Send the returned sessionId with later messages to continue the same conversation.
For write operations, requiresApproval can become true. The approval endpoint then resumes the persisted session after the user approves or rejects the operation.
Conceptually:
Load attendance-eligibility skill
|
v
GetStudentById
|
v
GetAttendanceSummaryForStudent
|
v
SearchInstitutionalKnowledge
|
v
Combine authoritative attendance data
with retrieved institutional policy
|
v
Evidence-based eligibility result
Conceptually:
Load fee-status-review skill
|
v
GetFeeStatement
|
v
SearchInstitutionalKnowledge
|
v
Report fee status
|
v
Only claim eligibility consequences
explicitly established by retrieved policy
An outstanding balance must not automatically be converted into an exam restriction when the retrieved policy does not establish that rule.
- SQL-backed application tools are authoritative for live operational data.
- Qdrant/RAG is for institutional knowledge, not live student records.
- The LLM does not directly modify the database.
- Write operations go through application services and Human-in-the-Loop approval.
- Exact target records are validated before writes.
- IDs, roll numbers, and course codes are not inferred from one another.
- Policy conclusions are grounded in retrieved institutional knowledge.
- Missing evidence is reported instead of invented.
- Calculated values returned by authoritative tools are used directly.
- Agent Skills hold reusable task workflows.
- Global agent instructions enforce cross-cutting safety/correctness rules.
- Observability measures LLM, tool, RAG, agent, and HTTP latency.
- SQL-backed sessions allow conversations and approval workflows to resume across requests.
Implemented:
- Student CRUD
- Course CRUD
- Enrollment management
- Attendance management
- Fee management
- JWT authentication
- Console application
- MVC application
- WPF client
- Angular client
- ASP.NET Core Web API
- Microsoft Agent Framework Copilot
- OpenRouter integration
- AI tool calling
- Human-in-the-Loop approval
- SQL-backed agent sessions
- RAG
- Qdrant
- Local embeddings
- Institutional knowledge search
- Combined live-data + policy reasoning
- Agent Skills
- AI/tool/RAG/HTTP observability
The project is primarily a learning and architecture project demonstrating how traditional .NET applications can be extended with an AI agent while keeping live data, authorization, write safety, and institutional policy grounded in controlled application components.