Dynamic Adaptive Cards with Copilot Studio
I wanted to generate Adaptive Cards dynamically rather than shipping a fixed card template for every scenario. Using Copilot Studio’s prompt tooling makes it possible to produce card JSON on the fly, adapt to user choices, and even include charts generated at runtime.
Quick summary
- Generate Adaptive Card JSON from a concise prompt rather than maintaining many rigid templates.
- Keep prompts small: avoid passing too many parameters directly into the prompt.
- Use memory/variables for personalization and enable the code interpreter for charts when needed.
Practical tips
Parameter limits: I found that feeding many separate parameters into the prompt (eight or more) caused inconsistent output — the Skill tended to return the same card. Instead, pass a single JSON payload or a compact object and let the prompt parse it.
Prompt length: prompts and context combined should stay within ~8,000 characters. Long prompts risk truncation or unexpected behavior.
Personalization: use agent memory and variables to keep user-specific data out of the prompt body. This reduces prompt size and makes the Skill reusable.
Dynamic charts: enable the code interpreter (when available) to generate charts or images on the fly and attach them to the Adaptive Card.
Behavior when web/LLM features are disabled
If Copilot Studio has LLM language use or web search disabled for the agent, the Skill may still use its local logic and available data, but external lookups and advanced reasoning will be limited. Design prompts to degrade gracefully: validate inputs and provide sensible defaults when external features are unavailable.
Example approach (pattern)
- Collect a compact input object (single parameter) describing the card: fields, labels, and data.
- Call the Skill with that object; keep the human prompt minimal and deterministic.
- If charts are needed, send the data to the code interpreter and receive an image URL or base64 payload to embed in the card.
- Return the Adaptive Card JSON and render it in the client.
Small prompt snippet (illustrative)
Generate an Adaptive Card JSON using this input object: {"title":"Sales summary","fields":[{"label":"Q1","value":12000},{"label":"Q2","value":15000}],"showChart":true}
Rules: produce valid Adaptive Card schema v1.5 JSON, include chart image URL if showChart is true, keep totals and a short summary line.
Closing notes
Generating Adaptive Cards dynamically simplifies maintenance and enables richer, personalized UIs. Keep payloads compact, prefer memory for personalization, and enable the code interpreter when you need runtime charting.