Skip to content

Your lightweight open-source personal agent.

fix(sdk): route github copilot through oauth provider

Xubin Ren2ec68582eb78
diff --git a/nanobot/nanobot.py b/nanobot/nanobot.py
index 137688455..84fb70934 100644
--- a/nanobot/nanobot.py
+++ b/nanobot/nanobot.py
@@ -135,6 +135,10 @@ def _make_provider(config: Any) -> Any:
from nanobot.providers.openai_codex_provider import OpenAICodexProvider
provider = OpenAICodexProvider(default_model=model)
+ elif backend == "github_copilot":
+ from nanobot.providers.github_copilot_provider import GitHubCopilotProvider
+
+ provider = GitHubCopilotProvider(default_model=model)
elif backend == "azure_openai":
from nanobot.providers.azure_openai_provider import AzureOpenAIProvider
diff --git a/tests/test_nanobot_facade.py b/tests/test_nanobot_facade.py
index 9d0d8a175..9ad9c5db1 100644
--- a/tests/test_nanobot_facade.py
+++ b/tests/test_nanobot_facade.py
@@ -125,6 +125,27 @@ def test_workspace_override(tmp_path):
assert bot._loop.workspace == custom_ws
+def test_sdk_make_provider_uses_github_copilot_backend():
+ from nanobot.config.schema import Config
+ from nanobot.nanobot import _make_provider
+
+ config = Config.model_validate(
+ {
+ "agents": {
+ "defaults": {
+ "provider": "github-copilot",
+ "model": "github-copilot/gpt-4.1",
+ }
+ }
+ }
+ )
+
+ with patch("nanobot.providers.openai_compat_provider.AsyncOpenAI"):
+ provider = _make_provider(config)
+
+ assert provider.__class__.__name__ == "GitHubCopilotProvider"
+
+
@pytest.mark.asyncio
async def test_run_custom_session_key(tmp_path):
from nanobot.bus.events import OutboundMessage