agent-did-microsoft-agent-framework 1.0.0rc1__tar.gz

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.
Files changed (22) hide show
  1. agent_did_microsoft_agent_framework-1.0.0rc1/PKG-INFO +298 -0
  2. agent_did_microsoft_agent_framework-1.0.0rc1/README.md +280 -0
  3. agent_did_microsoft_agent_framework-1.0.0rc1/pyproject.toml +50 -0
  4. agent_did_microsoft_agent_framework-1.0.0rc1/setup.cfg +4 -0
  5. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/__init__.py +63 -0
  6. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/config.py +29 -0
  7. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/context.py +42 -0
  8. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/handoff.py +421 -0
  9. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/integration.py +411 -0
  10. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/observability.py +171 -0
  11. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/sanitization.py +83 -0
  12. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/snapshot.py +50 -0
  13. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework/tools.py +364 -0
  14. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework.egg-info/PKG-INFO +298 -0
  15. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework.egg-info/SOURCES.txt +20 -0
  16. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework.egg-info/dependency_links.txt +1 -0
  17. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework.egg-info/requires.txt +10 -0
  18. agent_did_microsoft_agent_framework-1.0.0rc1/src/agent_did_microsoft_agent_framework.egg-info/top_level.txt +1 -0
  19. agent_did_microsoft_agent_framework-1.0.0rc1/tests/test_integration.py +211 -0
  20. agent_did_microsoft_agent_framework-1.0.0rc1/tests/test_observability.py +56 -0
  21. agent_did_microsoft_agent_framework-1.0.0rc1/tests/test_runtime_smoke.py +249 -0
  22. agent_did_microsoft_agent_framework-1.0.0rc1/tests/test_verified_handoff.py +510 -0
