@polymorphism-tech/morph-spec 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +314 -1673
- package/LICENSE +72 -72
- package/README.md +515 -516
- package/bin/detect-agents.js +225 -225
- package/bin/morph-spec.js +358 -173
- package/bin/render-template.js +302 -302
- package/bin/semantic-detect-agents.js +246 -246
- package/bin/task-manager.js +429 -0
- package/bin/validate-agents-skills.js +251 -251
- package/bin/validate-agents.js +69 -69
- package/bin/validate-phase.js +263 -263
- package/bin/validate.js +369 -0
- package/content/.azure/README.md +293 -293
- package/content/.azure/docs/azure-devops-setup.md +454 -454
- package/content/.azure/docs/branch-strategy.md +398 -398
- package/content/.azure/docs/local-development.md +515 -515
- package/content/.azure/pipelines/pipeline-variables.yml +34 -34
- package/content/.azure/pipelines/prod-pipeline.yml +319 -319
- package/content/.azure/pipelines/staging-pipeline.yml +234 -234
- package/content/.azure/pipelines/templates/build-dotnet.yml +75 -75
- package/content/.azure/pipelines/templates/deploy-app-service.yml +94 -94
- package/content/.azure/pipelines/templates/deploy-container-app.yml +120 -120
- package/content/.azure/pipelines/templates/infra-deploy.yml +90 -90
- package/content/.claude/commands/morph-apply.md +221 -158
- package/content/.claude/commands/morph-archive.md +79 -79
- package/content/.claude/commands/morph-infra.md +209 -209
- package/content/.claude/commands/morph-preflight.md +227 -0
- package/content/.claude/commands/morph-proposal.md +122 -101
- package/content/.claude/commands/morph-status.md +86 -86
- package/content/.claude/commands/morph-troubleshoot.md +122 -0
- package/content/.claude/settings.local.json +15 -15
- package/content/.claude/skills/checklists/code-review.md +226 -0
- package/content/.claude/skills/checklists/morph-checklist.md +117 -0
- package/content/.claude/skills/checklists/simulation-checklist.md +77 -0
- package/content/.claude/skills/infra/bicep-architect.md +126 -419
- package/content/.claude/skills/infra/container-specialist.md +131 -437
- package/content/.claude/skills/infra/devops-engineer.md +119 -405
- package/content/.claude/skills/integrations/asaas-financial.md +130 -333
- package/content/.claude/skills/integrations/azure-identity.md +142 -309
- package/content/.claude/skills/integrations/clerk-auth.md +108 -290
- package/content/.claude/skills/integrations/resend-email.md +119 -0
- package/content/.claude/skills/specialists/ai-system-architect.md +192 -604
- package/content/.claude/skills/specialists/azure-architect.md +142 -142
- package/content/.claude/skills/specialists/code-analyzer.md +235 -0
- package/content/.claude/skills/specialists/dotnet-senior.md +287 -0
- package/content/.claude/skills/specialists/ef-modeler.md +113 -200
- package/content/.claude/skills/specialists/hangfire-orchestrator.md +126 -245
- package/content/.claude/skills/specialists/ms-agent-expert.md +109 -263
- package/content/.claude/skills/specialists/po-pm-advisor.md +197 -197
- package/content/.claude/skills/specialists/standards-architect.md +156 -78
- package/content/.claude/skills/specialists/testing-specialist.md +126 -0
- package/content/.claude/skills/specialists/ui-ux-designer.md +191 -1060
- package/content/.claude/skills/stacks/dotnet-blazor.md +210 -588
- package/content/.claude/skills/stacks/dotnet-nextjs.md +154 -402
- package/content/.claude/skills/workflows/morph-replicate.md +213 -0
- package/content/.claude/{commands/morph-clarify.md → skills/workflows/phase-clarify.md} +5 -58
- package/content/.claude/{commands/morph-design.md → skills/workflows/phase-design.md} +16 -86
- package/content/.claude/{commands/morph-setup.md → skills/workflows/phase-setup.md} +9 -17
- package/content/.claude/skills/workflows/phase-tasks.md +164 -0
- package/content/.claude/{commands/morph-uiux.md → skills/workflows/phase-uiux.md} +15 -88
- package/content/.morph/.morphversion +5 -5
- package/content/.morph/archive/.gitkeep +25 -25
- package/content/.morph/config/agents.json +378 -242
- package/content/.morph/config/config.template.json +89 -108
- package/content/.morph/docs/STORY-DRIVEN-DEVELOPMENT.md +392 -392
- package/content/.morph/docs/workflows/design-impl.md +37 -0
- package/content/.morph/docs/workflows/fast-track.md +29 -0
- package/content/.morph/docs/workflows/full-morph.md +76 -0
- package/content/.morph/docs/workflows/standard.md +44 -0
- package/content/.morph/docs/workflows/ui-refresh.md +39 -0
- package/content/.morph/examples/api-nextjs/README.md +241 -241
- package/content/.morph/examples/api-nextjs/contracts.ts +307 -307
- package/content/.morph/examples/api-nextjs/spec.md +399 -399
- package/content/.morph/examples/api-nextjs/tasks.md +168 -168
- package/content/.morph/examples/micro-saas/README.md +125 -125
- package/content/.morph/examples/micro-saas/contracts.cs +358 -358
- package/content/.morph/examples/micro-saas/decisions.md +246 -246
- package/content/.morph/examples/micro-saas/spec.md +236 -236
- package/content/.morph/examples/micro-saas/tasks.md +150 -150
- package/content/.morph/examples/multi-agent/README.md +309 -309
- package/content/.morph/examples/multi-agent/contracts.cs +433 -433
- package/content/.morph/examples/multi-agent/spec.md +479 -479
- package/content/.morph/examples/multi-agent/tasks.md +185 -185
- package/content/.morph/examples/scheduled-reports/decisions.md +158 -0
- package/content/.morph/examples/scheduled-reports/proposal.md +95 -0
- package/content/.morph/examples/scheduled-reports/spec.md +267 -0
- package/content/.morph/examples/state-v3.json +188 -0
- package/content/.morph/features/.gitkeep +25 -25
- package/content/.morph/hooks/README.md +190 -239
- package/content/.morph/hooks/pre-commit-agents.sh +24 -24
- package/content/.morph/hooks/pre-commit-all.sh +48 -48
- package/content/.morph/hooks/pre-commit-specs.sh +49 -49
- package/content/.morph/hooks/pre-commit-tests.sh +60 -60
- package/content/.morph/project.md +160 -160
- package/content/.morph/schemas/agent.schema.json +296 -296
- package/content/.morph/schemas/tasks.schema.json +220 -0
- package/content/.morph/specs/.gitkeep +20 -20
- package/content/.morph/standards/agent-framework-blazor-ui.md +359 -0
- package/content/.morph/standards/agent-framework-production.md +410 -0
- package/content/.morph/standards/agent-framework-setup.md +413 -453
- package/content/.morph/standards/agent-framework-workflows.md +349 -0
- package/content/.morph/standards/architecture.md +325 -325
- package/content/.morph/standards/azure.md +605 -379
- package/content/.morph/standards/coding.md +377 -377
- package/content/.morph/standards/dotnet10-migration.md +520 -494
- package/content/.morph/standards/fluent-ui-setup.md +590 -590
- package/content/.morph/standards/migration-guide.md +514 -514
- package/content/.morph/standards/passkeys-auth.md +423 -423
- package/content/.morph/standards/vector-search-rag.md +536 -536
- package/content/.morph/state.json +17 -17
- package/content/.morph/templates/FluentDesignTheme.cs +149 -149
- package/content/.morph/templates/MudTheme.cs +281 -281
- package/content/.morph/templates/agent.cs +163 -172
- package/content/.morph/templates/clarify-questions.md +159 -0
- package/content/.morph/templates/component.razor +239 -239
- package/content/.morph/templates/contracts/Commands.cs +74 -0
- package/content/.morph/templates/contracts/Entities.cs +25 -0
- package/content/.morph/templates/contracts/Queries.cs +74 -0
- package/content/.morph/templates/contracts/README.md +74 -0
- package/content/.morph/templates/contracts.cs +217 -217
- package/content/.morph/templates/decisions.md +123 -106
- package/content/.morph/templates/design-system.css +226 -226
- package/content/.morph/templates/infra/.dockerignore.example +89 -89
- package/content/.morph/templates/infra/Dockerfile.example +82 -82
- package/content/.morph/templates/infra/README.md +286 -286
- package/content/.morph/templates/infra/app-insights.bicep +63 -63
- package/content/.morph/templates/infra/app-service.bicep +164 -164
- package/content/.morph/templates/infra/container-app-env.bicep +49 -49
- package/content/.morph/templates/infra/container-app.bicep +156 -156
- package/content/.morph/templates/infra/deploy-checklist.md +426 -0
- package/content/.morph/templates/infra/deploy.ps1 +229 -229
- package/content/.morph/templates/infra/deploy.sh +208 -208
- package/content/.morph/templates/infra/key-vault.bicep +91 -91
- package/content/.morph/templates/infra/main.bicep +189 -189
- package/content/.morph/templates/infra/parameters.dev.json +29 -29
- package/content/.morph/templates/infra/parameters.prod.json +29 -29
- package/content/.morph/templates/infra/parameters.staging.json +29 -29
- package/content/.morph/templates/infra/sql-database.bicep +103 -103
- package/content/.morph/templates/infra/storage.bicep +106 -106
- package/content/.morph/templates/integrations/asaas-client.cs +387 -387
- package/content/.morph/templates/integrations/asaas-webhook.cs +351 -351
- package/content/.morph/templates/integrations/azure-identity-config.cs +288 -288
- package/content/.morph/templates/integrations/clerk-config.cs +258 -258
- package/content/.morph/templates/job.cs +171 -171
- package/content/.morph/templates/migration.cs +83 -83
- package/content/.morph/templates/proposal.md +141 -155
- package/content/.morph/templates/recap.md +94 -105
- package/content/.morph/templates/repository.cs +141 -141
- package/content/.morph/templates/saas/subscription.cs +347 -347
- package/content/.morph/templates/saas/tenant.cs +338 -338
- package/content/.morph/templates/service.cs +139 -139
- package/content/.morph/templates/simulation.md +353 -0
- package/content/.morph/templates/spec.md +149 -148
- package/content/.morph/templates/sprint-status.yaml +68 -68
- package/content/.morph/templates/state.template.json +222 -222
- package/content/.morph/templates/story.md +143 -143
- package/content/.morph/templates/tasks.md +257 -235
- package/content/.morph/templates/test.cs +239 -239
- package/content/.morph/templates/ui-components.md +362 -276
- package/content/.morph/templates/ui-design-system.md +286 -286
- package/content/.morph/templates/ui-flows.md +336 -336
- package/content/.morph/templates/ui-mockups.md +133 -133
- package/content/.morph/test-infra/example.bicep +59 -59
- package/content/CLAUDE.md +150 -442
- package/content/README.md +79 -79
- package/detectors/config-detector.js +223 -223
- package/detectors/conversation-analyzer.js +163 -163
- package/detectors/index.js +84 -84
- package/detectors/standards-generator.js +275 -275
- package/detectors/structure-detector.js +245 -250
- package/docs/README.md +144 -149
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +977 -977
- package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1048 -1048
- package/docs/api/scripts/collapse.js +38 -38
- package/docs/api/scripts/commonNav.js +28 -28
- package/docs/api/scripts/linenumber.js +25 -25
- package/docs/api/scripts/nav.js +12 -12
- package/docs/api/scripts/polyfill.js +3 -3
- package/docs/api/scripts/prettify/Apache-License-2.0.txt +202 -202
- package/docs/api/scripts/prettify/lang-css.js +2 -2
- package/docs/api/scripts/prettify/prettify.js +28 -28
- package/docs/api/scripts/search.js +98 -98
- package/docs/api/styles/jsdoc.css +776 -776
- package/docs/api/styles/prettify.css +80 -80
- package/docs/examples.md +328 -328
- package/docs/getting-started.md +301 -302
- package/docs/installation.md +361 -361
- package/docs/templates.md +418 -418
- package/docs/validation-checklist.md +265 -266
- package/package.json +80 -80
- package/scripts/postinstall.js +132 -132
- package/src/commands/advance-phase.js +183 -0
- package/src/commands/analyze-blazor-concurrency.js +193 -0
- package/src/commands/create-story.js +351 -351
- package/src/commands/detect-agents.js +139 -0
- package/src/commands/detect.js +104 -104
- package/src/commands/doctor.js +356 -280
- package/src/commands/generate.js +149 -149
- package/src/commands/init.js +258 -245
- package/src/commands/lint-fluent.js +352 -0
- package/src/commands/rollback-phase.js +185 -0
- package/src/commands/session-summary.js +291 -0
- package/src/commands/shard-spec.js +224 -224
- package/src/commands/sprint-status.js +250 -250
- package/src/commands/state.js +333 -333
- package/src/commands/sync.js +167 -167
- package/src/commands/task.js +78 -0
- package/src/commands/troubleshoot.js +222 -0
- package/src/commands/update.js +192 -159
- package/src/commands/validate-blazor-state.js +210 -0
- package/src/commands/validate-blazor.js +156 -0
- package/src/commands/validate-css.js +84 -0
- package/src/commands/validate-phase.js +221 -0
- package/src/lib/blazor-concurrency-analyzer.js +288 -0
- package/src/lib/blazor-state-validator.js +291 -0
- package/src/lib/blazor-validator.js +374 -0
- package/src/lib/complexity-analyzer.js +441 -292
- package/src/lib/continuous-validator.js +421 -0
- package/src/lib/css-validator.js +352 -0
- package/src/lib/decision-constraint-loader.js +109 -0
- package/src/lib/design-system-generator.js +298 -298
- package/src/lib/learning-system.js +520 -0
- package/src/lib/mockup-generator.js +366 -0
- package/src/lib/recap-generator.js +205 -0
- package/src/lib/state-manager.js +397 -340
- package/src/lib/troubleshoot-grep.js +194 -0
- package/src/lib/troubleshoot-index.js +144 -0
- package/src/lib/ui-detector.js +350 -0
- package/src/lib/validation-runner.js +231 -0
- package/src/lib/validators/architecture-validator.js +387 -0
- package/src/lib/validators/contract-compliance-validator.js +273 -0
- package/src/lib/validators/package-validator.js +360 -0
- package/src/lib/validators/ui-contrast-validator.js +422 -0
- package/src/utils/file-copier.js +179 -139
- package/src/utils/logger.js +32 -32
- package/src/utils/version-checker.js +175 -175
- package/content/.claude/commands/morph-costs.md +0 -206
- package/content/.claude/commands/morph-tasks.md +0 -319
- package/content/.claude/skills/specialists/cost-guardian.md +0 -110
- package/content/.claude/skills/stacks/shopify.md +0 -445
- package/content/.morph/config/azure-pricing.json +0 -70
- package/content/.morph/config/azure-pricing.schema.json +0 -50
- package/content/.morph/hooks/pre-commit-costs.sh +0 -91
- package/docs/api/cost-calculator.js.html +0 -513
- package/docs/api/design-system-generator.js.html +0 -382
- package/docs/api/global.html +0 -5263
- package/docs/api/index.html +0 -96
- package/docs/api/state-manager.js.html +0 -423
- package/src/commands/cost.js +0 -181
- package/src/commands/update-pricing.js +0 -206
- package/src/lib/cost-calculator.js +0 -429
|
@@ -1,604 +1,192 @@
|
|
|
1
|
-
# AI System Architect
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
**
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
**
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
**
|
|
36
|
-
|
|
37
|
-
**
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
###
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
- Fixed size chunks
|
|
194
|
-
- Markdown Header Splitter
|
|
195
|
-
- Semantic boundaries
|
|
196
|
-
- Token-based
|
|
197
|
-
|
|
198
|
-
**Quando usar:**
|
|
199
|
-
- Necessidades de conhecimento documental
|
|
200
|
-
- Dados privados/proprietários
|
|
201
|
-
|
|
202
|
-
**Trade-offs:**
|
|
203
|
-
- ✅ Accuracy, escalabilidade
|
|
204
|
-
- ⚠️ Infraestrutura para construir e manter
|
|
205
|
-
- 💡 Azure AI Search + Semantic Kernel
|
|
206
|
-
|
|
207
|
-
### 14. Inter-Agent Communication (Comunicação Inter-Agentes)
|
|
208
|
-
**Uso:** Agentes comunicam via sistema de mensagens estruturado
|
|
209
|
-
|
|
210
|
-
**Protocolos:**
|
|
211
|
-
- **A2A (Agent-to-Agent)** — spec padronizada
|
|
212
|
-
- **Agent Cards** — metadados compartilhados
|
|
213
|
-
|
|
214
|
-
**Quando usar:**
|
|
215
|
-
- Sistemas enterprise complexos
|
|
216
|
-
- Orquestração distribuída
|
|
217
|
-
|
|
218
|
-
**Trade-offs:**
|
|
219
|
-
- ✅ Fault isolation
|
|
220
|
-
- ⚠️ Complexidade extrema
|
|
221
|
-
- 💡 Avaliar se realmente necessário (geralmente não)
|
|
222
|
-
|
|
223
|
-
### 15. Resource-Aware Optimization (Otimização Consciente de Recursos)
|
|
224
|
-
**Uso:** Rotear tarefas para modelos apropriados baseado em complexidade/custo
|
|
225
|
-
|
|
226
|
-
**Estratégia:**
|
|
227
|
-
- Tarefas simples → gpt-4o-mini
|
|
228
|
-
- Tarefas complexas → gpt-4o
|
|
229
|
-
- Tarefas de raciocínio → o1-mini
|
|
230
|
-
|
|
231
|
-
**Quando usar:**
|
|
232
|
-
- Operações cost-sensitive
|
|
233
|
-
- Processamento de alto volume
|
|
234
|
-
|
|
235
|
-
**Trade-offs:**
|
|
236
|
-
- ✅ Redução de custos
|
|
237
|
-
- ⚠️ Tuning de complexidade
|
|
238
|
-
- 💡 Router agent classifica complexidade
|
|
239
|
-
|
|
240
|
-
### 16. Reasoning Techniques (Técnicas de Raciocínio)
|
|
241
|
-
**Métodos disponíveis:**
|
|
242
|
-
|
|
243
|
-
#### Chain of Thought (Sequencial)
|
|
244
|
-
```
|
|
245
|
-
Step 1 → Think → Reason → Conclude → Step 2 → ...
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
#### Tree of Thought (Branching)
|
|
249
|
-
```
|
|
250
|
-
Problem → Generate Branches → Explore → Prune Dead Branches
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
#### Self-Consistency
|
|
254
|
-
```
|
|
255
|
-
Generate Multiple Solutions → Score → Select Best
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
#### Adversarial/Debate
|
|
259
|
-
```
|
|
260
|
-
Proponent Agent ↔ Opponent Agent → Exchange Arguments
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
**Quando usar:**
|
|
264
|
-
- Problemas muito complexos
|
|
265
|
-
- Raciocínio matemático
|
|
266
|
-
- Planejamento estratégico em escala
|
|
267
|
-
|
|
268
|
-
**Trade-offs:**
|
|
269
|
-
- ✅ Processo exaustivo e robusto
|
|
270
|
-
- ⚠️ Alto consumo de tokens, latência
|
|
271
|
-
- 💡 9 em 10 vezes não é necessário
|
|
272
|
-
|
|
273
|
-
### 17. Evaluation and Monitoring (Avaliação e Monitoramento)
|
|
274
|
-
**Uso:** Quality gates, golden tests, monitoramento contínuo de drift
|
|
275
|
-
|
|
276
|
-
**Métricas:**
|
|
277
|
-
- Accuracy
|
|
278
|
-
- Performance SLAs
|
|
279
|
-
- Compliance
|
|
280
|
-
- Drift detection
|
|
281
|
-
|
|
282
|
-
**Quando usar:**
|
|
283
|
-
- Sistemas production-grade
|
|
284
|
-
- Enterprise, SaaS
|
|
285
|
-
- Healthcare, finance
|
|
286
|
-
|
|
287
|
-
**Trade-offs:**
|
|
288
|
-
- ✅ Confiabilidade
|
|
289
|
-
- ⚠️ Alert fatigue
|
|
290
|
-
- 💡 Application Insights + Azure Monitor
|
|
291
|
-
|
|
292
|
-
### 18. Guardrails and Safety Patterns (Guardrails e Segurança)
|
|
293
|
-
**Uso:** Verificar inputs para conteúdo prejudicial, PII, injeções
|
|
294
|
-
|
|
295
|
-
**Checks:**
|
|
296
|
-
- PII Detection → Redact/Mask
|
|
297
|
-
- Injection Detection → Filter/Block
|
|
298
|
-
- Malicious Content → Filter/Block
|
|
299
|
-
- Risk Classification → Human-in-Loop se high
|
|
300
|
-
|
|
301
|
-
**Quando usar:**
|
|
302
|
-
- Sistemas public-facing
|
|
303
|
-
- Quando PR está em jogo
|
|
304
|
-
- Input de texto aberto
|
|
305
|
-
|
|
306
|
-
**Trade-offs:**
|
|
307
|
-
- ✅ Mitigação de risco, proteção de marca
|
|
308
|
-
- ⚠️ Falsos positivos, fricção
|
|
309
|
-
- 💡 Estratégia de prompts pré-definidos > texto livre
|
|
310
|
-
|
|
311
|
-
### 19. Prioritization (Priorização)
|
|
312
|
-
**Uso:** Pontuar tarefas baseado em valor, risco, esforço, urgência
|
|
313
|
-
|
|
314
|
-
**Fórmula:**
|
|
315
|
-
```
|
|
316
|
-
Priority = (Value × Effort) × Urgency / Risk
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
**Quando usar:**
|
|
320
|
-
- Ambientes dinâmicos
|
|
321
|
-
- Task management
|
|
322
|
-
- Customer service
|
|
323
|
-
|
|
324
|
-
**Trade-offs:**
|
|
325
|
-
- ✅ Adaptabilidade, transparência
|
|
326
|
-
- ⚠️ Context switching
|
|
327
|
-
- 💡 Dependency graph + reassessment
|
|
328
|
-
|
|
329
|
-
### 20. Exploration and Discovery (Exploração e Descoberta)
|
|
330
|
-
**Uso:** Explorar amplamente espaço de conhecimento, identificar padrões, focar em áreas promissoras
|
|
331
|
-
|
|
332
|
-
**Fluxo:**
|
|
333
|
-
```
|
|
334
|
-
Research Goal → Explore Sources → Compile → Map Knowledge Space →
|
|
335
|
-
Cluster Themes → Target Exploration → Synthesize Insights
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
**Quando usar:**
|
|
339
|
-
- Projetos de pesquisa
|
|
340
|
-
- Análise competitiva detalhada
|
|
341
|
-
- R&D
|
|
342
|
-
|
|
343
|
-
**Trade-offs:**
|
|
344
|
-
- ✅ Innovation enablement
|
|
345
|
-
- ⚠️ Time-sensitive, resource-heavy
|
|
346
|
-
- 💡 Perplexity Deep Research, Claude Deep Research
|
|
347
|
-
|
|
348
|
-
---
|
|
349
|
-
|
|
350
|
-
## Frameworks de Categorização de Agentes
|
|
351
|
-
|
|
352
|
-
### Framework TACO (KPMG)
|
|
353
|
-
|
|
354
|
-
| Categoria | Descrição | Autonomia |
|
|
355
|
-
|-----------|-----------|-----------|
|
|
356
|
-
| **Taskers** | Executam tarefas individuais bem definidas | Humano no loop |
|
|
357
|
-
| **Automators** | Gerenciam tarefas complexas multi-sistema | Automação |
|
|
358
|
-
| **Collaborators** | Companheiros de IA adaptativos | Objetivos multidimensionais |
|
|
359
|
-
| **Orchestrators** | Sistemas transformativos | Coordenação de múltiplos agentes |
|
|
360
|
-
|
|
361
|
-
### Framework Funcional (7 tipos)
|
|
362
|
-
|
|
363
|
-
1. **Simple Reflex Agents** — regras predefinidas
|
|
364
|
-
2. **Model-Based Reflex Agents** — avaliação de consequências
|
|
365
|
-
3. **Goal-Based Agents** — planejamento de sequências de ações
|
|
366
|
-
4. **Learning Agents** — melhoram com experiência
|
|
367
|
-
5. **Utility-Based Agents** — gerenciam trade-offs entre objetivos
|
|
368
|
-
6. **Hierarchical Agents** — desconstroem tarefas em subtarefas
|
|
369
|
-
7. **Multi-Agent Systems** — especialização e colaboração
|
|
370
|
-
|
|
371
|
-
---
|
|
372
|
-
|
|
373
|
-
## Pipeline RAG com Stack Microsoft
|
|
374
|
-
|
|
375
|
-
> "Dominar o processo de geração de informação"
|
|
376
|
-
|
|
377
|
-
### Arquitetura
|
|
378
|
-
```
|
|
379
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
380
|
-
│ PIPELINE RAG - STACK MICROSOFT │
|
|
381
|
-
└─────────────────────────────────────────────────────────────┘
|
|
382
|
-
│
|
|
383
|
-
├─→ EXTRAÇÃO: HttpClient → Azure Blob Storage (staging)
|
|
384
|
-
│
|
|
385
|
-
├─→ PROCESSAMENTO: Semantic Kernel → Chunking Strategies
|
|
386
|
-
│
|
|
387
|
-
├─→ EMBEDDING: Azure OpenAI text-embedding-3-small
|
|
388
|
-
│
|
|
389
|
-
├─→ INDEXAÇÃO: Azure AI Search (vector store com HNSW)
|
|
390
|
-
│
|
|
391
|
-
├─→ AVALIAÇÃO: Cosine Similarity → Ranking de Estratégias
|
|
392
|
-
│
|
|
393
|
-
└─→ DEPLOY: Azure Durable Functions (orquestração)
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
### Estratégias de Chunking (Semantic Kernel)
|
|
397
|
-
|
|
398
|
-
1. **Paragraph Splitter** — quebra por parágrafos
|
|
399
|
-
2. **Markdown Header Splitter** — quebra por headers (#, ##, ###)
|
|
400
|
-
3. **Token-based Splitter** — quebra por quantidade de tokens
|
|
401
|
-
4. **Semantic Splitter** — quebra por similaridade semântica
|
|
402
|
-
|
|
403
|
-
**Princípio:** Testar TODAS as estratégias e rankear por métricas
|
|
404
|
-
|
|
405
|
-
### Métricas de Avaliação
|
|
406
|
-
|
|
407
|
-
- **Score médio** de similaridade nos resultados
|
|
408
|
-
- **Token count médio** dos chunks recuperados
|
|
409
|
-
- **Relevância** para queries de teste
|
|
410
|
-
|
|
411
|
-
### Por Que Staging em Blob Storage?
|
|
412
|
-
|
|
413
|
-
| Benefício | Explicação |
|
|
414
|
-
|-----------|------------|
|
|
415
|
-
| **Imutabilidade** | Dados originais nunca são alterados |
|
|
416
|
-
| **Versionamento** | Blob Storage suporta versioning nativo |
|
|
417
|
-
| **Custo baixo** | Storage é muito mais barato que compute |
|
|
418
|
-
| **Fallback** | Bug no processamento não perde dados |
|
|
419
|
-
| **Auditoria** | Rastreamento completo de origem |
|
|
420
|
-
|
|
421
|
-
### Integração com Microsoft Agent Framework
|
|
422
|
-
|
|
423
|
-
```csharp
|
|
424
|
-
// Tool de busca semântica
|
|
425
|
-
[AgentTool("search_knowledge")]
|
|
426
|
-
public async Task<SearchResult[]> SearchKnowledgeAsync(
|
|
427
|
-
[Description("Query de busca")] string query,
|
|
428
|
-
CancellationToken ct = default)
|
|
429
|
-
{
|
|
430
|
-
// 1. Gerar embedding da query
|
|
431
|
-
var queryEmbedding = await _embeddings.GenerateAsync(query, ct);
|
|
432
|
-
|
|
433
|
-
// 2. Buscar no Azure AI Search (vector search)
|
|
434
|
-
var results = await _searchClient.SearchAsync<KnowledgeChunk>(
|
|
435
|
-
query,
|
|
436
|
-
new SearchOptions
|
|
437
|
-
{
|
|
438
|
-
VectorSearch = new VectorSearchOptions
|
|
439
|
-
{
|
|
440
|
-
Queries = { new VectorizedQuery(queryEmbedding) { KNearestNeighborsCount = 5 } }
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
ct
|
|
444
|
-
);
|
|
445
|
-
|
|
446
|
-
return results.Value.GetResults().ToArray();
|
|
447
|
-
}
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
---
|
|
451
|
-
|
|
452
|
-
## Microsoft Agent Framework: Orquestração
|
|
453
|
-
|
|
454
|
-
### Agentes Especializados Pequenos > Agente Monolítico Grande
|
|
455
|
-
|
|
456
|
-
**Exemplo: Projeto Lucy (Home Assistant)**
|
|
457
|
-
```
|
|
458
|
-
Orchestration Agent
|
|
459
|
-
├─→ Light Agent (196 lights)
|
|
460
|
-
├─→ Music Agent (Spotify/local)
|
|
461
|
-
├─→ Climate Agent (HVAC)
|
|
462
|
-
└─→ ...
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
**Vantagens:**
|
|
466
|
-
- Cada agente conhece apenas seu domínio
|
|
467
|
-
- Modelos menores = mais barato, mais rápido
|
|
468
|
-
- Busca semântica para entity matching (embeddings)
|
|
469
|
-
|
|
470
|
-
### Workflows com Microsoft.Agents.AI.Workflows
|
|
471
|
-
|
|
472
|
-
```csharp
|
|
473
|
-
// Criar workflow sequencial
|
|
474
|
-
var workflowBuilder = new AgentWorkflowBuilder()
|
|
475
|
-
.AddStep(researchAgent)
|
|
476
|
-
.AddStep(analysisAgent)
|
|
477
|
-
.AddStep(writerAgent);
|
|
478
|
-
|
|
479
|
-
var orchestrationAgent = workflowBuilder.Build();
|
|
480
|
-
|
|
481
|
-
// Executar pipeline
|
|
482
|
-
var result = await orchestrationAgent.RunAsync("Create report about AI trends");
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
### A2A (Agent-to-Agent) Communication
|
|
486
|
-
|
|
487
|
-
```csharp
|
|
488
|
-
// Expor agentes via A2A spec
|
|
489
|
-
app.MapA2A(); // Endpoints automáticos:
|
|
490
|
-
// GET /agents → Lista agent cards
|
|
491
|
-
// POST /message/send → JSON REST
|
|
492
|
-
// POST /jsonrpc → JSON-RPC
|
|
493
|
-
```
|
|
494
|
-
|
|
495
|
-
---
|
|
496
|
-
|
|
497
|
-
## Quando NÃO Usar Agent Framework
|
|
498
|
-
|
|
499
|
-
| Cenário | Recomendação |
|
|
500
|
-
|---------|--------------|
|
|
501
|
-
| Single LLM call resolve | Use Microsoft.Extensions.AI direto |
|
|
502
|
-
| Sem tools necessários | ChatClient simples |
|
|
503
|
-
| Modelo < 3B parâmetros | Tool calling não funciona bem |
|
|
504
|
-
| Apenas summarização/tradução | Não precisa de agente |
|
|
505
|
-
|
|
506
|
-
## Quando USAR
|
|
507
|
-
|
|
508
|
-
- Tools/function calling necessários
|
|
509
|
-
- Workflows assíncronos
|
|
510
|
-
- Multi-step processes
|
|
511
|
-
- Orquestração de múltiplos agentes
|
|
512
|
-
- Integração com sistemas externos
|
|
513
|
-
|
|
514
|
-
---
|
|
515
|
-
|
|
516
|
-
## Mentalidade de Engenharia
|
|
517
|
-
|
|
518
|
-
| Amador | Profissional |
|
|
519
|
-
|--------|--------------|
|
|
520
|
-
| "Joga lá e Deus abençoa" | "Domino cada etapa do processo" |
|
|
521
|
-
| Uma estratégia de chunking | Testa 5+ estratégias |
|
|
522
|
-
| Sem tracking de dados | Rastreamento completo |
|
|
523
|
-
| Espera cliente reclamar | Application Insights alerts |
|
|
524
|
-
| Código descartável | Class libraries reutilizáveis |
|
|
525
|
-
| Funciona na minha máquina | Durable Functions orquestrando |
|
|
526
|
-
|
|
527
|
-
---
|
|
528
|
-
|
|
529
|
-
## Combinações de Padrões
|
|
530
|
-
|
|
531
|
-
| Combinação | Caso de Uso |
|
|
532
|
-
|------------|-------------|
|
|
533
|
-
| Prompt Chaining + Reflection | Geração de conteúdo com qualidade controlada |
|
|
534
|
-
| Routing + Tool Use | Customer service com múltiplas integrações |
|
|
535
|
-
| Planning + Multi-Agent | Projetos complexos de desenvolvimento |
|
|
536
|
-
| Memory + Learning | Assistentes personalizados que evoluem |
|
|
537
|
-
| Parallelization + Exception Handling | Processamento de dados em escala |
|
|
538
|
-
| Resource-Aware + Routing | Otimização de custos em alto volume |
|
|
539
|
-
| Human-in-Loop + Guardrails | Sistemas críticos com compliance |
|
|
540
|
-
|
|
541
|
-
---
|
|
542
|
-
|
|
543
|
-
## Documentação de Referência
|
|
544
|
-
|
|
545
|
-
- [20 Padrões de Design Agêntico](../../.wiki/ai/20-agentic-design-patterns.md)
|
|
546
|
-
- [Transformação Agêntica: Frameworks](../../.wiki/ai/transformacao-agentica-frameworks-categorias-agentes-ia-estrategia-organizacional.md)
|
|
547
|
-
- [Microsoft Agent Framework na Prática](../../.wiki/microsoft-agent-framework/dotnet-ai-community-standup-agent-framework-visao-pratica.md)
|
|
548
|
-
- [Pipeline RAG .NET](../../.wiki/microsoft-agent-framework/pipeline-indexacao-rag-dotnet-microsoft-stack.md)
|
|
549
|
-
- [Microsoft Agent Framework](https://learn.microsoft.com/agent-framework/)
|
|
550
|
-
- [Azure AI Search](https://learn.microsoft.com/azure/search/)
|
|
551
|
-
- [Semantic Kernel](https://learn.microsoft.com/semantic-kernel/)
|
|
552
|
-
|
|
553
|
-
---
|
|
554
|
-
|
|
555
|
-
## Checklist de Arquitetura Agêntica
|
|
556
|
-
|
|
557
|
-
### Design de Sistema
|
|
558
|
-
- [ ] Padrões de design selecionados e justificados
|
|
559
|
-
- [ ] Estrutura de orquestração definida (Boss, Democratic, Bulletin Board)
|
|
560
|
-
- [ ] Agentes especializados mapeados com responsabilidades claras
|
|
561
|
-
- [ ] Comunicação inter-agentes desenhada (A2A se necessário)
|
|
562
|
-
|
|
563
|
-
### Pipeline RAG (se aplicável)
|
|
564
|
-
- [ ] Fonte de dados identificada e acessível
|
|
565
|
-
- [ ] Staging em Blob Storage configurado
|
|
566
|
-
- [ ] Múltiplas estratégias de chunking testadas
|
|
567
|
-
- [ ] Embeddings gerados via Azure OpenAI
|
|
568
|
-
- [ ] Azure AI Search index configurado (vector + hybrid)
|
|
569
|
-
- [ ] Métricas de avaliação definidas e executadas
|
|
570
|
-
- [ ] Estratégia vencedora selecionada e documentada
|
|
571
|
-
|
|
572
|
-
### Memória e Estado
|
|
573
|
-
- [ ] Tipo de memória definido (short-term, episodic, long-term)
|
|
574
|
-
- [ ] Threads configuradas para conversações persistentes
|
|
575
|
-
- [ ] Estratégia de compressão de contexto implementada
|
|
576
|
-
- [ ] Metadata tags definidos para retrieval
|
|
577
|
-
|
|
578
|
-
### Orquestração
|
|
579
|
-
- [ ] Microsoft.Agents.AI.Workflows configurado
|
|
580
|
-
- [ ] Durable Functions para workflows complexos (se necessário)
|
|
581
|
-
- [ ] Fan-out/Fan-in para processamento paralelo
|
|
582
|
-
- [ ] Error handling e retry policies definidos
|
|
583
|
-
|
|
584
|
-
### Monitoring e Avaliação
|
|
585
|
-
- [ ] Application Insights configurado
|
|
586
|
-
- [ ] Métricas de performance monitoradas (accuracy, latency, cost)
|
|
587
|
-
- [ ] Drift detection implementado
|
|
588
|
-
- [ ] Alertas proativos configurados (Teams/Slack)
|
|
589
|
-
|
|
590
|
-
### Segurança e Compliance
|
|
591
|
-
- [ ] Guardrails implementados (PII, injection, malicious content)
|
|
592
|
-
- [ ] Human-in-the-Loop para decisões de alto risco
|
|
593
|
-
- [ ] Risk classification implementado
|
|
594
|
-
- [ ] Compliance com regulações (se aplicável)
|
|
595
|
-
|
|
596
|
-
### Custos
|
|
597
|
-
- [ ] Resource-Aware Optimization implementado
|
|
598
|
-
- [ ] Modelos selecionados por complexidade (gpt-4o-mini vs gpt-4o)
|
|
599
|
-
- [ ] Token usage monitorado
|
|
600
|
-
- [ ] Custos estimados e documentados
|
|
601
|
-
|
|
602
|
-
---
|
|
603
|
-
|
|
604
|
-
*MORPH-SPEC by Polymorphism Tech*
|
|
1
|
+
# AI System Architect
|
|
2
|
+
|
|
3
|
+
Expert in agentic system architecture, multi-agent orchestration, and RAG pipelines.
|
|
4
|
+
|
|
5
|
+
> **Layer:** 2 | **Load:** on-keyword | **Keywords:** orchestration, multi-agent, rag, vector search, embedding, agentic, memory, reasoning
|
|
6
|
+
|
|
7
|
+
> **Ref:** `agent-framework-workflows.md` — Workflow patterns with AgentWorkflowBuilder
|
|
8
|
+
> **Ref:** `agent-framework-production.md` — Middleware, A2A, MCP, caching
|
|
9
|
+
> **Ref:** `vector-search-rag.md` — Vector Search + RAG with EF Core 10
|
|
10
|
+
|
|
11
|
+
## Responsibilities
|
|
12
|
+
|
|
13
|
+
1. Design scalable agentic architectures
|
|
14
|
+
2. Define orchestration patterns (workflows, inter-agent communication)
|
|
15
|
+
3. Implement RAG pipelines (chunking, embedding, retrieval)
|
|
16
|
+
4. Select patterns from 20 agentic design patterns
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 20 Agentic Design Patterns
|
|
21
|
+
|
|
22
|
+
| # | Pattern | Use Case | When to Use | Key Trade-off |
|
|
23
|
+
|---|---------|----------|-------------|---------------|
|
|
24
|
+
| 1 | **Prompt Chaining** | Multi-step processing | Data transformation, pipelines | Modular vs context explosion |
|
|
25
|
+
| 2 | **Routing** | Direct to specialist | Multiple domains | Specialization vs misrouting |
|
|
26
|
+
| 3 | **Parallelization** | Independent chunks | Large-scale processing | Speed vs coordination complexity |
|
|
27
|
+
| 4 | **Reflection** | Draft → critique → refine | Quality control, creative tasks | Quality vs cost (limit 3 iterations) |
|
|
28
|
+
| 5 | **Tool Use** | External tool calls | Multi-step workflows | Quality vs misfire propagation |
|
|
29
|
+
| 6 | **Planning** | Step-by-step before execute | Goal-oriented workflows | Strategic vs setup complexity |
|
|
30
|
+
| 7 | **Multi-Agent Collaboration** | Specialized agents + manager | Iterative refinement, dev | Specialization vs extensive testing |
|
|
31
|
+
| 8 | **Memory Management** | Short/episodic/long-term | Continuity, personalization | Context preservation vs privacy risk |
|
|
32
|
+
| 9 | **Learning & Adaptation** | Feedback → update prompts | Continuous improvement | Improvement vs learning wrong things |
|
|
33
|
+
| 10 | **Goal Setting & Monitoring** | SMART goals + metrics | Complex projects, autonomous ops | Efficiency vs goal conflicts |
|
|
34
|
+
| 11 | **Exception Handling** | Retry + exponential backoff | Production systems | Visibility vs infra complexity |
|
|
35
|
+
| 12 | **Human-in-the-Loop** | Human review for high-risk | Compliance, edge cases | Trust vs latency |
|
|
36
|
+
| 13 | **Knowledge Retrieval (RAG)** | Chunk + embed + search | Private/proprietary data | Accuracy vs infra to maintain |
|
|
37
|
+
| 14 | **Inter-Agent Communication** | Structured messaging (A2A) | Enterprise, distributed | Fault isolation vs extreme complexity |
|
|
38
|
+
| 15 | **Resource-Aware Optimization** | Route by complexity/cost | Cost-sensitive, high volume | Cost reduction vs tuning effort |
|
|
39
|
+
| 16 | **Reasoning Techniques** | CoT, ToT, Self-Consistency | Complex problems, math | Robust vs token-heavy (rarely needed) |
|
|
40
|
+
| 17 | **Evaluation & Monitoring** | Quality gates, drift detection | Production, enterprise | Reliability vs alert fatigue |
|
|
41
|
+
| 18 | **Guardrails & Safety** | PII, injection, malicious check | Public-facing systems | Risk mitigation vs false positives |
|
|
42
|
+
| 19 | **Prioritization** | Score by value/risk/effort | Dynamic environments, task mgmt | Adaptability vs context switching |
|
|
43
|
+
| 20 | **Exploration & Discovery** | Broad knowledge exploration | Research, competitive analysis | Innovation vs resource-heavy |
|
|
44
|
+
|
|
45
|
+
### Common Pattern Combinations
|
|
46
|
+
|
|
47
|
+
| Combination | Use Case |
|
|
48
|
+
|------------|----------|
|
|
49
|
+
| Prompt Chaining + Reflection | Content generation with quality control |
|
|
50
|
+
| Routing + Tool Use | Customer service with integrations |
|
|
51
|
+
| Planning + Multi-Agent | Complex development projects |
|
|
52
|
+
| Memory + Learning | Personalized assistants that evolve |
|
|
53
|
+
| Parallelization + Exception Handling | Data processing at scale |
|
|
54
|
+
| Human-in-Loop + Guardrails | Critical systems with compliance |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Microsoft Agent Framework Orchestration
|
|
59
|
+
|
|
60
|
+
### Workflow Patterns
|
|
61
|
+
|
|
62
|
+
```csharp
|
|
63
|
+
// Sequential — pipeline processing
|
|
64
|
+
Workflow sequential = AgentWorkflowBuilder.BuildSequential(researcher, analyst, writer);
|
|
65
|
+
AIAgent seqAgent = await sequential.AsAgentAsync();
|
|
66
|
+
|
|
67
|
+
// GroupChat — iterative refinement with manager
|
|
68
|
+
Workflow groupChat = AgentWorkflowBuilder
|
|
69
|
+
.CreateGroupChatBuilderWith(agents =>
|
|
70
|
+
new AgentWorkflowBuilder.RoundRobinGroupChatManager(agents)
|
|
71
|
+
{ MaximumIterationCount = 3 })
|
|
72
|
+
.AddParticipants(writer, editor, reviewer)
|
|
73
|
+
.Build();
|
|
74
|
+
|
|
75
|
+
// Handoff — dynamic routing
|
|
76
|
+
var handoff = AgentWorkflowBuilder.StartHandoffWith(triageAgent)
|
|
77
|
+
.WithHandoffs(triageAgent, [specialistA, specialistB])
|
|
78
|
+
.WithHandoff(specialistA, triageAgent)
|
|
79
|
+
.WithHandoff(specialistB, triageAgent)
|
|
80
|
+
.Build();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### A2A Protocol
|
|
84
|
+
|
|
85
|
+
```csharp
|
|
86
|
+
app.MapA2A(agent, "/a2a/agent-name", agentCard: new()
|
|
87
|
+
{
|
|
88
|
+
Name = "Agent Name",
|
|
89
|
+
Description = "What this agent does.",
|
|
90
|
+
Version = "1.0"
|
|
91
|
+
});
|
|
92
|
+
// Discovery: GET /a2a/agent-name/v1/card
|
|
93
|
+
// Message: POST /a2a/agent-name/v1/message:stream
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Small Specialized Agents > Monolithic Agent
|
|
97
|
+
|
|
98
|
+
Design principle: each agent has one clear responsibility, composed via workflows.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## RAG Pipeline with Microsoft Stack
|
|
103
|
+
|
|
104
|
+
### Architecture
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Extraction → Staging (Blob) → Chunking → Embedding → Indexing (AI Search) → Retrieval
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Chunking Strategies
|
|
111
|
+
|
|
112
|
+
| Strategy | Method | Best For |
|
|
113
|
+
|----------|--------|----------|
|
|
114
|
+
| Paragraph Splitter | By paragraphs | General text |
|
|
115
|
+
| Markdown Header Splitter | By headers (#, ##) | Documentation |
|
|
116
|
+
| Token-based Splitter | By token count | Fixed-size chunks |
|
|
117
|
+
| Semantic Splitter | By semantic similarity | Highest quality |
|
|
118
|
+
|
|
119
|
+
**Principle:** Test ALL strategies and rank by metrics (avg similarity score, token count, relevance).
|
|
120
|
+
|
|
121
|
+
### Agent Framework Integration
|
|
122
|
+
|
|
123
|
+
```csharp
|
|
124
|
+
[Description("Searches knowledge base")]
|
|
125
|
+
public async Task<SearchResult[]> SearchKnowledgeAsync(
|
|
126
|
+
[Description("Search query")] string query, CancellationToken ct = default)
|
|
127
|
+
{
|
|
128
|
+
var embedding = await _embeddings.GenerateAsync(query, ct);
|
|
129
|
+
var results = await _searchClient.SearchAsync<KnowledgeChunk>(query,
|
|
130
|
+
new SearchOptions { VectorSearch = new() {
|
|
131
|
+
Queries = { new VectorizedQuery(embedding) { KNearestNeighborsCount = 5 } }
|
|
132
|
+
}}, ct);
|
|
133
|
+
return results.Value.GetResults().ToArray();
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Why Staging in Blob Storage?
|
|
138
|
+
|
|
139
|
+
Immutability, versioning, low cost, fallback on processing bugs, audit trail.
|
|
140
|
+
|
|
141
|
+
### Key Insight
|
|
142
|
+
|
|
143
|
+
**LLM comes LAST.** 80% of RAG work happens before the model is called (extraction, chunking, embedding, evaluation).
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## When NOT to Use Agent Framework
|
|
148
|
+
|
|
149
|
+
| Scenario | Use Instead |
|
|
150
|
+
|----------|------------|
|
|
151
|
+
| Single LLM call resolves | `IChatClient` directly |
|
|
152
|
+
| No tools needed | `ChatClient.GetResponseAsync()` |
|
|
153
|
+
| Model < 3B params | Tool calling unreliable |
|
|
154
|
+
| Just summarization/translation | No agent needed |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Checklist
|
|
159
|
+
|
|
160
|
+
### System Design
|
|
161
|
+
- [ ] Patterns selected and justified
|
|
162
|
+
- [ ] Orchestration pattern chosen (Sequential/Concurrent/GroupChat/Handoff/Magentic)
|
|
163
|
+
- [ ] Specialized agents mapped with clear responsibilities
|
|
164
|
+
|
|
165
|
+
### RAG Pipeline (if applicable)
|
|
166
|
+
- [ ] Data source identified and accessible
|
|
167
|
+
- [ ] Staging in Blob Storage configured
|
|
168
|
+
- [ ] Multiple chunking strategies tested and ranked
|
|
169
|
+
- [ ] Azure AI Search index configured (vector + hybrid)
|
|
170
|
+
|
|
171
|
+
### Orchestration
|
|
172
|
+
- [ ] Workflow built with `AgentWorkflowBuilder`
|
|
173
|
+
- [ ] Error handling via middleware
|
|
174
|
+
- [ ] OpenTelemetry monitoring enabled
|
|
175
|
+
|
|
176
|
+
### Security & Cost
|
|
177
|
+
- [ ] Guardrails implemented (PII, injection, malicious content)
|
|
178
|
+
- [ ] Resource-Aware Optimization (model selection by complexity)
|
|
179
|
+
- [ ] Token usage monitored and costs documented
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## References
|
|
184
|
+
|
|
185
|
+
- [Microsoft Agent Framework](https://learn.microsoft.com/agent-framework/)
|
|
186
|
+
- [Azure AI Search](https://learn.microsoft.com/azure/search/)
|
|
187
|
+
- [GitHub: microsoft/agent-framework](https://github.com/microsoft/agent-framework)
|
|
188
|
+
- `.wiki/ai/20-agentic-design-patterns.md` — Full 20 patterns reference
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
*MORPH-SPEC by Polymorphism Tech*
|