Skip to content

Commit c3be75a

Browse files
committed
first commit
0 parents  commit c3be75a

44 files changed

Lines changed: 17080 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "AI Agent Development Environment",
5+
"features": {
6+
"ghcr.io/devcontainers/features/azure-cli:1": {
7+
"extensions": "ml"
8+
},
9+
"ghcr.io/devcontainers/features/dotnet:latest": {
10+
"version": "10.0"
11+
},
12+
"ghcr.io/azure/azure-dev/azd:latest": {}
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"ms-azuretools.vscode-docker",
18+
"ms-python.python",
19+
"ms-toolsai.jupyter",
20+
"ms-python.black-formatter",
21+
"mathematic.vscode-pdf",
22+
"ms-dotnettools.csdevkit",
23+
"ms-dotnettools.dotnet-interactive-vscode"
24+
]
25+
}
26+
},
27+
"postCreateCommand": "dotnet tool install -g Microsoft.dotnet-interactive && dotnet interactive jupyter install"
28+
}

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.git
2+
.venv
3+
.files
4+
.ruff_cache
5+
.vscode
6+
.env
7+
__pycache__`

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: ci
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
permissions:
8+
contents: write
9+
jobs:
10+
deploy:
11+
env:
12+
CONFIG_FILE: docs/mkdocs.yml
13+
REQUIREMENTS: docs/requirements.txt
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Configure Git Credentials
18+
run: |
19+
git config user.name github-actions[bot]
20+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: 3.x
24+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
25+
- uses: actions/cache@v3
26+
with:
27+
key: mkdocs-material-${{ env.cache_id }}
28+
path: .cache
29+
restore-keys: |
30+
mkdocs-material-
31+
- run: pip install mkdocs-material mkdocs-glightbox mkdocs-include-markdown-plugin
32+
- run: mkdocs gh-deploy --force --config-file docs/mkdocs.yml

.gitignore

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
__pycache__
2+
*.py[co]
3+
[.][v]env/
4+
.DS_Store
5+
.ruff_cache
6+
.env
7+
.coverage
8+
*.orig
9+
# .NET stuff
10+
bin
11+
obj
12+
appsettings.*.json
13+
*.csproj.user
14+
.mono
15+
*.user
16+
.vs
17+
18+
# AZD
19+
.azure/
20+
.files/
21+
src/workshop/[.][v]env/
22+
23+
/src/shared/files
24+
.azure
25+
26+
# Node.js
27+
node_modules/
28+
29+
# Logs
30+
logs
31+
*.log
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*
35+
pnpm-debug.log*
36+
37+
# Runtime data
38+
pids
39+
*.pid
40+
*.seed
41+
*.pid.lock
42+
43+
# Directory for instrumented libs generated by jscoverage/JSCover
44+
lib-cov
45+
46+
# Coverage directory used by tools like istanbul
47+
coverage
48+
49+
# nyc test coverage
50+
.nyc_output
51+
52+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
53+
.grunt
54+
55+
# Bower dependency directory (https://bower.io/)
56+
bower_components
57+
58+
# Compiled binary addons (https://nodejs.org/api/addons.html)
59+
build/Release
60+
61+
# Dependency directories
62+
dist/
63+
build/
64+
65+
# dotenv environment variables files
66+
.env
67+
.env.*
68+
.env.local
69+
70+
# next.js build output
71+
.next/
72+
73+
# Vite build output
74+
dist/
75+
76+
# Parcel build output
77+
dist/
78+
.cache/
79+
80+
# Svelte build output
81+
public/build
82+
83+
# Storybook build outputs
84+
.out/
85+
.storybook-out/
86+
87+
# VS Code settings
88+
.vscode/
89+
90+
# Mac system files
91+
.DS_Store
92+
93+
# Windows system files
94+
Thumbs.db
95+
96+
# Optional npm cache directory
97+
.npm
98+
99+
# Optional eslint cache
100+
.eslintcache
101+
102+
# Optional REPL history
103+
.node_repl_history
104+
105+
# Output of 'npm pack'
106+
*.tgz
107+
108+
# Yarn Integrity file
109+
yarn.lock
110+
111+
# pnpm lockfile
112+
pnpm-lock.yaml
113+
114+
# TypeScript cache
115+
*.tsbuildinfo
116+
117+
# IDE files
118+
.idea/
119+
*.suo
120+
*.ntvs*
121+
*.njsproj
122+
*.sln
123+
*.sw?

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Contoso Bike Store AI Assistant
2+
3+
An end-to-end sample that uses Microsoft Agent Framework to demonstrate how to build Human In the loop (HITL) AI assistant.
4+
The agent uses GitHub Models for inference and exposes an AG-UI endpoint. The frontend integrates via CopilotKit to provide a chat experience for Contoso Bike Store.
5+
6+
## Tech Stack
7+
8+
- Backend: .NET (ASP.NET Core), Microsoft Agent Framework, AG-UI, `OpenAIClient` (GitHub Models)
9+
- Frontend: Next.js (App Router), TypeScript
10+
- Tools: Product inventory tools + a payment approval tool (server function with approval)
11+
12+
## Prerequisites
13+
14+
- .NET 9/10 SDK (match your local environment)
15+
- Node.js 20+ and npm
16+
- GitHub account and Personal Access Token (PAT) for GitHub Models access
17+
18+
## GitHub Models Setup
19+
20+
1. Create a GitHub Personal Access Token:
21+
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
22+
- Generate a new token; no special scopes are required for models
23+
- Copy the token value
24+
25+
2. Set environment variables (choose your shell):
26+
27+
Windows (PowerShell):
28+
```powershell
29+
$env:GITHUB_TOKEN="<your_github_token>"
30+
$env:GITHUB_MODEL_ID="gpt-4o" # optional, defaults to gpt-4o
31+
$env:GITHUB_MODELS_BASE_URL="https://models.inference.ai.azure.com" # optional
32+
```
33+
34+
Windows (Command Prompt):
35+
```cmd
36+
set GITHUB_TOKEN=<your_github_token>
37+
set GITHUB_MODEL_ID=gpt-4o
38+
set GITHUB_MODELS_BASE_URL=https://models.inference.ai.azure.com
39+
```
40+
41+
macOS/Linux:
42+
```bash
43+
export GITHUB_TOKEN="<your_github_token>"
44+
export GITHUB_MODEL_ID="gpt-4o"
45+
export GITHUB_MODELS_BASE_URL="https://models.inference.ai.azure.com"
46+
```
47+
48+
You can also use the command `dotnet user-secrets` to set the `GITHUB_TOKEN` for the backend project.
49+
50+
## How to Run
51+
52+
1. Clone and open the repo
53+
```bash
54+
git clone <this-repository-url>
55+
cd maf-apporval-workflow
56+
```
57+
58+
2. Start the backend (agent host)
59+
```bash
60+
cd src/backend/ContosoBikestore.Agent.Host
61+
dotnet restore
62+
dotnet run
63+
```
64+
- Agent Dev UI: http://localhost:5001/devui
65+
- AG-UI endpoint: http://localhost:5001/agent/customer_service_assistant
66+
67+
3. Start the frontend (Next.js)
68+
```bash
69+
cd src/frontend
70+
npm install
71+
# optional: echo backend base URL to .env.local
72+
# Windows PowerShell
73+
"$env:BACKEND_AGENT_BASE_URL=http://localhost:5001" | Out-File -Encoding utf8 .env.local
74+
# macOS/Linux
75+
# echo "BACKEND_AGENT_BASE_URL=http://localhost:5001" > .env.local
76+
npm run dev
77+
```
78+
- App: http://localhost:3000
79+
80+
## Resources
81+
82+
- Microsoft Agent Framework Documentation: https://learn.microsoft.com/en-us/agent-framework/overview/agent-framework-overview
83+
- CopilotKit: https://www.copilotkit.ai/
84+
- GitHub Models: https://docs.github.com/en/github-models

SECURITY.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
2+
3+
## Security
4+
5+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
6+
7+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
8+
9+
## Reporting Security Issues
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
14+
15+
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
16+
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
18+
19+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20+
21+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
* Full paths of source file(s) related to the manifestation of the issue
23+
* The location of the affected source code (tag/branch/commit or direct URL)
24+
* Any special configuration required to reproduce the issue
25+
* Step-by-step instructions to reproduce the issue
26+
* Proof-of-concept or exploit code (if possible)
27+
* Impact of the issue, including how an attacker might exploit the issue
28+
29+
This information will help us triage your report more quickly.
30+
31+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
32+
33+
## Preferred Languages
34+
35+
We prefer all communications to be in English.
36+
37+
## Policy
38+
39+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
40+
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[tool.black]
2+
line-length = 120
3+
4+
[tool.ruff]
5+
line-length = 120
6+
7+
# Enable import sorting
8+
select = ["I"]
9+
10+
[tool.ruff.lint]
11+
extend-select = [
12+
"B",
13+
"C4",
14+
"PT",
15+
"RET",
16+
"SIM",
17+
"ARG",
18+
"PTH",
19+
"RUF",
20+
"PLE",
21+
"ANN",
22+
"RUF",
23+
"I" # Add 'I' to extend-select to activate import sorting
24+
]
25+
26+
[tool.ruff.lint.extend-per-file-ignores]
27+
"*.ipynb" = [
28+
"PLE1142", # await-outside-async: Jupyter Notebooks support top level await
29+
"E402", # module-import-not-at-top-of-file: It's relatively common to have to import "just in time"
30+
"E501", # line-too-long: Let black handle this
31+
]
32+
33+
# isort configuration
34+
[tool.isort]
35+
profile = "black" # Use the same line length and styling as Black
36+
line_length = 120 # Consistent line length with Ruff and Black
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.cs]
2+
3+
# SKEXP0110: Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
4+
dotnet_diagnostic.SKEXP0110.severity = warning

0 commit comments

Comments
 (0)