agent-framework-core 1.18.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.
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/PKG-INFO +48 -31
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/README.md +15 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/__init__.py +21 -1
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/__init__.pyi +21 -1
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_agent_hooks.py +62 -62
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_agents.py +233 -71
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_compaction.py +416 -54
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_evaluation.py +16 -10
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_feature_stage.py +1 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_agent.py +8 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_agent.pyi +1 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_file_access.py +316 -81
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_loop.py +52 -26
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_mode.py +84 -20
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_tool_approval.py +114 -43
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_in_memory.py +10 -103
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_mcp.py +623 -79
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_middleware.py +332 -22
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_sessions.py +184 -53
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_settings.py +47 -15
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_skills.py +639 -259
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_telemetry.py +13 -1
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_tools.py +1797 -280
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_types.py +873 -269
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_vector_filters.py +30 -1
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_vectors.py +1415 -21
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_agent.py +42 -7
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_agent_executor.py +472 -85
- agent_framework_core-1.20.0/agent_framework/_workflows/_agent_utils.py +153 -0
- agent_framework_core-1.20.0/agent_framework/_workflows/_checkpoint.py +873 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_checkpoint_encoding.py +31 -14
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_const.py +12 -2
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_edge.py +6 -5
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_edge_runner.py +26 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_executor.py +8 -9
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_function_executor.py +7 -9
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_functional.py +778 -102
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_request_info_mixin.py +46 -7
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_runner.py +15 -16
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_state.py +11 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_typing_utils.py +29 -3
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_workflow.py +328 -78
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_workflow_executor.py +134 -27
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/azure/__init__.py +3 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/azure/__init__.pyi +4 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/exceptions.py +11 -5
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/foundry/__init__.py +4 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/foundry/__init__.pyi +8 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/gemini/__init__.py +3 -1
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/gemini/__init__.pyi +6 -2
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/observability.py +115 -42
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/security.py +638 -185
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/pyproject.toml +34 -31
- agent_framework_core-1.18.0/agent_framework/_workflows/_agent_utils.py +0 -17
- agent_framework_core-1.18.0/agent_framework/_workflows/_checkpoint.py +0 -463
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/LICENSE +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_clients.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_docstrings.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_filesystem.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_background_agents.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_file_memory.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_memory.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_harness/_todo.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_serialization.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_conversation_history.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_events.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_message_utils.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_model_utils.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_runner_context.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_validation.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_viz.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_workflow_builder.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/_workflows/_workflow_context.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/a2a/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/a2a/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/ag_ui/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/ag_ui/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/amazon/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/amazon/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/anthropic/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/anthropic/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/chatkit/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/chatkit/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/declarative/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/declarative/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/devui/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/devui/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/github/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/github/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/google/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/google/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/hyperlight/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/lab/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/mem0/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/mem0/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/microsoft/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/microsoft/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/mistral/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/mistral/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/monty/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/monty/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/ollama/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/ollama/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/openai/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/openai/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/orchestrations/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/orchestrations/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/py.typed +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/redis/__init__.py +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/redis/__init__.pyi +0 -0
- {agent_framework_core-1.18.0 → agent_framework_core-1.20.0}/agent_framework/tools/__init__.py +0 -0
- {agent_framework_core-1.18.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.
|
|
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,41 +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.
|
|
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
|
+
Requires-Dist: pyyaml>=6.0,<7.0
|
|
25
|
+
Requires-Dist: regex>=2024.11.6
|
|
24
26
|
Requires-Dist: mcp>=1.24.0,<2 ; extra == "all"
|
|
25
|
-
Requires-Dist: agent-framework-a2a ; extra == "all"
|
|
26
|
-
Requires-Dist: agent-framework-ag-ui ; extra == "all"
|
|
27
|
-
Requires-Dist: agent-framework-anthropic ; extra == "all"
|
|
28
|
-
Requires-Dist: agent-framework-azure-ai-search ; extra == "all"
|
|
29
|
-
Requires-Dist: agent-framework-azure-contentunderstanding ; extra == "all"
|
|
30
|
-
Requires-Dist: agent-framework-azure-cosmos ; extra == "all"
|
|
31
|
-
Requires-Dist: agent-framework-azurefunctions ; extra == "all"
|
|
32
|
-
Requires-Dist: agent-framework-bedrock ; extra == "all"
|
|
33
|
-
Requires-Dist: agent-framework-chatkit ; extra == "all"
|
|
34
|
-
Requires-Dist: agent-framework-claude ; extra == "all"
|
|
35
|
-
Requires-Dist: agent-framework-copilotstudio ; extra == "all"
|
|
36
|
-
Requires-Dist: agent-framework-declarative ; extra == "all"
|
|
37
|
-
Requires-Dist: agent-framework-devui ; extra == "all"
|
|
38
|
-
Requires-Dist: agent-framework-durabletask ; extra == "all"
|
|
39
|
-
Requires-Dist: agent-framework-foundry ; extra == "all"
|
|
40
|
-
Requires-Dist: agent-framework-foundry-hosting ; extra == "all"
|
|
41
|
-
Requires-Dist: agent-framework-foundry-local ; extra == "all"
|
|
42
|
-
Requires-Dist: agent-framework-gemini ; extra == "all"
|
|
43
|
-
Requires-Dist: agent-framework-github-copilot ; extra == "all" and ( python_version >= '3.11')
|
|
44
|
-
Requires-Dist: agent-framework-hyperlight ; extra == "all" and ( (sys_platform == 'linux' and platform_machine == 'x86_64') or (sys_platform == 'win32' and platform_machine == 'AMD64'))
|
|
45
|
-
Requires-Dist: agent-framework-mem0 ; extra == "all"
|
|
46
|
-
Requires-Dist: agent-framework-mistral ; extra == "all"
|
|
47
|
-
Requires-Dist: agent-framework-monty ; extra == "all"
|
|
48
|
-
Requires-Dist: agent-framework-ollama ; extra == "all"
|
|
49
|
-
Requires-Dist: agent-framework-openai ; extra == "all"
|
|
50
|
-
Requires-Dist: agent-framework-orchestrations ; extra == "all"
|
|
51
|
-
Requires-Dist: agent-framework-purview ; extra == "all"
|
|
52
|
-
Requires-Dist: agent-framework-redis ; extra == "all"
|
|
53
|
-
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"
|
|
54
56
|
Project-URL: homepage, https://aka.ms/agent-framework
|
|
55
57
|
Project-URL: issues, https://github.com/microsoft/agent-framework/issues
|
|
56
58
|
Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
|
|
@@ -227,6 +229,21 @@ asyncio.run(main())
|
|
|
227
229
|
|
|
228
230
|
You can explore additional agent samples [here](https://github.com/microsoft/agent-framework/tree/main/python/samples/02-agents).
|
|
229
231
|
|
|
232
|
+
### MCP HTTP client ownership and cookies
|
|
233
|
+
|
|
234
|
+
**Breaking change:** HTTP clients created by `MCPStreamableHTTPTool` no longer persist
|
|
235
|
+
response cookies. This applies with or without a `header_provider`, including repeated
|
|
236
|
+
calls within the same MCP session. Connection reuse, timeout and redirect defaults,
|
|
237
|
+
and cleanup on close or reset are preserved. Explicit `Cookie` headers supplied through
|
|
238
|
+
`static_headers` or a `header_provider` are still supported.
|
|
239
|
+
|
|
240
|
+
Applications relying on cookie-based authentication, sessions, or load-balancer affinity
|
|
241
|
+
must supply an `httpx.AsyncClient` through `http_client=`. Supplied clients retain their
|
|
242
|
+
configuration and response-cookie handling and must be closed by the caller. Scope
|
|
243
|
+
cookie-bearing clients and MCP tool sessions to one authenticated principal; do not
|
|
244
|
+
share a user-specific cookie jar across users. Rejecting cookies does not partition
|
|
245
|
+
MCP protocol sessions or other server-side state between principals.
|
|
246
|
+
|
|
230
247
|
## 5. Multi-Agent Orchestration
|
|
231
248
|
|
|
232
249
|
Coordinate multiple agents to collaborate on complex tasks using orchestration patterns:
|
|
@@ -168,6 +168,21 @@ asyncio.run(main())
|
|
|
168
168
|
|
|
169
169
|
You can explore additional agent samples [here](https://github.com/microsoft/agent-framework/tree/main/python/samples/02-agents).
|
|
170
170
|
|
|
171
|
+
### MCP HTTP client ownership and cookies
|
|
172
|
+
|
|
173
|
+
**Breaking change:** HTTP clients created by `MCPStreamableHTTPTool` no longer persist
|
|
174
|
+
response cookies. This applies with or without a `header_provider`, including repeated
|
|
175
|
+
calls within the same MCP session. Connection reuse, timeout and redirect defaults,
|
|
176
|
+
and cleanup on close or reset are preserved. Explicit `Cookie` headers supplied through
|
|
177
|
+
`static_headers` or a `header_provider` are still supported.
|
|
178
|
+
|
|
179
|
+
Applications relying on cookie-based authentication, sessions, or load-balancer affinity
|
|
180
|
+
must supply an `httpx.AsyncClient` through `http_client=`. Supplied clients retain their
|
|
181
|
+
configuration and response-cookie handling and must be closed by the caller. Scope
|
|
182
|
+
cookie-bearing clients and MCP tool sessions to one authenticated principal; do not
|
|
183
|
+
share a user-specific cookie jar across users. Rejecting cookies does not partition
|
|
184
|
+
MCP protocol sessions or other server-side state between principals.
|
|
185
|
+
|
|
171
186
|
## 5. Multi-Agent Orchestration
|
|
172
187
|
|
|
173
188
|
Coordinate multiple agents to collaborate on complex tasks using orchestration patterns:
|
|
@@ -33,6 +33,7 @@ from ._telemetry import (
|
|
|
33
33
|
from .exceptions import (
|
|
34
34
|
AgentFrameworkException,
|
|
35
35
|
MiddlewareException,
|
|
36
|
+
ResponseInvalidatedException,
|
|
36
37
|
UserInputRequiredException,
|
|
37
38
|
WorkflowCheckpointException,
|
|
38
39
|
WorkflowConvergenceException,
|
|
@@ -253,6 +254,7 @@ _LAZY_MODULE_EXPORTS: Final[Mapping[str, tuple[str, ...]]] = {
|
|
|
253
254
|
"ChatOptions",
|
|
254
255
|
"ChatResponse",
|
|
255
256
|
"ChatResponseUpdate",
|
|
257
|
+
"ComputerSafetyCheck",
|
|
256
258
|
"Content",
|
|
257
259
|
"ContinuationToken",
|
|
258
260
|
"Embedding",
|
|
@@ -309,14 +311,24 @@ _LAZY_MODULE_EXPORTS: Final[Mapping[str, tuple[str, ...]]] = {
|
|
|
309
311
|
"SearchType",
|
|
310
312
|
"SupportsVectorSearch",
|
|
311
313
|
"SupportsVectorUpsert",
|
|
314
|
+
"VectorCollectionContextProvider",
|
|
312
315
|
"VectorStoreCollectionDefinition",
|
|
313
316
|
"VectorStoreField",
|
|
317
|
+
"VectorStoreHistoryProvider",
|
|
318
|
+
"create_delete_tool",
|
|
319
|
+
"create_get_tool",
|
|
320
|
+
"create_upsert_tool",
|
|
314
321
|
"create_vector_search_tool",
|
|
315
322
|
"register_vectorstoremodel",
|
|
316
323
|
"vectorstoremodel",
|
|
317
324
|
),
|
|
318
325
|
"._workflows._agent": ("WorkflowAgent",),
|
|
319
|
-
"._workflows._agent_executor": (
|
|
326
|
+
"._workflows._agent_executor": (
|
|
327
|
+
"AgentExecutor",
|
|
328
|
+
"AgentExecutorCheckpointState",
|
|
329
|
+
"AgentExecutorRequest",
|
|
330
|
+
"AgentExecutorResponse",
|
|
331
|
+
),
|
|
320
332
|
"._workflows._agent_utils": ("resolve_agent_id",),
|
|
321
333
|
"._workflows._checkpoint": (
|
|
322
334
|
"CheckpointID",
|
|
@@ -423,6 +435,7 @@ __all__ = [
|
|
|
423
435
|
"AgentContext",
|
|
424
436
|
"AgentEvalConverter",
|
|
425
437
|
"AgentExecutor",
|
|
438
|
+
"AgentExecutorCheckpointState",
|
|
426
439
|
"AgentExecutorRequest",
|
|
427
440
|
"AgentExecutorResponse",
|
|
428
441
|
"AgentFileStore",
|
|
@@ -464,6 +477,7 @@ __all__ = [
|
|
|
464
477
|
"ClassSkill",
|
|
465
478
|
"CompactionProvider",
|
|
466
479
|
"CompactionStrategy",
|
|
480
|
+
"ComputerSafetyCheck",
|
|
467
481
|
"Content",
|
|
468
482
|
"ContextProvider",
|
|
469
483
|
"ContextWindowCompactionStrategy",
|
|
@@ -565,6 +579,7 @@ __all__ = [
|
|
|
565
579
|
"Param",
|
|
566
580
|
"RawAgent",
|
|
567
581
|
"ReleaseCandidateFeature",
|
|
582
|
+
"ResponseInvalidatedException",
|
|
568
583
|
"ResponseStream",
|
|
569
584
|
"Role",
|
|
570
585
|
"RoleLiteral",
|
|
@@ -631,8 +646,10 @@ __all__ = [
|
|
|
631
646
|
"UsageDetails",
|
|
632
647
|
"UserInputRequiredException",
|
|
633
648
|
"ValidationTypeEnum",
|
|
649
|
+
"VectorCollectionContextProvider",
|
|
634
650
|
"VectorStoreCollectionDefinition",
|
|
635
651
|
"VectorStoreField",
|
|
652
|
+
"VectorStoreHistoryProvider",
|
|
636
653
|
"Workflow",
|
|
637
654
|
"WorkflowAgent",
|
|
638
655
|
"WorkflowBuilder",
|
|
@@ -665,8 +682,11 @@ __all__ = [
|
|
|
665
682
|
"create_agent_hooks_middleware_from_emitter",
|
|
666
683
|
"create_always_approve_tool_response",
|
|
667
684
|
"create_always_approve_tool_with_arguments_response",
|
|
685
|
+
"create_delete_tool",
|
|
668
686
|
"create_edge_runner",
|
|
687
|
+
"create_get_tool",
|
|
669
688
|
"create_harness_agent",
|
|
689
|
+
"create_upsert_tool",
|
|
670
690
|
"create_vector_search_tool",
|
|
671
691
|
"detect_media_type_from_base64",
|
|
672
692
|
"enqueue_messages",
|
|
@@ -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,
|
|
@@ -266,14 +267,24 @@ from ._vectors import (
|
|
|
266
267
|
SearchType,
|
|
267
268
|
SupportsVectorSearch,
|
|
268
269
|
SupportsVectorUpsert,
|
|
270
|
+
VectorCollectionContextProvider,
|
|
269
271
|
VectorStoreCollectionDefinition,
|
|
270
272
|
VectorStoreField,
|
|
273
|
+
VectorStoreHistoryProvider,
|
|
274
|
+
create_delete_tool,
|
|
275
|
+
create_get_tool,
|
|
276
|
+
create_upsert_tool,
|
|
271
277
|
create_vector_search_tool,
|
|
272
278
|
register_vectorstoremodel,
|
|
273
279
|
vectorstoremodel,
|
|
274
280
|
)
|
|
275
281
|
from ._workflows._agent import WorkflowAgent
|
|
276
|
-
from ._workflows._agent_executor import
|
|
282
|
+
from ._workflows._agent_executor import (
|
|
283
|
+
AgentExecutor,
|
|
284
|
+
AgentExecutorCheckpointState,
|
|
285
|
+
AgentExecutorRequest,
|
|
286
|
+
AgentExecutorResponse,
|
|
287
|
+
)
|
|
277
288
|
from ._workflows._agent_utils import resolve_agent_id
|
|
278
289
|
from ._workflows._checkpoint import (
|
|
279
290
|
CheckpointID,
|
|
@@ -335,6 +346,7 @@ from ._workflows._workflow_executor import SubWorkflowRequestMessage, SubWorkflo
|
|
|
335
346
|
from .exceptions import (
|
|
336
347
|
AgentFrameworkException,
|
|
337
348
|
MiddlewareException,
|
|
349
|
+
ResponseInvalidatedException,
|
|
338
350
|
UserInputRequiredException,
|
|
339
351
|
WorkflowCheckpointException,
|
|
340
352
|
WorkflowConvergenceException,
|
|
@@ -378,6 +390,7 @@ __all__ = [
|
|
|
378
390
|
"AgentContext",
|
|
379
391
|
"AgentEvalConverter",
|
|
380
392
|
"AgentExecutor",
|
|
393
|
+
"AgentExecutorCheckpointState",
|
|
381
394
|
"AgentExecutorRequest",
|
|
382
395
|
"AgentExecutorResponse",
|
|
383
396
|
"AgentFileStore",
|
|
@@ -419,6 +432,7 @@ __all__ = [
|
|
|
419
432
|
"ClassSkill",
|
|
420
433
|
"CompactionProvider",
|
|
421
434
|
"CompactionStrategy",
|
|
435
|
+
"ComputerSafetyCheck",
|
|
422
436
|
"Content",
|
|
423
437
|
"ContextProvider",
|
|
424
438
|
"ContextWindowCompactionStrategy",
|
|
@@ -520,6 +534,7 @@ __all__ = [
|
|
|
520
534
|
"Param",
|
|
521
535
|
"RawAgent",
|
|
522
536
|
"ReleaseCandidateFeature",
|
|
537
|
+
"ResponseInvalidatedException",
|
|
523
538
|
"ResponseStream",
|
|
524
539
|
"Role",
|
|
525
540
|
"RoleLiteral",
|
|
@@ -586,8 +601,10 @@ __all__ = [
|
|
|
586
601
|
"UsageDetails",
|
|
587
602
|
"UserInputRequiredException",
|
|
588
603
|
"ValidationTypeEnum",
|
|
604
|
+
"VectorCollectionContextProvider",
|
|
589
605
|
"VectorStoreCollectionDefinition",
|
|
590
606
|
"VectorStoreField",
|
|
607
|
+
"VectorStoreHistoryProvider",
|
|
591
608
|
"Workflow",
|
|
592
609
|
"WorkflowAgent",
|
|
593
610
|
"WorkflowBuilder",
|
|
@@ -620,8 +637,11 @@ __all__ = [
|
|
|
620
637
|
"create_agent_hooks_middleware_from_emitter",
|
|
621
638
|
"create_always_approve_tool_response",
|
|
622
639
|
"create_always_approve_tool_with_arguments_response",
|
|
640
|
+
"create_delete_tool",
|
|
623
641
|
"create_edge_runner",
|
|
642
|
+
"create_get_tool",
|
|
624
643
|
"create_harness_agent",
|
|
644
|
+
"create_upsert_tool",
|
|
625
645
|
"create_vector_search_tool",
|
|
626
646
|
"detect_media_type_from_base64",
|
|
627
647
|
"enqueue_messages",
|
|
@@ -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
|
|
73
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
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
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
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
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
1425
|
+
@contextlib.asynccontextmanager
|
|
1426
|
+
async def _consumption_scope() -> AsyncGenerator[None]:
|
|
1425
1427
|
with gate_handle:
|
|
1426
|
-
|
|
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
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
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
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
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):
|