Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Die Copilot Studio-Integration ermöglicht Ihnen die Verwendung von Copilot Studio-Agents innerhalb des Agent-Frameworks.
Das folgende Beispiel zeigt, wie Sie einen Agent mit Copilot Studio erstellen:
using System;
using Azure.Identity;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.CopilotStudio;
// Create a Copilot Studio agent using the IChatClient pattern
// Requires: dotnet add package Microsoft.Agents.AI.CopilotStudio --prerelease
var copilotClient = new CopilotStudioChatClient(
environmentId: "<your-environment-id>",
agentIdentifier: "<your-agent-id>",
credential: new AzureCliCredential());
AIAgent agent = copilotClient.AsAIAgent(
instructions: "You are a helpful enterprise assistant.");
Console.WriteLine(await agent.RunAsync("What are our company policies on remote work?"));
Hinweis
Python-Unterstützung für Copilot Studio-Agents ist über das agent-framework-copilotstudio Paket verfügbar.
Installation
pip install agent-framework-copilotstudio --pre
Konfiguration
Legen Sie die folgenden Umgebungsvariablen für die automatische Konfiguration fest:
COPILOTSTUDIOAGENT__ENVIRONMENTID="<your-environment-id>"
COPILOTSTUDIOAGENT__SCHEMANAME="<your-agent-schema-name>"
COPILOTSTUDIOAGENT__AGENTAPPID="<your-client-id>"
COPILOTSTUDIOAGENT__TENANTID="<your-tenant-id>"
Erstellen eines Copilot Studio-Agents
CopilotStudioAgent liest Verbindungseinstellungen automatisch aus Umgebungsvariablen:
import asyncio
from agent_framework.microsoft import CopilotStudioAgent
async def main():
agent = CopilotStudioAgent()
result = await agent.run("What are our company policies on remote work?")
print(result)
asyncio.run(main())
Streamen
async def streaming_example():
agent = CopilotStudioAgent()
print("Agent: ", end="", flush=True)
async for chunk in agent.run("What is the largest city in France?", stream=True):
if chunk.text:
print(chunk.text, end="", flush=True)
print()