agent-framework-github-copilot 2.0.1__tar.gz → 2.1.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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: agent-framework-github-copilot
3
- Version: 2.0.1
3
+ Version: 2.1.0
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
@@ -13,14 +13,16 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
16
17
  Classifier: Typing :: Typed
17
18
  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'
19
+ Requires-Dist: agent-framework-core>=1.22.0,<2
20
+ Requires-Dist: github-copilot-sdk>=1.0.16,<2.0; python_version >= '3.11'
20
21
  Project-URL: homepage, https://aka.ms/agent-framework
21
22
  Project-URL: issues, https://github.com/microsoft/agent-framework/issues
22
23
  Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
23
24
  Project-URL: source, https://github.com/microsoft/agent-framework/tree/main/python
25
+ Import-Name: agent_framework_github_copilot
24
26
 
25
27
  # Get Started with Microsoft Agent Framework GitHub Copilot
26
28
 
@@ -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()
@@ -1127,7 +1147,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1127
1147
  if data.delta_content:
1128
1148
  update = AgentResponseUpdate(
1129
1149
  role="assistant",
1130
- contents=[Content.from_text(data.delta_content)],
1150
+ contents=[Content.from_text(data.delta_content, merge_mode="append")],
1131
1151
  response_id=data.message_id,
1132
1152
  message_id=data.message_id,
1133
1153
  raw_representation=event,
@@ -1145,7 +1165,13 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1145
1165
  model = event.data.model or None
1146
1166
  if usage_details or finish_reason or model:
1147
1167
  update = AgentResponseUpdate(
1148
- contents=[Content.from_usage(usage_details, raw_representation=event.data)]
1168
+ contents=[
1169
+ Content.from_usage(
1170
+ usage_details,
1171
+ merge_mode="replace",
1172
+ raw_representation=event.data,
1173
+ )
1174
+ ]
1149
1175
  if usage_details
1150
1176
  else None,
1151
1177
  finish_reason=cast(Any, finish_reason),
@@ -1161,6 +1187,8 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1161
1187
  call_id=tool_call_id,
1162
1188
  name=tool_name,
1163
1189
  arguments=arguments,
1190
+ hosted=True,
1191
+ merge_mode="replace",
1164
1192
  raw_representation=event.data,
1165
1193
  )
1166
1194
  update = AgentResponseUpdate(
@@ -1354,6 +1382,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1354
1382
  List of Copilot SDK tools.
1355
1383
  """
1356
1384
  copilot_tools: list[CopilotTool] = []
1385
+ parent_service_session_state_keys = _provider_service_session_state_keys(self, self._client)
1357
1386
 
1358
1387
  for tool in tools:
1359
1388
  if isinstance(tool, CopilotTool):
@@ -1364,6 +1393,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1364
1393
  tool,
1365
1394
  agent_session=agent_session,
1366
1395
  function_invocation_kwargs=function_invocation_kwargs,
1396
+ parent_service_session_state_keys=parent_service_session_state_keys,
1367
1397
  )
1368
1398
  )
1369
1399
  elif isinstance(tool, MutableMapping):
@@ -1378,6 +1408,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1378
1408
  *,
1379
1409
  agent_session: AgentSession | None = None,
1380
1410
  function_invocation_kwargs: Mapping[str, Any] | None = None,
1411
+ parent_service_session_state_keys: frozenset[str] = frozenset(),
1381
1412
  ) -> CopilotTool:
1382
1413
  """Convert an FunctionTool to a Copilot SDK tool.
1383
1414
 
@@ -1392,6 +1423,14 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1392
1423
  callback is configured instead, approval is enforced inside this handler for
1393
1424
  backward compatibility. (``on_function_approval`` and ``on_pre_tool_use`` are
1394
1425
  mutually exclusive, so only one mechanism is ever active.)
1426
+
1427
+ Args:
1428
+ ai_func: Agent Framework function tool to convert.
1429
+
1430
+ Keyword Args:
1431
+ agent_session: Parent agent session passed to the tool.
1432
+ function_invocation_kwargs: Runtime keyword arguments forwarded to the tool.
1433
+ parent_service_session_state_keys: Provider-owned state declared by the parent agent and client.
1395
1434
  """
1396
1435
  approval_handler = self._function_approval_handler
1397
1436
  enforce = approval_handler is not None and ai_func.approval_mode == "always_require"
@@ -1419,6 +1458,7 @@ class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
1419
1458
  arguments=args,
1420
1459
  session=agent_session,
1421
1460
  kwargs=runtime_kwargs,
1461
+ parent_service_session_state_keys=parent_service_session_state_keys,
1422
1462
  )
1423
1463
  if ai_func.input_model:
1424
1464
  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.1.0"
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"
@@ -19,11 +19,12 @@ classifiers = [
19
19
  "Programming Language :: Python :: 3.12",
20
20
  "Programming Language :: Python :: 3.13",
21
21
  "Programming Language :: Python :: 3.14",
22
+ "Programming Language :: Python :: 3.15",
22
23
  "Typing :: Typed",
23
24
  ]
24
25
  dependencies = [
25
- "agent-framework-core>=1.15.0,<2",
26
- "github-copilot-sdk==1.0.11; python_version >= '3.11'",
26
+ "agent-framework-core>=1.22.0,<2",
27
+ "github-copilot-sdk>=1.0.16,<2.0; python_version >= '3.11'",
27
28
  ]
28
29
 
29
30
  [tool.uv]
@@ -99,5 +100,5 @@ shell = "python -c \"import sys; exit(0 if sys.version_info < (3,11) else 1)\" |
99
100
  interpreter = "posix"
100
101
 
101
102
  [build-system]
102
- requires = ["flit-core >= 3.11,<4.0"]
103
+ requires = ["flit-core>=3.11,<5.0"]
103
104
  build-backend = "flit_core.buildapi"