agent-framework-github-copilot 2.0.1__tar.gz → 2.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-framework-github-copilot
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: GitHub Copilot integration for Microsoft Agent Framework.
5
5
  Author-email: Microsoft <af-support@microsoft.com>
6
6
  Requires-Python: >=3.11
@@ -15,8 +15,8 @@ Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.14
16
16
  Classifier: Typing :: Typed
17
17
  License-File: LICENSE
18
- Requires-Dist: agent-framework-core>=1.15.0,<2
19
- Requires-Dist: github-copilot-sdk==1.0.11; python_version >= '3.11'
18
+ Requires-Dist: agent-framework-core>=1.21.0,<2
19
+ Requires-Dist: github-copilot-sdk>=1.0.16,<2.0; python_version >= '3.11'
20
20
  Project-URL: homepage, https://aka.ms/agent-framework
21
21
  Project-URL: issues, https://github.com/microsoft/agent-framework/issues
22
22
  Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
@@ -10,7 +10,16 @@ import logging
10
10
  import sys
11
11
  import warnings
12
12
  import weakref
13
- from collections.abc import AsyncGenerator, AsyncIterable, Awaitable, Callable, Mapping, MutableMapping, Sequence
13
+ from collections.abc import (
14
+ AsyncGenerator,
15
+ AsyncIterable,
16
+ Awaitable,
17
+ Callable,
18
+ Collection,
19
+ Mapping,
20
+ MutableMapping,
21
+ Sequence,
22
+ )
14
23
  from pathlib import Path
15
24
  from typing import Any, ClassVar, Generic, Literal, TypedDict, cast, overload
16
25
  from urllib.parse import urlparse
@@ -183,6 +192,17 @@ async def _resolve_function_approval(
183
192
 
184
193
  logger = logging.getLogger("agent_framework.github_copilot")
185
194
 
195
+
196
+ def _provider_service_session_state_keys(agent: object, client: object | None) -> frozenset[str]:
197
+ """Return provider-owned session-state keys declared by the Copilot agent or client."""
198
+ keys: set[str] = set()
199
+ for owner in (agent, client):
200
+ declared = getattr(owner, "service_session_state_keys", ())
201
+ if isinstance(declared, (list, tuple, set, frozenset)):
202
+ keys.update(key for key in cast(Collection[Any], declared) if isinstance(key, str))
203
+ return frozenset(keys)
204
+
205
+
186
206
  # One lock per (CopilotClient, service session ID), shared across agents that share a client.
187
207
  # Entries disappear once no run holds or awaits the lock.
188
208
  _SESSION_RUN_LOCKS: weakref.WeakValueDictionary[tuple[int, str], asyncio.Lock] = weakref.WeakValueDictionary()
@@ -1354,6 +1374,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1354
1374
  List of Copilot SDK tools.
1355
1375
  """
1356
1376
  copilot_tools: list[CopilotTool] = []
1377
+ parent_service_session_state_keys = _provider_service_session_state_keys(self, self._client)
1357
1378
 
1358
1379
  for tool in tools:
1359
1380
  if isinstance(tool, CopilotTool):
@@ -1364,6 +1385,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1364
1385
  tool,
1365
1386
  agent_session=agent_session,
1366
1387
  function_invocation_kwargs=function_invocation_kwargs,
1388
+ parent_service_session_state_keys=parent_service_session_state_keys,
1367
1389
  )
1368
1390
  )
1369
1391
  elif isinstance(tool, MutableMapping):
@@ -1378,6 +1400,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1378
1400
  *,
1379
1401
  agent_session: AgentSession | None = None,
1380
1402
  function_invocation_kwargs: Mapping[str, Any] | None = None,
1403
+ parent_service_session_state_keys: frozenset[str] = frozenset(),
1381
1404
  ) -> CopilotTool:
1382
1405
  """Convert an FunctionTool to a Copilot SDK tool.
1383
1406
 
@@ -1392,6 +1415,14 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1392
1415
  callback is configured instead, approval is enforced inside this handler for
1393
1416
  backward compatibility. (``on_function_approval`` and ``on_pre_tool_use`` are
1394
1417
  mutually exclusive, so only one mechanism is ever active.)
1418
+
1419
+ Args:
1420
+ ai_func: Agent Framework function tool to convert.
1421
+
1422
+ Keyword Args:
1423
+ agent_session: Parent agent session passed to the tool.
1424
+ function_invocation_kwargs: Runtime keyword arguments forwarded to the tool.
1425
+ parent_service_session_state_keys: Provider-owned state declared by the parent agent and client.
1395
1426
  """
1396
1427
  approval_handler = self._function_approval_handler
1397
1428
  enforce = approval_handler is not None and ai_func.approval_mode == "always_require"
@@ -1419,6 +1450,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1419
1450
  arguments=args,
1420
1451
  session=agent_session,
1421
1452
  kwargs=runtime_kwargs,
1453
+ parent_service_session_state_keys=parent_service_session_state_keys,
1422
1454
  )
1423
1455
  if ai_func.input_model:
1424
1456
  args_instance = ai_func.input_model(**args)
@@ -4,7 +4,7 @@ description = "GitHub Copilot integration for Microsoft Agent Framework."
4
4
  authors = [{ name = "Microsoft", email = "af-support@microsoft.com"}]
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
7
- version = "2.0.1"
7
+ version = "2.0.2"
8
8
  license-files = ["LICENSE"]
9
9
  urls.homepage = "https://aka.ms/agent-framework"
10
10
  urls.source = "https://github.com/microsoft/agent-framework/tree/main/python"
@@ -22,8 +22,8 @@ classifiers = [
22
22
  "Typing :: Typed",
23
23
  ]
24
24
  dependencies = [
25
- "agent-framework-core>=1.15.0,<2",
26
- "github-copilot-sdk==1.0.11; python_version >= '3.11'",
25
+ "agent-framework-core>=1.21.0,<2",
26
+ "github-copilot-sdk>=1.0.16,<2.0; python_version >= '3.11'",
27
27
  ]
28
28
 
29
29
  [tool.uv]