ZOYKUHot Board

nashtech-garage/ntg-agentДокументація

A sample Chatbot in C# using Microsoft Agent Framework

Мовне сповіщення:Локалізована документація відсутня. Відображається офіційний англійський оригінал.
Швидке встановлення
git clone https://github.com/nashtech-garage/ntg-agent.git

NTG Agent

This project aims to practice building a chatbot in C#

Build Quality Gate Status SonarCloud Coverage Security Rating Vulnerabilities

High level architecture

NTG Agent - High level architecture

Technologies and frameworks

  • .NET 10
  • .NET Aspire
  • Blazor
  • Microsoft Agent Framework
  • LightRAG
  • Support multiple LLMs: GitHub Models, Open AI, Azure Open AI etc.
  • SQL Server
  • NextJs
  • Docker & Docker Compose

Documentation

Details about the project can be referenced at DeepWiki: https://deepwiki.com/nashtech-garage/ntg-agent

Getting started

Run the project locally with .NET Aspire.

Quick start (Linux/macOS)

One command on a fresh machine — clones the repo and runs the installer:

curl -fsSL https://raw.githubusercontent.com/nashtech-garage/ntg-agent/main/install.sh | bash

Or, from an existing checkout, ./install-local.sh. Either way the script does the whole local setup end-to-end — checks system prerequisites (.NET 10 SDK, Docker, Node ≥ 20) and installs the missing ones automatically: on Ubuntu/Debian with sudo apt (Node via NodeSource); on macOS with Homebrew (brew install --cask dotnet-sdk, brew install node, etc. — Homebrew must be installed first; if git is missing, run xcode-select --install). On macOS, Docker must already be running (Docker Desktop or Colima — it is not auto-installed; the script prints how to get it if it's missing). Other systems get install instructions instead. The script then activates the repo git hooks, installs dotnet-ef, asks for your Azure OpenAI endpoint + key (one resource serves LightRAG and the Default Agent; deployment names default to gpt-5.1 / text-embedding-3-large, override in .env), auto-generates the remaining secrets, writes the AppHost user-secrets, brings up the local LightRAG stack (deploy/lightrag-local: Postgres + nginx gateway on 127.0.0.1:8080), and launches the AppHost.

Re-running is safe: existing .env values are kept and only missing pieces are filled in. After the first setup, stop the application with Ctrl+C and use ./ntg run for subsequent runs. The shortcut refreshes the AppHost secrets, starts the local LightRAG stack, and launches the Aspire AppHost.

The installer now selects the global LLM and embedding providers independently; the Azure-only wording in older setup notes is obsolete. See LightRAG provider configuration for the supported bindings and variables.

Quick start (Windows via WSL2)

The same script is the supported path on Windows — it runs inside WSL2:

  1. Install WSL2 with the default Ubuntu distro: wsl --install in an admin PowerShell, then reboot and create your Linux user.
  2. Install Docker Desktop with the WSL2 backend, and enable your distro under Settings → Resources → WSL integration.
  3. Inside the WSL shell, use a checkout in the WSL filesystem (~/ntg-agent, not /mnt/c/... — file watching and builds are unreliable and slow on the Windows mount), then run ./install-local.sh from the repository root for the first setup. The script apt-installs the remaining prerequisites (.NET 10 SDK, Node ≥ 20, git); Docker itself is left to Docker Desktop.

The dashboard is reachable from your Windows browser at https://localhost:17050 (WSL2 forwards localhost automatically). The HTTPS dev certificate is generated inside WSL and won't be trusted by the Windows browser — accept the certificate warning, or run dotnet dev-certs https --export-path in WSL and import it into the Windows certificate store.

The AppHost orchestrates everything: it starts a SQL Server container, runs EF migrations for Admin and Orchestrator, then launches all 5 services with service discovery and config wiring. No local SQL Server install required.

Run the first setup from the repository root:

./install-local.sh

After stopping the application with Ctrl+C, run it again with:

./ntg run

Use ./ntg run for later development runs after making code changes. It refreshes the AppHost secrets, starts the local LightRAG stack, and launches the Aspire AppHost.

Open the Aspire Dashboard URL printed at startup. Resources you'll see:

  • sqlserver — SQL Server 2022 container with a persistent volume
  • db-migrate-admin, db-migrate-orchestrator — one-shot EF migrations (finished)
  • ntg-agent-mcp-server, ntg-agent-orchestrator — backend services
  • ntg-agent-webclient — end-user chat UI (default admin account: [email protected] / Ntg@123)
  • ntg-agent-admin — admin dashboard (default admin account: [email protected] / Ntg@123)
  • ntg-agent-ag-ui-webclient — CopilotKit AG-UI React chat UI (default admin account: [email protected] / Ntg@123)

The Default Agent's provider is configured automatically on first startup from the selected global LLM settings. To use a different provider or model, open Agent Management > Agent Default in the Admin dashboard. Note: GitHub Models is being retired by GitHub (410 brownouts) and is no longer the seeded default.

LightRAG provider configuration

The installer follows LightRAG's LLM_BINDING and EMBEDDING_BINDING environment contract. The global LLM supports openai, ollama, lollms, azure_openai, bedrock, and gemini. The current LightRAG embedding contract supports openai, ollama, lollms, azure_openai, and bedrock; Gemini embedding is rejected by the installer because LightRAG does not advertise gemini as an embedding binding. The default for both selections is openai when left blank.

The main values are stored in .env and copied into AppHost user-secrets:

Purpose Variables
Global LLM LIGHTRAG_LLM_BINDING, LIGHTRAG_LLM_ENDPOINT, LIGHTRAG_LLM_API_KEY, LIGHTRAG_LLM_MODEL
Embeddings LIGHTRAG_EMBEDDING_BINDING, LIGHTRAG_EMBEDDING_ENDPOINT, LIGHTRAG_EMBEDDING_API_KEY, LIGHTRAG_EMBEDDING_MODEL
LightRAG image LIGHTRAG_IMAGE_TAG
Azure OpenAI LIGHTRAG_AZURE_API_VERSION, LIGHTRAG_AZURE_EMBEDDING_API_VERSION
AWS Bedrock LIGHTRAG_AWS_REGION plus either LIGHTRAG_AWS_BEARER_TOKEN_BEDROCK or an access-key/secret-key pair
Ollama LIGHTRAG_OLLAMA_LLM_NUM_CTX

Provider defaults include OpenAI at https://api.openai.com/v1, Ollama at http://localhost:11434, Gemini at DEFAULT_GEMINI_ENDPOINT, Bedrock at DEFAULT_BEDROCK_ENDPOINT, and lollms at http://localhost:9600. For Docker-hosted Ollama or lollms, use an address reachable from the container, such as http://host.docker.internal:11434.

These settings are applied to every per-agent LightRAG container. Changing a binding, endpoint, model, credential, or provider-specific option causes that container to be recreated; changing EMBEDDING_DIM also resets that agent's vector schema because existing vectors cannot be mixed across dimensions. The authoritative upstream examples are LightRAG env.example and LightRAG env.docker-compose-full.

Dev shortcuts (ntg)

./ntg is a small launcher for the commands you run all the time, so you don't have to memorize or retype them. No installation required (pure bash).

./ntg            # interactive menu of available commands
./ntg help       # list commands with descriptions
./ntg run        # dotnet run the AppHost AND auto-open the Aspire dashboard
./ntg ports      # show which project ports are in use
./ntg lightrag-dashboard # pick a running agent and open its LightRAG WebUI in the browser

Adding your own shortcut is meant to be trivial:

./ntg new <name>           # creates scripts/dev-commands/<name>.sh from a template
# edit that file: update the "# desc:" line and add your commands
./ntg <name>               # run it — it also shows up in `./ntg` and `./ntg help` automatically

Each command is a standalone bash file in scripts/dev-commands/; the filename is the command name and its # desc: header is the menu description. Files starting with _ are hidden helpers.

Using other LLM models

NTG Agent supports multiple LLM model providers: GitHub Model, Azure Open AI, Google Gemini

Google Gemini

Setup Gemini API: Create your API key in Google AI Studio https://aistudio.google.com/api-keys The Provider Endpoint: https://generativelanguage.googleapis.com/v1beta/

How authentication work

To get started easily, we use the shared cookies approach. In NTG.Agent.Admin, we add YARP as a BFF (Backend for Frontend), which forwards API requests to NTG.Agent.Orchestrator. Currently, it only works for Blazor WebAssembly. Cookies are not included when the request is made from the server (Blazor).

Knowledge providers

Document knowledge (upload, search, RAG) is served by a pluggable provider behind IKnowledgeService / IKnowledgeProvisioner (in NTG.Agent.Common). The Orchestrator selects the provider from configuration, so backends can be swapped without code changes:

{
  "Knowledge": {
    "Provider": "LightRag"
  }
}
  • LightRag (default) — one LightRAG container per agent, implemented in the NTG.Agent.LightRag project. The Orchestrator only provides two small EF-backed stores (agent port reservations, document ingestion status).

Azure AI Document Intelligence Configuration (Optional)

Azure AI Document Intelligence enables file upload in the chat, allowing users to attach documents (PDFs, images, Office files, etc.) and ask questions about their content. This feature is entirely optional — the chat works normally without it.

To set it up, follow the official guide to create an Azure AI Document Intelligence resource: Create a Document Intelligence resource

Once you have the resource endpoint and API key, add the following to your user secrets or appsettings.Development.json in the NTG.Agent.Orchestrator project:

{
  "Azure": {
    "DocumentIntelligence": {
      "IsEnabled": true,
      "Endpoint": "https://<your-resource-name>.cognitiveservices.azure.com/",
      "ApiKey": "<your-api-key>"
    }
  }
}
  • IsEnabled defaults to false. Set it to true only when you have a valid Azure subscription and resource configured.
  • When IsEnabled is false, the file upload button is hidden in the chat UI and no OCR processing is performed.
  • The API key is sensitive — use user secrets in development and environment variables or Azure Key Vault in production. Do not commit it to source control.

Contributing

By contributing, you agree that your contributions will be licensed under Apache-2.0 license.

Дзеркало документації архівовано з офіційного репозиторію GitHub · Перейти на GitHub
Дата знімка: 2026-11-14