Introduction

As autonomous agents evolve, they need intelligence, context, and rich interfaces. In this post, you’ll learn how to:

  1. 🔍 Enrich data using OpenAI (GPT) to reason beyond static logic
  2. 💬 Send Adaptive Cards to Teams to create rich, actionable conversations
  3. 🧠 Use Dataverse for long-term memory to personalize interactions across sessions

Each section includes Power Fx, plugin payloads, and Power Automate usage.


✨ 1. Data Enrichment with OpenAI (GPT)

📌 Use Case:

Your copilot gets an ambiguous user question like:

“What could be the business impact if this system goes down?”

Instead of hardcoding all logic, use OpenAI to:

  • Summarize
  • Classify
  • Generate hypotheses or actions

⚙️ Step-by-Step

🔧 Power Automate Flow: AskOpenAI

  • Trigger: HTTP Request
  • Action: Call OpenAI’s API (e.g., gpt-4)
POST https://api.openai.com/v1/chat/completions
Authorization: Bearer <api_key>
Content-Type: application/json

{
  "model": "gpt-4",
  "messages": [
    {"role": "system", "content": "You are an AI agent that helps assess business risks."},
    {"role": "user", "content": "@{triggerBody()['userQuery']}"}
  ]
}

🧠 Copilot Plugin JSON

{
  "name": "EnrichWithOpenAI",
  "description": "Get GPT-powered insights",
  "parameters": [{ "name": "userQuery", "type": "String" }],
  "response": { "type": "String", "name": "insight" }
}

🧬 Power Fx in Topic

Set(insight, CallPlugin("EnrichWithOpenAI", { userQuery: UserInput }).insight);

💬 Output

Here’s what I found: {insight}

💬 2. Adaptive Cards in Microsoft Teams

📌 Use Case:

Instead of plain text, you want your agent to send an interactive card to a user’s Teams chat with buttons like:

  • ✅ Approve
  • ❌ Reject
  • 📄 View Report

🛠 Power Automate Flow: SendAdaptiveCardToTeams

Trigger

From plugin or a button node.

Action: Post Adaptive Card

Use the Teams connector → Post Adaptive Card in chat or channel

Sample Card JSON:

{
  "type": "AdaptiveCard",
  "body": [
    { "type": "TextBlock", "text": "🚨 Approval Request", "weight": "Bolder", "size": "Medium" },
    { "type": "TextBlock", "text": "Expense request for $584 by John Smith" }
  ],
  "actions": [
    { "type": "Action.Submit", "title": "Approve", "data": { "action": "approve" } },
    { "type": "Action.Submit", "title": "Reject", "data": { "action": "reject" } }
  ],
  "version": "1.3"
}

Copilot Plugin Example

{
  "name": "SendCardToTeams",
  "description": "Send interactive Adaptive Card to Teams",
  "parameters": [
    { "name": "userId", "type": "String" },
    { "name": "cardText", "type": "String" }
  ],
  "response": { "type": "String", "name": "status" }
}

Power Fx

Set(response, CallPlugin("SendCardToTeams", {
  userId: "8:orgid:<teamsUserId>",
  cardText: "Expense request for $584"
}))

🧠 3. Long-Term Memory with Dataverse

📌 Use Case:

Remember the user’s preferred language, last interaction, or profile details across multiple sessions or channels.


🛠 Step-by-Step

Step 1: Create a Dataverse Table

Table: UserMemory
Columns:

  • UserId (Primary key)
  • PreferredLanguage
  • LastInteraction
  • CustomNotes

Step 2: Plugin to Read/Write Memory

Read Memory
{
  "name": "GetUserMemory",
  "parameters": [{ "name": "userId", "type": "String" }],
  "response": {
    "type": "Object",
    "properties": {
      "PreferredLanguage": { "type": "String" },
      "LastInteraction": { "type": "String" }
    }
  }
}
Write Memory
{
  "name": "UpdateUserMemory",
  "parameters": [
    { "name": "userId", "type": "String" },
    { "name": "PreferredLanguage", "type": "String" }
  ],
  "response": { "type": "String", "name": "status" }
}

Step 3: Use Power Fx in Copilot Topic

Read on Start:
Set(memory, CallPlugin("GetUserMemory", { userId: userEmail }));
Write on Update:
CallPlugin("UpdateUserMemory", {
  userId: userEmail,
  PreferredLanguage: UserInput
});
Use it Later:
If(IsBlank(memory.PreferredLanguage), "Which language do you prefer?", 
   "Welcome back! Continuing in " & memory.PreferredLanguage & ".")

✅ Summary

FeatureTool UsedKey Benefit
GPT EnrichmentPower Automate + OpenAI APIContext-aware responses + reasoning
Teams Adaptive CardsPower Automate + Teams APIInteractive UX, approvals, and actions
Long-term Memory in DataversePlugins + Power FxPersistent personalization across sessions

Views: 11

🧠 Supercharging Copilot Studio Agents: OpenAI Enrichment, Teams Cards & Dataverse Memory

Johannes Rest


.NET Architekt und Entwickler


Beitragsnavigation


Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert