Skip to content

Ramakrishnan24689/agent-api-pcf

Repository files navigation

PowerApps + Copilot Studio: Smart Forms with Agent APIs

Reference implementation demonstrating how to integrate Microsoft Copilot Studio with PowerApps using the new Agent APIs in PCF controls.

What This Shows

🎥 Watch the Live Demo

Watch the demo

Architectural Flow

Architectural Flow

Two working examples of PCF controls that call Copilot Studio agents using context.copilot.executeEvent:

  • 🏥 Patient Care Assistant - Healthcare recommendations
  • 💰 Financial Advisor Assistant - Investment risk analysis

Patient Care Assistant Demo

Patient Care PCF

Financial Advisor Assistant Demo

Financial Advisor PCF

Core Implementation

// Call Copilot Studio agent from PCF
const result = await context.copilot.executeEvent(
  "healthcare.patient_care_optimization.pcf", 
  { id: patientId, symptoms }
);

Each PCF includes:

  • React + Fluent UI components with loading states
  • Agent API service layer with error handling
  • Structured response parsing from Copilot Studio
  • Bidirectional data binding (input fields → AI → output fields)

How to Use

1. Setup Copilot Studio

Create topics with event triggers matching the PCF calls:

  • financial.dynamic_risk_optimization.pcf
  • healthcare.patient_care_optimization.pcf

Copilot Studio Setup

Note: Ensure you have sufficient AI Builder Credits for the custom prompts to work in the Agent.

2. Deploy PCF Controls

npm install && npm run build
pac pcf push --publisher-prefix yourprefix

3. Add to Model-Driven Apps Forms

  • Add the PCF controls to your forms
  • Bind input properties to Dataverse fields
  • Bind output properties to fields that should receive AI recommendations

Disclaimer

This repository is a reference implementation only. The sole purpose of this project is to demonstrate how to use Agent APIs in Model-Driven Apps forms via PCF controls. This code is provided as-is for educational and demonstration purposes and should not be used in production environments without proper testing, security review, and customization for your specific requirements.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published