agent-framework-core 1.19.0__tar.gz → 1.20.0__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 (112) hide show
  1. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/PKG-INFO +32 -31
  2. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/__init__.py +9 -1
  3. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/__init__.pyi +9 -1
  4. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_agent_hooks.py +62 -62
  5. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_agents.py +212 -65
  6. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_compaction.py +251 -38
  7. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_evaluation.py +16 -10
  8. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_feature_stage.py +1 -0
  9. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_agent.py +8 -0
  10. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_agent.pyi +1 -0
  11. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_file_access.py +316 -81
  12. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_loop.py +52 -26
  13. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_mode.py +15 -3
  14. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_tool_approval.py +49 -2
  15. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_in_memory.py +8 -5
  16. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_mcp.py +51 -13
  17. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_middleware.py +280 -11
  18. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_sessions.py +124 -47
  19. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_settings.py +47 -15
  20. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_skills.py +372 -40
  21. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_telemetry.py +11 -1
  22. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_tools.py +314 -83
  23. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_types.py +769 -243
  24. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_vector_filters.py +30 -1
  25. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_vectors.py +175 -21
  26. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_agent.py +30 -4
  27. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_agent_executor.py +450 -53
  28. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_checkpoint.py +4 -4
  29. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_checkpoint_encoding.py +21 -11
  30. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_const.py +4 -0
  31. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_edge.py +6 -5
  32. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_edge_runner.py +26 -0
  33. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_functional.py +748 -92
  34. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_state.py +11 -0
  35. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_typing_utils.py +5 -0
  36. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_workflow.py +173 -66
  37. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_workflow_executor.py +130 -26
  38. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/exceptions.py +5 -5
  39. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/foundry/__init__.py +4 -0
  40. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/foundry/__init__.pyi +8 -0
  41. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/gemini/__init__.py +3 -1
  42. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/gemini/__init__.pyi +6 -2
  43. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/security.py +151 -71
  44. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/pyproject.toml +32 -31
  45. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/LICENSE +0 -0
  46. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/README.md +0 -0
  47. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_clients.py +0 -0
  48. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_docstrings.py +0 -0
  49. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_filesystem.py +0 -0
  50. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/__init__.py +0 -0
  51. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_background_agents.py +0 -0
  52. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_file_memory.py +0 -0
  53. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_memory.py +0 -0
  54. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_todo.py +0 -0
  55. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_serialization.py +0 -0
  56. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/__init__.py +0 -0
  57. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_agent_utils.py +0 -0
  58. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_conversation_history.py +0 -0
  59. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_events.py +0 -0
  60. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_executor.py +0 -0
  61. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_function_executor.py +0 -0
  62. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_message_utils.py +0 -0
  63. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_model_utils.py +0 -0
  64. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_request_info_mixin.py +0 -0
  65. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_runner.py +0 -0
  66. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_runner_context.py +0 -0
  67. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_validation.py +0 -0
  68. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_viz.py +0 -0
  69. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_workflow_builder.py +0 -0
  70. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_workflow_context.py +0 -0
  71. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/a2a/__init__.py +0 -0
  72. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/a2a/__init__.pyi +0 -0
  73. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/ag_ui/__init__.py +0 -0
  74. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/ag_ui/__init__.pyi +0 -0
  75. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/amazon/__init__.py +0 -0
  76. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/amazon/__init__.pyi +0 -0
  77. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/anthropic/__init__.py +0 -0
  78. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/anthropic/__init__.pyi +0 -0
  79. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/azure/__init__.py +0 -0
  80. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/azure/__init__.pyi +0 -0
  81. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/chatkit/__init__.py +0 -0
  82. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/chatkit/__init__.pyi +0 -0
  83. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/declarative/__init__.py +0 -0
  84. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/declarative/__init__.pyi +0 -0
  85. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/devui/__init__.py +0 -0
  86. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/devui/__init__.pyi +0 -0
  87. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/github/__init__.py +0 -0
  88. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/github/__init__.pyi +0 -0
  89. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/google/__init__.py +0 -0
  90. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/google/__init__.pyi +0 -0
  91. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/hyperlight/__init__.py +0 -0
  92. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/lab/__init__.py +0 -0
  93. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/mem0/__init__.py +0 -0
  94. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/mem0/__init__.pyi +0 -0
  95. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/microsoft/__init__.py +0 -0
  96. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/microsoft/__init__.pyi +0 -0
  97. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/mistral/__init__.py +0 -0
  98. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/mistral/__init__.pyi +0 -0
  99. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/monty/__init__.py +0 -0
  100. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/monty/__init__.pyi +0 -0
  101. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/observability.py +0 -0
  102. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/ollama/__init__.py +0 -0
  103. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/ollama/__init__.pyi +0 -0
  104. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/openai/__init__.py +0 -0
  105. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/openai/__init__.pyi +0 -0
  106. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/orchestrations/__init__.py +0 -0
  107. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/orchestrations/__init__.pyi +0 -0
  108. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/py.typed +0 -0
  109. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/redis/__init__.py +0 -0
  110. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/redis/__init__.pyi +0 -0
  111. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/tools/__init__.py +0 -0
  112. {agent_framework_core-1.19.0 → agent_framework_core-1.20.0}/agent_framework/tools/__init__.pyi +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-framework-core
