@polymorphism-tech/morph-spec 8.33.0 → 8.35.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 +22 -2
- package/README.md +2 -2
- package/bin/morph-spec.js +43 -5
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +5 -4
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +2 -2
- package/framework/MORPH.md +20 -22
- package/framework/agents.json +198 -44
- package/framework/ai-pin.json +22 -0
- package/framework/commands/morph-media.md +45 -0
- package/framework/docs/CLI.md +238 -10
- package/framework/evals/proof-rubrics/README.md +76 -0
- package/framework/evals/proof-rubrics/eval-de-modelo.md +64 -0
- package/framework/evals/proof-rubrics/fiacao.md +54 -0
- package/framework/evals/proof-rubrics/guard-cego.md +52 -0
- package/framework/evals/proof-rubrics/media-claims.md +109 -0
- package/framework/evals/proof-rubrics/mutation-proof.md +77 -0
- package/framework/evals/proof-rubrics/observabilidade-genai.md +119 -0
- package/framework/evals/proof-rubrics/verde-nao-e-coberto.md +48 -0
- package/framework/evals/rubrics/architecture.md +30 -0
- package/framework/evals/rubrics/code-quality.md +26 -0
- package/framework/evals/rubrics/test-coverage.md +20 -0
- package/framework/hooks/README.md +11 -1
- package/framework/hooks/claude-code/core/block-destructive-worktree-removal.js +5 -8
- package/framework/hooks/claude-code/core/block-raw-worktree-add.js +79 -0
- package/framework/hooks/claude-code/core/chain.js +27 -7
- package/framework/hooks/claude-code/core/protect-spec-files.js +41 -4
- package/framework/hooks/claude-code/core/worktree-context.js +83 -14
- package/framework/hooks/claude-code/core/worktree-create.js +206 -0
- package/framework/hooks/claude-code/core/worktree-env-inject.js +87 -0
- package/framework/hooks/claude-code/core/worktree-remove.js +81 -0
- package/framework/hooks/shared/command-tokens.js +23 -0
- package/framework/hooks/shared/e2e-check.js +0 -0
- package/framework/hooks/shared/git-paths.js +25 -0
- package/framework/hooks/shared/hook-response.js +17 -0
- package/framework/hooks/shared/morph-cli.js +134 -0
- package/framework/rules/ai-agents-standards.md +14 -2
- package/framework/rules/infrastructure-standards.md +3 -1
- package/framework/schemas/ai-pin.schema.json +97 -0
- package/framework/schemas/config.schema.json +107 -0
- package/framework/schemas/feature.schema.json +23 -4
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +28 -7
- package/framework/skills/core/morph-brainstorming/SKILL.md +1 -1
- package/framework/skills/core/morph-eval/SKILL.md +1 -1
- package/framework/skills/core/morph-hotfix/SKILL.md +2 -2
- package/framework/skills/core/morph-implement/SKILL.md +20 -2
- package/framework/skills/core/morph-media/SKILL.md +215 -0
- package/framework/skills/core/morph-plan/SKILL.md +38 -4
- package/framework/skills/core/morph-proposal/SKILL.md +1 -1
- package/framework/skills/core/morph-review/SKILL.md +166 -9
- package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
- package/framework/skills/core/morph-standards/SKILL.md +1 -1
- package/framework/skills/core/morph-uiux/SKILL.md +1 -1
- package/framework/standards/PROVENANCE.json +81 -3
- package/framework/standards/STANDARDS.json +1504 -830
- package/framework/standards/ai-agents/agent-archetypes.md +160 -0
- package/framework/standards/ai-agents/agent-session.md +256 -160
- package/framework/standards/ai-agents/agent-spec.md +196 -0
- package/framework/standards/ai-agents/batching.md +217 -193
- package/framework/standards/ai-agents/context-providers.md +261 -188
- package/framework/standards/ai-agents/conversational-agent-with-phases.md +239 -0
- package/framework/standards/ai-agents/cost-and-budget.md +256 -0
- package/framework/standards/ai-agents/durable-workflows-hitl.md +98 -5
- package/framework/standards/ai-agents/evals-with-cache.md +289 -0
- package/framework/standards/ai-agents/guardrails.md +222 -0
- package/framework/standards/ai-agents/llm-runtime-defaults.md +226 -0
- package/framework/standards/ai-agents/mcp-server.md +351 -250
- package/framework/standards/ai-agents/mcp-tools.md +250 -197
- package/framework/standards/ai-agents/media-pipeline.md +352 -0
- package/framework/standards/ai-agents/media-video.md +267 -0
- package/framework/standards/ai-agents/middleware-patterns.md +241 -207
- package/framework/standards/ai-agents/modalities-image-gen.md +422 -173
- package/framework/standards/ai-agents/modalities-speech-to-text.md +177 -171
- package/framework/standards/ai-agents/modalities-text-to-speech.md +189 -181
- package/framework/standards/ai-agents/modalities-vision.md +205 -201
- package/framework/standards/ai-agents/multi-agent-patterns.md +211 -155
- package/framework/standards/ai-agents/observability-patterns.md +227 -17
- package/framework/standards/ai-agents/production.md +260 -231
- package/framework/standards/ai-agents/prompt-sources.md +389 -0
- package/framework/standards/ai-agents/providers/model-registry.md +293 -158
- package/framework/standards/ai-agents/rag-custom-pgvector.md +69 -4
- package/framework/standards/ai-agents/service-tier-flex.md +143 -135
- package/framework/standards/ai-agents/setup.md +166 -50
- package/framework/standards/ai-agents/structured-output.md +280 -249
- package/framework/standards/ai-agents/sweet-spot.md +129 -109
- package/framework/standards/ai-agents/testing-ai.md +236 -0
- package/framework/standards/ai-agents/vector-data-extensions.md +50 -20
- package/framework/standards/ai-agents/workflows.md +27 -7
- package/framework/standards/frontend/design-system/ai-image-generation.md +12 -0
- package/framework/standards/frontend/design-system/ai-video-generation.md +13 -0
- package/framework/standards/infrastructure/docker/local-compose-isolation.md +90 -0
- package/framework/templates/REGISTRY.json +14 -1
- package/framework/templates/code/dotnet/ai-agents/PromptRepository.cs.template +95 -95
- package/framework/templates/code/sql/ai-agents/agent-prompts-migration.sql.template +58 -58
- package/framework/templates/dotnet/ai-kit/Directory.Build.props +25 -0
- package/framework/templates/dotnet/ai-kit/Directory.Packages.props +26 -0
- package/framework/templates/dotnet/ai-kit/Morph.AiKit.sln +56 -0
- package/framework/templates/dotnet/ai-kit/NuGet.config +12 -0
- package/framework/templates/dotnet/ai-kit/README.md +128 -0
- package/framework/templates/dotnet/ai-kit/global.json +9 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentApi.cs +65 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentFactory.cs +289 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentFactoryOptions.cs +91 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentSpec.cs +91 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentSpecOptions.cs +181 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/AiKitAssemblyMarker.cs +14 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/ConversationStore.cs +174 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/IConversationStore.cs +54 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/InMemoryConversationStore.cs +75 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/CountingChatClient.cs +71 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalAssertion.cs +246 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheMissException.cs +57 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheOptions.cs +78 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheStamp.cs +225 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalFixture.cs +463 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalMode.cs +32 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalQualityEvaluators.cs +49 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalScenario.cs +214 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalSummary.cs +168 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/OfflineChatClient.cs +142 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/ShortPathResponseCache.cs +349 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/IMediaGenerator.cs +42 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/IMediaProvider.cs +77 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaArtifact.cs +28 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaDisclosure.cs +107 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaGenerator.cs +253 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaIdempotencyKey.cs +103 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJob.cs +259 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJobId.cs +21 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJobState.cs +47 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaPricing.cs +102 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaProvenance.cs +44 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaRequest.cs +192 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaResult.cs +94 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaReview.cs +99 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaSeams.cs +97 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaStore.cs +133 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MorphMedia.cs +93 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/GoogleImageProvider.cs +112 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/OpenAIImageProvider.cs +288 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/VeoVideoProvider.cs +158 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/IUsageCostSink.cs +29 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/UsageCostMiddleware.cs +208 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/UsageCostRecord.cs +95 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Morph.AiKit.csproj +38 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Observability/MorphOpenTelemetryExtensions.cs +119 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Observability/MorphTelemetryOptions.cs +82 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/IProviderClientFactory.cs +33 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/ModelAlias.cs +267 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/ModelRegistry.cs +474 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/model-registry.v2.json +87 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Rag/DeltaIngest.cs +169 -0
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Rag/DeltaPlan.cs +49 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/AgentFactoryTests.cs +495 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/AgentSpecTests.cs +260 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/ConversationStoreTests.cs +405 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/DeltaIngestTests.cs +379 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalAssertionTests.cs +197 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalCacheMissTests.cs +139 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalCacheStampTests.cs +157 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalFailuresTests.cs +178 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalFixtureTests.cs +153 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalRefreshTests.cs +194 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalWorkspace.cs +86 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/KitEvals.cs +213 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/OfflineChatClientTests.cs +95 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeChatClient.cs +225 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeChatClientTests.cs +215 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeClock.cs +33 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeMediaProvider.cs +89 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeProviderClientFactory.cs +55 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeUsageCostSink.cs +60 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/InMemoryMediaStore.cs +131 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaAccessibilityTests.cs +133 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaAliasIsNotAnAgentTests.cs +127 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaDisclosureTests.cs +216 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaGeneratorTests.cs +264 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaIdempotencyKeyTests.cs +148 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaJobStateTests.cs +184 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaReviewTests.cs +89 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaStoreTests.cs +98 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/ModelRegistryTests.cs +451 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Morph.AiKit.Tests.csproj +76 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/SkeletonSmokeTests.cs +33 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/TelemetryTests.cs +261 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/UsageCostMiddlewareTests.cs +374 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/.morph-eval-cache.json +12 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/cache/orcamento.acme.a-resposta-estruturada/1/CF70A7CE27BBD66A/contents.data +13 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/cache/orcamento.acme.a-resposta-estruturada/1/CF70A7CE27BBD66A/entry.json +7 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/cache/triagem.acme.a-saudacao/1/19F631228C6E00BA/contents.data +13 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/cache/triagem.acme.a-saudacao/1/19F631228C6E00BA/entry.json +7 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/cache/triagem.acme.b-escalonamento/1/A24A7C9BDD8239D8/contents.data +13 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/cache/triagem.acme.b-escalonamento/1/A24A7C9BDD8239D8/entry.json +7 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/cache/triagem.globex.a-saudacao/1/E38CD37DF003EDB7/contents.data +13 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-cache/cache/triagem.globex.a-saudacao/1/E38CD37DF003EDB7/entry.json +7 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-datasets/orcamento/acme/a-resposta-estruturada.json +24 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-datasets/triagem/acme/a-saudacao.json +23 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-datasets/triagem/acme/b-escalonamento.json +24 -0
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/eval-datasets/triagem/globex/a-saudacao.json +23 -0
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +24 -14
- package/package.json +3 -3
- package/src/commands/e2e/e2e.js +91 -40
- package/src/commands/project/doctor.js +143 -6
- package/src/commands/project/env.js +95 -0
- package/src/commands/project/update.js +469 -153
- package/src/commands/project/worktree.js +274 -53
- package/src/commands/state/advance.js +24 -2
- package/src/commands/state/approve.js +33 -1
- package/src/commands/state/create.js +72 -11
- package/src/commands/state/delete.js +8 -0
- package/src/commands/state/finish.js +360 -53
- package/src/commands/state/gate-check.js +190 -6
- package/src/commands/state/score.js +36 -1
- package/src/commands/validation/verify.js +134 -25
- package/src/core/state/state-manager.js +9 -1
- package/src/dashboard/app/pages/HookInspector.jsx +430 -418
- package/src/dashboard/scanner/hooks-scanner.js +5 -1
- package/src/lib/ai/ai-checks.js +182 -0
- package/src/lib/ai/ai-project-scan.js +347 -0
- package/src/lib/ai/code-audit.js +181 -0
- package/src/lib/ai/comment-stripper.js +184 -0
- package/src/lib/ai/pin-drift.js +138 -0
- package/src/lib/ai/registry-audit.js +285 -0
- package/src/lib/e2e/compose-env.js +55 -14
- package/src/lib/e2e/stack-teardown.js +115 -0
- package/src/lib/evaluator-report.js +269 -15
- package/src/lib/generators/architecture-scanner.js +2 -1
- package/src/lib/git/default-branch.js +92 -4
- package/src/lib/graph/graphifyignore.js +2 -1
- package/src/lib/installers/effects.js +193 -0
- package/src/lib/installers/templates-reconcile.js +3 -3
- package/src/lib/risk-detector.js +284 -0
- package/src/lib/standards/verified-against.js +276 -0
- package/src/lib/tasks/eval-node.js +485 -0
- package/src/lib/tasks/linux-runner.js +297 -0
- package/src/lib/tasks/test-nodes.js +486 -0
- package/src/lib/tasks/test-runner.js +431 -37
- package/src/lib/validators/verify-runner.js +590 -28
- package/src/lib/worktree/dirs.js +32 -0
- package/src/lib/worktree/docker-audit.js +287 -0
- package/src/lib/worktree/env-allocator.js +69 -11
- package/src/lib/worktree/worktree-audit.js +70 -3
- package/src/scripts/setup-infra.js +24 -11
- package/src/utils/agents-installer.js +18 -8
- package/src/utils/claude-md-injector.js +10 -5
- package/src/utils/file-copier.js +28 -16
- package/src/utils/hooks-installer.js +75 -29
- package/src/utils/skills-installer.js +194 -187
- package/src/utils/version-checker.js +68 -3
- package/framework/standards/ai-agents/prompts-in-db.md +0 -214
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
> **Scope:** stacks=["dotnet"]
|
|
4
4
|
> **Layer:** 0 (always-load via persona maf-expert)
|
|
5
|
-
> **Keywords:** maf setup, microsoft agents ai, chatclient, ai agent, agent framework, agent dotnet, AsAIAgent
|
|
5
|
+
> **Keywords:** maf setup, microsoft agents ai, chatclient, ai agent, agent framework, agent dotnet, AsAIAgent, responses api, chat completions, store false
|
|
6
6
|
> **Read by Claude in:** plan (pra citar pacote em tasks.json) + implement (pra escrever .csproj e Program.cs)
|
|
7
7
|
|
|
8
|
-
**Verified against:** Microsoft.Agents.AI 1.0
|
|
8
|
+
**Verified against:** Microsoft.Agents.AI 1.20.0 + Microsoft.Extensions.AI 10.9.0 + OpenAI 2.13.0 (ai-pin 2026-09-08); provado por `templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentFactory.cs` (pipeline e escolha de protocolo). A superfície do SDK `OpenAI` e das pontes `Microsoft.Agents.AI.OpenAI` / `Microsoft.Extensions.AI.OpenAI` foi **medida por reflexão sobre as assemblies do pin** em 2026-09-08 — o ai-kit **não exercita** o cliente concreto da OpenAI — referencia o pacote no `.csproj`, mas não há `using OpenAI` em `src/` (medido 2026-09-08); ver a tabela "Dois níveis de garantia" no README do kit. Last-verified: 2026-09-08.
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -24,7 +24,7 @@ The concrete model choice lives in the project's Model Registry, not in this sta
|
|
|
24
24
|
Está adicionando um agente AI a um projeto .NET?
|
|
25
25
|
├─ Sim → use este standard + ai-agents-sweet-spot + ai-agents-providers-model-registry
|
|
26
26
|
│ ├─ Projeto tem >1 modelo ou >1 provider? → SEMPRE use Model Registry
|
|
27
|
-
│ ├─ Provider OpenAI? → §3.1
|
|
27
|
+
│ ├─ Provider OpenAI? → §3.1 (Responses = default) / §3.1.b (Chat Completions = opt-in)
|
|
28
28
|
│ ├─ Provider Ollama (local)? → §3.2
|
|
29
29
|
│ ├─ Provider Google / Anthropic? → §3.3
|
|
30
30
|
│ └─ Provider Azure OpenAI (data residency)? → §3.4 (nota, não default)
|
|
@@ -35,80 +35,162 @@ Está adicionando um agente AI a um projeto .NET?
|
|
|
35
35
|
|
|
36
36
|
## 1. Packages (NuGet)
|
|
37
37
|
|
|
38
|
+
**Nenhuma faixa flutuante.** Um SDK de cadência semanal com `2.*` é como o ProspectPRO comprou um `MissingMethodException` na Responses API **depois de a chamada ser paga**. Versões abaixo: as do `framework/ai-pin.json` (`pinnedAt` 2026-09-08) ou, quando o pacote **não está no pin**, a versão apurada no nuget.org em **2026-09-08**, dita como tal.
|
|
39
|
+
|
|
38
40
|
**Required for any MAF project:**
|
|
39
41
|
|
|
40
42
|
```xml
|
|
41
|
-
|
|
43
|
+
<!-- no ai-pin.json -->
|
|
44
|
+
<PackageReference Include="Microsoft.Agents.AI" Version="1.20.0" />
|
|
42
45
|
```
|
|
43
46
|
|
|
44
47
|
**Provider-specific (escolha conforme o Model Registry do projeto):**
|
|
45
48
|
|
|
46
49
|
```xml
|
|
47
|
-
<!-- OpenAI direct
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
<!-- OpenAI direct.
|
|
51
|
+
Microsoft.Agents.AI.OpenAI e Microsoft.Extensions.AI.OpenAI NÃO estão no ai-pin.json;
|
|
52
|
+
versões apuradas no nuget.org em 2026-09-08. -->
|
|
53
|
+
<PackageReference Include="Microsoft.Agents.AI.OpenAI" Version="1.20.0" />
|
|
54
|
+
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.9.0" />
|
|
55
|
+
<PackageReference Include="OpenAI" Version="2.13.0" /> <!-- pin -->
|
|
50
56
|
|
|
51
57
|
<!-- Ollama (local / on-prem) — usa o mesmo OpenAI-compatible client -->
|
|
52
|
-
<PackageReference Include="OpenAI" Version="2
|
|
58
|
+
<PackageReference Include="OpenAI" Version="2.13.0" /> <!-- pin -->
|
|
53
59
|
|
|
54
|
-
<!-- Google Gemini —
|
|
60
|
+
<!-- Google Gemini — Google.GenAI 1.21.0 (pin). Ver ai-agents-providers-model-registry §providers -->
|
|
55
61
|
<!-- Anthropic Claude — SDK verificado no standard model-registry.md -->
|
|
56
|
-
<!-- Azure OpenAI (somente se data residency exigir) — Azure.AI.OpenAI
|
|
62
|
+
<!-- Azure OpenAI (somente se data residency exigir) — confira Azure.AI.OpenAI + Azure.Identity no NuGet -->
|
|
57
63
|
```
|
|
58
64
|
|
|
59
|
-
>
|
|
65
|
+
> **Armadilha de restore, medida em 2026-09-08:** `Microsoft.Extensions.AI.OpenAI` 10.9.0 declara a dependência `OpenAI (>= 2.12.0 && < 2.13.0)`. Com o `OpenAI` **2.13.0** do pin, o `dotnet restore` emite **NU1608** (*"Versão detectada do pacote fora da restrição de dependência"*). Duas saídas honestas: fixar `OpenAI` em 2.12.x ao lado da ponte, **ou** aceitar o aviso conscientemente e registrar a decisão em `decisions.md`. Não descubra isso no CI.
|
|
66
|
+
|
|
67
|
+
> **De onde vem cada extensão** (medido por reflexão sobre as assemblies do pin, 2026-09-08):
|
|
68
|
+
> | Extensão | Assembly que a publica | Namespace do `using` |
|
|
69
|
+
> |---|---|---|
|
|
70
|
+
> | `.AsIChatClient()` sobre `OpenAI.Chat.ChatClient` e sobre `OpenAI.Responses.ResponsesClient` | **`Microsoft.Extensions.AI.OpenAI`** (`Microsoft.Extensions.AI.OpenAIClientExtensions`) | `Microsoft.Extensions.AI` |
|
|
71
|
+
> | `.AsAIAgent(...)` sobre `ResponsesClient` / `ChatClient` | **`Microsoft.Agents.AI.OpenAI`** (`OpenAI.Responses.OpenAIResponseClientExtensions`, `OpenAI.Chat.OpenAIChatClientExtensions`) | `Microsoft.Agents.AI` + `OpenAI.Responses` / `OpenAI.Chat` |
|
|
72
|
+
> | `.AsIChatClientWithStoredOutputDisabled(...)` | **`Microsoft.Agents.AI.OpenAI`** | `OpenAI.Responses` |
|
|
73
|
+
>
|
|
74
|
+
> A abstração `IChatClient` em si vive em `Microsoft.Extensions.AI.Abstractions` (dependência transitiva) — código que usa `IChatClient` precisa de `using Microsoft.Extensions.AI;`.
|
|
60
75
|
|
|
61
76
|
> Os pacotes de Google e Anthropic mudam de nome/versão com frequência. O standard `ai-agents-providers-model-registry` mantém a lista verificada com data. Não trave SDK aqui.
|
|
62
77
|
|
|
63
78
|
**Optional (only when feature requires):**
|
|
64
79
|
|
|
65
80
|
```xml
|
|
66
|
-
<!-- Hosting helpers (AddAIAgent, AddSequentialWorkflow)
|
|
67
|
-
|
|
81
|
+
<!-- Hosting helpers (AddAIAgent, AddSequentialWorkflow).
|
|
82
|
+
PRERELEASE: não há versão estável. Apurado no nuget.org em 2026-09-08. -->
|
|
83
|
+
<PackageReference Include="Microsoft.Agents.AI.Hosting" Version="1.20.0-preview.260831.1" />
|
|
84
|
+
|
|
85
|
+
<!-- A2A protocol. PRERELEASE, fora do pin. Apurado em 2026-09-08. -->
|
|
86
|
+
<PackageReference Include="Microsoft.Agents.AI.A2A" Version="1.20.0-preview.260831.1" />
|
|
68
87
|
|
|
69
|
-
<!--
|
|
70
|
-
<PackageReference Include="Microsoft.Agents.AI.
|
|
88
|
+
<!-- Workflows (grafo). Estável, fora do pin. Apurado em 2026-09-08. -->
|
|
89
|
+
<PackageReference Include="Microsoft.Agents.AI.Workflows" Version="1.20.0" />
|
|
71
90
|
```
|
|
72
91
|
|
|
73
92
|
**Forbidden in new MAF projects:**
|
|
74
93
|
|
|
75
|
-
- `Microsoft.SemanticKernel.*` — superseded by MAF, do not introduce.
|
|
76
|
-
- `Microsoft.Extensions.AI.OpenAI` 9
|
|
94
|
+
- `Microsoft.SemanticKernel.*` — superseded by MAF, do not introduce (ver a exceção de Vector Store abaixo).
|
|
95
|
+
- `Microsoft.Extensions.AI.OpenAI` **9.\*** — a linha 9.x é a antiga. A linha **10.x é a atual e é o que a ponte `AsIChatClient` publica hoje**; ver a tabela de origem das extensões acima. (Correção de 2026-09-08: a versão anterior deste standard mandava substituir `Microsoft.Extensions.AI.OpenAI` por `Microsoft.Agents.AI.OpenAI`, o que não é possível — os dois pacotes publicam extensões **diferentes**.)
|
|
77
96
|
- Hosted agent services (Foundry Agent Service, etc.) — use direct models.
|
|
78
97
|
|
|
79
|
-
> **Exceção — conectores de Vector Store:** the ban above targets the SK **orchestration** surface (`Kernel`, `KernelFunction`, `ChatHistory`, `Kernel.InvokePromptAsync()`). It does **not** apply to `Microsoft.SemanticKernel.Connectors.*` packages
|
|
98
|
+
> **Exceção — conectores de Vector Store:** the ban above targets the SK **orchestration** surface (`Kernel`, `KernelFunction`, `ChatHistory`, `Kernel.InvokePromptAsync()`). It does **not** apply to `Microsoft.SemanticKernel.Connectors.*` packages — those are `Microsoft.Extensions.VectorData` backend connectors with zero SK orchestration code, despite the package name. See `ai-agents-vector-data-extensions` before treating one of these as forbidden — e note que o conector PgVector foi **renomeado** para `CommunityToolkit.VectorData.PgVector`.
|
|
80
99
|
|
|
81
100
|
---
|
|
82
101
|
|
|
83
102
|
## 2. Quick Start (canonical minimal agent)
|
|
84
103
|
|
|
104
|
+
**Caminho default para OpenAI: a Responses API.** Código conferido contra a doc oficial (learn.microsoft.com/en-us/agent-framework/integrations/by-component/model-providers/openai, `ms.date` 2026-09-03) e contra a assinatura real medida na assembly `Microsoft.Agents.AI.OpenAI` 1.20.0.
|
|
105
|
+
|
|
85
106
|
```csharp
|
|
86
107
|
using Microsoft.Agents.AI;
|
|
87
|
-
using Microsoft.Extensions.AI;
|
|
88
108
|
using OpenAI;
|
|
89
|
-
using OpenAI.
|
|
109
|
+
using OpenAI.Responses;
|
|
90
110
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
111
|
+
OpenAIClient client = new OpenAIClient("<from-config>");
|
|
112
|
+
ResponsesClient responses = client.GetResponsesClient();
|
|
113
|
+
|
|
114
|
+
AIAgent agent = responses.AsAIAgent(
|
|
115
|
+
model: "gpt-4o-mini",
|
|
116
|
+
instructions: "You are a helpful assistant.",
|
|
117
|
+
name: "assistant");
|
|
94
118
|
|
|
95
119
|
var response = await agent.RunAsync("Analyze this order.");
|
|
96
120
|
Console.WriteLine(response.Text);
|
|
97
121
|
```
|
|
98
122
|
|
|
123
|
+
Para o caminho `IChatClient` puro (sem MAF):
|
|
124
|
+
|
|
125
|
+
```csharp
|
|
126
|
+
using Microsoft.Extensions.AI;
|
|
127
|
+
using OpenAI;
|
|
128
|
+
|
|
129
|
+
IChatClient chat = new OpenAIClient("<key>")
|
|
130
|
+
.GetResponsesClient()
|
|
131
|
+
.AsIChatClient("gpt-4o-mini"); // o modelo é argumento da ponte, não do GetResponsesClient()
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
> **Assinatura medida:** `OpenAIClient.GetResponsesClient()` **não recebe modelo**; o modelo entra em `AsAIAgent(model:)` ou em `AsIChatClient(defaultModelId)`. Isso difere do `GetChatClient(model)` da Chat Completions.
|
|
135
|
+
|
|
99
136
|
This snippet is the baseline. In a real project you never hardcode the model — use the Model Registry (`ai-agents-providers-model-registry`). Anything more complex (DI, tools, structured output, RAG) layers on top via the other ai-agents standards.
|
|
100
137
|
|
|
138
|
+
### Por que Responses é o default
|
|
139
|
+
|
|
140
|
+
| Ferramenta hospedada | Responses | Chat Completions |
|
|
141
|
+
|---|---|---|
|
|
142
|
+
| Code Interpreter | ✔ | ✘ |
|
|
143
|
+
| File Search | ✔ | ✘ |
|
|
144
|
+
| Hosted MCP | ✔ | ✘ |
|
|
145
|
+
| Function calling (tools do seu código) | ✔ | ✔ |
|
|
146
|
+
|
|
147
|
+
Fontes, ambas lidas em 2026-09-08:
|
|
148
|
+
|
|
149
|
+
- Microsoft Learn, *Agent Framework → model providers → OpenAI* (`ms.date` 2026-09-03), verbatim: *"Responses is the recommended primary client when available"* — é de lá que sai a matriz acima.
|
|
150
|
+
- OpenAI, *Migrate to the Responses API* (developers.openai.com/api/docs/guides/migrate-to-responses), verbatim: *"While Chat Completions remains supported, Responses is recommended for all new projects."* e *"…improved cache utilization (40% to 80% improvement when compared to Chat Completions in internal tests)"*.
|
|
151
|
+
|
|
152
|
+
**Chat Completions continua legítima** — não está deprecada. Escolha-a, **por escrito no alias** (`"api": "chat"`), quando: (a) o modelo alvo não é servido pela Responses; (b) a integração existente já fala Chat Completions e o custo de migrar não se paga; (c) há um SDK de outra linguagem no caminho (o Go, por exemplo) sem cliente de Responses. Ver `ai-agents-providers-model-registry` §API per alias — inclusive o limite documentado de tool calling com `reasoning_effort` na Chat Completions.
|
|
153
|
+
|
|
154
|
+
### `store: false` é a regra da casa
|
|
155
|
+
|
|
156
|
+
A Responses API **armazena por padrão**. OpenAI, mesmo guia, verbatim: *"Responses are stored by default. Chat completions are stored by default for new accounts. To disable storage when using either API, set `store: false`."* Respostas retidas ficam 30 dias no provedor.
|
|
157
|
+
|
|
158
|
+
Projetos desta casa mantêm o histórico **próprio** (ver `ai-agents-agent-session`), então não se quer uma segunda cópia da conversa no provedor. **Regra: `store: false` explícito.** Quem quiser o oposto registra o porquê em `decisions.md`.
|
|
159
|
+
|
|
160
|
+
O MAF tem um atalho de primeira classe para isso — medido na assembly `Microsoft.Agents.AI.OpenAI` 1.20.0:
|
|
161
|
+
|
|
162
|
+
```csharp
|
|
163
|
+
using OpenAI.Responses;
|
|
164
|
+
|
|
165
|
+
// AsIChatClientWithStoredOutputDisabled(ResponsesClient, string model, bool includeReasoningEncryptedContent)
|
|
166
|
+
IChatClient chat = new OpenAIClient("<key>")
|
|
167
|
+
.GetResponsesClient()
|
|
168
|
+
.AsIChatClientWithStoredOutputDisabled(
|
|
169
|
+
model: "gpt-4o-mini",
|
|
170
|
+
includeReasoningEncryptedContent: true); // reasoning encriptado viaja no lugar do estado no servidor
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
No caminho cru do SDK, o campo é `CreateResponseOptions.StoredOutputEnabled = false` (medido; o nome C# não é `Store`).
|
|
174
|
+
|
|
175
|
+
> **Nota de leitura sobre reasoning encriptado:** a doc da OpenAI (*deployment checklist*) diz que *"…encrypted reasoning content enables a stateless handoff"*. Que isso seja **exclusivo** da Responses API é **inferência** desta casa a partir do conjunto das páginas, não uma frase da OpenAI — e está marcado como inferência de propósito.
|
|
176
|
+
|
|
177
|
+
### `OPENAI001`
|
|
178
|
+
|
|
179
|
+
**Medido, não inferido:** em `OpenAI` 2.13.0, `OpenAI.Responses.ResponsesClient` e `OpenAI.Responses.CreateResponseOptions` **ainda carregam** `[Experimental("OPENAI001")]` (reflexão sobre a assembly do pin, 2026-09-08). `OpenAI.Chat.ChatClient` não carrega.
|
|
180
|
+
|
|
181
|
+
Consequência prática: código que toca os tipos concretos de Responses precisa de `#pragma warning disable OPENAI001` ou `<NoWarn>OPENAI001</NoWarn>` no `.csproj`. Código que fica em `IChatClient`/`AIAgent` **não** precisa — a ponte absorve o diagnóstico. É um argumento objetivo a favor da abstração, não preferência de estilo.
|
|
182
|
+
|
|
101
183
|
---
|
|
102
184
|
|
|
103
185
|
## 3. Setup by Provider
|
|
104
186
|
|
|
105
187
|
> In any project with >1 model or >1 provider, **do not register `IChatClient` directly** — use the Model Registry (`ai-agents-providers-model-registry`). The snippets below show the raw client construction the registry wraps.
|
|
106
188
|
|
|
107
|
-
### 3.1 OpenAI direct (
|
|
189
|
+
### 3.1 OpenAI direct — Responses (default)
|
|
108
190
|
|
|
109
191
|
```csharp
|
|
110
192
|
using OpenAI;
|
|
111
|
-
using OpenAI.
|
|
193
|
+
using OpenAI.Responses;
|
|
112
194
|
using Microsoft.Extensions.AI;
|
|
113
195
|
|
|
114
196
|
builder.Services.AddSingleton<IChatClient>(sp =>
|
|
@@ -120,10 +202,11 @@ builder.Services.AddSingleton<IChatClient>(sp =>
|
|
|
120
202
|
throw new InvalidOperationException(
|
|
121
203
|
"OpenAI:ApiKey is required. Bind it from an environment variable or secret store.");
|
|
122
204
|
}
|
|
123
|
-
return new
|
|
205
|
+
return new OpenAIClient(apiKey)
|
|
206
|
+
.GetResponsesClient()
|
|
207
|
+
.AsIChatClientWithStoredOutputDisabled(
|
|
124
208
|
model: cfg["OpenAI:Model"] ?? "gpt-4o-mini",
|
|
125
|
-
|
|
126
|
-
.AsIChatClient();
|
|
209
|
+
includeReasoningEncryptedContent: true);
|
|
127
210
|
});
|
|
128
211
|
```
|
|
129
212
|
|
|
@@ -132,12 +215,27 @@ builder.Services.AddSingleton<IChatClient>(sp =>
|
|
|
132
215
|
> exist with blank values — which is the common shape of a checked-in
|
|
133
216
|
> `appsettings.json` placeholder (`"OpenAI": { "ApiKey": "" }`). A
|
|
134
217
|
> `?? throw` guard against `null` therefore never fires; the program
|
|
135
|
-
> proceeds to
|
|
218
|
+
> proceeds to a client built with `""` and crashes much later with
|
|
136
219
|
> an opaque OpenAI SDK error. Always check whitespace.
|
|
137
220
|
|
|
221
|
+
### 3.1.b OpenAI direct — Chat Completions (opt-in explícito)
|
|
222
|
+
|
|
223
|
+
Legítimo, mas escolhido por escrito. Ver `ai-agents-providers-model-registry` §API per alias.
|
|
224
|
+
|
|
225
|
+
```csharp
|
|
226
|
+
using OpenAI;
|
|
227
|
+
using OpenAI.Chat;
|
|
228
|
+
using Microsoft.Extensions.AI;
|
|
229
|
+
|
|
230
|
+
builder.Services.AddSingleton<IChatClient>(sp =>
|
|
231
|
+
new OpenAIClient(apiKey)
|
|
232
|
+
.GetChatClient(cfg["OpenAI:Model"] ?? "gpt-4o-mini") // modelo no Get, aqui
|
|
233
|
+
.AsIChatClient());
|
|
234
|
+
```
|
|
235
|
+
|
|
138
236
|
### 3.2 Ollama (local dev / on-prem)
|
|
139
237
|
|
|
140
|
-
Ollama exposes an OpenAI-compatible endpoint —
|
|
238
|
+
Ollama exposes an **OpenAI-compatible** endpoint — Chat Completions, não Responses. A Responses API é da OpenAI, não do protocolo compatível: nunca aponte um endpoint de Ollama para o caminho de Responses.
|
|
141
239
|
|
|
142
240
|
```csharp
|
|
143
241
|
using OpenAI;
|
|
@@ -157,17 +255,17 @@ builder.Services.AddSingleton<IChatClient>(sp =>
|
|
|
157
255
|
|
|
158
256
|
### 3.3 Google (Gemini) / Anthropic (Claude)
|
|
159
257
|
|
|
160
|
-
Both are first-class providers reached as direct models. The exact NuGet SDK and client construction are documented (with verification date) in `ai-agents-providers-model-registry` §providers — that standard is the single source of truth for provider SDKs, since they change names/versions often.
|
|
258
|
+
Both are first-class providers reached as direct models. The exact NuGet SDK and client construction are documented (with verification date) in `ai-agents-providers-model-registry` §providers — that standard is the single source of truth for provider SDKs, since they change names/versions often. O pin traz `Google.GenAI` **1.21.0**.
|
|
161
259
|
|
|
162
260
|
### 3.4 Azure OpenAI (note — not a default)
|
|
163
261
|
|
|
164
|
-
Azure OpenAI is also a direct model, but requires an Azure resource + deployment per model. It is **not a default provider** in this framework — projects deploy to VPS, not Azure. Add an Azure branch to the Model Registry only when a client explicitly requires data residency in a specific Azure region. The pattern: `new AzureOpenAIClient(endpoint, credential).GetChatClient(deployment).AsIChatClient()`.
|
|
262
|
+
Azure OpenAI is also a direct model, but requires an Azure resource + deployment per model. It is **not a default provider** in this framework — projects deploy to VPS, not Azure. Add an Azure branch to the Model Registry only when a client explicitly requires data residency in a specific Azure region. The pattern: `new AzureOpenAIClient(endpoint, credential).GetChatClient(deployment).AsIChatClient()`. Confirme as versões de `Azure.AI.OpenAI` e `Azure.Identity` no NuGet antes de travar — não estão no pin.
|
|
165
263
|
|
|
166
264
|
---
|
|
167
265
|
|
|
168
266
|
## 4. DI Registration (keyed agents)
|
|
169
267
|
|
|
170
|
-
> The `builder.AddAIAgent(...)` extension requires the `Microsoft.Agents.AI.Hosting` package (see §1 Optional)
|
|
268
|
+
> The `builder.AddAIAgent(...)` extension requires the `Microsoft.Agents.AI.Hosting` package (see §1 Optional) — que está em **prerelease**. For projects that register agents manually without `AddAIAgent`, the base `Microsoft.Agents.AI` package is enough.
|
|
171
269
|
|
|
172
270
|
```csharp
|
|
173
271
|
// Program.cs
|
|
@@ -188,27 +286,36 @@ public class AgentController(
|
|
|
188
286
|
[FromKeyedServices("OrderAnalyzer")] AIAgent orderAgent) : ControllerBase { ... }
|
|
189
287
|
```
|
|
190
288
|
|
|
191
|
-
For agents with tools and structured output, see `ai-agents-multi-agent-patterns` and `ai-agents-structured-output
|
|
289
|
+
For agents with tools and structured output, see `ai-agents-multi-agent-patterns` and `ai-agents-structured-output`.
|
|
192
290
|
|
|
193
291
|
---
|
|
194
292
|
|
|
195
293
|
## 5. OpenTelemetry
|
|
196
294
|
|
|
295
|
+
**Correção medida em 2026-09-08:** `AgentOpenTelemetryConsts` e `agent.WithOpenTelemetry()` **não existem** em `Microsoft.Agents.AI` 1.20.0 (reflexão sobre a assembly do pin). A API real é `UseOpenTelemetry` sobre o *builder* de cada nível:
|
|
296
|
+
|
|
197
297
|
```csharp
|
|
198
298
|
using OpenTelemetry;
|
|
199
299
|
using OpenTelemetry.Trace;
|
|
200
300
|
using Microsoft.Agents.AI;
|
|
301
|
+
using Microsoft.Extensions.AI;
|
|
201
302
|
|
|
303
|
+
// Duas ActivitySource DIFERENTES, uma por nível — medidas nas assemblies do pin:
|
|
304
|
+
// agente → "Experimental.Microsoft.Agents.AI" (span invoke_agent)
|
|
305
|
+
// chat/tools → "Experimental.Microsoft.Extensions.AI" (spans chat e execute_tool)
|
|
202
306
|
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
|
|
203
|
-
.AddSource(
|
|
307
|
+
.AddSource("Experimental.Microsoft.Agents.AI")
|
|
308
|
+
.AddSource("Experimental.Microsoft.Extensions.AI")
|
|
204
309
|
.AddOtlpExporter()
|
|
205
310
|
.Build();
|
|
206
311
|
|
|
207
|
-
|
|
208
|
-
|
|
312
|
+
AIAgent instrumented = agent.AsBuilder()
|
|
313
|
+
.UseOpenTelemetry(sourceName: "Experimental.Microsoft.Agents.AI",
|
|
314
|
+
configure: o => o.EnableSensitiveData = false)
|
|
315
|
+
.Build();
|
|
209
316
|
```
|
|
210
317
|
|
|
211
|
-
> **
|
|
318
|
+
> A regra de **onde** instrumentar (e como não duplicar span) é do standard `ai-agents-observability-patterns` — que é o dono canônico do assunto. O que precisa ficar aqui é só o fato que muda o `.csproj` e o `Program.cs`: são **duas** fontes, e o `AddSource` precisa das duas quando os dois níveis estão instrumentados. A instrução antiga deste standard — *"não use `Experimental.Microsoft.Extensions.AI.*`"* — está **errada para o pin** e foi removida.
|
|
212
319
|
|
|
213
320
|
---
|
|
214
321
|
|
|
@@ -217,7 +324,8 @@ var instrumented = agent.WithOpenTelemetry();
|
|
|
217
324
|
- [ ] API keys never in source. Bind from environment variables / secret store (the VPS deploy uses env vars; Docker secrets or a vault are fine too).
|
|
218
325
|
- [ ] `appsettings.json` checked into git never contains real keys — only placeholder/empty values.
|
|
219
326
|
- [ ] Provider keys (`OpenAI:ApiKey`, `Google:ApiKey`, `Anthropic:ApiKey`) bound from environment.
|
|
220
|
-
- [ ]
|
|
327
|
+
- [ ] `store: false` (ou `AsIChatClientWithStoredOutputDisabled`) quando o projeto tem histórico próprio — senão a conversa fica duplicada no provedor por 30 dias.
|
|
328
|
+
- [ ] No agent receives raw user input without input-validation middleware (see `ai-agents-middleware-patterns`).
|
|
221
329
|
|
|
222
330
|
---
|
|
223
331
|
|
|
@@ -230,18 +338,24 @@ var instrumented = agent.WithOpenTelemetry();
|
|
|
230
338
|
| `[KernelFunction]` | `[Description]` on method + parameters; register via `AIFunctionFactory.Create()` |
|
|
231
339
|
| `ChatHistory` | `IEnumerable<ChatMessage>` |
|
|
232
340
|
| Hardcoded model strings spread across codebase | Single source via Model Registry (see `ai-agents-providers-model-registry`) |
|
|
233
|
-
| `
|
|
341
|
+
| `PackageReference` com faixa flutuante (`2.*`, `1.0.*`) | Versão exata; fora do pin, com data de apuração |
|
|
342
|
+
| Chat Completions por inércia num projeto novo OpenAI | Responses, e Chat Completions só com `"api": "chat"` escrito no alias |
|
|
343
|
+
| Responses com o `store` default | `store: false` / `AsIChatClientWithStoredOutputDisabled` |
|
|
344
|
+
| Apontar Ollama/endpoint compatível para o caminho de Responses | Ollama fala Chat Completions |
|
|
234
345
|
| Hosted agent service "to simplify" | Direct models always |
|
|
235
346
|
|
|
236
347
|
---
|
|
237
348
|
|
|
238
349
|
## 8. Checklist (verifiable by morph-eval)
|
|
239
350
|
|
|
240
|
-
- [ ] `Microsoft.Agents.AI` package present in `.csproj
|
|
241
|
-
- [ ] No `Microsoft.SemanticKernel.*` references
|
|
351
|
+
- [ ] `Microsoft.Agents.AI` package present in `.csproj`, com versão exata
|
|
352
|
+
- [ ] No `Microsoft.SemanticKernel.*` orchestration references
|
|
353
|
+
- [ ] Nenhum `PackageReference` de SDK de IA com faixa flutuante
|
|
242
354
|
- [ ] `IChatClient` registered (either directly or via Model Registry)
|
|
243
355
|
- [ ] At least one `AIAgent` created via `AsAIAgent()` or `new ChatClientAgent()`
|
|
244
|
-
- [ ]
|
|
356
|
+
- [ ] Projeto OpenAI novo usa Responses, ou tem `"api": "chat"` declarado no alias
|
|
357
|
+
- [ ] `store` desligado quando o histórico é próprio
|
|
358
|
+
- [ ] Telemetria (se ligada) faz `AddSource` das **duas** fontes: `Experimental.Microsoft.Agents.AI` e `Experimental.Microsoft.Extensions.AI`
|
|
245
359
|
- [ ] Models reference Model Registry alias when project has >1 model use case
|
|
246
360
|
|
|
247
361
|
---
|
|
@@ -249,13 +363,15 @@ var instrumented = agent.WithOpenTelemetry();
|
|
|
249
363
|
## 9. References
|
|
250
364
|
|
|
251
365
|
- `ai-agents-sweet-spot` — when to use agents vs workflows
|
|
252
|
-
- `ai-agents-providers-model-registry` — provider-agnostic pattern
|
|
253
|
-
- `ai-agents-
|
|
254
|
-
- `ai-agents-
|
|
255
|
-
- `ai-agents-
|
|
256
|
-
-
|
|
257
|
-
-
|
|
366
|
+
- `ai-agents-providers-model-registry` — provider-agnostic pattern, `api` por alias, reasoning effort
|
|
367
|
+
- `ai-agents-agent-session` — histórico próprio, e por que `store: false`
|
|
368
|
+
- `ai-agents-observability-patterns` — dono canônico de spans, métricas e duplicação
|
|
369
|
+
- `ai-agents-structured-output` — typed responses
|
|
370
|
+
- `ai-agents-middleware-patterns` — telemetry, retry, anti-hallucination, streaming agent responses
|
|
371
|
+
- `ai-agents-vector-data-extensions` — a exceção `Microsoft.SemanticKernel.Connectors.*` da lista Forbidden acima
|
|
372
|
+
- Microsoft.Agents.AI docs: https://learn.microsoft.com/agent-framework/ (`ms.date` 2026-09-03 na página de OpenAI)
|
|
373
|
+
- OpenAI, *Migrate to the Responses API*: https://developers.openai.com/api/docs/guides/migrate-to-responses (lido 2026-09-08)
|
|
258
374
|
|
|
259
375
|
---
|
|
260
376
|
|
|
261
|
-
*MORPH-SPEC by Polymorphism Tech — ai-agents/setup.md
|
|
377
|
+
*MORPH-SPEC by Polymorphism Tech — ai-agents/setup.md v3.0 (2026-09-08)*
|