@@ -0,0 +1,298 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-did-microsoft-agent-framework
3
+ Version: 1.0.0rc1
4
+ Summary: Microsoft Agent Framework Python integration for Agent-DID identities, native tools and sanitized observability.
5
+ Author-email: Edison Munoz <edison.munoz@agent-did.org>
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: agent-did-sdk==1.0.0rc1
10
+ Requires-Dist: agent-framework<2,>=1.0.1
11
+ Requires-Dist: pydantic>=2.0
12
+ Provides-Extra: dev
13
+ Requires-Dist: build>=1.2; extra == "dev"
14
+ Requires-Dist: pytest<9.0,>=8.0; extra == "dev"
15
+ Requires-Dist: pytest-asyncio<1.0,>=0.23; extra == "dev"
16
+ Requires-Dist: ruff>=0.4; extra == "dev"
17
+ Requires-Dist: mypy>=1.10; extra == "dev"
18
+
19
+ # agent-did-microsoft-agent-framework
20
+
21
+ Integracion funcional de Agent-DID para Microsoft Agent Framework con foco en Python.
22
+
23
+ Esta variante usa el paquete oficial `agent-framework --pre` documentado en Microsoft Learn y ya no se limita a wiring basico de `Agent(...)`: ahora cubre helpers nativos para `AgentExecutor` y `WorkflowBuilder`, observabilidad especializada con OpenTelemetry, recipes operativas profundas y validacion automatizada de runtime/orquestacion sin depender de proveedores externos.
24
+
25
+ ## Estado
26
+
27
+ - Estado actual: `functional`
28
+ - Roadmap: F2-09
29
+ - Lenguaje objetivo: Python
30
+ - Runtime objetivo: `agent-framework>=1.0.1,<2`
31
+ - Implementacion: funcional para tools nativas, `Agent`, `AgentExecutor`, `WorkflowBuilder`, observabilidad saneada y recipes operativas multi-step
32
+
33
+ Con el estado actual, la claim correcta para F2-09 ya no es solo “MVP de wiring basico”. El paquete tiene cierre operativo para el alcance gobernado en runtime/orchestrations, observabilidad y recipes, con CI dedicada y artefactos de gobernanza equivalentes al resto de integraciones Python del repositorio.
34
+
35
+ ## Hallazgos tecnicos confirmados
36
+
37
+ La documentacion oficial en [Microsoft Learn](https://learn.microsoft.com/es-es/agent-framework/) y el runtime validado en local confirman superficies utiles para una integracion Agent-DID en Python:
38
+
39
+ - `Agent` como host principal con `instructions`, `tools`, `middleware` y `context_providers`.
40
+ - `tool(...)` y `FunctionTool` como superficie nativa para exponer herramientas.
41
+ - `AgentSession` para continuidad conversacional sin exponer secretos en prompts.
42
+ - `AgentExecutor` como unidad reusable para orquestaciones.
43
+ - `WorkflowBuilder` y `Workflow.run(...)` como superficie real para workflows multi-step.
44
+ - observabilidad nativa basada en OpenTelemetry dentro del propio runtime.
45
+
46
+ ## Objetivo
47
+
48
+ Integrar Agent-DID como capa de identidad verificable para agentes y workflows construidos sobre Microsoft Agent Framework, con foco en:
49
+
50
+ - exponer el DID actual y capacidades verificables del agente,
51
+ - resolver documentos DID y verificar firmas desde tools nativas del host,
52
+ - habilitar firma de payloads y firma HTTP solo mediante opt-in,
53
+ - soportar secuencias de workflow y orquestacion sin perder continuidad de identidad,
54
+ - mantener la clave privada fuera del prompt y del contexto visible al modelo.
55
+
56
+ ## Uso rapido
57
+
58
+ ```python
59
+ from agent_did_microsoft_agent_framework import create_agent_did_microsoft_agent_framework_integration
60
+
61
+ integration = create_agent_did_microsoft_agent_framework_integration(
62
+ agent_identity=agent_identity,
63
+ runtime_identity=runtime_identity,
64
+ expose={"sign_payload": True, "rotate_keys": True},
65
+ )
66
+
67
+ agent = integration.create_agent(
68
+ client=chat_client,
69
+ name="Verifier",
70
+ base_instructions="Use Agent-DID tools when verifiable identity evidence is required.",
71
+ )
72
+ executor = integration.create_agent_executor(agent, executor_id="verifier_executor")
73
+ workflow = integration.build_workflow_chain([executor], name="identity_workflow")
74
+ ```
75
+
76
+ El bundle devuelto incluye:
77
+
78
+ - `tools`: `FunctionTool` nativas de Agent Framework.
79
+ - `get_current_identity()` y `get_current_document()`.
80
+ - `get_tool(...)` para resolver tools por nombre sin duplicar wiring manual.
81
+ - `compose_instructions(...)`.
82
+ - `create_agent_kwargs(...)` para inyectar `instructions` y `tools`.
83
+ - `create_agent(...)` para construir un `Agent` listo para usar con el cliente del host.
84
+ - `create_agent_executor(...)` para adaptarlo a orquestaciones.
85
+ - `create_function_executor(...)` para reducers y handlers tipados compatibles con `fan-in`.
86
+ - `create_workflow_builder(...)` y `build_workflow_chain(...)` para recipes y runtime coverage de workflows.
87
+ - `build_fan_out_fan_in_workflow(...)`, `build_multi_selection_workflow(...)` y `build_switch_case_workflow(...)` para patrones avanzados del runtime.
88
+ - `add_verified_handoff(...)` sobre el `WorkflowBuilder` para insertar verificacion de identidad en los bordes de handoff con TTL por `action_class` (ver seccion de abajo).
89
+
90
+ ## Verified handoffs (`add_verified_handoff`)
91
+
92
+ Inserta un verificador de Agent-DID en el borde entre dos executors de un workflow. Hard gate fail-closed con TTL por `action_class`, soporte de la race condition de rotacion de llave durante el handoff y disposicion de bloqueo via excepcion tipada (default) o callback opt-in.
93
+
94
+ ```python
95
+ from agent_did_microsoft_agent_framework import (
96
+ SignedHandoffMessage,
97
+ VerificationBlockedError,
98
+ create_agent_did_microsoft_agent_framework_integration,
99
+ )
100
+
101
+ integration = create_agent_did_microsoft_agent_framework_integration(...)
102
+
103
+ builder = integration.create_workflow_builder(start_executor=intake)
104
+ builder.add_edge(intake, enrichment)
105
+ builder.add_verified_handoff(
106
+ from_executor=enrichment,
107
+ to_executor=execution,
108
+ action_class="reversible", # irreversible | compensable | reversible
109
+ allowed_dids=["did:wba:trusted"],
110
+ require_signature=True,
111
+ on_verification_blocked=None, # default = raise VerificationBlockedError
112
+ output_type=str,
113
+ )
114
+ ```
115
+
116
+ Defaults TTL (overridables por workflow, no por encima de los topes para `irreversible` y cross-domain):
117
+
118
+ | `action_class` | TTL default |
119
+ |---|---|
120
+ | `irreversible` | 30 s (no widenable) |
121
+ | `compensable` | 120 s |
122
+ | `reversible` | 300 s |
123
+
124
+ Reglas adicionales:
125
+ - Cross-domain hops fuerzan re-verify (TTL = 0).
126
+ - Dentro del TTL: si la firma fue emitida bajo la llave previa y el agente roto su llave, se acepta via `verify_historical_signature` del SDK central.
127
+ - Fuera del TTL: solo se acepta firma contra el current key set; si la llave previa fue revocada -> `VerificationBlockedError(failing_gates=["key_lifecycle"])`.
128
+
129
+ Disposicion de bloqueo:
130
+ - Default: levanta `VerificationBlockedError(result, failing_gates, enforcement_note, checked_did, action_class)`.
131
+ - Opt-in: si registras `on_verification_blocked=callback`, recibe el mismo error. Devolver `None` detiene el workflow grasiosamente; devolver cualquier otro valor lo emite via `ctx.send_message(...)` como salida del verificador.
132
+
133
+ Observabilidad:
134
+ - `agent_did.workflow.handoff_verified` en exitos (incluye `from_did`, `action_class`, `ttl_seconds`, `decision_reason`).
135
+ - `agent_did.workflow.handoff_blocked` en bloqueos (incluye `failing_gates`, `decision_reason`).
136
+
137
+ Ejemplo end-to-end: [`examples/agent_did_microsoft_agent_framework_verified_handoff_example.py`](examples/agent_did_microsoft_agent_framework_verified_handoff_example.py).
138
+
139
+ ### Credito de diseno
140
+
141
+ El diseno de esta API surgio de una conversacion publica con [@haroldmalikfrimpong-ops](https://github.com/haroldmalikfrimpong-ops) en `microsoft/agent-framework#4842`. Hilos de referencia:
142
+ - Discusion original (handoff boundary vs middleware): [microsoft/agent-framework#4842](https://github.com/microsoft/agent-framework/issues/4842).
143
+ - Issue concreto con la API completa lockeada: [edisonduran/agent-did#26](https://github.com/edisonduran/agent-did/issues/26).
144
+ - Race condition de key-rotation durante handoff: [microsoft/agent-framework#4842 (comentario)](https://github.com/microsoft/agent-framework/issues/4842#issuecomment-4327716940).
145
+
146
+
147
+ ## Tools expuestas por defecto
148
+
149
+ - `agent_did_get_current_identity`
150
+ - `agent_did_resolve_did`
151
+ - `agent_did_verify_signature`
152
+
153
+ ## Tools opt-in
154
+
155
+ - `agent_did_sign_payload`
156
+ - `agent_did_sign_http_request`
157
+ - `agent_did_rotate_key`
158
+ - `agent_did_get_document_history`
159
+
160
+ ## Runtime y orquestacion
161
+
162
+ La validacion automatizada ya no se limita a `Agent(...)` y aceptación del bundle. Ahora cubre tambien:
163
+
164
+ - construccion de `AgentExecutor`
165
+ - armado de cadenas con `WorkflowBuilder`
166
+ - ejecucion real de un workflow multi-step con dos agentes stub
167
+ - patrones avanzados de `fan-out`, `fan-in`, `multi-selection` y `switch-case`
168
+ - continuidad de identidad a traves de firma, verificacion, rotacion de claves e historial documental antes y despues del workflow
169
+
170
+ ## Recetas operativas
171
+
172
+ ### Receta 1: workflow de identidad multi-step
173
+
174
+ Use esta receta cuando quiera validar una secuencia real de orquestacion con dos agentes y herramientas Agent-DID sin depender de un proveedor externo:
175
+
176
+ - firma antes de rotacion
177
+ - rotacion de clave activa
178
+ - firma despues de rotacion
179
+ - consulta de historial documental
180
+ - workflow planner → reviewer con `WorkflowBuilder`
181
+
182
+ Ejecute:
183
+
184
+ ```bash
185
+ cd integrations/microsoft-agent-framework
186
+ python -m pip install -e .[dev]
187
+ python examples/agent_did_microsoft_agent_framework_workflow_recipe_example.py
188
+ ```
189
+
190
+ Artefacto runnable asociado:
191
+
192
+ - `examples/agent_did_microsoft_agent_framework_workflow_recipe_example.py`
193
+
194
+ ### Receta 2: patterns avanzados de workflow
195
+
196
+ Use esta receta cuando quiera validar patrones nativos adicionales del runtime:
197
+
198
+ - `fan-out` hacia ramas paralelas
199
+ - `fan-in` a un reductor final
200
+ - `multi-selection` basado en funcion de seleccion
201
+ - `switch-case` con `Case` y `Default`
202
+
203
+ Ejecute:
204
+
205
+ ```bash
206
+ cd integrations/microsoft-agent-framework
207
+ python -m pip install -e .[dev]
208
+ python examples/agent_did_microsoft_agent_framework_advanced_workflow_recipe_example.py
209
+ ```
210
+
211
+ Artefacto runnable asociado:
212
+
213
+ - `examples/agent_did_microsoft_agent_framework_advanced_workflow_recipe_example.py`
214
+
215
+ ### Receta 3: recipe production-style con sesiones y observabilidad compuesta
216
+
217
+ Use esta receta cuando quiera validar operacion mas cercana a produccion sin credenciales externas:
218
+
219
+ - continuidad de sesion con `AgentSession`
220
+ - firma de payload
221
+ - firma HTTP opt-in
222
+ - rotacion de clave activa
223
+ - historial documental
224
+ - workflow multi-step
225
+ - fan-out de observabilidad a memoria, JSON logging y OpenTelemetry
226
+
227
+ Ejecute:
228
+
229
+ ```bash
230
+ cd integrations/microsoft-agent-framework
231
+ python -m pip install -e .[dev]
232
+ python examples/agent_did_microsoft_agent_framework_production_recipe_example.py
233
+ ```
234
+
235
+ Artefacto runnable asociado:
236
+
237
+ - `examples/agent_did_microsoft_agent_framework_production_recipe_example.py`
238
+
239
+ ## Observabilidad
240
+
241
+ La integracion emite eventos saneados y puede proyectarlos a JSON logging o a spans OpenTelemetry:
242
+
243
+ ```python
244
+ from agent_did_microsoft_agent_framework.observability import (
245
+ compose_event_handlers,
246
+ create_json_logger_event_handler,
247
+ create_opentelemetry_event_handler,
248
+ create_opentelemetry_tracer,
249
+ )
250
+ ```
251
+
252
+ Eventos relevantes cubiertos por la integracion:
253
+
254
+ - `agent_did.identity_snapshot.refreshed`
255
+ - `agent_did.tool.started`
256
+ - `agent_did.tool.succeeded`
257
+ - `agent_did.tool.failed`
258
+ - `agent_did.workflow.executor_created`
259
+ - `agent_did.workflow.function_executor_created`
260
+ - `agent_did.workflow.builder_created`
261
+ - `agent_did.workflow.chain_built`
262
+ - `agent_did.workflow.fan_out_fan_in_built`
263
+ - `agent_did.workflow.multi_selection_built`
264
+ - `agent_did.workflow.switch_case_built`
265
+
266
+ La redaccion cubre `payload`, `body`, `signature`, headers sensibles y URLs con credenciales o query strings.
267
+
268
+ ## Validacion local
269
+
270
+ ```bash
271
+ cd sdk-python
272
+ python -m pip install -e .[dev]
273
+ cd ../integrations/microsoft-agent-framework
274
+ python -m pip install -e .[dev]
275
+ python -m ruff check src tests examples
276
+ python -m mypy src
277
+ python -m pytest tests -q
278
+ python examples/agent_did_microsoft_agent_framework_mvp_example.py
279
+ python examples/agent_did_microsoft_agent_framework_workflow_recipe_example.py
280
+ python examples/agent_did_microsoft_agent_framework_advanced_workflow_recipe_example.py
281
+ python examples/agent_did_microsoft_agent_framework_production_recipe_example.py
282
+ ```
283
+
284
+ ## Gobernanza de implementacion
285
+
286
+ - Checklist de implementacion: `../../docs/F2-09-Microsoft-Agent-Framework-Implementation-Checklist.md`
287
+ - Checklist de review recurrente: `../../docs/F2-09-Microsoft-Agent-Framework-Integration-Review-Checklist.md`
288
+ - Matriz de paridad: `../../docs/F2-09-Microsoft-Agent-Framework-Parity-Matrix.md`
289
+ - Evaluacion de brecha de madurez: `../../docs/F2-09-Microsoft-Agent-Framework-Maturity-Gap-Assessment.md`
290
+ - Documento de diseno: `../../docs/F2-09-Microsoft-Agent-Framework-Integration-Design.md`
291
+
292
+ ## CI dedicada
293
+
294
+ La validacion del paquete queda cubierta por `.github/workflows/ci-microsoft-agent-framework.yml`, con lint, type-check, tests, smoke runtime de workflow/orchestracion y build del paquete.
295
+
296
+ ## Conclusión
297
+
298
+ Para el alcance gobernado por F2-09, ya no queda una divergencia material abierta en runtime/orchestrations, observabilidad o recipes operativas. El siguiente trabajo natural pasa a ser mantenimiento incremental o extensiones no requeridas para la claim actual.
@@ -0,0 +1,280 @@
1
+ # agent-did-microsoft-agent-framework
2
+
3
+ Integracion funcional de Agent-DID para Microsoft Agent Framework con foco en Python.
4
+
5
+ Esta variante usa el paquete oficial `agent-framework --pre` documentado en Microsoft Learn y ya no se limita a wiring basico de `Agent(...)`: ahora cubre helpers nativos para `AgentExecutor` y `WorkflowBuilder`, observabilidad especializada con OpenTelemetry, recipes operativas profundas y validacion automatizada de runtime/orquestacion sin depender de proveedores externos.
6
+
7
+ ## Estado
8
+
9
+ - Estado actual: `functional`
10
+ - Roadmap: F2-09
11
+ - Lenguaje objetivo: Python
12
+ - Runtime objetivo: `agent-framework>=1.0.1,<2`
13
+ - Implementacion: funcional para tools nativas, `Agent`, `AgentExecutor`, `WorkflowBuilder`, observabilidad saneada y recipes operativas multi-step
14
+
15
+ Con el estado actual, la claim correcta para F2-09 ya no es solo “MVP de wiring basico”. El paquete tiene cierre operativo para el alcance gobernado en runtime/orchestrations, observabilidad y recipes, con CI dedicada y artefactos de gobernanza equivalentes al resto de integraciones Python del repositorio.
16
+
17
+ ## Hallazgos tecnicos confirmados
18
+
19
+ La documentacion oficial en [Microsoft Learn](https://learn.microsoft.com/es-es/agent-framework/) y el runtime validado en local confirman superficies utiles para una integracion Agent-DID en Python:
20
+
21
+ - `Agent` como host principal con `instructions`, `tools`, `middleware` y `context_providers`.
22
+ - `tool(...)` y `FunctionTool` como superficie nativa para exponer herramientas.
23
+ - `AgentSession` para continuidad conversacional sin exponer secretos en prompts.
24
+ - `AgentExecutor` como unidad reusable para orquestaciones.
25
+ - `WorkflowBuilder` y `Workflow.run(...)` como superficie real para workflows multi-step.
26
+ - observabilidad nativa basada en OpenTelemetry dentro del propio runtime.
27
+
28
+ ## Objetivo
29
+
30
+ Integrar Agent-DID como capa de identidad verificable para agentes y workflows construidos sobre Microsoft Agent Framework, con foco en:
31
+
32
+ - exponer el DID actual y capacidades verificables del agente,
33
+ - resolver documentos DID y verificar firmas desde tools nativas del host,
34
+ - habilitar firma de payloads y firma HTTP solo mediante opt-in,
35
+ - soportar secuencias de workflow y orquestacion sin perder continuidad de identidad,
36
+ - mantener la clave privada fuera del prompt y del contexto visible al modelo.
37
+
38
+ ## Uso rapido
39
+
40
+ ```python
41
+ from agent_did_microsoft_agent_framework import create_agent_did_microsoft_agent_framework_integration
42
+
43
+ integration = create_agent_did_microsoft_agent_framework_integration(
44
+ agent_identity=agent_identity,
45
+ runtime_identity=runtime_identity,
46
+ expose={"sign_payload": True, "rotate_keys": True},
47
+ )
48
+
49
+ agent = integration.create_agent(
50
+ client=chat_client,
51
+ name="Verifier",
52
+ base_instructions="Use Agent-DID tools when verifiable identity evidence is required.",
53
+ )
54
+ executor = integration.create_agent_executor(agent, executor_id="verifier_executor")
55
+ workflow = integration.build_workflow_chain([executor], name="identity_workflow")
56
+ ```
57
+
58
+ El bundle devuelto incluye:
59
+
60
+ - `tools`: `FunctionTool` nativas de Agent Framework.
61
+ - `get_current_identity()` y `get_current_document()`.
62
+ - `get_tool(...)` para resolver tools por nombre sin duplicar wiring manual.
63
+ - `compose_instructions(...)`.
64
+ - `create_agent_kwargs(...)` para inyectar `instructions` y `tools`.
65
+ - `create_agent(...)` para construir un `Agent` listo para usar con el cliente del host.
66
+ - `create_agent_executor(...)` para adaptarlo a orquestaciones.
67
+ - `create_function_executor(...)` para reducers y handlers tipados compatibles con `fan-in`.
68
+ - `create_workflow_builder(...)` y `build_workflow_chain(...)` para recipes y runtime coverage de workflows.
69
+ - `build_fan_out_fan_in_workflow(...)`, `build_multi_selection_workflow(...)` y `build_switch_case_workflow(...)` para patrones avanzados del runtime.
70
+ - `add_verified_handoff(...)` sobre el `WorkflowBuilder` para insertar verificacion de identidad en los bordes de handoff con TTL por `action_class` (ver seccion de abajo).
71
+
72
+ ## Verified handoffs (`add_verified_handoff`)
73
+
74
+ Inserta un verificador de Agent-DID en el borde entre dos executors de un workflow. Hard gate fail-closed con TTL por `action_class`, soporte de la race condition de rotacion de llave durante el handoff y disposicion de bloqueo via excepcion tipada (default) o callback opt-in.
75
+
76
+ ```python
77
+ from agent_did_microsoft_agent_framework import (
78
+ SignedHandoffMessage,
79
+ VerificationBlockedError,
80
+ create_agent_did_microsoft_agent_framework_integration,
81
+ )
82
+
83
+ integration = create_agent_did_microsoft_agent_framework_integration(...)
84
+
85
+ builder = integration.create_workflow_builder(start_executor=intake)
86
+ builder.add_edge(intake, enrichment)
87
+ builder.add_verified_handoff(
88
+ from_executor=enrichment,
89
+ to_executor=execution,
90
+ action_class="reversible", # irreversible | compensable | reversible
91
+ allowed_dids=["did:wba:trusted"],
92
+ require_signature=True,
93
+ on_verification_blocked=None, # default = raise VerificationBlockedError
94
+ output_type=str,
95
+ )
96
+ ```
97
+
98
+ Defaults TTL (overridables por workflow, no por encima de los topes para `irreversible` y cross-domain):
99
+
100
+ | `action_class` | TTL default |
101
+ |---|---|
102
+ | `irreversible` | 30 s (no widenable) |
103
+ | `compensable` | 120 s |
104
+ | `reversible` | 300 s |
105
+
106
+ Reglas adicionales:
107
+ - Cross-domain hops fuerzan re-verify (TTL = 0).
108
+ - Dentro del TTL: si la firma fue emitida bajo la llave previa y el agente roto su llave, se acepta via `verify_historical_signature` del SDK central.
109
+ - Fuera del TTL: solo se acepta firma contra el current key set; si la llave previa fue revocada -> `VerificationBlockedError(failing_gates=["key_lifecycle"])`.
110
+
111
+ Disposicion de bloqueo:
112
+ - Default: levanta `VerificationBlockedError(result, failing_gates, enforcement_note, checked_did, action_class)`.
113
+ - Opt-in: si registras `on_verification_blocked=callback`, recibe el mismo error. Devolver `None` detiene el workflow grasiosamente; devolver cualquier otro valor lo emite via `ctx.send_message(...)` como salida del verificador.
114
+
115
+ Observabilidad:
116
+ - `agent_did.workflow.handoff_verified` en exitos (incluye `from_did`, `action_class`, `ttl_seconds`, `decision_reason`).
117
+ - `agent_did.workflow.handoff_blocked` en bloqueos (incluye `failing_gates`, `decision_reason`).
118
+
119
+ Ejemplo end-to-end: [`examples/agent_did_microsoft_agent_framework_verified_handoff_example.py`](examples/agent_did_microsoft_agent_framework_verified_handoff_example.py).
120
+
121
+ ### Credito de diseno
122
+
123
+ El diseno de esta API surgio de una conversacion publica con [@haroldmalikfrimpong-ops](https://github.com/haroldmalikfrimpong-ops) en `microsoft/agent-framework#4842`. Hilos de referencia:
124
+ - Discusion original (handoff boundary vs middleware): [microsoft/agent-framework#4842](https://github.com/microsoft/agent-framework/issues/4842).
125
+ - Issue concreto con la API completa lockeada: [edisonduran/agent-did#26](https://github.com/edisonduran/agent-did/issues/26).
126
+ - Race condition de key-rotation durante handoff: [microsoft/agent-framework#4842 (comentario)](https://github.com/microsoft/agent-framework/issues/4842#issuecomment-4327716940).
127
+
128
+
129
+ ## Tools expuestas por defecto
130
+
131
+ - `agent_did_get_current_identity`
132
+ - `agent_did_resolve_did`
133
+ - `agent_did_verify_signature`
134
+
135
+ ## Tools opt-in
136
+
137
+ - `agent_did_sign_payload`
138
+ - `agent_did_sign_http_request`
139
+ - `agent_did_rotate_key`
140
+ - `agent_did_get_document_history`
141
+
142
+ ## Runtime y orquestacion
143
+
144
+ La validacion automatizada ya no se limita a `Agent(...)` y aceptación del bundle. Ahora cubre tambien:
145
+
146
+ - construccion de `AgentExecutor`
147
+ - armado de cadenas con `WorkflowBuilder`
148
+ - ejecucion real de un workflow multi-step con dos agentes stub
149
+ - patrones avanzados de `fan-out`, `fan-in`, `multi-selection` y `switch-case`
150
+ - continuidad de identidad a traves de firma, verificacion, rotacion de claves e historial documental antes y despues del workflow
151
+
152
+ ## Recetas operativas
153
+
154
+ ### Receta 1: workflow de identidad multi-step
155
+
156
+ Use esta receta cuando quiera validar una secuencia real de orquestacion con dos agentes y herramientas Agent-DID sin depender de un proveedor externo:
157
+
158
+ - firma antes de rotacion
159
+ - rotacion de clave activa
160
+ - firma despues de rotacion
161
+ - consulta de historial documental
162
+ - workflow planner → reviewer con `WorkflowBuilder`
163
+
164
+ Ejecute:
165
+
166
+ ```bash
167
+ cd integrations/microsoft-agent-framework
168
+ python -m pip install -e .[dev]
169
+ python examples/agent_did_microsoft_agent_framework_workflow_recipe_example.py
170
+ ```
171
+
172
+ Artefacto runnable asociado:
173
+
174
+ - `examples/agent_did_microsoft_agent_framework_workflow_recipe_example.py`
175
+
176
+ ### Receta 2: patterns avanzados de workflow
177
+
178
+ Use esta receta cuando quiera validar patrones nativos adicionales del runtime:
179
+
180
+ - `fan-out` hacia ramas paralelas
181
+ - `fan-in` a un reductor final
182
+ - `multi-selection` basado en funcion de seleccion
183
+ - `switch-case` con `Case` y `Default`
184
+
185
+ Ejecute:
186
+
187
+ ```bash
188
+ cd integrations/microsoft-agent-framework
189
+ python -m pip install -e .[dev]
190
+ python examples/agent_did_microsoft_agent_framework_advanced_workflow_recipe_example.py
191
+ ```
192
+
193
+ Artefacto runnable asociado:
194
+
195
+ - `examples/agent_did_microsoft_agent_framework_advanced_workflow_recipe_example.py`
196
+
197
+ ### Receta 3: recipe production-style con sesiones y observabilidad compuesta
198
+
199
+ Use esta receta cuando quiera validar operacion mas cercana a produccion sin credenciales externas:
200
+
201
+ - continuidad de sesion con `AgentSession`
202
+ - firma de payload
203
+ - firma HTTP opt-in
204
+ - rotacion de clave activa
205
+ - historial documental
206
+ - workflow multi-step
207
+ - fan-out de observabilidad a memoria, JSON logging y OpenTelemetry
208
+
209
+ Ejecute:
210
+
211
+ ```bash
212
+ cd integrations/microsoft-agent-framework
213
+ python -m pip install -e .[dev]
214
+ python examples/agent_did_microsoft_agent_framework_production_recipe_example.py
215
+ ```
216
+
217
+ Artefacto runnable asociado:
218
+
219
+ - `examples/agent_did_microsoft_agent_framework_production_recipe_example.py`
220
+
221
+ ## Observabilidad
222
+
223
+ La integracion emite eventos saneados y puede proyectarlos a JSON logging o a spans OpenTelemetry:
224
+
225
+ ```python
226
+ from agent_did_microsoft_agent_framework.observability import (
227
+ compose_event_handlers,
228
+ create_json_logger_event_handler,
229
+ create_opentelemetry_event_handler,
230
+ create_opentelemetry_tracer,
231
+ )
232
+ ```
233
+
234
+ Eventos relevantes cubiertos por la integracion:
235
+
236
+ - `agent_did.identity_snapshot.refreshed`
237
+ - `agent_did.tool.started`
238
+ - `agent_did.tool.succeeded`
239
+ - `agent_did.tool.failed`
240
+ - `agent_did.workflow.executor_created`
241
+ - `agent_did.workflow.function_executor_created`
242
+ - `agent_did.workflow.builder_created`
243
+ - `agent_did.workflow.chain_built`
244
+ - `agent_did.workflow.fan_out_fan_in_built`
245
+ - `agent_did.workflow.multi_selection_built`
246
+ - `agent_did.workflow.switch_case_built`
247
+
248
+ La redaccion cubre `payload`, `body`, `signature`, headers sensibles y URLs con credenciales o query strings.
249
+
250
+ ## Validacion local
251
+
252
+ ```bash
253
+ cd sdk-python
254
+ python -m pip install -e .[dev]
255
+ cd ../integrations/microsoft-agent-framework
256
+ python -m pip install -e .[dev]
257
+ python -m ruff check src tests examples
258
+ python -m mypy src
259
+ python -m pytest tests -q
260
+ python examples/agent_did_microsoft_agent_framework_mvp_example.py
261
+ python examples/agent_did_microsoft_agent_framework_workflow_recipe_example.py
262
+ python examples/agent_did_microsoft_agent_framework_advanced_workflow_recipe_example.py
263
+ python examples/agent_did_microsoft_agent_framework_production_recipe_example.py
264
+ ```
265
+
266
+ ## Gobernanza de implementacion
267
+
268
+ - Checklist de implementacion: `../../docs/F2-09-Microsoft-Agent-Framework-Implementation-Checklist.md`
269
+ - Checklist de review recurrente: `../../docs/F2-09-Microsoft-Agent-Framework-Integration-Review-Checklist.md`
270
+ - Matriz de paridad: `../../docs/F2-09-Microsoft-Agent-Framework-Parity-Matrix.md`
271
+ - Evaluacion de brecha de madurez: `../../docs/F2-09-Microsoft-Agent-Framework-Maturity-Gap-Assessment.md`
272
+ - Documento de diseno: `../../docs/F2-09-Microsoft-Agent-Framework-Integration-Design.md`
273
+
274
+ ## CI dedicada
275
+
276
+ La validacion del paquete queda cubierta por `.github/workflows/ci-microsoft-agent-framework.yml`, con lint, type-check, tests, smoke runtime de workflow/orchestracion y build del paquete.
277
+
278
+ ## Conclusión
279
+
280
+ Para el alcance gobernado por F2-09, ya no queda una divergencia material abierta en runtime/orchestrations, observabilidad o recipes operativas. El siguiente trabajo natural pasa a ser mantenimiento incremental o extensiones no requeridas para la claim actual.
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agent-did-microsoft-agent-framework"
7
+ version = "1.0.0rc1"
8
+ description = "Microsoft Agent Framework Python integration for Agent-DID identities, native tools and sanitized observability."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ authors = [
13
+ { name = "Edison Munoz", email = "edison.munoz@agent-did.org" }
14
+ ]
15
+ dependencies = [
16
+ "agent-did-sdk==1.0.0rc1",
17
+ "agent-framework>=1.0.1,<2",
18
+ "pydantic>=2.0",
19
+ ]
20
+
21
+ [project.optional-dependencies]
22
+ dev = [
23
+ "build>=1.2",
24
+ "pytest>=8.0,<9.0",
25
+ "pytest-asyncio>=0.23,<1.0",
26
+ "ruff>=0.4",
27
+ "mypy>=1.10",
28
+ ]
29
+
30
+ [tool.setuptools.packages.find]
31
+ where = ["src"]
32
+
33
+ [tool.pytest.ini_options]
34
+ testpaths = ["tests"]
35
+
36
+ [tool.ruff]
37
+ target-version = "py310"
38
+ line-length = 120
39
+
40
+ [tool.ruff.lint]
41
+ select = ["E", "F", "I", "W", "UP"]
42
+
43
+ [tool.mypy]
44
+ strict = true
45
+ python_version = "3.10"
46
+
47
+ [tool.agent-did]
48
+ status = "functional"
49
+ roadmap = "F2-09"
50
+ implementation = "functional"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+