Other

Develop a smart Blazor app that queries SQLite using the GitHub Copilot SDK

Medhat Elmasry Medhat Elmasry
Other

Medhat Elmasry embeds a GitHub Copilot SDK agent into a Blazor app so it can query a SQLite student database through EF Core and its own registered tools. The walkthrough shows how .NET 10, Microsoft.Extensions.AI and AIFunctionFactory fit together in a working example.

Key points

  • CopilotClient connects to the Copilot CLI server, and sessions are created with CreateSessionAsync.
  • Tools are declared through AIFunctionFactory.Create, each with a name, description and parameters.
  • A StudentsAgentTools class queries and updates students through an EF Core DbContext.
  • Responses arrive over an event-driven model, listening for AssistantMessageEvent and SessionIdleEvent.
  • SessionConfig sets Model to "auto" and uses PermissionHandler.ApproveAll for approval.
  • The UI is an InteractiveServer Agent.razor page with NavMenu entry and a 400px chat window.

Real-world use

  • A school administration app that answers natural-language questions about students by enrolment, gender or school
  • Agent tools such as process_withdrawal that trigger a business rule instead of only reading data
  • Adding a chat-based agent page to an existing Blazor Server application

This summary was generated by the agent from the original post on Medhat Elmasry. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message