3
- Version: 1.19.0
3
+ Version: 1.20.0
4
4
  Summary: Microsoft Agent Framework for building AI Agents with Python. This is the core package that has all the core abstractions and implementations.
5
5
  Author-email: Microsoft <af-support@microsoft.com>
6
6
  Requires-Python: >=3.10
@@ -16,42 +16,43 @@ Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Programming Language :: Python :: 3.14
17
17
  Classifier: Typing :: Typed
18
18
  License-File: LICENSE
19
- Requires-Dist: msgspec>=0.20.0,<0.22
19
+ Requires-Dist: msgspec>=0.20.0,<0.23
20
20
  Requires-Dist: typing-extensions>=4.15.0,<5
21
21
  Requires-Dist: pydantic>=2,<3
22
22
  Requires-Dist: python-dotenv>=1,<2
23
23
  Requires-Dist: opentelemetry-api>=1.39.0,<2
24
24
  Requires-Dist: pyyaml>=6.0,<7.0
25
+ Requires-Dist: regex>=2024.11.6
25
26
  Requires-Dist: mcp>=1.24.0,<2 ; extra == "all"
26
- Requires-Dist: agent-framework-a2a ; extra == "all"
27
- Requires-Dist: agent-framework-ag-ui ; extra == "all"
28
- Requires-Dist: agent-framework-anthropic ; extra == "all"
29
- Requires-Dist: agent-framework-azure-ai-search ; extra == "all"
30
- Requires-Dist: agent-framework-azure-contentunderstanding ; extra == "all"
31
- Requires-Dist: agent-framework-azure-cosmos ; extra == "all"
32
- Requires-Dist: agent-framework-azurefunctions ; extra == "all"
33
- Requires-Dist: agent-framework-bedrock ; extra == "all"
34
- Requires-Dist: agent-framework-chatkit ; extra == "all"
35
- Requires-Dist: agent-framework-claude ; extra == "all"
36
- Requires-Dist: agent-framework-copilotstudio ; extra == "all"
37
- Requires-Dist: agent-framework-declarative ; extra == "all"
38
- Requires-Dist: agent-framework-devui ; extra == "all"
39
- Requires-Dist: agent-framework-durabletask ; extra == "all"
40
- Requires-Dist: agent-framework-foundry ; extra == "all"
41
- Requires-Dist: agent-framework-foundry-hosting ; extra == "all"
42
- Requires-Dist: agent-framework-foundry-local ; extra == "all"
43
- Requires-Dist: agent-framework-gemini ; extra == "all"
44
- Requires-Dist: agent-framework-github-copilot ; extra == "all" and ( python_version >= '3.11')
45
- Requires-Dist: agent-framework-hyperlight ; extra == "all" and ( python_version < '3.15' and ((sys_platform == 'linux' and platform_machine == 'x86_64') or (sys_platform == 'win32' and platform_machine == 'AMD64')))
46
- Requires-Dist: agent-framework-mem0 ; extra == "all"
47
- Requires-Dist: agent-framework-mistral ; extra == "all"
48
- Requires-Dist: agent-framework-monty ; extra == "all"
49
- Requires-Dist: agent-framework-ollama ; extra == "all"
50
- Requires-Dist: agent-framework-openai ; extra == "all"
51
- Requires-Dist: agent-framework-orchestrations ; extra == "all"
52
- Requires-Dist: agent-framework-purview ; extra == "all"
53
- Requires-Dist: agent-framework-redis ; extra == "all"
54
- Requires-Dist: agent-framework-tools ; extra == "all"
27
+ Requires-Dist: agent-framework-a2a>=1.0.0b261002,<2 ; extra == "all"
28
+ Requires-Dist: agent-framework-ag-ui>=1.5.0,<2 ; extra == "all"
29
+ Requires-Dist: agent-framework-anthropic>=1.0.0b261002,<2 ; extra == "all"
30
+ Requires-Dist: agent-framework-azure-ai-search>=1.0.0b261002,<2 ; extra == "all"
31
+ Requires-Dist: agent-framework-azure-contentunderstanding>=1.0.0b261002,<2 ; extra == "all"
32
+ Requires-Dist: agent-framework-azure-cosmos>=1.0.0b261002,<2 ; extra == "all"
33
+ Requires-Dist: agent-framework-azurefunctions>=1.0.0b260922,<2 ; extra == "all"
34
+ Requires-Dist: agent-framework-bedrock>=1.0.0b261002,<2 ; extra == "all"
35
+ Requires-Dist: agent-framework-chatkit>=1.0.0b261002,<2 ; extra == "all"
36
+ Requires-Dist: agent-framework-claude>=1.0.0b261002,<2 ; extra == "all"
37
+ Requires-Dist: agent-framework-copilotstudio>=1.0.0b261002,<2 ; extra == "all"
38
+ Requires-Dist: agent-framework-declarative>=1.2.0,<2 ; extra == "all"
39
+ Requires-Dist: agent-framework-devui>=1.0.0b261002,<2 ; extra == "all"
40
+ Requires-Dist: agent-framework-durabletask>=1.0.0b260922,<2 ; extra == "all"
41
+ Requires-Dist: agent-framework-foundry>=1.14.0,<2 ; extra == "all"
42
+ Requires-Dist: agent-framework-foundry-hosting>=1.0.0b261002,<2 ; extra == "all"
43
+ Requires-Dist: agent-framework-foundry-local>=1.0.0b260730,<2 ; extra == "all"
44
+ Requires-Dist: agent-framework-gemini>=1.0.0b261002,<2 ; extra == "all"
45
+ Requires-Dist: agent-framework-github-copilot>=2.0.1,<3 ; extra == "all" and ( python_version >= '3.11')
46
+ Requires-Dist: agent-framework-hyperlight>=1.0.0b261002,<2 ; extra == "all" and ( python_version < '3.15' and ((sys_platform == 'linux' and platform_machine == 'x86_64') or (sys_platform == 'win32' and platform_machine == 'AMD64')))
47
+ Requires-Dist: agent-framework-mem0>=1.0.0b261002,<2 ; extra == "all"
48
+ Requires-Dist: agent-framework-mistral>=1.0.0b260918,<2 ; extra == "all"
49
+ Requires-Dist: agent-framework-monty>=1.0.0b261002,<2 ; extra == "all"
50
+ Requires-Dist: agent-framework-ollama>=1.0.0b261002,<2 ; extra == "all"
51
+ Requires-Dist: agent-framework-openai>=1.15.0,<2 ; extra == "all"
52
+ Requires-Dist: agent-framework-orchestrations>=1.3.0,<2 ; extra == "all"
53
+ Requires-Dist: agent-framework-purview>=1.0.0b261002,<2 ; extra == "all"
54
+ Requires-Dist: agent-framework-redis>=1.0.0b261002,<2 ; extra == "all" and ( python_version < '3.15')
55
+ Requires-Dist: agent-framework-tools>=1.0.0b261002,<2 ; extra == "all"
55
56
  Project-URL: homepage, https://aka.ms/agent-framework
