Skip to content

Commit 7ad4a25

Browse files
XiyangTaoclaude
andcommitted
chore: initial public release
完整开源的 Microsoft Agent Framework 1.0 GA 16 个 pattern 参考实现。 包含: - 16 个独立可跑的 pattern(编排 5 / 能力 4 / 生产 5 / 工程 2) - docs/known-issues.md 收录 12 条已验证的兼容性坑 + 修复 - pytest 套件:21 个 smoke(不调 LLM)+ 16 个 live(调真实 LLM),均已绿 - GitHub Actions:smoke 矩阵 (Py 3.10/3.11/3.12) + ruff lint + tag 触发 release - 开源治理:LICENSE (Apache 2.0) + CONTRIBUTING + SECURITY + CoC + CHANGELOG - ISSUE / PR 模板 + Dependabot + pre-commit (ruff) - 跨平台 entrypoint:python -m patterns <name> / scripts/run_all.py - 依赖锁定:requirements.txt (~=) + requirements.lock (==,已验证 16/16 全绿) - 中英双 README 经过两轮独立 agent 交叉验证(A/B/C),6 处发现的 issue 全部修复并复核。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 parents  commit 7ad4a25

60 files changed

Lines changed: 3892 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.

.env.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Microsoft Agent Framework 参考工程 · 环境变量样例
2+
# 复制为 .env 并填入真实 key
3+
4+
# 主要 LLM 后端(OpenAI 兼容端点,2026.05 推荐 deepseek-v4-flash)
5+
DEEPSEEK_API_KEY=sk-xxx
6+
7+
# 多 provider 演示用(pattern: multi_provider)
8+
GEMINI_API_KEY=AIza-xxx
9+
10+
# 可选:OpenAI / Anthropic(若要把官方 sample 跑 Foundry stateful 模式)
11+
# OPENAI_API_KEY=
12+
# ANTHROPIC_API_KEY=
13+
14+
# 可选:Azure Foundry(pattern: a2a / hitl 官方写法用)
15+
# FOUNDRY_PROJECT_ENDPOINT=
16+
# FOUNDRY_MODEL=gpt-4o-mini

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Bug 报告 / Bug report
2+
description: 跑某个 pattern 时出错、或测试失败 / pattern run failure or test failure
3+
title: "[bug] "
4+
labels: [bug]
5+
body:
6+
- type: input
7+
id: pattern
8+
attributes:
9+
label: 涉及的 pattern
10+
description: 例如 sequential / hitl / a2a / 全部
11+
placeholder: sequential
12+
validations:
13+
required: true
14+
15+
- type: input
16+
id: env
17+
attributes:
18+
label: 环境
19+
description: OS / Python 版本 / agent-framework 版本
20+
placeholder: macOS 14.5 / Python 3.12 / agent-framework 1.4.0
21+
validations:
22+
required: true
23+
24+
- type: textarea
25+
id: command
26+
attributes:
27+
label: 复现命令
28+
render: bash
29+
placeholder: python -m patterns.sequential
30+
validations:
31+
required: true
32+
33+
- type: textarea
34+
id: output
35+
attributes:
36+
label: 报错 / 输出
37+
description: 粘贴完整 stderr 或 runs/<日期>/<pattern>.log 里的关键段
38+
render: text
39+
validations:
40+
required: true
41+
42+
- type: textarea
43+
id: checked
44+
attributes:
45+
label: 是否已对照 docs/known-issues.md
46+
description: 11 条已知坑里看是否对得上
47+
placeholder: 已查阅,疑似 / 不对应 / ...

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: 选型决策树
4+
url: https://github.com/XiyangTao/microsoft-agent-framework-reference/blob/main/docs/decision-tree.md
5+
about: 不确定该用哪个 pattern?先看这里。
6+
- name: 已知兼容性坑
7+
url: https://github.com/XiyangTao/microsoft-agent-framework-reference/blob/main/docs/known-issues.md
8+
about: 11 条已记录的踩坑 + 修复,提 issue 前先比对。
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 新踩坑 / Compat issue
2+
description: 提交一个 docs/known-issues.md 还没收的兼容性坑
3+
title: "[known-issue] "
4+
labels: [known-issue]
5+
body:
6+
- type: textarea
7+
id: symptom
8+
attributes:
9+
label: 症状
10+
placeholder: 报错 / 行为异常的最直接观察
11+
validations:
12+
required: true
13+
14+
- type: textarea
15+
id: root
16+
attributes:
17+
label: 根因(如已查清)
18+
19+
- type: textarea
20+
id: fix
21+
attributes:
22+
label: 修复 / 绕过方法
23+
render: python
24+
validations:
25+
required: true
26+
27+
- type: input
28+
id: refs
29+
attributes:
30+
label: 参考资料
31+
description: 官方 issue / changelog / blog 链接
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 新增 Pattern / New pattern proposal
2+
description: 提议加一个新 pattern 到 patterns/
3+
title: "[pattern] "
4+
labels: [pattern]
5+
body:
6+
- type: input
7+
id: name
8+
attributes:
9+
label: Pattern 名(snake_case)
10+
placeholder: streaming_summarizer
11+
validations:
12+
required: true
13+
14+
- type: input
15+
id: category
16+
attributes:
17+
label: 类别
18+
description: 编排 / 能力 / 生产 / 工程
19+
placeholder: 生产
20+
validations:
21+
required: true
22+
23+
- type: textarea
24+
id: oneliner
25+
attributes:
26+
label: 一句话
27+
description: 像 README 列表里那样描述
28+
validations:
29+
required: true
30+
31+
- type: textarea
32+
id: scenario
33+
attributes:
34+
label: 场景 / 反场景
35+
validations:
36+
required: true
37+
38+
- type: textarea
39+
id: api
40+
attributes:
41+
label: 核心 API 草图
42+
render: python

