chore: import upstream snapshot with attribution
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:39:25 +08:00
commit db620d33df
5151 changed files with 925932 additions and 0 deletions
@@ -0,0 +1,52 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "agent-framework-copilotstudio",
# "semantic-kernel",
# ]
# ///
# Run with any PEP 723 compatible runner, e.g.:
# uv run samples/semantic-kernel-migration/copilot_studio/01_basic_copilot_studio_agent.py
# Copyright (c) Microsoft. All rights reserved.
"""Call a Copilot Studio agent with SK and Agent Framework."""
import asyncio
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
async def run_semantic_kernel() -> None:
from semantic_kernel.agents import CopilotStudioAgent
# SK agent talks to the configured Copilot Studio bot directly.
agent = CopilotStudioAgent(
name="PhysicsAgent",
instructions="Answer physics questions concisely.",
)
response = await agent.get_response("Why is the sky blue?")
print("[SK]", response.message.content)
async def run_agent_framework() -> None:
from agent_framework.microsoft import CopilotStudioAgent
# AF exposes an equivalent CopilotStudioAgent wrapper.
agent = CopilotStudioAgent(
name="PhysicsAgent",
instructions="Answer physics questions concisely.",
)
reply = await agent.run("Why is the sky blue?")
print("[AF]", reply.text)
async def main() -> None:
await run_semantic_kernel()
await run_agent_framework()
if __name__ == "__main__":
asyncio.run(main())
@@ -0,0 +1,58 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "agent-framework-copilotstudio",
# "semantic-kernel",
# ]
# ///
# Run with any PEP 723 compatible runner, e.g.:
# uv run samples/semantic-kernel-migration/copilot_studio/02_copilot_studio_streaming.py
# Copyright (c) Microsoft. All rights reserved.
"""Stream responses from Copilot Studio agents in SK and AF."""
import asyncio
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
async def run_semantic_kernel() -> None:
from semantic_kernel.agents import CopilotStudioAgent
agent = CopilotStudioAgent(
name="TourGuide",
instructions="Provide travel recommendations in short bursts.",
)
# SK streaming yields chunks with message metadata.
print("[SK][stream]", end=" ")
async for chunk in agent.invoke_stream("Plan a day in Copenhagen for foodies."):
if chunk.message:
print(chunk.message.content, end="", flush=True)
print()
async def run_agent_framework() -> None:
from agent_framework.microsoft import CopilotStudioAgent
agent = CopilotStudioAgent(
name="TourGuide",
instructions="Provide travel recommendations in short bursts.",
)
# AF streaming provides incremental AgentResponseUpdate objects.
print("[AF][stream]", end=" ")
async for update in agent.run("Plan a day in Copenhagen for foodies.", stream=True):
if update.text:
print(update.text, end="", flush=True)
print()
async def main() -> None:
await run_semantic_kernel()
await run_agent_framework()
if __name__ == "__main__":
asyncio.run(main())