56
57
  Project-URL: issues, https://github.com/microsoft/agent-framework/issues
57
58
  Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
@@ -254,6 +254,7 @@ _LAZY_MODULE_EXPORTS: Final[Mapping[str, tuple[str, ...]]] = {
254
254
  "ChatOptions",
255
255
  "ChatResponse",
256
256
  "ChatResponseUpdate",
257
+ "ComputerSafetyCheck",
257
258
  "Content",
258
259
  "ContinuationToken",
259
260
  "Embedding",
@@ -322,7 +323,12 @@ _LAZY_MODULE_EXPORTS: Final[Mapping[str, tuple[str, ...]]] = {
322
323
  "vectorstoremodel",
323
324
  ),
324
325
  "._workflows._agent": ("WorkflowAgent",),
325
- "._workflows._agent_executor": ("AgentExecutor", "AgentExecutorRequest", "AgentExecutorResponse"),
326
+ "._workflows._agent_executor": (
327
+ "AgentExecutor",
328
+ "AgentExecutorCheckpointState",
329
+ "AgentExecutorRequest",
330
+ "AgentExecutorResponse",
331
+ ),
326
332
  "._workflows._agent_utils": ("resolve_agent_id",),
327
333
  "._workflows._checkpoint": (
328
334
  "CheckpointID",
@@ -429,6 +435,7 @@ __all__ = [
429
435
  "AgentContext",
430
436
  "AgentEvalConverter",
431
437
  "AgentExecutor",
438
+ "AgentExecutorCheckpointState",
432
439
  "AgentExecutorRequest",
433
440
  "AgentExecutorResponse",
434
441
  "AgentFileStore",
@@ -470,6 +477,7 @@ __all__ = [
470
477
  "ClassSkill",
471
478
  "CompactionProvider",
472
479
  "CompactionStrategy",
480
+ "ComputerSafetyCheck",
473
481
  "Content",
474
482
  "ContextProvider",
475
483
  "ContextWindowCompactionStrategy",
@@ -220,6 +220,7 @@ from ._types import (
220
220
  ChatOptions,
221
221
  ChatResponse,
222
222
  ChatResponseUpdate,
223
+ ComputerSafetyCheck,
223
224
  Content,
224
225
  ContinuationToken,
225
226
  Embedding,
@@ -278,7 +279,12 @@ from ._vectors import (
278
279
  vectorstoremodel,
279
280
  )
280
281
  from ._workflows._agent import WorkflowAgent
281
- from ._workflows._agent_executor import AgentExecutor, AgentExecutorRequest, AgentExecutorResponse
282
+ from ._workflows._agent_executor import (
283
+ AgentExecutor,
284
+ AgentExecutorCheckpointState,
285
+ AgentExecutorRequest,
286
+ AgentExecutorResponse,
287
+ )
282
288
  from ._workflows._agent_utils import resolve_agent_id
283
289
  from ._workflows._checkpoint import (
284
290
  CheckpointID,
@@ -384,6 +390,7 @@ __all__ = [
384
390
  "AgentContext",
385
391
  "AgentEvalConverter",
386
392
  "AgentExecutor",
393
+ "AgentExecutorCheckpointState",
387
394
  "AgentExecutorRequest",
388
395
  "AgentExecutorResponse",
389
396
  "AgentFileStore",
@@ -425,6 +432,7 @@ __all__ = [
425
432
  "ClassSkill",
426
433
  "CompactionProvider",
427
434
  "CompactionStrategy",
435
+ "ComputerSafetyCheck",
428
436
  "Content",
429
437
  "ContextProvider",
430
438
  "ContextWindowCompactionStrategy",
@@ -69,9 +69,8 @@ Enforcement semantics (``mode="enforce"``):
69
69
  outside the tool seam falls back to deferring both — fail-closed, matching the
70
70
  pre-ownership behavior.
71
71
 
72
- Streaming is supported **fail-closed by buffering** via
73
- :meth:`ResponseStream.buffered_and_gated`: the model/agent stream is fully consumed
74
- internally, middleware stream hooks are applied to the buffered content, the
72
+ Streaming is supported **fail-closed by buffering**: the model/agent stream is fully
73
+ consumed internally, middleware stream hooks are applied to the buffered content, the
75
74
  ``post_model_call`` / ``output`` verdict is applied to the finalized result, and only
76
75
  then are the (possibly transformed) updates released to the consumer. No partial content
77
76
  ever egresses ahead of a verdict (spec §12.1/§12.1a ``buffered_output: true``
@@ -103,7 +102,7 @@ import contextlib
103
102
  import json
104
103
  import logging
105
104
  import uuid
106
- from collections.abc import Awaitable, Callable, Mapping, Sequence
105
+ from collections.abc import AsyncGenerator, Awaitable, Callable, Mapping, Sequence
107
106
  from contextvars import ContextVar
108
107
  from dataclasses import dataclass
109
108
  from typing import TYPE_CHECKING, Any, NoReturn, cast
@@ -1231,7 +1230,10 @@ class _AgentHooksAgentMiddleware(_AgentHooksMiddlewareBase, AgentMiddleware):
1231
1230
  f"got {type(inner).__name__}."
1232
1231
  )
1233
1232
  context.result = self._gated_agent_stream(
1234
- state, cast("ResponseStream[AgentResponseUpdate, AgentResponse[Any]]", inner), gate_handle
1233
+ context,
1234
+ state,
1235
+ cast("ResponseStream[AgentResponseUpdate, AgentResponse[Any]]", inner),
1236
+ gate_handle,
1235
1237
  )
1236
1238
  # The gated stream now owns the shutdown emission.
1237
1239
  shutdown_reason = None
@@ -1255,6 +1257,7 @@ class _AgentHooksAgentMiddleware(_AgentHooksMiddlewareBase, AgentMiddleware):
1255
1257
 
1256
1258
  def _gated_agent_stream(
1257
1259
  self,
1260
+ context: AgentContext,
1258
1261
  state: _RunState,
1259
1262
  inner: ResponseStream[AgentResponseUpdate, AgentResponse[Any]],
1260
1263
  gate_handle: _RunPersistenceGate,
@@ -1262,18 +1265,19 @@ class _AgentHooksAgentMiddleware(_AgentHooksMiddlewareBase, AgentMiddleware):
1262
1265
  """Guard a streaming run with a fail-closed buffered gate.
1263
1266
 
1264
1267
  The run is fully consumed (with the run state and the persistence gate active),
1265
- middleware stream hooks are applied by the combinator before the verdict, the
1268
+ middleware stream hooks are applied by the buffered enforcement helper before the verdict, the
1266
1269
  ``output`` verdict is applied to the finalized response, and deferred
1267
- persistence is released only after the verdict permits. The combinator owns the
1270
+ persistence is released only after the verdict permits. The helper owns the
1268
1271
  no-divergence rule: a transformed output (or any applied stream hooks)
1269
1272
  re-derives the released updates from the verdicted response.
1270
1273
  """
1271
1274
 
1272
- async def _consume() -> tuple[Sequence[AgentResponseUpdate], AgentResponse[Any]]:
1275
+ @contextlib.asynccontextmanager
1276
+ async def _consumption_scope() -> AsyncGenerator[None]:
1273
1277
  run_token = _RUN_STATE.set(state)
1274
1278
  try:
1275
1279
  with gate_handle:
1276
- final = await inner.get_final_response()
1280
+ yield
1277
1281
  except asyncio.CancelledError:
1278
1282
  await self._emit_shutdown(state, "cancelled")
1279
1283
  raise
@@ -1290,40 +1294,32 @@ class _AgentHooksAgentMiddleware(_AgentHooksMiddlewareBase, AgentMiddleware):
1290
1294
  raise
1291
1295
  finally:
1292
1296
  _RUN_STATE.reset(run_token)
1293
- return list(inner.updates), final
1294
1297
 
1295
- async def _gate(
1296
- _updates: list[AgentResponseUpdate], final: AgentResponse[Any]
1297
- ) -> tuple[AgentResponse[Any], bool]:
1298
- from agent_hooks import InterceptionBlocked
1298
+ async def _transform(final: AgentResponse[Any]) -> AgentResponse[Any] | None:
1299
+ if not isinstance(final, AgentResponse):
1300
+ raise MiddlewareException(
1301
+ f"agent-hooks cannot guard a streamed run result of type {type(final).__name__}; "
1302
+ "the output interception point was not emitted."
1303
+ )
1304
+ transformed = await self._emit_output(state, final)
1305
+ return final if transformed else None
1299
1306
 
1300
- try:
1301
- if not isinstance(final, AgentResponse):
1302
- raise MiddlewareException(
1303
- f"agent-hooks cannot guard a streamed run result of type {type(final).__name__}; "
1304
- "the output interception point was not emitted."
1305
- )
1306
- transformed = await self._emit_output(state, final)
1307
- await gate_handle.flush()
1308
- await self._emit_shutdown(state, "completed")
1309
- return final, transformed
1310
- except InterceptionBlocked:
1311
- gate_handle.drop()
1312
- await self._emit_shutdown(state, "error")
1313
- raise
1314
- except asyncio.CancelledError:
1315
- await self._emit_shutdown(state, "cancelled")
1316
- raise
1317
- except BaseException:
1318
- await self._emit_shutdown(state, "error")
1319
- raise
1307
+ async def _release() -> None:
1308
+ await gate_handle.flush()
1309
+ await self._emit_shutdown(state, "completed")
1320
1310
 
1321
- return cast(
1322
- "ResponseStream[AgentResponseUpdate, AgentResponse[Any]]",
1323
- cast(Any, ResponseStream).buffered_and_gated(
1324
- consume=_consume, gate=_gate, rederive=_agent_updates_from_response
1325
- ),
1326
- )
1311
+ async def _release_error(exc: BaseException) -> None:
1312
+ gate_handle.drop()
1313
+ await self._emit_shutdown(state, "cancelled" if isinstance(exc, asyncio.CancelledError) else "error")
1314
+
1315
+ context._stream_terminal_result_transforms.append(_transform) # pyright: ignore[reportPrivateUsage]
1316
+ context._stream_terminal_result_to_updates = _agent_updates_from_response # pyright: ignore[reportPrivateUsage]
1317
+ context._stream_terminal_result_is_authoritative = True # pyright: ignore[reportPrivateUsage]
1318
+ context._stream_release_hooks.append(_release) # pyright: ignore[reportPrivateUsage]
1319
+ context._stream_release_error_hooks.append(_release_error) # pyright: ignore[reportPrivateUsage]
1320
+ context.stream_buffer_updates = True
1321
+ context.stream_consumption_context_manager_factories.append(_consumption_scope)
1322
+ return inner
1327
1323
 
1328
1324
 
1329
1325
  class _AgentHooksChatMiddleware(_AgentHooksMiddlewareBase, ChatMiddleware):
@@ -1367,7 +1363,11 @@ class _AgentHooksChatMiddleware(_AgentHooksMiddlewareBase, ChatMiddleware):
1367
1363
  result = context.result
1368
1364
  if isinstance(result, ResponseStream):
1369
1365
  context.result = self._gated_chat_stream(
1370
- state, model_id, cast("ResponseStream[ChatResponseUpdate, ChatResponse[Any]]", result), gate
1366
+ context,
1367
+ state,
1368
+ model_id,
1369
+ cast("ResponseStream[ChatResponseUpdate, ChatResponse[Any]]", result),
1370
+ gate,
1371
1371
  )
1372
1372
  elif isinstance(result, ChatResponse):
1373
1373
  try:
@@ -1406,6 +1406,7 @@ class _AgentHooksChatMiddleware(_AgentHooksMiddlewareBase, ChatMiddleware):
1406
1406
 
1407
1407
  def _gated_chat_stream(
1408
1408
  self,
1409
+ context: ChatContext,
1409
1410
  state: _RunState,
1410
1411
  model_id: str,
1411
1412
  inner: ResponseStream[ChatResponseUpdate, ChatResponse[Any]],
@@ -1417,39 +1418,38 @@ class _AgentHooksChatMiddleware(_AgentHooksMiddlewareBase, ChatMiddleware):
1417
1418
  emitted, and nothing (updates or tool calls) is released beforehand. A deny
1418
1419
  raises before any update egresses, and per-service-call history persistence
1419
1420
  deferred by the run persistence gate is released only after the verdict
1420
- permits. The combinator owns the no-divergence rule: a transformed response
1421
+ permits. The buffered enforcement helper owns the no-divergence rule: a transformed response
1421
1422
  (or any applied stream hooks) re-derives the released updates from it.
1422
1423
  """
1423
1424
 
1424
- async def _consume() -> tuple[Sequence[ChatResponseUpdate], ChatResponse[Any]]:
1425
+ @contextlib.asynccontextmanager
1426
+ async def _consumption_scope() -> AsyncGenerator[None]:
1425
1427
  with gate_handle:
1426
- response = await inner.get_final_response()
1427
- return list(inner.updates), response
1428
-
1429
- async def _gate(_updates: list[ChatResponseUpdate], final: ChatResponse[Any]) -> tuple[ChatResponse[Any], bool]:
1430
- from agent_hooks import InterceptionBlocked
1428
+ yield
1431
1429
 
1430
+ async def _transform(final: ChatResponse[Any]) -> ChatResponse[Any] | None:
1432
1431
  if not isinstance(final, ChatResponse):
1433
1432
  raise MiddlewareException(
1434
1433
  f"agent-hooks cannot guard a streamed chat result of type {type(final).__name__}; "
1435
1434
  "the post_model_call interception point was not emitted."
1436
1435
  )
1437
- try:
1438
- changed = await self._emit_post_model_call(state, model_id, final)
1439
- except InterceptionBlocked:
1440
- # §6.1: the deferred per-service-call persistence for the denied
1441
- # response is dropped, never executed.
1442
- gate_handle.drop()
1443
- raise
1436
+ changed = await self._emit_post_model_call(state, model_id, final)
1437
+ return final if changed else None
1438
+
1439
+ async def _release() -> None:
1444
1440
  await gate_handle.flush()
1445
- return final, changed
1446
1441
 
1447
- return cast(
1448
- "ResponseStream[ChatResponseUpdate, ChatResponse[Any]]",
1449
- cast(Any, ResponseStream).buffered_and_gated(
1450
- consume=_consume, gate=_gate, rederive=_chat_updates_from_response
1451
- ),
1452
- )
1442
+ def _release_error(_: BaseException) -> None:
1443
+ gate_handle.drop()
1444
+
1445
+ context._stream_terminal_result_transforms.append(_transform) # pyright: ignore[reportPrivateUsage]
1446
+ context._stream_terminal_result_to_updates = _chat_updates_from_response # pyright: ignore[reportPrivateUsage]
1447
+ context._stream_terminal_result_is_authoritative = True # pyright: ignore[reportPrivateUsage]
1448
+ context._stream_release_hooks.append(_release) # pyright: ignore[reportPrivateUsage]
1449
+ context._stream_release_error_hooks.append(_release_error) # pyright: ignore[reportPrivateUsage]
1450
+ context.stream_buffer_updates = True
1451
+ context.stream_consumption_context_manager_factories.append(_consumption_scope)
1452
+ return inner
1453
1453
 
1454
1454
 
1455
1455
  class _AgentHooksFunctionMiddleware(_AgentHooksMiddlewareBase, FunctionMiddleware):