.github/dependabot.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
open-pull-requests-limit: 5
9+
labels:
10+
- dependencies
11+
groups:
12+
agent-framework:
13+
patterns:
14+
- "agent-framework*"
15+
a2a-mcp:
16+
patterns:
17+
- "a2a-sdk"
18+
- "mcp"
19+
20+
- package-ecosystem: github-actions
21+
directory: "/"
22+
schedule:
23+
interval: weekly
24+
day: monday
25+
open-pull-requests-limit: 5
26+
labels:
27+
- dependencies
28+
- ci

.github/pull_request_template.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## 改动概述
2+
3+
<!-- 一句话说清这次 PR 干啥;新 pattern?修踩坑?文档?基建? -->
4+
5+
## 类型
6+
7+
- [ ] 新 pattern(`patterns/<name>.py` + `ALL_PATTERNS` 登记 + smoke 测试通过)
8+
- [ ] 已有 pattern 修复 / 增强
9+
- [ ] 新踩坑入 `docs/known-issues.md`
10+
- [ ] 文档 / 选型决策树更新
11+
- [ ] 工程基建(CI / 依赖 / 模板)
12+
13+
## 自检 checklist
14+
15+
- [ ] `python -m pytest tests/test_smoke.py -v` 通过
16+
- [ ] `ruff check .` + `ruff format --check .` 通过
17+
- [ ] 若改了 pattern:本地能跑 `python -m patterns.<name>` 输出符合预期
18+
- [ ] 若加新 pattern:README + docs/PATTERNS.md 表格已更新
19+
20+
## 备注 / 相关 issue
21+
22+
Fixes #

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
ruff:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
- run: pip install ruff
21+
- name: ruff check
22+
run: ruff check .
23+
- name: ruff format --check
24+
run: ruff format --check .

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Extract changelog section
19+
id: notes
20+
run: |
21+
TAG="${GITHUB_REF_NAME#v}"
22+
{
23+
echo "notes<<EOF"
24+
awk -v tag="$TAG" '
25+
/^## \[/ {
26+
if (in_section) exit
27+
if (index($0, "[" tag "]") > 0) { in_section=1; next }
28+
}
29+
in_section { print }
30+
' CHANGELOG.md
31+
echo "EOF"
32+
} >> "$GITHUB_OUTPUT"
33+
34+
- name: Create GitHub Release
35+
uses: softprops/action-gh-release@v2
36+
with:
37+
name: ${{ github.ref_name }}
38+
body: ${{ steps.notes.outputs.notes }}
39+
draft: false
40+
prerelease: ${{ contains(github.ref_name, '-') }}

.github/workflows/smoke.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Smoke
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
smoke:
15+
name: smoke-py${{ matrix.python }}
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python: ["3.10", "3.11", "3.12"]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Python ${{ matrix.python }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python }}
29+
cache: pip
30+
cache-dependency-path: |
31+
requirements.txt
32+
requirements.lock
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
# smoke 测试不调 LLM,但仍需框架 import 通过
38+
pip install -r requirements.txt
39+
40+
- name: Run smoke tests
41+
run: python -m pytest tests/test_smoke.py -v

0 commit comments

Comments
 (0)