agent-framework-github-copilot 1.0.0b260423__tar.gz → 1.0.0b260428__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_github_copilot-1.0.0b260423 → agent_framework_github_copilot-1.0.0b260428}/PKG-INFO +2 -2
- {agent_framework_github_copilot-1.0.0b260423 → agent_framework_github_copilot-1.0.0b260428}/agent_framework_github_copilot/__init__.py +2 -1
- {agent_framework_github_copilot-1.0.0b260423 → agent_framework_github_copilot-1.0.0b260428}/agent_framework_github_copilot/_agent.py +144 -20
- {agent_framework_github_copilot-1.0.0b260423 → agent_framework_github_copilot-1.0.0b260428}/pyproject.toml +2 -2
- {agent_framework_github_copilot-1.0.0b260423 → agent_framework_github_copilot-1.0.0b260428}/LICENSE +0 -0
- {agent_framework_github_copilot-1.0.0b260423 → agent_framework_github_copilot-1.0.0b260428}/README.md +0 -0
{agent_framework_github_copilot-1.0.0b260423 → agent_framework_github_copilot-1.0.0b260428}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-framework-github-copilot
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0b260428
|
|
4
4
|
Summary: GitHub Copilot integration for Microsoft Agent Framework.
|
|
5
5
|
Author-email: Microsoft <af-support@microsoft.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -16,7 +16,7 @@ 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: agent-framework-core>=1.
|
|
19
|
+
Requires-Dist: agent-framework-core>=1.2.1,<2
|
|
20
20
|
Requires-Dist: github-copilot-sdk>=0.2.1,<=0.2.1; python_version >= '3.11'
|
|
21
21
|
Project-URL: homepage, https://aka.ms/agent-framework
|
|
22
22
|
Project-URL: issues, https://github.com/microsoft/agent-framework/issues
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
|
-
from ._agent import GitHubCopilotAgent, GitHubCopilotOptions, GitHubCopilotSettings
|
|
5
|
+
from ._agent import GitHubCopilotAgent, GitHubCopilotOptions, GitHubCopilotSettings, RawGitHubCopilotAgent
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
8
|
__version__ = importlib.metadata.version(__name__)
|
|
@@ -13,5 +13,6 @@ __all__ = [
|
|
|
13
13
|
"GitHubCopilotAgent",
|
|
14
14
|
"GitHubCopilotOptions",
|
|
15
15
|
"GitHubCopilotSettings",
|
|
16
|
+
"RawGitHubCopilotAgent",
|
|
16
17
|
"__version__",
|
|
17
18
|
]
|
|
@@ -9,7 +9,13 @@ import sys
|
|
|
9
9
|
from collections.abc import AsyncIterable, Awaitable, Callable, MutableMapping, Sequence
|
|
10
10
|
from typing import Any, ClassVar, Generic, Literal, TypedDict, overload
|
|
11
11
|
|
|
12
|
+
if sys.version_info >= (3, 11):
|
|
13
|
+
from typing import Self # pragma: no cover
|
|
14
|
+
else:
|
|
15
|
+
from typing_extensions import Self # pragma: no cover
|
|
16
|
+
|
|
12
17
|
from agent_framework import (
|
|
18
|
+
AgentMiddlewareLayer,
|
|
13
19
|
AgentMiddlewareTypes,
|
|
14
20
|
AgentResponse,
|
|
15
21
|
AgentResponseUpdate,
|
|
@@ -27,6 +33,7 @@ from agent_framework._settings import load_settings
|
|
|
27
33
|
from agent_framework._tools import FunctionTool, ToolTypes
|
|
28
34
|
from agent_framework._types import AgentRunInputs, normalize_tools
|
|
29
35
|
from agent_framework.exceptions import AgentException
|
|
36
|
+
from agent_framework.observability import AgentTelemetryLayer
|
|
30
37
|
|
|
31
38
|
try:
|
|
32
39
|
from copilot import CopilotClient, CopilotSession, SubprocessConfig
|
|
@@ -135,8 +142,11 @@ OptionsT = TypeVar(
|
|
|
135
142
|
)
|
|
136
143
|
|
|
137
144
|
|
|
138
|
-
class
|
|
139
|
-
"""A GitHub Copilot Agent.
|
|
145
|
+
class RawGitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
146
|
+
"""A GitHub Copilot Agent without telemetry layers.
|
|
147
|
+
|
|
148
|
+
This is the core GitHub Copilot agent implementation without OpenTelemetry instrumentation.
|
|
149
|
+
For most use cases, prefer :class:`GitHubCopilotAgent` which includes telemetry support.
|
|
140
150
|
|
|
141
151
|
This agent wraps the GitHub Copilot SDK to provide Copilot agentic capabilities
|
|
142
152
|
within the Agent Framework. It supports both streaming and non-streaming responses,
|
|
@@ -149,7 +159,7 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
149
159
|
|
|
150
160
|
.. code-block:: python
|
|
151
161
|
|
|
152
|
-
async with
|
|
162
|
+
async with RawGitHubCopilotAgent() as agent:
|
|
153
163
|
response = await agent.run("Hello, world!")
|
|
154
164
|
print(response)
|
|
155
165
|
|
|
@@ -157,22 +167,11 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
157
167
|
|
|
158
168
|
.. code-block:: python
|
|
159
169
|
|
|
160
|
-
from agent_framework_github_copilot import
|
|
170
|
+
from agent_framework_github_copilot import RawGitHubCopilotAgent, GitHubCopilotOptions
|
|
161
171
|
|
|
162
|
-
agent:
|
|
172
|
+
agent: RawGitHubCopilotAgent[GitHubCopilotOptions] = RawGitHubCopilotAgent(
|
|
163
173
|
default_options={"model": "claude-sonnet-4", "timeout": 120}
|
|
164
174
|
)
|
|
165
|
-
|
|
166
|
-
With tools:
|
|
167
|
-
|
|
168
|
-
.. code-block:: python
|
|
169
|
-
|
|
170
|
-
def get_weather(city: str) -> str:
|
|
171
|
-
return f"Weather in {city} is sunny"
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
async with GitHubCopilotAgent(tools=[get_weather]) as agent:
|
|
175
|
-
response = await agent.run("What's the weather in Seattle?")
|
|
176
175
|
"""
|
|
177
176
|
|
|
178
177
|
AGENT_PROVIDER_NAME: ClassVar[str] = "github.copilot"
|
|
@@ -200,9 +199,9 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
200
199
|
Keyword Args:
|
|
201
200
|
client: Optional pre-configured CopilotClient instance. If not provided,
|
|
202
201
|
a new client will be created using the other parameters.
|
|
203
|
-
id: ID of the
|
|
204
|
-
name: Name of the
|
|
205
|
-
description: Description of the
|
|
202
|
+
id: ID of the RawGitHubCopilotAgent.
|
|
203
|
+
name: Name of the RawGitHubCopilotAgent.
|
|
204
|
+
description: Description of the RawGitHubCopilotAgent.
|
|
206
205
|
context_providers: Context Providers, to be used by the agent.
|
|
207
206
|
middleware: Agent middleware used by the agent.
|
|
208
207
|
tools: Tools to use for the agent. Can be functions
|
|
@@ -258,7 +257,7 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
258
257
|
self._default_options = opts
|
|
259
258
|
self._started = False
|
|
260
259
|
|
|
261
|
-
async def __aenter__(self) ->
|
|
260
|
+
async def __aenter__(self) -> Self:
|
|
262
261
|
"""Start the agent when entering async context."""
|
|
263
262
|
await self.start()
|
|
264
263
|
return self
|
|
@@ -308,6 +307,20 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
308
307
|
|
|
309
308
|
self._started = False
|
|
310
309
|
|
|
310
|
+
@property
|
|
311
|
+
def default_options(self) -> dict[str, Any]:
|
|
312
|
+
"""Expose default options including model from settings.
|
|
313
|
+
|
|
314
|
+
Returns a merged dict of ``_default_options`` with the resolved ``model``
|
|
315
|
+
from settings injected under the ``model`` key. This is read by
|
|
316
|
+
:class:`AgentTelemetryLayer` to include the model name in span attributes.
|
|
317
|
+
"""
|
|
318
|
+
opts = dict(self._default_options)
|
|
319
|
+
model = self._settings.get("model")
|
|
320
|
+
if model:
|
|
321
|
+
opts["model"] = model
|
|
322
|
+
return opts
|
|
323
|
+
|
|
311
324
|
@overload
|
|
312
325
|
def run(
|
|
313
326
|
self,
|
|
@@ -315,7 +328,9 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
315
328
|
*,
|
|
316
329
|
stream: Literal[False] = False,
|
|
317
330
|
session: AgentSession | None = None,
|
|
331
|
+
middleware: Sequence[AgentMiddlewareTypes] | None = None,
|
|
318
332
|
options: OptionsT | None = None,
|
|
333
|
+
**kwargs: Any,
|
|
319
334
|
) -> Awaitable[AgentResponse]: ...
|
|
320
335
|
|
|
321
336
|
@overload
|
|
@@ -325,7 +340,9 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
325
340
|
*,
|
|
326
341
|
stream: Literal[True],
|
|
327
342
|
session: AgentSession | None = None,
|
|
343
|
+
middleware: Sequence[AgentMiddlewareTypes] | None = None,
|
|
328
344
|
options: OptionsT | None = None,
|
|
345
|
+
**kwargs: Any,
|
|
329
346
|
) -> ResponseStream[AgentResponseUpdate, AgentResponse]: ...
|
|
330
347
|
|
|
331
348
|
def run(
|
|
@@ -334,7 +351,9 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
334
351
|
*,
|
|
335
352
|
stream: bool = False,
|
|
336
353
|
session: AgentSession | None = None,
|
|
354
|
+
middleware: Sequence[AgentMiddlewareTypes] | None = None,
|
|
337
355
|
options: OptionsT | None = None,
|
|
356
|
+
**kwargs: Any, # type: ignore[override]
|
|
338
357
|
) -> Awaitable[AgentResponse] | ResponseStream[AgentResponseUpdate, AgentResponse]:
|
|
339
358
|
"""Get a response from the agent.
|
|
340
359
|
|
|
@@ -348,7 +367,12 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
348
367
|
Keyword Args:
|
|
349
368
|
stream: Whether to stream the response. Defaults to False.
|
|
350
369
|
session: The conversation session associated with the message(s).
|
|
370
|
+
middleware: Not used by this agent directly. Accepted for interface
|
|
371
|
+
compatibility; pass middleware via :class:`GitHubCopilotAgent` which
|
|
372
|
+
forwards it through :class:`AgentTelemetryLayer`.
|
|
351
373
|
options: Runtime options (model, timeout, etc.).
|
|
374
|
+
kwargs: Additional keyword arguments for compatibility with the shared agent
|
|
375
|
+
interface (e.g. compaction_strategy, tokenizer). Not used by this agent.
|
|
352
376
|
|
|
353
377
|
Returns:
|
|
354
378
|
When stream=False: An Awaitable[AgentResponse].
|
|
@@ -357,6 +381,12 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
357
381
|
Raises:
|
|
358
382
|
AgentException: If the request fails.
|
|
359
383
|
"""
|
|
384
|
+
if middleware:
|
|
385
|
+
logger.warning(
|
|
386
|
+
"Per-run middleware is not supported by RawGitHubCopilotAgent: the GitHub Copilot SDK "
|
|
387
|
+
"handles tool execution internally, so chat/function middleware cannot be injected into "
|
|
388
|
+
"the tool call path. Use agent-level middleware via the GitHubCopilotAgent constructor instead."
|
|
389
|
+
)
|
|
360
390
|
if stream:
|
|
361
391
|
ctx_holder: dict[str, Any] = {}
|
|
362
392
|
|
|
@@ -767,3 +797,97 @@ class GitHubCopilotAgent(BaseAgent, Generic[OptionsT]):
|
|
|
767
797
|
mcp_servers=self._mcp_servers or None,
|
|
768
798
|
provider=self._provider or None,
|
|
769
799
|
)
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
class GitHubCopilotAgent( # type: ignore[misc]
|
|
803
|
+
AgentMiddlewareLayer,
|
|
804
|
+
AgentTelemetryLayer,
|
|
805
|
+
RawGitHubCopilotAgent[OptionsT],
|
|
806
|
+
Generic[OptionsT],
|
|
807
|
+
):
|
|
808
|
+
"""A GitHub Copilot Agent with full middleware and telemetry support.
|
|
809
|
+
|
|
810
|
+
This is the recommended agent class for most use cases. It includes
|
|
811
|
+
middleware support and OpenTelemetry-based telemetry for observability,
|
|
812
|
+
with middleware running outside the telemetry span so middleware execution
|
|
813
|
+
time is not captured in traces. For a minimal implementation without these
|
|
814
|
+
layers, use :class:`RawGitHubCopilotAgent`.
|
|
815
|
+
|
|
816
|
+
Examples:
|
|
817
|
+
Basic usage:
|
|
818
|
+
|
|
819
|
+
.. code-block:: python
|
|
820
|
+
|
|
821
|
+
async with GitHubCopilotAgent() as agent:
|
|
822
|
+
response = await agent.run("Hello, world!")
|
|
823
|
+
print(response)
|
|
824
|
+
|
|
825
|
+
With explicitly typed options:
|
|
826
|
+
|
|
827
|
+
.. code-block:: python
|
|
828
|
+
|
|
829
|
+
from agent_framework_github_copilot import GitHubCopilotAgent, GitHubCopilotOptions
|
|
830
|
+
|
|
831
|
+
agent: GitHubCopilotAgent[GitHubCopilotOptions] = GitHubCopilotAgent(
|
|
832
|
+
default_options={"model": "claude-sonnet-4-5", "timeout": 120}
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
With observability:
|
|
836
|
+
|
|
837
|
+
.. code-block:: python
|
|
838
|
+
|
|
839
|
+
from agent_framework.observability import configure_otel_providers
|
|
840
|
+
|
|
841
|
+
configure_otel_providers()
|
|
842
|
+
async with GitHubCopilotAgent() as agent:
|
|
843
|
+
response = await agent.run("Hello, world!")
|
|
844
|
+
"""
|
|
845
|
+
|
|
846
|
+
def __init__(
|
|
847
|
+
self,
|
|
848
|
+
instructions: str | None = None,
|
|
849
|
+
*,
|
|
850
|
+
client: CopilotClient | None = None,
|
|
851
|
+
id: str | None = None,
|
|
852
|
+
name: str | None = None,
|
|
853
|
+
description: str | None = None,
|
|
854
|
+
context_providers: Sequence[ContextProvider] | None = None,
|
|
855
|
+
middleware: Sequence[AgentMiddlewareTypes] | None = None,
|
|
856
|
+
tools: ToolTypes | Callable[..., Any] | Sequence[ToolTypes | Callable[..., Any]] | None = None,
|
|
857
|
+
default_options: OptionsT | None = None,
|
|
858
|
+
env_file_path: str | None = None,
|
|
859
|
+
env_file_encoding: str | None = None,
|
|
860
|
+
) -> None:
|
|
861
|
+
"""Initialize a GitHub Copilot Agent with full middleware and telemetry.
|
|
862
|
+
|
|
863
|
+
Args:
|
|
864
|
+
instructions: System message for the agent.
|
|
865
|
+
|
|
866
|
+
Keyword Args:
|
|
867
|
+
client: Optional pre-configured CopilotClient instance. If not provided,
|
|
868
|
+
a new client will be created using the other parameters.
|
|
869
|
+
id: ID of the agent.
|
|
870
|
+
name: Name of the agent.
|
|
871
|
+
description: Description of the agent.
|
|
872
|
+
context_providers: Context providers to be used by the agent.
|
|
873
|
+
middleware: Agent middleware used by the agent.
|
|
874
|
+
tools: Tools to use for the agent. Can be functions or tool definition dicts.
|
|
875
|
+
These are converted to Copilot SDK tools internally.
|
|
876
|
+
default_options: Default options for the agent. Can include cli_path, model,
|
|
877
|
+
timeout, log_level, etc.
|
|
878
|
+
env_file_path: Optional path to .env file for loading configuration.
|
|
879
|
+
env_file_encoding: Encoding of the .env file, defaults to 'utf-8'.
|
|
880
|
+
"""
|
|
881
|
+
super().__init__(
|
|
882
|
+
instructions,
|
|
883
|
+
client=client,
|
|
884
|
+
id=id,
|
|
885
|
+
name=name,
|
|
886
|
+
description=description,
|
|
887
|
+
context_providers=context_providers,
|
|
888
|
+
middleware=middleware,
|
|
889
|
+
tools=tools,
|
|
890
|
+
default_options=default_options,
|
|
891
|
+
env_file_path=env_file_path,
|
|
892
|
+
env_file_encoding=env_file_encoding,
|
|
893
|
+
)
|
|
@@ -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.10"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.0b260428"
|
|
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"
|
|
@@ -23,7 +23,7 @@ classifiers = [
|
|
|
23
23
|
"Typing :: Typed",
|
|
24
24
|
]
|
|
25
25
|
dependencies = [
|
|
26
|
-
"agent-framework-core>=1.
|
|
26
|
+
"agent-framework-core>=1.2.1,<2",
|
|
27
27
|
"github-copilot-sdk>=0.2.1,<=0.2.1; python_version >= '3.11'",
|
|
28
28
|
]
|
|
29
29
|
|
{agent_framework_github_copilot-1.0.0b260423 → agent_framework_github_copilot-1.0.0b260428}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|